[[ghelda-devel]] [3] Add handling of "Order of display". |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/ghelda-devel Archives
]
Revision: 3
Author: odyx
Date: 2008-11-25 23:50:07 +0100 (Tue, 25 Nov 2008)
Log Message:
-----------
Add handling of "Order of display". Useful and beautiful.
By the way, should test the mailing list. Hello world !
Modified Paths:
--------------
trunk/plugins/People/config_core.php
trunk/plugins/People.php
Modified: trunk/plugins/People/config_core.php
===================================================================
--- trunk/plugins/People/config_core.php 2008-11-25 14:53:00 UTC (rev 2)
+++ trunk/plugins/People/config_core.php 2008-11-25 22:50:07 UTC (rev 3)
@@ -27,6 +27,7 @@
$conf['fields_core'][G_DB_PEOPLE_USERNAME]['type'] = 'VARCHAR( 50 )';
$conf['fields_core'][G_DB_PEOPLE_USERNAME]['name'] = T_('Username');
$conf['fields_core'][G_DB_PEOPLE_USERNAME]['restricted'] = 'unique';
+$conf['fields_core'][G_DB_PEOPLE_USERNAME]['order'] = 100;
// Required
$conf['fields_core'][G_DB_PEOPLE_PASSWORD]['type'] = 'VARCHAR';
@@ -38,27 +39,34 @@
// Required
$conf['fields_core'][G_DB_PEOPLE_EMAIL]['type'] = 'VARCHAR( 256 )';
$conf['fields_core'][G_DB_PEOPLE_EMAIL]['name'] = T_('E-mail');
-// $conf['fields_core'][G_DB_PEOPLE_EMAIL]['preg'] = '/^( [a-zA-Z0-9] )+( [a-zA-Z0-9\._-] )*@( [a-zA-Z0-9_-] )+( [a-zA-Z0-9\._-] +)+$/'; // TODO
+$conf['fields_core'][G_DB_PEOPLE_EMAIL]['order'] = 25;
+// $conf['fields_core'][G_DB_PEOPLE_EMAIL]['preg'] = ''; // TODO
-
// Optional
$conf['fields']['Name']['type'] = 'VARCHAR( 128 )';
$conf['fields']['Name']['name'] = T_('Name');
-$conf['fields']['Name']['list'] = true;
+$conf['fields']['Name']['order'] = 50;
$conf['fields']['Surname']['type'] = 'VARCHAR( 128 )';
$conf['fields']['Surname']['name'] = T_('Surname');
-$conf['fields']['Surname']['list'] = true;
+$conf['fields']['Surname']['order'] = 60;
$conf['fields']['Genre']['type'] = 'ENUM';
$conf['fields']['Genre']['name'] = T_('Genre');
$conf['fields']['Genre']['values']['female'] = T_('female - ♀');
$conf['fields']['Genre']['values']['male'] = T_('male - ♂');
+$conf['fields']['Genre']['order'] = 40;
$conf['fields']['Date_Birth']['type'] = 'DATE';
$conf['fields']['Date_Birth']['name'] = T_('Date of birth');
+$conf['fields']['Date_Birth']['order'] = 30;
+$conf['fields']['Mobile_phone']['type'] = 'VARCHAR( 10 )';
+$conf['fields']['Mobile_phone']['name'] = T_('Mobile phone number');
+$conf['fields']['Mobile_phone']['preg'] = '~^[0-9]{10}$~';
+$conf['fields']['Mobile_phone']['order'] = 20;
+
$conf['fields']['NNSS']['type'] = 'VARCHAR(16)';
$conf['fields']['NNSS']['name'] = T_('New Social Security Number');
$conf['fields']['NNSS']['default'] = '000.0000.0000.00';
Modified: trunk/plugins/People.php
===================================================================
--- trunk/plugins/People.php 2008-11-25 14:53:00 UTC (rev 2)
+++ trunk/plugins/People.php 2008-11-25 22:50:07 UTC (rev 3)
@@ -63,6 +63,13 @@
$this->fieldsCore = $this->configH[$this->name]['fields_core'];
$this->fieldsAll = array_merge($this->fields,$this->fieldsCore);
+
+ $i = 0;
+ // Sort the fields in descending Order
+ foreach( $this->fieldsAll as $fieldName => $field ) {
+ $orderArray[$fieldName] = !empty($field['order']) ? $field['order'] : $i--;
+ }
+ array_multisort($orderArray,SORT_DESC,$this->fieldsAll);
// Only execute if the user is authentified
if($this->authH->getAuth()) {