[ghelda-devel] [26] Tweak xHTML.inc.php to allow sub-selects (see diff).

[ Thread Index | Date Index | More lists.tuxfamily.org/ghelda-devel Archives ]


Revision: 26
Author:   odyx
Date:     2009-04-29 14:27:29 +0200 (Wed, 29 Apr 2009)

Log Message:
-----------
Tweak xHTML.inc.php to allow sub-selects (see diff).

Modified Paths:
--------------
    trunk/inc/outputs/xHTML.class.php


Modified: trunk/inc/outputs/xHTML.class.php
===================================================================
--- trunk/inc/outputs/xHTML.class.php	2009-04-29 12:27:25 UTC (rev 25)
+++ trunk/inc/outputs/xHTML.class.php	2009-04-29 12:27:29 UTC (rev 26)
@@ -283,8 +283,10 @@
 					if(stripos($fieldsSpec[$fieldName]['type'],'date') !== false) { // If we have a date
 						$fieldContent = $this->formatDate($fieldContent);
 					}
-					elseif(stripos($fieldsSpec[$fieldName]['type'],'select') !== false) { // If we have a select
-						$fieldContent = $fieldsSpec[$fieldName]['values'][$fieldContent];
+					elseif( stripos($fieldsSpec[$fieldName]['type'],'select') !== false or 
+						stripos($fieldsSpec[$fieldName]['type'],'enum') !== false) { // If we have a select
+						$tmpVar = $fieldsSpec[$fieldName]['values'][$fieldContent];
+						$fieldContent = array_key_exists('name',$tmpVar) ? $tmpVar['name'] : $tmpVar;
 					}
 					$line .= $this->tag('td',$fieldContent);
 			}
@@ -488,7 +490,7 @@
 					if( !array_key_exists('optgroups',$fieldProperties)) {
 						$fieldProperties['optgroups'] = false;
 					}
-					
+
 					$field = $this->select($fieldProperties['values'],$options_selected,$paramsArray,false,$fieldProperties['optgroups']);
 					// Stack the fields
 					$fields .= $this->mark('p',$label.LB.$field);
@@ -656,13 +658,14 @@
 			$optionsTxt = '';
 			// Go through all the options and draw the correct section
 			foreach($options as $value => $name) {
+
 				// Set the value iff the value is different
 				$attributes = $value !== $name ? array('value' => $value) : array();
 	
 				if(!is_null($options_selected) && in_array($value,$options_selected)) {
 					$attributes['selected'] = 'selected';
 				}
-				$optionsTxt .= $this->tag('option',$name,$attributes); // Add "true" at the end for easier formatting
+				$optionsTxt .= $this->tag('option',array_key_exists('name',$name) ? $name['name'] : $name,$attributes); // Add "true" at the end for easier formatting
 			}
 		} else {
 			// Go along all the optgroups
@@ -681,7 +684,7 @@
 					if(!is_null($options_selected) && in_array($value,$options_selected)) {
 						$attributes['selected'] = 'selected';
 					}
-					$optionsInTxt .= $this->tag('option',$name,$attributes); // Add "true" at the end for easier formatting
+					$optionsInTxt .= $this->tag('option',array_key_exists('name',$name) ? $name['name'] : $name,$attributes); // Add "true" at the end for easier formatting
 				}
 				$optionsTxt .= $this->mark('optgroup',$optionsInTxt,$opt_attributes);
 			}
@@ -751,4 +754,4 @@
 	}
 
 }	
-?>
\ No newline at end of file
+?>


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/