예제 #1
0
 /**
  * Render
  *
  * @return null|string
  */
 public function render()
 {
     if (isset($this->_addon)) {
         $div = new Tag('div', NULL, $this->_attributes);
         $output[] = $div->open();
         if (isset($this->_append)) {
             $output[] = '<span class="input-group-addon">' . $this->_append . '</span>';
         }
         $output[] = $this->_addon;
         if (isset($this->_prepend)) {
             $output[] = '<span class="input-group-addon">' . $this->_prepend . '</span>';
         }
         $output[] = $div->close();
         return implode(PHP_EOL, $output);
     }
     return NULL;
 }
예제 #2
0
 public function render()
 {
     $form = new Tag('form', NULL, $this->_attributes);
     $output[] = $form->open();
     if (isset($this->_field) && is_array($this->_field)) {
         foreach ($this->_field as $key => $value) {
             $input = new Input();
             $render_input[] = $input->build($value['label'], $value['name'])->{$value}['type']($value['value'])->render();
         }
         $output[] = implode(PHP_EOL, $render_input);
         $output[] = (new Tag('button', 'Submit', ['class' => ['btn', 'btn-default']]))->render();
     } else {
         $output[] = $this->_field;
         $output[] = (new Tag('button', 'Submit', ['class' => ['btn', 'btn-default'], 'type' => 'submit']))->render();
     }
     $output[] = $form->close();
     return implode(PHP_EOL, $output);
 }
예제 #3
0
 /**
  * Render
  *
  * @return null|string
  */
 public function render()
 {
     if (isset($this->_panel)) {
         $div = new Tag('div', NULL, $this->_attributes);
         $output[] = $div->open();
         $output[] = (new Tag('i', $this->_icon, []))->render();
         $output[] = (new Tag('div', $this->_panel, ['class' => 'panel panel-heading']))->render();
         if (isset($this->_content)) {
             $output[] = (new Tag('div', $this->_content, ['class' => 'panel-body']))->render();
         }
         if (isset($this->_footer)) {
             $output[] = (new Tag('div', $this->_footer, ['class' => 'panel-footer']))->render();
         }
         $output[] = $div->close();
         return implode(PHP_EOL, $output);
     }
     return NULL;
 }
예제 #4
0
 /**
  * Render
  *
  * @return null|string
  */
 public function render()
 {
     if (isset($this->_breadcrumb)) {
         $ol = new Tag('ol', NULL, $this->_attributes);
         $output[] = $ol->open();
         $c = count($this->_breadcrumb);
         foreach ($this->_breadcrumb as $key => $value) {
             if ($key == $c - 1) {
                 $output[] = (new Tag('li', $value['name'], ['class' => 'active']))->render();
             } else {
                 $a = (new Tag('a', $value['name'], ['href' => $value['link']]))->render();
                 $output[] = (new Tag('li', $a, ['class' => '']))->render();
             }
         }
         $output[] = $ol->close();
         return implode(PHP_EOL, $output);
     }
     return NULL;
 }
예제 #5
0
 /**
  * Render
  *
  * @return
  */
 public function render()
 {
     if (isset($this->_description)) {
         $jumbotron = new Tag('div', NULL, $this->_attributes);
         $output[] = $jumbotron->open();
         if (isset($this->_header)) {
             $output[] = (new Tag('h1', $this->_header, array()))->render();
         }
         $output[] = (new Tag('p', $this->_description, array()))->render();
         if (isset($this->_link)) {
             $link = new Tag('p', NULL, array());
             $output[] = $link->open();
             $output[] = $this->_link;
             $output[] = $link->close();
         }
         $output[] = $jumbotron->close();
         return implode(PHP_EOL, $output);
     }
     return NULL;
 }
예제 #6
0
 public function render($html = NULL)
 {
     if (isset($this->_navbar)) {
         $div = new Tag('div', NULL, $this->_attributes);
         $output[] = $div->open();
         $output[] = '<div class="container-fluid">';
         if (isset($this->_brand)) {
             $output[] = '<div class="navbar-header">';
             $output[] = (new Tag('a', $this->_brand, $this->_brandattr))->render();
             $output[] = '</div>';
         }
         $output[] = '<div><ul class="nav navbar-nav">';
         foreach ($this->_navbar as $key => $nav) {
             $active = $key == 0 ? 'active' : '';
             if (isset($nav['child'])) {
                 $child[] = '<ul class="dropdown-menu">';
                 foreach ($nav['child'] as $key => $value) {
                     $a = (new Tag('a', $value['name'], ['href' => $value['link']]))->render();
                     $child[] = (new Tag('li', $a, ['class' => '']))->render();
                 }
                 $child[] = '</ul>';
                 $child_string = implode(PHP_EOL, $child);
                 $caret = '<span class="caret"></span>';
                 $a = (new Tag('a', $nav['name'] . $caret, ['class' => "dropdown-toggle", 'data-toggle' => "dropdown", 'href' => "#"]))->render();
                 $a = $a . $child_string;
                 $drop_attr = 'dropdown';
             } else {
                 $a = (new Tag('a', $nav['name'], ['href' => $nav['link']]))->render();
                 $drop_attr = '';
             }
             $output[] = (new Tag('li', $a, ['class' => [$active, $drop_attr]]))->render();
         }
         $output[] = '</ul></div>';
         $output[] = '</div>';
         $output[] = $div->close();
         return implode(PHP_EOL, $output);
     }
     return NULL;
 }
예제 #7
0
 /**
  * Render
  *
  * @return null|string
  */
 public function render()
 {
     if (isset($this->_alert)) {
         $div = new Tag('div', NULL, $this->_attributes);
         $output[] = $div->open();
         if ($this->_dismissible === TRUE) {
             $output[] = (new Tag('button', new Tag('span', '&times;', ['aria-hidden' => 'true']), ['type' => 'button', 'class' => 'close', 'data-dismiss' => 'alert', 'aria-label' => 'Close']))->render();
         }
         if (isset($this->_title_string)) {
             $title = '';
             if (isset($this->_icon)) {
                 $title = (new Tag('i', NULL, ['class' => $this->_icon, 'aria-hidden' => 'true']))->render();
             }
             $title .= '&nbsp;' . $this->_title_string;
             $output[] = (new Tag($this->_title_tag, $title, array()))->render();
         } elseif (isset($this->_icon)) {
             $output[] = (new Tag('i', NULL, ['class' => $this->_icon, 'aria-hidden' => 'true']))->render();
         }
         if (is_array($this->_alert)) {
             $output[] = '<br />';
             $list = new Tag('ul', NULL, ['class' => 'alert-list']);
             $output[] = $list->open();
             foreach ($this->_alert as $_alert) {
                 $output[] = (new Tag('li', $_alert, array()))->render();
             }
             $output[] = $list->close();
         } else {
             $output[] = $this->_alert;
         }
         $output[] = $div->close();
         return implode(PHP_EOL, $output);
     }
     return NULL;
 }
예제 #8
0
 /**
  * Render
  *
  * @return null|string
  */
 public function render()
 {
     if (isset($this->_nav)) {
         //--- link tab ---\\
         $ul = new Tag('ul', NULL, $this->_attributes);
         //ul open  tag
         $output[] = $ul->open();
         foreach ($this->_nav as $label => $attributes) {
             if (isset($attributes['active'])) {
                 $li = new Tag('li', NULL, ['class' => 'active']);
             } else {
                 $li = new Tag('li', NULL, []);
             }
             $output[] = $li->open();
             //a open tag
             $a = new Tag('a', ['href' => '#' . $label, 'role' => 'tab', 'data-toggle' => 'tab']);
             $output[] = $a->open();
             //for icon
             if (isset($nav['icon'])) {
                 $output[] = (new Tag('i', ['class' => $attributes['icon']]))->render();
             }
             $output[] = $label;
             //a close tag
             $output[] = $a->close();
             $output[] = $li->close();
             //for content
             $active = isset($attributes['active']) ? 'active in' : '';
             $div = new Tag('div', ['class' => ['tab-pane', 'fade', $active], 'id' => $label]);
             $content[] = $div->open();
             $content[] = $attributes['content'];
             $content[] = $div->close();
         }
         $output[] = $ul->close();
         //--- end link tab ---\\
         //--- content tab ---\\
         $divcontent = new Tag('div', ['class' => 'tab-content']);
         $output[] = $divcontent->open();
         $output[] = implode(PHP_EOL, $content);
         $output[] = $divcontent->close();
         //--- end content tab ---\\
         return implode(PHP_EOL, $output);
     }
     return NULL;
 }
예제 #9
0
 /**
  * Render
  *
  * @return null|string
  */
 public function render()
 {
     if (isset($this->_nav)) {
         //--- link tab ---\\
         $ul = new Tag('ul', NULL, $this->_attributes);
         //ul open  tag
         $output[] = $ul->open();
         $i = 1;
         foreach ($this->_nav as $key => $nav) {
             $output[] = $key == 0 ? '<li class="active">' : '<li class="">';
             //a open tag
             $a = new Tag('a', ['href' => '#' . $nav['link'], 'role' => 'tab', 'data-toggle' => 'tab']);
             $output[] = $a->open();
             //for icon
             if (isset($nav['icon'])) {
                 $output[] = (new Tag('i', ['class' => $nav['icon']]))->render();
             }
             $output[] = $nav['link'];
             //a close tag
             $output[] = $a->close();
             $output[] = '</li>';
             //for content
             $active = $key == 0 ? 'active in' : '';
             $div = new Tag('div', ['class' => ['tab-pane', 'fade', $active], 'id' => $nav['link']]);
             $content[] = $div->open();
             $content[] = $nav['content'] . '<h1>' . $i++ . '</h1>';
             $content[] = $div->close();
         }
         $output[] = $ul->close();
         //--- end link tab ---\\
         //--- content tab ---\\
         $divcontent = new Tag('div', ['class' => 'tab-content']);
         $output[] = $divcontent->open();
         $output[] = implode(PHP_EOL, $content);
         $output[] = $divcontent->close();
         //--- end content tab ---\\
         return implode(PHP_EOL, $output);
     }
     return NULL;
 }
예제 #10
0
 /**
  * Render
  *
  * @return null|string
  */
 public function render()
 {
     if (isset($this->_button)) {
         $button = new Tag('button', NULL, $this->_attributes);
         if (isset($this->_dropdown)) {
             $output[] = '<div class="dropdown">';
         } elseif (isset($this->_dropup)) {
             $output[] = '<div class="dropup">';
         }
         $output[] = $button->open();
         if (isset($this->_icon)) {
             $output[] = (new Tag('span', NULL, ['class' => $this->_icon, 'aria-hidden' => 'true']))->render();
         }
         $output[] = $this->_button;
         $output[] = isset($this->_dropdown) || isset($this->_dropup) ? '<span class="caret"></span>' : '';
         $output[] = $button->close();
         if (isset($this->_dropdown)) {
             $position = isset($this->_position) ? $this->position : '';
             $drop[] = '<ul class="dropdown-menu ' . $position . '">';
             foreach ($this->_dropdown as $key => $value) {
                 if (isset($value['header']) && $value['header'] === TRUE) {
                     $drop[] = (new Tag('li', $value['name'], array('class' => 'dropdown-header')))->render();
                     if (isset($value['divider']) && $value['divider'] === TRUE) {
                         $drop[] = (new Tag('li', NULL, array('role' => 'separator', 'class' => 'divider')))->render();
                     }
                 } else {
                     $attr = isset($value['disable']) && $value['disable'] === TRUE ? ['class' => 'disabled'] : array();
                     $a = (new Tag('a', $value['name'], ['href' => $value['link']]))->render();
                     $drop[] = (new Tag('li', $a, $attr))->render();
                     if (isset($value['divider']) && $value['divider'] === TRUE) {
                         $drop[] = (new Tag('li', NULL, array('role' => 'separator', 'class' => 'divider')))->render();
                     }
                 }
             }
             $drop[] = '</ul>';
             $output[] = implode(PHP_EOL, $drop);
             $output[] = '</div>';
         }
         if (isset($this->_dropup)) {
             $position = isset($this->_position) ? $this->position : '';
             $drop[] = '<ul class="dropdown-menu ' . $position . '">';
             foreach ($this->_dropup as $key => $value) {
                 if (isset($value['header']) && $value['header'] === TRUE) {
                     $drop[] = (new Tag('li', $value['name'], array('class' => 'dropdown-header')))->render();
                     if (isset($value['divider']) && $value['divider'] === TRUE) {
                         $drop[] = (new Tag('li', NULL, array('role' => 'separator', 'class' => 'divider')))->render();
                     }
                 } else {
                     $attr = isset($value['disable']) && $value['disable'] === TRUE ? ['class' => 'disabled'] : array();
                     $a = (new Tag('a', $value['name'], ['href' => $value['link']]))->render();
                     $drop[] = (new Tag('li', $a, $attr))->render();
                     if (isset($value['divider']) && $value['divider'] === TRUE) {
                         $drop[] = (new Tag('li', NULL, array('role' => 'separator', 'class' => 'divider')))->render();
                     }
                 }
             }
             $drop[] = '</ul>';
             $output[] = implode(PHP_EOL, $drop);
             $output[] = '</div>';
         }
         return implode(PHP_EOL, $output);
     }
     return NULL;
 }
예제 #11
0
 /**
  * Render
  *
  * @return null|string
  */
 public function render()
 {
     if (isset($this->_link)) {
         $link = new Tag('a', NULL, $this->_attributes);
         if (isset($this->_dropdown)) {
             $output[] = '<div class="dropdown">';
         }
         $output[] = $link->open();
         if (isset($this->_icon)) {
             $output[] = (new Tag('span', ['class' => $this->_icon, 'aria-hidden' => 'true']))->render();
         }
         $output[] = $this->_link;
         if (isset($this->_dropdown)) {
             $output[] = '<span class="caret"></span>';
         }
         $output[] = $link->close();
         if (isset($this->_dropdown)) {
             $drop[] = '<ul class="dropdown-menu">';
             foreach ($this->_dropdown as $key => $value) {
                 $a = (new Tag('a', $value['name'], ['href' => $value['link']]))->render();
                 $drop[] = (new Tag('li', $a))->render();
             }
             $drop[] = '</ul>';
             $output[] = implode(PHP_EOL, $drop);
             $output[] = '</div>';
         }
         return implode(PHP_EOL, $output);
     }
     return NULL;
 }
예제 #12
0
 /**
  * Render
  *
  * @return null|string
  */
 public function render()
 {
     if (!isset($this->_attributes['type'])) {
         $this->_attributes['type'] = '';
     }
     if (isset($this->_input)) {
         if ($this->_attributes['type'] === 'textarea') {
             unset($this->_attributes['type']);
             $div = new Tag('div', NULL, ['class' => 'form-group']);
             $output[] = $div->open();
             $output[] = (new Tag('label', $this->_input, ['for' => $this->_input]))->render();
             $output[] = (new Tag('textarea', NULL, $this->_attributes))->render();
             $output[] = $div->close();
         } elseif ($this->_attributes['type'] === 'select') {
             $div = new Tag('div', NULL, ['class' => 'form-group']);
             $output[] = $div->open();
             $output[] = (new Tag('label', $this->_input, ['for' => $this->_input]))->render();
             if (is_array($this->_attributes['value'])) {
                 $values = $this->_attributes['value'];
                 unset($this->_attributes['value']);
                 $select = new Tag('select', NULL, $this->_attributes);
                 $output[] = $select->open();
                 foreach ($values as $value) {
                     $output[] = (new Tag('option', $value['name'], array('value' => $value['id'])))->render();
                 }
                 $output[] = $select->close();
             }
             $output[] = $div->close();
         } elseif ($this->_attributes['type'] === 'checkbox' || $this->_attributes['type'] === 'radio') {
             if (isset($this->_inline)) {
                 $attr_group['class'] = $this->_attributes['type'] . '-inline';
             } else {
                 $attr_group['class'] = $this->_attributes['type'];
             }
             $div = new Tag('div', NULL, $attr_group);
             $output[] = $div->open();
             $label = new Tag('label', $this->_input, ['for' => $this->_input]);
             $output[] = $label->open();
             $output[] = (new Tag('input', NULL, $this->_attributes))->render();
             $output[] = $this->_input;
             $output[] = $label->close();
             $output[] = $div->close();
         } elseif ($this->_attributes['type'] === 'text') {
             $div = new Tag('div', NULL, ['class' => 'form-group']);
             $output[] = $div->open();
             $output[] = (new Tag('label', $this->_input, ['for' => $this->_input]))->render();
             $output[] = (new Tag('input', NULL, $this->_attributes))->render();
             $output[] = $div->close();
         } elseif ($this->_attributes['type'] === 'email') {
             $div = new Tag('div', NULL, ['class' => 'form-group']);
             $output[] = $div->open();
             $output[] = (new Tag('label', $this->_input, ['for' => $this->_input]))->render();
             $output[] = (new Tag('input', NULL, $this->_attributes))->render();
             $output[] = $div->close();
         } elseif ($this->_attributes['type'] === 'password') {
             $div = new Tag('div', NULL, ['class' => 'form-group']);
             $output[] = $div->open();
             $output[] = (new Tag('label', $this->_input, ['for' => $this->_input]))->render();
             $output[] = (new Tag('input', NULL, $this->_attributes))->render();
             $output[] = $div->close();
         } elseif ($this->_attributes['type'] === 'submit') {
             $div = new Tag('div', NULL, ['class' => 'form-group']);
             $output[] = $div->open();
             $output[] = (new Tag('button', $this->_input, $this->_attributes))->render();
             $output[] = $div->close();
         } else {
             $output[] = (new Tag('input', NULL, $this->_attributes))->render();
         }
         return implode(PHP_EOL, $output);
     }
     return NULL;
 }