Example #1
0
 function setParent(&$parent)
 {
     parent::setParent($parent);
     $step = $this->level;
     if (isset($parent->parent) && is_a($parent->parent, 'ListContainer')) {
         $step -= $parent->parent->level;
     }
     $margin = $this->margin * $step;
     if ($step == $this->level) {
         $margin += $this->left_margin;
     }
     if ($this->tag !== 'dl') {
         global $_list_pad_str;
         $this->style = sprintf($_list_pad_str, $this->level, $margin, $margin);
     } else {
         global $_dlist_pad_str;
         $this->style = sprintf(' class="list%d dl-horizontal" ', $this->level, $margin, $margin);
     }
 }
 function addChild(Element $child)
 {
     $this->children[] = $child;
     $child->setParent($this);
 }
Example #3
0
 /**
  * putPreviousSibling() should throw BadMethodCallException if element is not child
  */
 public function testPutPreviousSibling_throwsBadMethodCallException_ifElementIsNotChild()
 {
     $this->setExpectedException('BadMethodCallException');
     $parent = new Group();
     $parent->appendChild(new Element())->appendChild(new Element());
     $element = new Element();
     $element->setParent($parent);
     $element->putPreviousSibling(new Element());
     return;
 }
Example #4
0
 function setParent(&$parent)
 {
     global $_list_pad_str;
     parent::setParent($parent);
     $step = $this->level;
     if (isset($parent->parent) && is_a($parent->parent, 'ListContainer')) {
         $step -= $parent->parent->level;
     }
     $margin = $this->margin * $step;
     if ($step == $this->level) {
         $margin += $this->left_margin;
     }
     $this->style = sprintf($_list_pad_str, $this->level, $margin, $margin);
 }
Example #5
0
 /**
  * Добавляет элемен в коллекцию
  * @param Element $element потомок элемента
  */
 public function addChild(Element $element)
 {
     $this->children[] = $element;
     $element->setParent($this);
 }