/** * Loads the rows of menu * * @param SimpleXMLElement $child */ protected function _loadMenuRows(&$child) { if ($child->getName() == 'menu') { $listFieldsRows = $child->getElementByPath('fields'); $menuName = $child->attributes('name'); $this->rows[$menuName] = new Table(); if ($listFieldsRows) { foreach ($listFieldsRows->children() as $field) { /** @var $field SimpleXMLElement */ if ($field->attributes('type') == 'private') { $name = $field->attributes('name'); // $className = $field->attributes( 'class' ); // $methodName = $field->attributes( 'method' ); $value = $field->attributes('value'); $content = $value; // it will be called at rendering time: /* if ( $className && $methodName && class_exists( $className ) ) { $obj = new $className( $this->_db ); //TBD: implement the singleton similarly/calling _form_private if ( method_exists( $obj, $methodName ) ) { /* $row = $this->_modelOfData[0]; //TBD: checked.... foreach (get_object_vars($obj) as $key => $v) { if( substr( $key, 0, 1 ) != '_' ) { // internal attributes of an object are ignored if (isset($row->$key)) { $obj->$key = $row->$key; } } } * $content = $obj->$methodName( $value, $this->_pluginParams ); //TBD: pluginParams should be available by the method params() of $obj, not as function parameter } else { $content = 'Missing method ' . $methodName; } } else { $content = 'Missing class, or method in xml'; } */ $this->rows[$menuName]->{$name} = $content; } else { $xmlsql = new XmlQuery($this->_db, null, $this->_pluginParams); $xmlsql->process_field($field); $obj = null; if ($xmlsql->queryLoadObject($obj)) { // get the resulting object foreach (get_object_vars($obj) as $k => $v) { if (substr($k, 0, 1) != '_') { // internal attributes of an object are ignored $this->rows[$menuName]->{$k} = $v; } } // } else { // error in query... } } } } } }