[Phpcms-plugins-cvs] admin4phpCMS/modules/layout class.module_layout.php,1.1,1.2
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2004-05-30 03:49:07
|
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/layout In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4472 Modified Files: class.module_layout.php Log Message: test Index: class.module_layout.php =================================================================== RCS file: /cvsroot/phpcms-plugins/admin4phpCMS/modules/layout/class.module_layout.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- class.module_layout.php 26 May 2004 11:26:00 -0000 1.1 +++ class.module_layout.php 30 May 2004 03:48:55 -0000 1.2 @@ -1,13 +1,87 @@ <?php +/** +* +**/ + +/** CVS-data +$Id$ + +$Header$ + + +$Log$ +Revision 1.2 2004/05/30 03:48:55 mjahn +test + +**/ + +include_once ('XML/Tree.php'); +include_once (dirname (__FILE__).'/class.layout_phpcms.php'); class module_layout extends module { + var $elements = array (); + var $ids = array (); + function init () { - $this->__registerEvent ('LAYOUT_ADD_ELEMENT', 'doLayoutAddElement'); - $this->__registerAction ('doLayoutAddElement', 'addElement'); + $this->_registerEvent ('LAYOUT_ADD_ELEMENT', 'doLayoutAddElement'); + $this->_registerAction ('doLayoutAddElement', 'addElement'); + $this->_registerAction ('doDisplay', 'displayLayout'); + $this->elements =& new layout_phpcms (); } - function &addElement (&$actiondata) { + function addElement (&$actiondata) { + $parent =& $this->elements; + if (isset ($actiondata['root'])) { + $parent =& $this->ids[$actiondata['root']]; + } + $id = $actiondata['id']; + $this->ids[$id] =& $parent->addElement($actiondata); + } + + function &getElement ($id) { + if (!isset($this->ids[$id])) { + return false; + } + return $this->ids[$id]; + } + + function display () { + echo '<p>Meine Ausgabe</p>'; + + if (!isset ($this->elements) || !is_array ($this->elements)) { + return false; + } + for ($i = 0; $i < count($this->elements); $i++) { + $this->elements[$i]->display(); + } + } + + function displayLayout (&$actiondata) { + $this->layoutfile = dirname(__FILE__).'/layout.xml'; + + if (!isset($this->layoutfile)) { + $actiondata = array ('errortext'=>'Layoutdatei konnte nicht geladen werden!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata); + return false; + } + + if (!file_exists ($this->layoutfile)) { + unset ($this->configfile); + $actiondata = array ('errortext'=>'Layoutdatei konnte nicht geladen werden!'); + $this->_callEvent ('ERROR_NOTICE', $actiondata); + return false; + } + + $XML =& new XML_Tree ($this->layoutfile); + $layout =& $XML->getTreeFromFile (); + foreach ($layout->children as $a) { + if (!isset($a->name)) { + continue; + } + $this->layout[$a->name] =& $a->content; + } + } } |