Example #1
0
 public static function render($attributes, $echo = true)
 {
     $i = new self($attributes);
     if ($echo) {
         echo $i->getHtml();
     } else {
         return $i->getHtml();
     }
 }
Example #2
0
 public static function render($attributes, $echo = true)
 {
     if (!empty($attributes['model'])) {
         $attributes['model'] = $attributes['model']->getCustomfieldsRecord();
     }
     $i = new self($attributes);
     if ($echo) {
         echo $i->getHtml();
     } else {
         return $i->getHtml();
     }
 }
 /**
  *
  */
 protected function buildFixedNavBarIfRequested()
 {
     // if a fixed navbar is requested
     if (filter_var($this->getDomElement()->getAttribute('fixed'), FILTER_VALIDATE_BOOLEAN) === true || $this->getDomElement()->getAttribute('position') === 'fixed') {
         // first build the actual navbar and set a class so it will be fixed
         $this->getDomElement()->setAttribute('fixed', '0');
         $this->getDomElement()->setAttribute('position', '');
         $realNav = new self($this->getSkinTemplate(), $this->getDomElement(), $this->getIndent());
         $realNav->setClasses($this->getClassString() . ' navbar-fixed-top');
         // then add an invisible copy of the nav bar that will act as a spacer
         $this->addClasses('navbar-static-top invisible');
         return $realNav->getHtml();
     } else {
         return '';
     }
 }
 /**
  * Builds the HTML code for this component
  *
  * @return String the HTML code
  */
 public function getHtml()
 {
     $this->mHtml = '';
     if ($this->getDomElement() === null) {
         return $this->mHtml;
     }
     // if a fixed navbar is requested
     if (filter_var($this->getDomElement()->getAttribute('fixed'), FILTER_VALIDATE_BOOLEAN)) {
         // first build the actual navbar and set a class so it will be fixed
         $this->getDomElement()->setAttribute('fixed', '0');
         $realNav = new self($this->getSkinTemplate(), $this->getDomElement(), $this->getIndent());
         $realNav->addClasses('navbar-fixed-top');
         $this->mHtml .= $realNav->getHtml();
         // then add an invisible copy of the nav bar that will act as a spacer
         $this->addClasses('navbar-static-top invisible');
     }
     $this->mHtml .= $this->indent() . '<!-- navigation bar -->' . $this->indent() . \HTML::openElement('nav', array('class' => 'navbar navbar-default p-navbar ' . $this->getClassString(), 'role' => 'navigation', 'id' => IdRegistry::getRegistry()->getId('mw-navigation'))) . $this->indent(1) . '<ul class="nav navbar-nav">';
     $this->indent(1);
     $children = $this->getDomElement()->hasChildNodes() ? $this->getDomElement()->childNodes : array();
     // add components
     foreach ($children as $node) {
         if (is_a($node, 'DOMElement') && $node->tagName === 'component' && $node->hasAttribute('type')) {
             switch ($node->getAttribute('type')) {
                 case 'Logo':
                     $this->mHtml .= $this->getLogo($node);
                     break;
                 case 'NavMenu':
                     $this->mHtml .= $this->getNavMenu($node);
                     break;
                 case 'PageTools':
                     $this->mHtml .= $this->getPageTools($node);
                     break;
                 case 'SearchBar':
                     $this->mHtml .= $this->getSearchBar($node);
                     break;
                 case 'PersonalTools':
                     $this->mHtml .= $this->getPersonalTools($node);
                     break;
             }
         }
     }
     $this->mHtml .= $this->indent(-1) . '</ul>' . $this->indent(-1) . '</nav>' . "\n";
     return $this->mHtml;
 }