true, 'type' => Wizard::WIZARD_BOOTSTRAP ); private $_structure = array( 'options' => array(), 'step' => array(), 'content' => array(), 'widget' => null, 'active' => array(), 'title' => '', 'tabl_class' => 'form-wizard', 'id' => '' ); public function __construct($steps, $options = array()) { $this->_init_structure($steps, $options); } private function _init_structure($steps, $user_options = array()) { $this->_structure = Util::array_to_object($this->_structure); $this->_structure->options = Util::set_array_prop_def($this->_options_map, $user_options); $this->_structure->step = $steps; $this->_structure->id = Util::create_id(true); $widget = new Widget(); $widget->options('editbutton', false) ->header('title', '
'); $this->_structure->widget = $widget; } public function __get($name) { if (isset($this->_structure->{$name})) { return $this->_structure->{$name}; } SmartUI::err('Undefined structure property: '.$name); return null; } public function __set($name, $value) { if (isset($this->_structure->{$name})) { $this->_structure->{$name} = $value; return; } SmartUI::err('Undefined structure property: '.$name); } public function __call($name, $args) { return parent::_call($this, $this->_structure, $name, $args); } private function _get_bootstrap_result() { $structure = $this->_structure; $steps = Util::get_property_value($structure->step, array( 'if_closure' => function($steps) { return SmartUI::run_callback($steps, array($this)); }, 'if_other' => function($steps) { SmartUI::err('SmartUI::Wizard::step requires array'); return null; } )); if (!is_array($steps)) { parent::err("SmartUI::Wizard::step requires array"); return null; } $li_list = array(); $step_content_list = array(); $has_active = false; $step = 1; foreach ($steps as $step_id => $step_prop) { $step_structure = array( 'content' => isset($structure->content[$step_id]) ? $structure->content[$step_id] : '', 'title' => isset($structure->title[$step_id]) ? $structure->title[$step_id] : '', 'step' => $step, 'active' => isset($structure->active[$step_id]) && $structure->active[$step_id] === true, ); $new_step_prop = Util::get_clean_structure($step_structure, $step_prop, array($this, $steps, $step_id), 'title'); foreach ($new_step_prop as $step_prop_key => $step_prop_vaue) { $new_step_prop_value = Util::get_property_value($step_prop_vaue, array( 'if_closure' => function($prop_value) use ($steps) { return SmartUI::run_callback($prop_value, array($this, $steps)); } )); $new_step_prop[$step_prop_key] = $new_step_prop_value; } $step_content_classes = array(); $step_content_classes[] = 'tab-pane'; $li_classes = array(); $a_classes = array(); $a_attr = array(); if ((!$structure->active && !$has_active) || ($new_step_prop['active'] === true && !$has_active)) { $li_classes[] = 'active'; $step_content_classes[] = 'active'; $has_active = true; } $title = $new_step_prop['title']; $href = '#'.$step_id; $a_attr[] = 'data-toggle="tab"'; $class = $li_classes ? ' class="'.implode(' ', $li_classes).'"' : ''; $li_html = '