Exemplo n.º 1
0
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->addClass('panel');
     if ($this->hasAttribute('THEME')) {
         $this->ignoreAttribute('THEME');
         switch ($this->getAttribute('THEME')) {
             case 'default':
                 $this->addClass('panel-default');
                 break;
             case 'primary':
                 $this->addClass('panel-primary');
                 break;
             case 'success':
                 $this->addClass('panel-success');
                 break;
             case 'info':
                 $this->addClass('panel-info');
                 break;
             case 'warning':
                 $this->addClass('panel-warning');
                 break;
             case 'danger':
                 $this->addClass('panel-danger');
                 break;
         }
     }
 }
Exemplo n.º 2
0
 public function compile(\Xtpl\Compiler $compiler, $cwd)
 {
     $compiled = null;
     if (!$this->isCompiled()) {
         $this->ignoreAttribute(array('PLACEMENT', 'TRIGGER', 'DELAY'));
         $id = 'xtpl-bootstrap-tooltip-' . $this->getUniqueId();
         $this->getParent()->addClass($id);
         $this->getParent()->setAttribute('DATA-TOGGLE', 'tooltip');
         $args = array();
         $compiled = parent::compile($compiler, $cwd)->process();
         $args['title'] = $compiled->render();
         $args['html'] = true;
         $args['container'] = 'body';
         if ($this->hasAttribute('PLACEMENT')) {
             $args['placement'] = $this->getAttribute('PLACEMENT');
         }
         if ($this->hasAttribute('TRIGGER')) {
             $args['trigger'] = $this->getAttribute('TRIGGER');
         }
         if ($this->hasAttribute('DELAY')) {
             $args['delay'] = $this->getAttribute('DELAY');
         }
         $this->addJs("\$( '.{$id}' ).tooltip( " . json_encode($args) . " );");
         $this->getParent()->removeChild($this);
     }
     return $compiled ? $compiled : parent::compile($compiler, $cwd);
 }
Exemplo n.º 3
0
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     if ($this->hasAttribute('HREF')) {
         $this->setTagName('A');
     }
     $this->addClass('thumbnail');
 }
Exemplo n.º 4
0
 public function compile(\Xtpl\Compiler $compiler, $cwd)
 {
     if (!$this->isCompiled()) {
         $controls = $this->hasAttribute('CONTROLS') ? $this->getAttribute('CONTROLS') : 'all';
         $indicators = $this->hasAttribute('INDICATORS') && $this->getAttribute('INDICATORS') == 'false' ? false : true;
         $inner = $this->wrapInner(new DivElement());
         $inner->addClass('carousel-inner');
         if (!empty($controls)) {
             $controls = explode(' ', $controls);
             foreach ($controls as $control) {
                 switch ($control) {
                     case 'left':
                         $this->addChild(new Carousel\ControlElement(array('ICON' => $this->getAttribute('ICON-LEFT'))));
                         break;
                     case 'right':
                         $this->addChild(new Carousel\ControlElement(array('ICON' => $this->getAttribute('ICON-RIGHT'), 'DIRECTION' => 'right')));
                         break;
                     case 'all':
                         $this->addChild(new Carousel\ControlElement(array('ICON' => $this->getAttribute('ICON-LEFT'))));
                         $this->addChild(new Carousel\ControlElement(array('ICON' => $this->getAttribute('ICON-RIGHT'), 'DIRECTION' => 'right')));
                         break 2;
                 }
             }
         }
         if ($indicators) {
             $slides = $this->find('DIV');
             $slideCount = 0;
             $active = -1;
             $firstSlide = null;
             foreach ($slides as $slide) {
                 if ($slide instanceof SlideElement) {
                     if (!$firstSlide) {
                         $firstSlide = $slide;
                     }
                     $slideCount++;
                     $inner->addChild($slide);
                     if ($slide->hasClass('active')) {
                         $active = $slideCount - 1;
                     }
                 }
             }
             if ($active < 0 && $firstSlide) {
                 $active = 0;
                 $firstSlide->addClass('active');
             }
             $ind = $this->prependChild(new Carousel\IndicatorsElement());
             while ($slideCount--) {
                 $li = $ind->prependChild(new LiElement());
                 $li->setAttribute('DATA-TARGET', '#' . $this->getAttribute('ID'));
                 $li->setAttribute('DATA-SLIDE-TO', $slideCount);
                 if ($active === $slideCount) {
                     $li->addClass('active');
                 }
             }
         }
     }
     return parent::compile($compiler, $cwd);
 }
Exemplo n.º 5
0
 public function process()
 {
     if (!$this->isProcessed()) {
         if ($this->getParent() instanceof TableElement) {
             $this->setTagName('COL');
         }
     }
     return parent::process();
 }
Exemplo n.º 6
0
 public function process()
 {
     if (!$this->isProcessed()) {
         if ($this->getParent() instanceof NavbarElement) {
             $this->addClass('navbar-collapse');
         }
     }
     return parent::process();
 }
Exemplo n.º 7
0
 public function process()
 {
     if (!$this->isProcessed()) {
         $dialog = new DivElement(array('CLASS' => 'modal-dialog'));
         $content = new DivElement(array('CLASS' => 'modal-content'));
         foreach ($this->getChildren() as $child) {
             $content->addChild($child);
         }
         $this->addChild($dialog);
         $dialog->addChild($content);
     }
     return parent::process();
 }
Exemplo n.º 8
0
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->addClass('progress');
     if ($this->hasAttribute('THEME')) {
         $styles = explode(' ', $this->getAttribute('THEME'));
         foreach ($styles as $style) {
             switch ($style) {
                 case 'striped':
                     $this->addClass('progress-striped');
                     break;
                 case 'active':
                     $this->addClass('active');
                     break;
             }
         }
     }
 }
Exemplo n.º 9
0
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->addClass('well');
     if ($this->hasAttribute('SIZE')) {
         $size = $this->getAttribute('SIZE');
         $this->ignoreAttribute('SIZE');
         switch ($size) {
             case 'large':
             case 'lg':
                 $this->addClass('well-lg');
                 break;
             case 'small':
             case 'sm':
                 $this->addClass('well-sm');
                 break;
         }
     }
 }
Exemplo n.º 10
0
 public function __construct(array $attributes = array())
 {
     parent::__construct($attributes);
     $this->addClass('row');
 }
Exemplo n.º 11
0
 public function process()
 {
     if (!$this->isProcessed()) {
     }
     return parent::process();
 }