Exemple #1
0
 /**
  * Default rendering of a node.
  *
  * This renders a URL into a XML sitemap node.
  * <code>
  * <url>
  *   <loc>http://www.example.com/</loc>
  *   <changefreq>monthly</changefreq>
  *   <priority>0.8</priority>
  * </url>
  * </code>
  *
  * @param T_CompositeLeaf $node  node to visit
  */
 function renderDefault(T_CompositeLeaf $node)
 {
     $url = $this->addChild('url');
     $loc = $node->getUrl($this->url_filter);
     $url->addChild('loc', $loc);
     $freq = $node->getChangeFreq();
     if (!is_null($freq)) {
         $url->addChild('changefreq', $freq);
     }
     $url->addChild('priority', $node->getPriority());
 }
Exemple #2
0
 /**
  * Add a child test case.
  *
  * @param T_CompositeLeaf $child  child test case.
  * @return T_Unit_Suite  fluent interface
  */
 function addChild(T_CompositeLeaf $child, $key = null)
 {
     foreach ($this->observers as $observe) {
         $child->attach($observe);
     }
     if (isset($key)) {
         $this->children[$key] = $child;
     } else {
         $this->children[] = $child;
     }
     return $this;
 }
Exemple #3
0
 /**
  * Add a child URL.
  *
  * @param T_CompositeLeaf $child  child URL object.
  * @return T_Url_Collection  fluent interface
  */
 function addChild(T_CompositeLeaf $child, $key = null)
 {
     $child->setParent($this);
     if (isset($key)) {
         $this->children[$key] = $child;
     } else {
         $this->children[] = $child;
     }
     if ($child->isActive()) {
         $this->setActive();
     }
     return $this;
 }
Exemple #4
0
 /**
  * Add a child Composite.
  *
  * @param T_CompositeLeaf $child  child URL object.
  * @return T_Text_Composite  fluent interface
  */
 function addChild(T_CompositeLeaf $child, $key = null)
 {
     if (isset($key)) {
         $this->children[$key] = $child;
     } else {
         $this->children[] = $child;
     }
     $child->setParent(get_class($this));
     foreach (array_keys($this->parents) as $parent) {
         $child->setParent($parent);
     }
     return $this;
 }
Exemple #5
0
 /**
  * Get the class of a node.
  *
  * @param T_CompositeLeaf $node
  */
 protected function getClass($node)
 {
     $class = false;
     if ($node instanceof T_Url_Leaf) {
         if ($node->isActive()) {
             $class = 'cur ';
         }
         $c = $node->getComposite();
         if ($c && $c->isChildren()) {
             $class .= 'parent';
         }
     }
     return $class ? trim($class) : false;
 }
Exemple #6
0
 /**
  * Adds a child to the composite.
  *
  * @param T_CompositeLeaf $child  child to add
  * @param string $key  optional key to refer to composite.
  * @return T_Form_MultiStep  fluent interface
  */
 function addChild(T_CompositeLeaf $child, $key = null)
 {
     if ($child instanceof T_Form_Step) {
         if (!isset($key)) {
             $key = $child->getAlias();
         }
         $this->steps[$key] = $child;
         reset($this->steps);
         // keep array pointer at start
         $this->init();
         return $this;
     } else {
         return parent::addChild($child, $key);
     }
 }
Exemple #7
0
 /**
  * Add a child element.
  *
  * @param T_CompositeLeaf $child  child input element object.
  * @return T_Form_Group  fluent interface
  */
 function addChild(T_CompositeLeaf $child, $key = null)
 {
     if (!$key) {
         $key = $child->getAlias();
     }
     $i = 1;
     foreach ($this->children as $group) {
         $block = clone $child;
         $block->accept(new T_Form_SuffixAlias("_{$i}"));
         $group->addChild($block, $key);
         // ^ cloned and alias suffixed, and added to each group with
         //   original alias
         $i++;
     }
     return $this;
 }
Exemple #8
0
 /**
  * Prepend a child to first position.
  *
  * @param T_CompositeLeaf $child  child URL object
  * @param string $key  optional reference key
  * @return T_Template_Composite  fluent interface
  */
 function prependChild(T_CompositeLeaf $child, $key = null)
 {
     if ($child instanceof T_Template_File) {
         $child->addParent($this);
     }
     if ($key) {
         $this->_children = array($key => $child) + $this->_children;
     } else {
         array_unshift($this->_children, $child);
     }
     return $this;
 }
Exemple #9
0
 /**
  * Add a child element.
  *
  * Can override default behaviour by specifying a named key for the child,
  * otherwise the element alias is used by default.
  *
  * @param T_CompositeLeaf $child  child input element object.
  * @return T_Form_Group  fluent interface
  */
 function addChild(T_CompositeLeaf $child, $key = null)
 {
     if (isset($key)) {
         $this->children[$key] = $child;
     } else {
         $this->children[$child->getAlias()] = $child;
     }
     return $this;
 }