本文整理汇总了PHP中parent::create_widget方法的典型用法代码示例。如果您正苦于以下问题:PHP parent::create_widget方法的具体用法?PHP parent::create_widget怎么用?PHP parent::create_widget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parent
的用法示例。
在下文中一共展示了parent::create_widget方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _init_structure
private function _init_structure($data, $user_options, $widget_title)
{
$this->_structure = parent::array_to_object($this->_structure);
$this->_structure->data = $data;
$this->_structure->options = parent::set_array_prop_def($this->_options_map, $user_options);
$uid = parent::create_id(true);
$this->_structure->id = $uid;
// set the id as default id
$this->_uid = $uid;
$ui = new parent();
$this->_structure->widget = $ui->create_widget();
$this->_structure->widget->header('icon', 'fa-table')->header('title', $widget_title)->body("class", "no-padding")->body("editbox", '<input class="form-control" type="text">
<span class="note"><i class="fa fa-check text-success"></i> Change title to update and save instantly!</span>');
if (!$this->_structure->data) {
$col_list = array("No Data");
} else {
$col_list = array_keys(is_object($data[0]) ? get_object_vars($data[0]) : $data[0]);
}
$cols = array_combine($col_list, $col_list);
$cells = array_fill_keys($col_list, array());
$hide = array_fill_keys($col_list, false);
$this->_cells_map = $cells;
$this->_cols_map = $cols;
$this->_hide_map = $hide;
$this->_structure->col = $cols;
$this->_structure->cell = $cells;
$this->_structure->hide = $hide;
$this->_structure->row = array_fill(1, count($data) + 1, array());
$this->_structure->js = array("properties" => array(), "oTable" => 'oTable_' . $this->_uid, "custom" => "");
}
示例2: _init_structure
private function _init_structure($fields, $user_options = array())
{
$this->_structure = parent::array_to_object($this->_structure);
$this->_structure->options = parent::set_array_prop_def($this->_options_map, $user_options);
$this->_structure->field = $fields;
$ui = new parent();
$widget = $ui->create_widget();
$widget->options('editbutton', false)->body('class', 'no-padding')->header('title', '<h2></h2>');
$this->_structure->widget = $widget;
}
示例3: _init_structure
private function _init_structure($steps, $user_options = array())
{
$this->_structure = parent::array_to_object($this->_structure);
$this->_structure->options = parent::set_array_prop_def($this->_options_map, $user_options);
$this->_structure->step = $steps;
$this->_structure->id = parent::create_id(true);
$ui = new parent();
$widget = $ui->create_widget();
$widget->options('editbutton', false)->header('title', '<h2></h2>');
$this->_structure->widget = $widget;
}
示例4: print_html
public function print_html($return = false)
{
$get_property_value = parent::_get_property_value_func();
$that = $this;
$structure = $this->_structure;
$structure->options = parent::set_array_prop_def($this->_options_map, $structure->options);
$tabs = $get_property_value($structure->tab, array('if_closure' => function ($tabs) use($that) {
return SmartUI::run_callback($tabs, array($that));
}, 'if_other' => function ($tabs) {
SmartUI::err('SmartUI::Tab::tab requires array');
return null;
}));
if (!is_array($tabs)) {
parent::err("SmartUI::Tab::tab requires array");
return null;
}
$li_list = array();
$tab_content_list = array();
$has_active = false;
foreach ($tabs as $tab_id => $tab_prop) {
$tab_structure = array('content' => isset($structure->content[$tab_id]) ? $structure->content[$tab_id] : '', 'title' => isset($structure->title[$tab_id]) ? $structure->title[$tab_id] : '', 'icon' => isset($structure->icon[$tab_id]) ? $structure->icon[$tab_id] : '', 'dropdown' => isset($structure->dropdown[$tab_id]) ? $structure->dropdown[$tab_id] : '', 'position' => isset($structure->position[$tab_id]) ? $structure->position[$tab_id] : '', 'active' => isset($structure->active[$tab_id]) && $structure->active[$tab_id] === true, 'fade' => false);
$new_tab_prop = parent::get_clean_structure($tab_structure, $tab_prop, array($that, $tabs, $tab_id), 'title');
foreach ($new_tab_prop as $tab_prop_key => $tab_prop_vaue) {
$new_tab_prop_value = $get_property_value($tab_prop_vaue, array('if_closure' => function ($prop_value) use($that, $tabs) {
return SmartUI::run_callback($prop_value, array($that, $tabs));
}));
$new_tab_prop[$tab_prop_key] = $new_tab_prop_value;
}
$tab_content_classes = array();
$tab_content_classes[] = 'tab-pane';
$li_classes = array();
$a_classes = array();
$a_attr = array();
if (!$structure->active && !$has_active || $new_tab_prop['active'] === true && !$has_active) {
$li_classes[] = 'active';
$tab_content_classes[] = 'in active';
$has_active = true;
}
$title = $new_tab_prop['title'];
$dropdown_html = '';
if ($new_tab_prop['dropdown']) {
$dropdown = $new_tab_prop['dropdown'];
$li_classes[] = 'dropdown';
$href = 'javascript:void(0);';
$dropdown_html = is_array($dropdown) ? parent::print_dropdown($dropdown, false, true) : $dropdown;
$a_classes[] = 'dropdown-toggle';
$a_attr[] = 'data-toggle="dropdown"';
$title .= ' <b class="caret"></b>';
} else {
$href = '#' . $tab_id;
$a_attr[] = 'data-toggle="tab"';
}
if ($new_tab_prop['position']) {
$li_classes[] = 'pull-' . $new_tab_prop['position'];
}
$icon = $new_tab_prop['icon'] ? '<i class="fa ' . $new_tab_prop['icon'] . '"></i> ' : '';
$class = $li_classes ? ' class="' . implode(' ', $li_classes) . '"' : '';
$li_html = '<li' . $class . '>';
$li_html .= '<a href="' . $href . '" ' . ($a_classes ? 'class="' . implode(' ', $a_classes) . '"' : '') . ($a_attr ? ' ' . implode(' ', $a_attr) : '') . '>' . $icon . $title . '</a>';
$li_html .= $dropdown_html;
$li_html .= '</li>';
$li_list[] = $li_html;
if ($new_tab_prop['fade']) {
$tab_content_classes[] = 'fade';
}
$tab_content_html = '<div class="' . implode(' ', $tab_content_classes) . '" id="' . $tab_id . '">';
$tab_content_html .= $new_tab_prop['content'];
$tab_content_html .= '</div>';
$tab_content_list[] = $tab_content_html;
}
$ul_classes = array();
$ul_attr = array();
$ul_classes[] = 'nav nav-tabs';
$ul_id = $structure->tabs_id ? 'id="' . $structure->tabs_id . '"' : '';
$ul_attr[] = $ul_id;
$content_classes = array();
$content_classes[] = 'tab-content';
if ($structure->content_class) {
$content_classes[] = is_array($structure->content_class) ? implode(' ', $structure->content_class) : $structure->content_class;
}
$content_id = $structure->content_id ? 'id="' . $structure->content_id . '"' : '';
if ($structure->options['padding']) {
$content_classes[] = 'padding-' . $structure->options['padding'];
}
$content_html = '<div class="' . implode(' ', $content_classes) . '" ' . $content_id . '>';
$content_html .= implode('', $tab_content_list);
$content_html .= '</div>';
$main_content_html = '';
if ($structure->options['widget']) {
$ul_classes[] = $structure->options['pull'] ? 'pull-' . $structure->options['pull'] : 'pull-left';
$ul_html = '<ul class="' . implode(' ', $ul_classes) . '" ' . implode(' ', $ul_attr) . '>';
$ul_html .= implode('', $li_list);
$ul_html .= '</ul>';
$widget = $structure->options['widget'];
if (!$widget instanceof Widget) {
$ui = new parent();
$widget = $ui->create_widget();
}
$widget->body('content', $content_html);
$widget->options('colorbutton', false)->options('editbutton', false);
//.........这里部分代码省略.........