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; }
function isSent($form) { $xml = new xml($form); return param('action') == $xml->evaluate('string(//param[@name = "action"]/@value)', $form); }
static function getPos(DOMElement $e) { $xml = new xml($e->ownerDocument); return $xml->evaluate('count(preceding-sibling::' . $e->tagName . ')', $e); }
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; } }
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); } } }
function evaluate($query) { $xml = new xml($this->e); return $xml->evaluate($query, $this->e); }
function isChildOf($id) { $xml = new xml($this->e->ownerDocument); return $xml->evaluate('count(ancestor::sec[@id="' . htmlspecialchars($id) . '"])', $this->e); }