예제 #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
파일: table.php 프로젝트: poef/ariadne
 private function getCells($list, $tag = 'td')
 {
     $nodes = ar_html::nodes();
     foreach ($list as $key => $content) {
         $nodes[] = ar_html::el($tag, $content);
     }
     return $nodes;
 }
예제 #3
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;
         }
     }
 }
예제 #4
0
파일: form.php 프로젝트: poef/ariadne
 public function getField($content = null)
 {
     $legend = null;
     if ($this->label) {
         $legend = ar_html::el('legend', $this->label);
     }
     if (!isset($content)) {
         $content = ar_html::nodes();
         foreach ($this->children as $child) {
             $content[] = $child->getField();
         }
     }
     $content = ar_html::nodes($legend, $content);
     $help = $this->getHelp();
     if ($help) {
         $content[] = $help;
     }
     $class = array('formField', 'form' . ucfirst($this->type));
     if ($this->class) {
         $class[] = $this->class;
     }
     $attributes = array('class' => $class);
     if ($this->id) {
         $attributes['id'] = $this->id;
     }
     return ar_html::el('fieldset', $content, $attributes);
 }
예제 #5
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;
 }
예제 #6
0
파일: html.php 프로젝트: poef/ariadne
 public static function editableTextSpan($content, $name, $editTitle = '')
 {
     if (self::$editMode) {
         $context = pobject::getContext();
         $me = $context["arCurrentObject"];
         $register = self::registerEditable($name);
         return ar_html::nodes($register['content'], ar_html::tag('span', array('id' => $register['id'], 'class' => array('editable', 'text-only'), 'ar:path' => $me->path, 'ar:id' => $me->id, 'title' => $editTitle), self::parse($content)));
     } else {
         return self::parse($content);
     }
 }
예제 #7
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";
 }