public function render() { if (!empty($this->_items)) { if ($this->_num_rows > 2) { $col_xs = @round(12 / ($this->_num_per_rows - 2)); $col_sm = @round(12 / ($this->_num_per_rows - 1)); } $col_md = round(12 / $this->_num_per_rows); $col_lg = round(12 / $this->_num_per_rows); $container = new Tag('div', ['class' => 'row']); foreach ($this->_items as $key => $item) { $column = new Tag('div', $item, ['class' => 'grid-item']); if (isset($col_xs)) { $column->add_class('col-xs-' . $col_xs); } if (isset($col_sm)) { $column->add_class('col-sm-' . $col_sm); } $column->add_class('col-md-' . $col_md); $column->add_class('col-lg-' . $col_lg); $this->_items[$key] = $column; } $container->set_content(implode(PHP_EOL, $this->_items)); return (new Tag($this->_tag, $container, $this->_attributes))->render(); } return ''; }
/** * 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; }
/** * 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; }
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); }
/** * 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; }
/** * 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; }
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; }
/** * 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; }
/** * 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', '×', ['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 .= ' ' . $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; }
/** * Render * * @return */ public function render() { if (!empty($this->image)) { if (isset($this->link)) { $image = clone $this->link; $image->set_label($this->image); $this->link->set_label($this->caption); $caption = new Tag('div', $this->link, ['class' => 'carousel-caption']); } else { $image = $this->image; $caption = new Tag('div', $this->caption, ['class' => 'carousel-caption']); } if (isset($this->description)) { $caption->append_content($this->description); } if (!empty($this->buttons)) { $button = new Tag('p', implode(PHP_EOL, $this->buttons), ['class' => 'thumbnail-buttons']); $caption->append_content($button); } return $image . (new Tag($this->_tag, $caption, $this->_attributes))->render(); } return ''; }
/** * 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; }
/** * 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; }
/** * 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; }
public function render() { switch ($this->_type) { case 'text': $this->_attributes['type'] = 'text'; $field = new Tag('input', $this->_attributes); break; case 'password': $this->_attributes['type'] = 'password'; $field = new Tag('input', $this->_attributes); break; case 'radio': $this->_attributes['type'] = 'radio'; $field = new Tag('input', $this->_attributes); break; case 'checkbox': $this->_attributes['type'] = 'checkbox'; $field = new Tag('input', $this->_attributes); break; case 'number': $this->_attributes['type'] = 'number'; $field = new Tag('input', $this->_attributes); break; case 'date': $this->_attributes['type'] = 'date'; $field = new Tag('input', $this->_attributes); break; case 'color': $this->_attributes['type'] = 'color'; $field = new Tag('input', $this->_attributes); break; case 'month': $this->_attributes['type'] = 'month'; $field = new Tag('input', $this->_attributes); break; case 'week': $this->_attributes['type'] = 'week'; $field = new Tag('input', $this->_attributes); break; case 'time': $this->_attributes['type'] = 'time'; $field = new Tag('input', $this->_attributes); break; case 'datetime': $this->_attributes['type'] = 'datetime'; $field = new Tag('input', $this->_attributes); break; case 'datetime-local': $this->_attributes['type'] = 'datetime-local'; $field = new Tag('input', $this->_attributes); break; case 'email': $this->_attributes['type'] = 'email'; $field = new Tag('input', $this->_attributes); break; case 'search': $this->_attributes['type'] = 'search'; $field = new Tag('input', $this->_attributes); break; case 'tel': $this->_attributes['type'] = 'tel'; $field = new Tag('input', $this->_attributes); break; case 'url': $this->_attributes['type'] = 'url'; $field = new Tag('input', $this->_attributes); break; case 'select': $field = new Tag('select', $this->_attributes); if (!empty($this->_options)) { foreach ($this->_options as $group => $option) { if (is_array($option)) { $group = new Tag('optgroup', ['label' => $group]); foreach ($option as $value => $label) { $attr = ['value' => $value]; if (isset($this->_value)) { if ($this->_value == $value) { $attr['selected'] = 'selected'; } } $group->append_content(new Tag('option', $label, $attr)); } $field->append_content($group); } elseif (is_string($option) or is_numeric($option)) { $attr = ['value' => $group]; if (isset($this->_value)) { if ($this->_value == $group) { $attr['selected'] = 'selected'; } } $field->append_content(new Tag('option', $option, $attr)); } } } break; case 'textarea': $this->_attributes['type'] = 'textarea'; $field = new Tag('textarea', $this->_attributes); break; case 'file': $this->_attributes['type'] = 'file'; $field = new Tag('input', $this->_attributes); break; case 'featured-image': $field = new Tag('div', ['data-role' => 'featured-image']); $properties['size'] = isset($this->_properties['size']) ? $this->_properties['size'] : ['width' => 270, 'height' => 270]; $properties['text'] = isset($this->_properties['text']) ? $this->_properties['text'] : 'Featured Image'; $image_holder = new Tag('img', array('src' => 'holder.js/' . implode('x', $properties['size']) . '?text=' . $this->_properties['text'], 'data-pattern' => 'image-preview')); if (!empty($this->_value)) { $image_holder->add_class('hidden'); $image_preview = new Tag('img', array('src' => $this->_value, 'data-role' => 'image-preview')); $field->append_content($image_preview); } $field->append_content($image_holder); $this->_attributes['type'] = 'file'; $this->_attributes['data-role'] = 'image-input'; $this->_attributes['accept'] = 'image/*'; $input_group = new Group(Group::INPUT_GROUP); $input_group->add_item(new Tag('span', new Tag('span', '<i class="fa fa-camera"></i>' . new Tag('input', $this->_attributes), array('class' => 'btn btn-file', 'data-role' => 'image-browse', 'title' => 'Browse', 'data-toggle' => 'tooltip')), ['class' => 'input-group-btn'])); $field->append_content($input_group); break; case 'textarea': $this->_attributes['type'] = 'textarea'; $field = new Tag('textarea', $this->_attributes); break; default: $field = new Tag($this->_tag, $this->_attributes); break; } $field->add_class('form-control'); if (isset($this->label)) { $group = new Group(Group::FORM_GROUP); $group->add_item($this->label); $group->add_item($field); if (isset($this->help)) { $group->add_item($this->help); } return $group->render(); } return $field->render(); }
public function render() { if (!empty($this->left_media) or !empty($this->right_media)) { if (isset($this->left_media)) { if (isset($this->link)) { $media = clone $this->link; $media->set_label($this->left_media); } else { $media = $this->left_media; } $left_classes[] = 'media-left'; if ($this->_is_align_bottom === TRUE) { $left_classes[] = 'media-bottom'; } elseif ($this->_is_align_middle === TRUE) { $left_classes[] = 'media-middle'; } $output['left'] = new Tag('div', $media, ['class' => $left_classes]); } $body = new Tag('div', ['class' => 'media-body']); if (isset($this->link)) { $heading = clone $this->link; $heading->set_label($this->heading); } else { $heading = $this->heading; } $body->append_content($heading); if (isset($this->description)) { $body->append_content($this->description); } if (!empty($this->childs)) { foreach ($this->childs as $child) { $body->append_content($child); } } $output['body'] = $body; if (isset($this->right_media)) { if (isset($this->link)) { $media = clone $this->link; $media->set_label($this->right_media); } else { $media = $this->right_media; } $right_classes[] = 'media-right'; if ($this->_is_align_bottom === TRUE) { $right_classes[] = 'media-bottom'; } elseif ($this->_is_align_middle === TRUE) { $right_classes[] = 'media-middle'; } $output['right'] = new Tag('div', $media, ['class' => $right_classes]); } return (new Tag($this->_tag, implode(PHP_EOL, $output), $this->_attributes))->render(); } return ''; }
/** * Render * * @access public * @return string */ public function render(array $attr = array()) { if (!empty($this->_rows)) { // Set Table Caption if (!empty($this->_caption)) { $output[] = $this->_caption; } // Set Table Headers $thead = new Tag('tr'); foreach ($this->_headers as $column) { $thead->append_content(new Tag('th', $column)); } $output[] = new Tag('thead', $thead->render()); // Set Table Body $output[] = new Tag('tbody', implode(PHP_EOL, $this->_rows)); // Set Table Footers if (!empty($this->_footers)) { $tfoot = new Tag('tr'); foreach ($this->_footers as $column) { $tfoot->append_content(new Tag('th', $column)); } $output[] = new Tag('tfoot', $tfoot); } $table = new Tag($this->_tag, implode(PHP_EOL, $output), $this->_attributes); if ($this->_is_responsive) { return (new Tag('div', $table, ['class' => 'table-responsive']))->render(); } return $table->render(); } return ''; }
public function render() { if (!empty($this->image)) { if (isset($this->_template)) { $vars = get_object_vars($this); extract($vars); ob_start(); // If the PHP installation does not support short tags we'll // do a little string replacement, changing the short tags // to standard PHP echo statements. if (!ini_get('short_open_tag') and function_usable('eval')) { echo eval('?>' . preg_replace('/;*\\s*\\?>/', '; ?>', str_replace('<?=', '<?php echo ', $this->_template))); } else { echo eval('?>' . preg_replace('/;*\\s*\\?>/', '; ?>', $this->_template)); } $output = ob_get_contents(); ob_end_clean(); return $output; } else { if (isset($this->link)) { $output[] = new Link($this->image, $this->link); $caption = new Link($this->caption, $this->link, ['class' => 'caption']); } else { $output[] = $this->image; $caption = new Tag('div', $this->caption, ['class' => 'caption']); } if (isset($this->description)) { $caption->append_content($this->description); } if (!empty($this->buttons)) { $button = new Tag('p', implode(PHP_EOL, $this->buttons), ['class' => 'thumbnail-buttons']); $caption->append_content($button); } $output[] = $caption; return (new Tag($this->_tag, implode(PHP_EOL, $output), $this->_attributes))->render(); } } return ''; }
/** * 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; }
public function render() { switch ($this->_fieldset_type) { case self::PANEL_FIELDSET: $fieldset = new Panel(Panel::DEFAULT_PANEL, $this->_attributes); $this->legend->append_content((new Link(['class' => 'panel-collapse pull-right']))->set_icon('fa fa-chevron-up')); $fieldset->set_title($this->legend); if ($this->_group_type === Form::HORIZONTAL_FORM) { $fieldset->add_class('form-horizontal'); } elseif ($this->_group_type === Form::VERTICAL_FORM) { $fieldset->add_class('form-vertical'); } elseif ($this->_group_type === Form::INLINE_FORM) { $fieldset->add_class('form-inline'); } break; default: $fieldset = new Tag($this->_tag, $this->_attributes); break; } $fieldset->set_body(implode(PHP_EOL, $this->_items)); return $fieldset->render(); }
public function render() { if (!empty($this->_items)) { if ($this->_type === self::THUMBNAIL_GROUP) { $col_xs = round(12 / ($this->_num_per_rows - 2)); $col_sm = round(12 / ($this->_num_per_rows - 1)); $col_md = round(12 / $this->_num_per_rows); $col_lg = round(12 / $this->_num_per_rows); foreach ($this->_items as $key => $item) { $container = new Tag('div', $item, ['class' => 'thumbnail-item']); $container->add_class('col-xs-' . $col_xs); $container->add_class('col-sm-' . $col_sm); $container->add_class('col-md-' . $col_md); $container->add_class('col-lg-' . $col_lg); $this->_items[$key] = $container; } } return (new Tag($this->_tag, implode(PHP_EOL, $this->_items), $this->_attributes))->render(); } return ''; }
/** * render * * @return object */ public function render() { if (isset($this->brand)) { if (empty($this->_target)) { $this->_target = uniqid('navbar-'); } $toggle = new Button(); $toggle->append_label(new Tag('span', 'Toggle Navigation', ['class' => 'sr-only'])); $icons[] = new Tag('span', ['class' => 'icon-bar']); $icons[] = new Tag('span', ['class' => 'icon-bar']); $icons[] = new Tag('span', ['class' => 'icon-bar']); $toggle->append_label(implode(PHP_EOL, $icons)); $toggle->add_attributes(array('class' => 'navbar-toggle', 'data-toggle' => 'collapse', 'data-target' => '#' . $this->_target)); $output['header'] = new Tag('div', implode(PHP_EOL, [$toggle, $this->brand]), ['class' => 'navbar-header']); } $output['collapse'] = new Tag('div', ['id' => $this->_target, 'class' => 'collapse navbar-collapse']); $output['collapse']->append_content($this->left); $output['collapse']->append_content($this->form); $output['collapse']->append_content($this->right); $container = new Tag('div', implode(PHP_EOL, $output)); if ($this->_is_full_width === FALSE) { if ($this->_is_fluid === TRUE) { $container->add_class('container-fluid'); } else { $container->add_class('container'); } } else { $container->add_class('container-full-width'); } return (new Tag($this->_tag, $container, $this->_attributes))->render(); }