Ejemplo n.º 1
0
 public function process()
 {
     global $current_user;
     /* @var $current_user CurrentUser */
     XMLClass::$pageNode = XMLClass::createNodeFromObject(array(), false, 'page', false);
     XMLClass::appendNode(XMLClass::$pageNode, '');
     XMLClass::$accessNode = XMLClass::createNodeFromObject(AccessRules::getRules(), false, 'access', true);
     XMLClass::appendNode(XMLClass::$accessNode, '');
     XMLClass::$pageNode->setAttribute('current_url', Request::$url);
     XMLClass::$pageNode->setAttribute('prefix', Config::need('www_path') . '/');
     XMLClass::$varNode = XMLClass::$xml->createElement('variables');
     foreach (Request::$get_normal as $f => $v) {
         XMLClass::$varNode->setAttribute($f, $v);
     }
     XMLClass::$pageNode->appendChild(XMLClass::$varNode);
     XMLClass::$rootNode->appendChild(XMLClass::$xml->importNode(StructureParser::toXML(), 1));
     if ($current_user->authorized) {
         XMLClass::$CurrentUserNode = XMLClass::createNodeFromObject($current_user->getXMLInfo(), false, 'current_user', false);
     } else {
         XMLClass::$CurrentUserNode = XMLClass::createNodeFromObject(array(), false, 'current_user', false);
     }
     XMLClass::$pageNode->appendChild(XMLClass::$CurrentUserNode);
     // втыкаем модули страницы
     $role = $current_user->getRole();
     foreach ($this->modules as $module) {
         $this->processModule($module['name'], $module);
     }
     if ($pageTitle = StructureParser::getTitle()) {
         $this->buildPageTitle($pageTitle);
     }
     switch (Request::$responseType) {
         case 'xml':
         case 'xmlc':
             return XMLClass::dumpToBrowser();
             break;
         case 'xsl':
         case 'xslc':
             $xslTemplateClass = new XSLClass($this->xsltFileName);
             return $xslTemplateClass->dumpToBrowser();
             break;
         case 'html':
             $xslTemplateClass = new XSLClass($this->xsltFileName);
             $html = $xslTemplateClass->getHTML(XMLClass::$xml);
             return $html;
             break;
         default:
             return XMLClass::dumpToBrowser();
             break;
     }
 }
Ejemplo n.º 2
0
 function __construct()
 {
     $rules_obj = new AccessRules();
     $this->rules = $rules_obj->getRules();
 }