Changeset 2956
- Timestamp:
- 07/24/08 17:28:14 (4 weeks ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/project/modules/devel/cms3/heading/classes/headingelementtype.class.php
r2949 r2956 1 1 <?php 2 2 /** 3 * @package standard3 * @package cms 4 4 * @subpackage heading 5 5 * @author Gérald CROËS, Alexandre JULIEN … … 8 8 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file 9 9 */ 10 11 /** 12 * Opérations sur les types d'éléments 13 * @package cms 14 * @subpackage heading 15 */ 10 16 class HeadingElementType { 11 17 … … 13 19 CopixClassesFactory::fileInclude ('heading|headingparameterservices'); 14 20 $xml = CopixModule::getParsedModuleInformation ( 15 "heading List_ParameterGroups",21 "heading_ElementTypes", 16 22 "/moduledefinition/registry/entry[@id='HeadingElement']/*", 17 array ( 'HeadingParameterServices', 'getTypesFromXML'));23 array ($this, 'getTypesFromXML')); 18 24 return $xml; 19 25 } … … 25 31 * @return string libellé 26 32 */ 27 public function getCaption ($id) { 28 $arData = self::getList($id); 29 return $arData[$id]; 33 public function getCaption ($pId) { 34 $arData = self::getList (); 35 if (!array_key_exists ($pId, $arData)){ 36 throw new CopixException ('Element de type '.$pId.' non trouvé'); 37 } 38 return $arData[$id]['caption']; 30 39 } 31 40 41 /** 42 * 43 */ 44 public function getTypesFromXml ($moduleNode){ 45 $arData = array (); 46 foreach ($moduleNode as $moduleName=>$moduleNodes) { 47 foreach ($moduleNodes as $node){ 48 if ($node->getName () === 'type') { 49 $id = _toString ($node['id']); 50 51 if (_toString ($node['caption']) !== '') { 52 $arData[$id]['caption'] = _toString ($node['caption']); 53 } elseif (_toString ($node['captioni18n']) !== '') { 54 $arData[$id]['caption'] = _i18n (_toString($node['captioni18n'])); 55 } 56 57 if (_toString ($node['image']) !== ''){ 58 $arData[$id]['image'] = _toString ($node['image']); 59 }else{ 60 $arData[$id]['image'] = null; 61 } 62 } 63 } 64 } 65 return $arData; 66 } 32 67 } 33 68 ?>
