コード例 #1
0
ファイル: zen.php プロジェクト: poef/ariadne
 private function compileNodes($nodes, $childNodes = null)
 {
     if (!isset($childNodes)) {
         $childNodes = ar_html::nodes();
     }
     if (isset($nodes["children"])) {
         $childNodes = $this->compileNodes($nodes["children"], $childNodes);
     }
     unset($nodes["children"]);
     $result = array();
     $mult = 1;
     if (isset($nodes["multiplier"])) {
         $mult = (int) $nodes["multiplier"];
         unset($nodes["multiplier"]);
     }
     for ($i = 0; $i < $mult; $i++) {
         foreach ($nodes as $key => $value) {
             if ($value["tagName"]) {
                 $tmult = 1;
                 if (isset($value["multiplier"])) {
                     $tmult = (int) $value["multiplier"];
                 }
                 for ($j = 0; $j < $tmult; $j++) {
                     $result[] = ar_html::tag($value["tagName"], $value["attributes"], $childNodes->cloneNode(true));
                 }
             } else {
                 $result = array_merge($result, (array) $this->compileNodes($value, $childNodes));
             }
         }
     }
     return ar_html::nodes($result);
 }
コード例 #2
0
ファイル: diff.php プロジェクト: poef/ariadne
 public static function diff($a, $b)
 {
     $a = is_array($a) ? $a : explode("\n", $a);
     $b = is_array($b) ? $b : explode("\n", $b);
     $diff = new Diff($a, $b);
     if ($diff) {
         $formatter = new AriadneDiffFormatter();
         $result = $formatter->format($diff);
         $rows = ar_html::nodes();
         foreach ($result as $line) {
             $cells = ar_html::nodes();
             foreach ($line as $content) {
                 if (is_array($content)) {
                     $options = array();
                     if ($content['class']) {
                         $options['class'] = $content['class'];
                     }
                     if ($content['colspan']) {
                         $options['colspan'] = $content['colspan'];
                     }
                     $cell = ar_html::tag("td", $options, $content['data']);
                     $cells[] = $cell;
                 } else {
                     $cells[] = ar_html::tag("td", $content);
                 }
             }
             $rows[] = ar_html::tag("tr", $cells);
         }
         if (count($rows)) {
             $table = ar_html::tag("table", array("class" => "diff"), $rows);
             $table->insertBefore(ar_html::tag("col", array("class" => "content")), $table->firstChild);
             $table->insertBefore(ar_html::tag("col"), $table->firstChild);
             $table->insertBefore(ar_html::tag("col", array("class" => "content")), $table->firstChild);
             $table->insertBefore(ar_html::tag("col"), $table->firstChild);
             return $table;
         }
     }
 }
コード例 #3
0
ファイル: form.php プロジェクト: poef/ariadne
 public function getField($content = null)
 {
     $fieldset = parent::getField($content);
     $count = 0;
     foreach ($fieldset->div as $field) {
         $field->appendChild(ar_html::el('button', array('class' => 'formFieldListDelete', 'type' => 'submit', 'name' => $this->name . '[Delete]', 'value' => $count), '-'));
         $count++;
     }
     if ($this->newField) {
         $newField = $this->newField->getField();
         $newField->appendChild(ar_html::el('button', array('class' => 'formFieldListAdd', 'type' => 'submit', 'name' => $this->name . '[Add]', 'value' => $this->name . 'NewField'), '+'));
         $fieldset->appendChild(ar_html::el('div', array('class' => 'formFieldListAdd'), $newField));
     }
     return $fieldset;
 }
コード例 #4
0
ファイル: menu.php プロジェクト: poef/ariadne
 public function levels($options = array())
 {
     $options += array('maxDepth' => 5, 'startLevel' => 0);
     // add level classes to the ul/li tags, level-0, level-1, etc.
     if ($options['maxDepth'] == 0) {
         return $this;
     }
     if (!isset($options['rootNode'])) {
         $options['rootNode'] = $this;
     }
     if ($options['rootNode'] instanceof ar_htmlElement) {
         $options['rootNode'] = ar_html::nodes($options['rootNode']);
     }
     if ($options['rootNode'] instanceof ar_htmlNodes && count($options['rootNode'])) {
         $options['rootNode']->setAttribute('class', array('menuLevels' => 'menuLevel-' . $options['startLevel']));
         foreach ($options['rootNode'] as $element) {
             $element->childNodes->setAttribute('class', array('menuLevels' => 'menuLevel-' . $options['startLevel']));
             $this->levels(array('maxDepth' => $options['maxDepth'] - 1, 'startLevel' => $options['startLevel'] + 1, 'rootNode' => $element->getElementsByTagName($this->options['itemTag'], true)->getElementsByTagName($this->options['listTag'], true)));
         }
     }
     $this->levelOptions = $options;
     return $this;
 }
コード例 #5
0
ファイル: html.php プロジェクト: poef/ariadne
 public static function registerEditable($name)
 {
     $context = pobject::getContext();
     $me = $context["arCurrentObject"];
     $id = self::$editCounter++;
     $prefix = self::$editPrefix;
     return array('id' => $prefix . $id, 'content' => ar_html::tag('script', " parent.registerDataField('" . $prefix . $id . "', '" . AddCSlashes($name, ARESCAPE) . "', '" . $me->path . "', '" . $me->id . "' );"));
 }
コード例 #6
0
ファイル: table.php プロジェクト: poef/ariadne
 public function caption($content, $attributes = null)
 {
     $newCaption = ar_html::tag('caption', $content, $attributes);
     if ($caption = $this->caption->firstChild) {
         $this->replaceChild($newCaption, $caption);
     } else {
         $this->insertBefore($newCaption, $this->firstChild);
     }
     return $this;
 }
コード例 #7
0
ファイル: html.php プロジェクト: poef/ariadne
 public function toString($indent = '', $current = 0)
 {
     $indent = ar_html::$indenting ? $indent : '';
     $result = "\n" . $indent . '<' . ar_html::name($this->tagName);
     if (is_array($this->attributes)) {
         foreach ($this->attributes as $name => $value) {
             $result .= ar_html::attribute($name, $value, $current);
         }
     } else {
         if (is_string($this->attributes)) {
             $result .= ltrim(' ' . $this->attributes);
         }
     }
     if (!ar_html::$xhtml || ar_html::canHaveContent($this->tagName)) {
         $result .= '>';
         if (ar_html::canHaveContent($this->tagName)) {
             if (isset($this->childNodes) && count($this->childNodes)) {
                 if (ar_html::canIndentInside($this->tagName)) {
                     $result .= $this->childNodes->toString(ar_html::$indent . $indent);
                     if (substr($result, -1) == ">") {
                         $result .= "\n" . $indent;
                     }
                 } else {
                     $result .= $this->childNodes->toString('');
                 }
             }
             $result .= '</' . ar_html::name($this->tagName) . '>';
         }
     } else {
         $result .= ' />';
     }
     return $result;
 }
コード例 #8
0
ファイル: mod_yui.php プロジェクト: poef/ariadne
 public static function showList($data, $viewtype = 'list')
 {
     global $ARnls;
     if (is_array($data['objects']) && count($data['objects']) && $data['total'] > 0) {
         $nodes = ar_html::nodes();
         switch ($viewtype) {
             case "details":
                 $maxlen = 32;
                 break;
             case "icons":
                 $maxlen = 14;
                 break;
             default:
                 $maxlen = 11;
                 break;
         }
         foreach ($data['objects'] as $node) {
             $content = self::getTypeIcon($node, $viewtype);
             if (is_array($node['svn'])) {
                 $content[] = self::getSvnIcon($node['svn']['status']);
             }
             $item_class = "explore_item";
             if ($node['priority'] < 0) {
                 $item_class .= " hidden";
             }
             $content[] = ar_html::tag('span', array('class' => 'explore_name'), self::labelspan($node['name'], $maxlen));
             $nodes[] = ar_html::tag('li', array('class' => $item_class, 'data-path' => $node['path']), ar_html::tag('a', array('class' => 'explore_link', 'href' => $node['local_url'] . 'explore.html', 'onDblClick' => "top.muze.ariadne.explore.view('" . htmlspecialchars($node['path']) . "'); return false;", 'title' => $node['name']), $content));
         }
         $result = ar_html::tag('ul', array('class' => array('explore_list', $viewtype)), $nodes);
     } else {
         if ($data['total'] > 1000) {
             $content = htmlspecialchars($ARnls['ariadne:too_many_objects_found'] . " (" . $data['total'] . ")");
             $selectoptions = array("sanity-off" => $ARnls['ariadne:select:showall']);
             foreach ($selectoptions as $key => $value) {
                 $content .= '<br><a href="#" onclick="muze.ariadne.explore.viewpane.setfilter(\'' . htmlspecialchars($key) . '\'); return false;">' . htmlspecialchars($value) . '</a>';
             }
             $result = ar_html::tag('div', array('class' => 'noobjects'), $content);
         } else {
             $result = ar_html::tag('div', array('class' => 'noobjects'), htmlspecialchars($ARnls['ariadne:no_objects_found']));
         }
     }
     echo $result . "\n";
 }
コード例 #9
0
ファイル: css.php プロジェクト: poef/ariadne
 public function __toString()
 {
     return (string) ar_html::tag('style', $this->attributes, (string) $this->rules);
 }