Пример #1
0
 function getConf($name, $required = false)
 {
     $xml = new xml(PATH_ROOT . ABS_PATH_DATA_CLIENT . ap::id($this->getSection()->getId()) . '.xml');
     $v = $xml->evaluate('string(/section/modules/module[@id="' . $this->getId() . '"]/config/@' . $name . ')');
     if (!$v && $required) {
         vdump('No ' . $name . ' has been chosen');
     }
     return $v;
 }
Пример #2
0
 function isSent($form)
 {
     $xml = new xml($form);
     return param('action') == $xml->evaluate('string(//param[@name = "action"]/@value)', $form);
 }
Пример #3
0
 static function getPos(DOMElement $e)
 {
     $xml = new xml($e->ownerDocument);
     return $xml->evaluate('count(preceding-sibling::' . $e->tagName . ')', $e);
 }
Пример #4
0
 function setOrder($col, $order = 'asc')
 {
     $xml = new xml($this->getRootElement());
     if ($col && $order && $xml->evaluate('count(headers/h[@name="' . $col . '"])', $this->getRootElement())) {
         $res = $xml->query('headers/h[@sort]', $this->getRootElement());
         foreach ($res as $e) {
             if ($col == $e->getAttribute('name')) {
                 $e->setAttribute('sort', $order);
             } else {
                 $e->setAttribute('sort', 'sort');
             }
         }
         return true;
     }
 }
Пример #5
0
 static function seclist($e, $ff, $arExclude = null)
 {
     //список разделов для селекта
     $xml = new xml($e);
     $shift = str_repeat('- ', $xml->evaluate('count(ancestor-or-self::sec)', $e));
     $res = $xml->query('sec', $e);
     foreach ($res as $sec) {
         if (!($arExclude && in_array($sec->getAttribute('id'), $arExclude))) {
             $ff->addOption($sec->getAttribute('id'), $shift . $sec->getAttribute('title'));
             apSectionEdit::seclist($sec, $ff, $arExclude);
         }
     }
 }
Пример #6
0
 function evaluate($query)
 {
     $xml = new xml($this->e);
     return $xml->evaluate($query, $this->e);
 }
Пример #7
0
 function isChildOf($id)
 {
     $xml = new xml($this->e->ownerDocument);
     return $xml->evaluate('count(ancestor::sec[@id="' . htmlspecialchars($id) . '"])', $this->e);
 }