示例#1
0
 protected function _call($ui_member, $structure, $name, $args)
 {
     if (property_exists($structure, $name)) {
         if (!$args) {
             return $structure->{$name};
         }
         $value = null;
         $key = null;
         if (count($args) > 1 && is_array($structure->{$name})) {
             $key = $args[0];
             $value = $args[1];
             if (!is_string($key) && !is_int($key)) {
                 SmartUI::err("SmartUI structure property: {$name} must be string or int.");
                 return null;
             }
             $structure->{$name}[$key] = $value;
             if (isset($args[2]) && SmartUtil::is_closure($args[2])) {
                 //process callback
                 $callback = $args[2];
                 SmartUtil::run_callback($callback, array($ui_member));
             }
             return $ui_member;
         } else {
             if (isset($args[1]) && SmartUtil::is_closure($args[1])) {
                 $value = $args[0];
                 $structure->{$name} = $value;
                 $callback = $args[1];
                 SmartUtil::run_callback($callback, array($ui_member));
                 return $ui_member;
             } else {
                 if (is_array($structure->{$name}) && (is_string($args[0]) || is_int($args[0]))) {
                     $key = $args[0];
                     if (!is_string($key) && !is_int($key)) {
                         SmartUI::err("SmartUI property key: {$key} must be string or int.");
                         return null;
                     }
                     return $structure->{$name}[$key];
                 } else {
                     $value = $args[0];
                     $structure->{$name} = $value;
                     return $ui_member;
                 }
             }
         }
     }
     SmartUI::err('Undefined structure property: ' . $name);
     return null;
 }
 public function print_html($return = false)
 {
     $get_property_value = parent::_get_property_value_func();
     $that = $this;
     $structure = $this->_structure;
     $rows = $get_property_value($structure->row, array('if_closure' => function ($rows) use($that) {
         return SmartUI::run_callback($rows, array($that));
     }, 'if_other' => function ($rows) {
         SmartUI::err('SmartUI::ProfileInfo::row requires array');
         return null;
     }));
     if (!is_array($rows)) {
         parent::err("SmartUI::ProfileInfo::row requires array");
         return null;
     }
     $rows_html_list = array();
     foreach ($rows as $key => $info) {
         $row_prop = array('icon' => isset($structure->icon[$key]) ? $structure->icon[$key] : '', 'value' => isset($structure->value[$key]) ? $structure->value[$key] : '', 'name' => isset($structure->name[$key]) ? $structure->name[$key] : $key, 'action' => isset($structure->action[$key]) ? $structure->action[$key] : '');
         $new_row_prop = parent::get_clean_structure($row_prop, $info, array($that, $rows, $key), 'value');
         $icon = $new_row_prop['icon'] ? '<i class="' . SmartUI::$icon_source . ' ' . $new_row_prop['icon'] . '"></i> ' : '';
         $row_html = '<div class="info-row">';
         $row_html .= '	<div class="info-name"> ' . $new_row_prop['name'] . ' </div>';
         $row_html .= '	<div class="info-action"> ' . $new_row_prop['action'] . ' </div>';
         $row_html .= '	<div class="info-value"> ' . $icon . $new_row_prop['value'] . ' </div>';
         $row_html .= '</div>';
         $rows_html_list[] = $row_html;
     }
     $classes = array();
     if ($structure->options['stripped']) {
         $classes[] = 'info-stripped';
     }
     if ($structure->options['grouped']) {
         $classes[] = 'info-grouped';
     }
     $classes[] = $structure->options['class'];
     $result = '<div class="info' . ($classes ? ' ' . implode(' ', $classes) : '') . '">';
     $result .= $structure->title ? '<div class="info-title">' . $structure->title . '</div>' : '';
     $result .= implode('', $rows_html_list);
     $result .= '</div>';
     if ($return) {
         return $result;
     } else {
         echo $result;
     }
 }
 public function print_html($return = false)
 {
     $get_property_value = parent::_get_property_value_func();
     $that = $this;
     $structure = $this->_structure;
     $icon = $get_property_value($structure->icon, array('if_closure' => function ($icon) use($that) {
         return SmartUtil::run_callback($icon, array($that));
     }, 'if_array' => function ($icon) {
         SmartUI::err('SmartUI::Widget::icon requires string.');
         return '';
     }));
     $container = $get_property_value($structure->container, array('if_closure' => function ($container) use($that) {
         return SmartUtil::run_callback($container, array($that));
     }, 'if_array' => function ($container) {
         SmartUI::err('SmartUI::Widget::container requires string.');
         return '';
     }));
     $content = $get_property_value($structure->content, array('if_closure' => function ($content) use($that) {
         return SmartUtil::run_callback($content, array($that));
     }, 'if_array' => function ($content) {
         SmartUI::err('SmartUI::Widget::content requires string.');
         return '';
     }));
     $attr = $get_property_value($structure->attr, array('if_closure' => function ($attr) use($that) {
         $callback_return = SmartUtil::run_callback($attr, $array($that));
         if (is_array($callback_return)) {
             return $callback_return;
         } else {
             return array($callback_return);
         }
     }, 'if_array' => function ($attr) {
         $attrs = array();
         foreach ($attr as $key => $value) {
             $attrs[] = $key . '="' . $value . '"';
         }
         return $attrs;
     }, 'if_other' => function ($attr) {
         return array($attr);
     }));
     $class = $get_property_value($structure->class, array("if_closure" => function ($class) use($that) {
         return SmartUtil::run_callback($class, array($that));
     }, "if_array" => function ($class) {
         return implode(' ', $class);
     }));
     $type = $get_property_value($structure->type, array('if_array' => function ($class) {
         SmartUI::err('SmartUI::Button:type requires string.');
         return SmartUI::BUTTON_TYPE_DEFAULT;
     }));
     $classes = array();
     // labeled and icon
     if (trim($icon)) {
         $icon = '<i class="fa ' . $icon . '"></i>';
         if ($structure->options['labeled']) {
             $classes[] = 'btn-labeled';
             $icon = $structure->options['labeled'] ? '<span class="btn-label">' . $icon . '</span>' : $icon;
         }
         $content = $icon . ' ' . $content;
     }
     // custom class
     if ($class) {
         $classes[] = $class;
     }
     // size
     $size_class = '';
     if ($structure->size) {
         $size_class = 'btn-' . $structure->size;
         $classes[] = $size_class;
     }
     // disabled
     $disabled = $structure->options['disabled'] ? 'disabled' : '';
     $classes[] = $disabled;
     $class_htm = $classes ? ' ' . implode(' ', $classes) : '';
     $result = '';
     if ($structure->dropdown) {
         $dd_prop = array('items' => array(), 'multilevel' => false, 'split' => false);
         $new_dd_prop = parent::get_clean_structure($dd_prop, $structure->dropdown, array($this), 'items');
         if (is_array($new_dd_prop['items'])) {
             $dropdown_html = parent::print_dropdown($new_dd_prop['items'], $new_dd_prop['multilevel'], true);
         } else {
             $dropdown_html = $new_dd_prop['items'];
         }
         if ($new_dd_prop['split']) {
             $split_prop = array('type' => $type, 'disabled' => false, 'dropup' => false, 'class' => array(), 'attr' => array());
             $new_split_prop = parent::get_clean_structure($split_prop, $new_dd_prop['split'], array($this, $new_dd_prop), 'type');
             $split_attrs = array();
             if (is_array($new_split_prop['attr'])) {
                 foreach ($new_split_prop['attr'] as $split_attr => $value) {
                     $split_attrs[] = $split_attr . '="' . $value . '"';
                 }
             } else {
                 $split_attrs[] = $new_split_prop['attr'];
             }
             $split_classes = array();
             if (is_array($new_split_prop['class'])) {
                 $split_classes[] = implode(' ', $new_split_prop['class']);
             } else {
                 $split_classes[] = $new_split_prop['class'];
             }
             $split_classes[] = $size_class;
             $split_class_htm = $split_classes ? ' ' . implode(' ', $split_classes) : '';
             $btn_main = '<' . $container . ' class="btn btn-' . $type . $class_htm . '" ' . implode(' ', $attr) . '>';
             $btn_main .= $content;
             $btn_main .= '</' . $container . '>';
             $btn_dd = '<' . $container . ' class="btn btn-' . $new_split_prop['type'] . $split_class_htm . ' dropdown-toggle" data-toggle="dropdown" ' . implode(' ', $split_attrs) . '>';
             $btn_dd .= '<span class="caret"></span>';
             $btn_dd .= '</' . $container . '>';
             $btn_dd .= $dropdown_html;
             $result .= '<div class="btn-group' . ($new_split_prop['dropup'] ? ' dropup' : '') . '">' . $btn_main . $btn_dd . '</div>';
         } else {
             $result .= '<div class="dropdown">';
             $result .= '<' . $container . ' class="btn btn-' . $type . $class_htm . ' dropdown-toggle" ' . implode(' ', $attr) . ' data-toggle="dropdown">';
             $result .= $content . ' <span class="caret"></span>';
             $result .= '</' . $container . '>';
             $result .= $dropdown_html;
             $result .= '</div>';
         }
     } else {
         $result .= '<' . $container . ' class="btn btn-' . $type . $class_htm . '" ' . implode(' ', $attr) . '>';
         $result .= $content;
         $result .= '</' . $container . '>';
     }
     if ($return) {
         return $result;
     } else {
         echo $result;
     }
 }
示例#4
0
<!-- ==========================CONTENT STARTS HERE ========================== -->
<!-- MAIN PANEL -->
<div id="main" role="main">
	<?php 
//configure ribbon (breadcrumbs) array("name"=>"url"), leave url empty if no url
//$breadcrumbs["New Crumb"] => "http://url.com"
$breadcrumbs["Misc"] = "";
include "inc/ribbon.php";
?>

	<!-- MAIN CONTENT -->
	<div id="content">
		<section id="widget-grid" class="">
			
			<?php 
$ui = new SmartUI();
$ui->start_track();
// smartui code
$panels = array('panel1' => 'Collapsible Group Item #1', 'panel2' => 'Collapsible Group Item #2', 'panel3' => 'Collapsible Group Item #3');
$accordion = $ui->create_accordion($panels);
$accordion->content('panel1', 'Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et.');
$accordion->content('panel2', function ($this, $panels) use($ui) {
    $data = json_decode(file_get_contents(APP_URL . "/data/data.json"));
    $dt = $ui->create_datatable($data)->options('in_widget', false);
    return $dt->print_html(true);
})->padding('panel2', false)->expand('panel2', true);
$accordion->icons('panel2', array('fa fa-fw fa-plus-circle txt-color-green pull-right', 'fa-fw fa-minus-circle txt-color-red pull-right'));
$accordion_html = $accordion->print_html(true);
$body = $accordion_html;
$ui->create_widget()->body('content', $body)->options('editbutton', false)->header('title', '<h2>SmartUI::Accordion</h2>')->print_html();
// print html output
示例#5
0
<?php

//initilize the page
require_once "inc/init.php";
?>
		<section id="widget-grid" class="">
			
				<?php 
$ui = new SmartUI();
$ui->start_track();
// smartui code
$prg_simple = SmartUI::print_progress(33, 'info', null, true);
$prg_danger_right_striped_active = SmartUI::print_progress(55.5, 'danger', array('position' => 'right', 'striped' => 'active', 'tooltip' => 'This is tooltip'), true);
$prg_small_striped = SmartUI::print_progress(20, '', array('background' => 'redLight', 'size' => 'sm', 'striped' => true), true);
$prg_micro = SmartUI::print_progress(60, '', array('background' => 'greenLight', 'size' => 'micro'), true);
$prg_trans = SmartUI::print_progress('21%', 'success', array('transitional' => true), true);
$prg_trans_vertical_bottom = SmartUI::print_progress('80%', '', array('transitional' => true, 'vertical' => true, 'position' => 'bottom', 'background' => 'redLight'), true);
$prg_trans_vertical = SmartUI::print_progress('80%', 'primary', array('transitional' => true, 'vertical' => true), true);
// stack progress bars
$prg_stack = array();
$prg_stack[] = SmartUI::get_progress(80, '', array('background' => 'redLight'));
$prg_stack[] = SmartUI::get_progress(55, 'info');
$prg_stack[] = SmartUI::get_progress(33, 'success');
$prg_stack_progress = SmartUI::print_stack_progress($prg_stack, array('size' => 'sm', 'tooltip' => 'Stacked Progress', 'striped' => 'active'), true);
$body = $prg_simple . $prg_micro . $prg_small_striped . $prg_danger_right_striped_active . $prg_trans . $prg_trans_vertical . $prg_trans_vertical_bottom . $prg_stack_progress;
$ui->create_widget()->body('content', $body)->header('title', '<h2>SmartUI Alerts</h2>')->print_html();
// print html output
$run_time = $ui->run_time(false);
$hb = new HTMLIndent();
$html_snippet = SmartUtil::clean_html_string($hb->indent($body), false);
$contents = array("body" => '<pre class="prettyprint linenums">' . $html_snippet . '</pre>', "header" => array("icon" => 'fa fa-code', "title" => '<h2>HTML Output (Run Time: ' . $run_time . ')</h2>'));
示例#6
0
<?php

//initilize the page
require_once "inc/init.php";
//require UI configuration (nav, ribbon, etc.)
require_once "inc/config.ui.php";
session_start();
$login = htmlspecialchars(stripslashes($_POST["email"]));
$password = htmlspecialchars(stripslashes($_POST["password"]));
$result = mysql_query("SELECT * FROM users WHERE login='******'", $db);
$myrow = mysql_fetch_array($result);
if (empty($myrow['password'])) {
    SmartUI::print_alert('<strong>Ошибка!</strong> Введеный Вами логин не найден.', 'warning');
} else {
    if ($myrow['password'] == $password) {
        echo "Успех";
        $_SESSION['login'] = $myrow['login'];
        $_SESSION['id'] = $myrow['userid'];
        echo "<script type=\"text/javascript\"> window.location=\"index.php\";</script>";
    } else {
        SmartUI::print_alert('<strong>Ошибка!</strong> Логин и пароль не совпадают.', 'warning');
    }
}
示例#7
0
							john.doe
						</span>
						<i class="fa fa-angle-down"></i>
					</a>

				</span>
			</div>
			<!-- end user info -->

			<!-- NAVIGATION : This navigation is also responsive

			To make this navigation dynamic please make sure to link the node
			(the reference to the nav > ul) after page load. Or the navigation
			will not initialize.
			-->
			<nav>
				<!-- NOTE: Notice the gaps after each icon usage <i></i>..
				Please note that these links work a bit different than
				traditional hre="" links. See documentation for details.
				-->

				<?php 
$ui = new SmartUI();
$ui->create_nav($page_nav)->print_html();
?>

			</nav>
			<span class="minifyme" data-action="minifyMenu"> <i class="fa fa-arrow-circle-left hit"></i> </span>

		</aside>
		<!-- END NAVIGATION -->
示例#8
0
    private function parse_nav($nav_item, $is_parent = false)
    {
        if (!$nav_item) {
            return '';
        }
        $nav_items_list = array();
        foreach ($nav_item as $name => $nav) {
            $nav_prop = array('url' => '#', 'url_target' => '', 'icon' => '', 'icon_badge' => '', 'label_htm' => '', 'title' => $name, 'title_append' => '', 'label' => '', 'active' => false, 'sub' => array(), 'attr' => array(), 'class' => array(), 'li_class' => array());
            $new_nav_prop = parent::set_array_prop_def($nav_prop, $nav, 'title');
            $icon_badge_prop = array('content' => '', 'class' => '');
            $icon_badge_prop = parent::set_array_prop_def($icon_badge_prop, $new_nav_prop['icon_badge'], 'content');
            $badge = '';
            if ($icon_badge_prop['content']) {
                $badge_class = $icon_badge_prop['class'] ? 'class="' . $icon_badge_prop['class'] . '"' : '';
                $badge = '<em ' . $badge_class . '>' . $icon_badge_prop['content'] . '</em>';
            }
            $icon = $new_nav_prop['icon'] ? '<i class="' . SmartUI::$icon_source . ' ' . SmartUI::$icon_source . '-lg ' . SmartUI::$icon_source . '-fw ' . $new_nav_prop['icon'] . '">' . $badge . '</i>' : '';
            $title = $new_nav_prop['title'];
            $title_append = $new_nav_prop['title_append'];
            $display_title = $title . ' ' . $title_append;
            $label_htm = $new_nav_prop['label_htm'] ? ' ' . $new_nav_prop['label_htm'] : '';
            $display_text = $is_parent ? '<span class="menu-item-parent">' . $display_title . '</span>' : $display_title;
            $display_text .= $label_htm;
            $attrs = array_map(function ($attr, $value) {
                return $attr . '="' . $value . '"';
            }, array_keys($new_nav_prop['attr']), $new_nav_prop['attr']);
            if ($new_nav_prop['class']) {
                $attrs[] = 'class="' . $new_nav_prop['class'] . '"';
            }
            $nav_htm = '<a
				href="' . $new_nav_prop['url'] . '"
				target="' . $new_nav_prop['url_target'] . '"
				title="' . $title . '"
				' . implode(' ', $attrs) . '>
					' . $icon . '
					' . $display_text . '
					' . $new_nav_prop['label'] . '
				</a>';
            $li_classes = array();
            if ($new_nav_prop["active"]) {
                $li_classes[] = 'active';
            }
            if ($new_nav_prop['li_class']) {
                if (is_string($new_nav_prop['li_class'])) {
                    $li_classes[] = $new_nav_prop['li_class'];
                } else {
                    if (is_array($new_nav_prop['li_class'])) {
                        $li_classes = array_merge($li_classes, $new_nav_prop['li_class']);
                    }
                }
            }
            $nav_item_structure = array('content' => $nav_htm, 'class' => implode(' ', $li_classes));
            if (isset($new_nav_prop['sub'])) {
                if (is_string($new_nav_prop['sub'])) {
                    $nav_item_structure['subitems'] = array($new_nav_prop['sub']);
                } else {
                    $nav_item_structure['subitems'] = $this->parse_nav($new_nav_prop['sub']);
                }
            }
            $nav_items_list[] = $nav_item_structure;
        }
        return $nav_items_list;
    }
 public function print_html($return = false)
 {
     $get_property_value = parent::_get_property_value_func();
     $that = $this;
     $structure = $this->_structure;
     $attr = $get_property_value($structure->attr, array("if_closure" => function ($attr) use($that) {
         return SmartUtil::run_callback($attr, array($that));
     }, "if_other" => function ($attr) {
         return $attr;
     }, "if_array" => function ($attr) {
         $props = array_map(function ($attr, $attr_value) {
             //build attribute values from passed array
             return $attr . ' = "' . $attr_value . '"';
         }, array_keys($attr), $attr);
         return implode(' ', $props);
     }));
     $options_map = $this->_options_map;
     $options = $get_property_value($structure->options, array("if_closure" => function ($options) use($that) {
         return SmartUtil::run_callback($options, array($that));
     }, "if_other" => function ($options) {
         return $options;
     }, "if_array" => function ($options) use($that, $options_map) {
         $props = array_map(function ($option, $value) use($that, $options_map) {
             if (is_bool($value)) {
                 $str_val = var_export($value, true);
                 if (isset($options_map[$option])) {
                     if ($value !== $options_map[$option]) {
                         return 'data-widget-' . $option . '="' . $str_val . '"';
                     } else {
                         return '';
                     }
                 } else {
                     return 'data-widget-' . $option . '="' . $str_val . '"';
                 }
             }
             return 'data-widget-' . $option . '="' . $value . '"';
         }, array_keys($options), $options);
         return implode(' ', $props);
     }));
     $body = $get_property_value($structure->body, array("if_closure" => function ($body) use($that) {
         return SmartUtil::run_callback($body, array($that));
     }, "if_other" => function ($body) {
         return '<div class="widget-body">' . $body . '</div>';
     }, "if_array" => function ($body) use($that) {
         $editbox = '';
         if (isset($body["editbox"])) {
             $editbox = '<div class="jarviswidget-editbox">';
             $editbox .= $body["editbox"];
             $editbox .= '</div>';
         }
         $content = '';
         if (isset($body['content'])) {
             if (SmartUtil::is_closure($body['content'])) {
                 $content = SmartUtil::run_callback($body['content'], array($that));
             } else {
                 $content = $body['content'];
             }
         }
         $class = 'widget-body';
         if (isset($body["class"])) {
             if (is_array($body["class"])) {
                 $class .= ' ' . implode(' ', $body["class"]);
             } else {
                 $class .= ' ' . $body["class"];
             }
         }
         $toolbar = '';
         if (isset($body["toolbar"])) {
             $toolbar = '<div class="widget-body-toolbar">';
             $toolbar .= $body["toolbar"];
             $toolbar .= '</div>';
         }
         $footer = '';
         if (isset($body['footer'])) {
             $footer = '<div class="widget-footer">';
             $footer .= $body['footer'];
             $footer .= '</div>';
         }
         $result = $editbox;
         $result .= '<div class="' . $class . '">';
         $result .= $toolbar;
         $result .= $content;
         $result .= $footer;
         $result .= '</div>';
         return $result;
     }));
     $header = $get_property_value($structure->header, array("if_closure" => function ($header) use($that) {
         return SmartUtil::run_callback($body, array($that));
     }, "if_other" => function ($body) {
         return $body;
     }, "if_array" => function ($body) use($get_property_value, $that) {
         $toolbar_htm = '';
         if (isset($body["icon"])) {
             $toolbar_htm .= '<span class="widget-icon"> <i class="' . SmartUI::$icon_source . ' ' . $body["icon"] . '"></i> </span>';
         }
         if (isset($body["toolbar"])) {
             $toolbar_htm .= $get_property_value($body["toolbar"], array("if_closure" => function ($toolbar) use($that) {
                 return SmartUtil::run_callback($toolbar, array($that, $toolbar));
             }, "if_other" => function ($toolbar) {
                 return $toolbar;
             }, "if_array" => function ($toolbar) {
                 $toolbar_props_htm = array();
                 foreach ($toolbar as $toolbar_prop) {
                     $id = '';
                     $class = 'widget-toolbar';
                     $attrs = array();
                     $content = '';
                     if (is_string($toolbar_prop)) {
                         $content = $toolbar_prop;
                     } else {
                         if (is_array($toolbar_prop)) {
                             $id = isset($toolbar_prop["id"]) ? $toolbar_prop["id"] : '';
                             $class .= isset($toolbar_prop["class"]) ? ' ' . $toolbar_prop["class"] : '';
                             if (isset($toolbar_prop["attr"])) {
                                 if (is_array($toolbar_prop["attr"])) {
                                     foreach ($toolbar_prop["attr"] as $attr => $value) {
                                         $attrs[] = $attr . '="' . $value . '"';
                                     }
                                 } else {
                                     $attrs[] = $toolbar_prop["attr"];
                                 }
                             }
                             $content = isset($toolbar_prop["content"]) ? $toolbar_prop["content"] : '';
                         }
                     }
                     $htm = '<div class="' . trim($class) . '" id="' . $id . '" ' . implode(' ', $attrs) . '>';
                     $htm .= $content;
                     $htm .= '</div>';
                     $toolbar_props_htm[] = $htm;
                 }
                 return implode(' ', $toolbar_props_htm);
             }));
         }
         if (isset($body["title"])) {
             $toolbar_htm .= $body["title"];
         } else {
             $toolbar_htm .= '<h2><code>SmartUI::Widget->header[content] not defined</code></h2>';
         }
         return $toolbar_htm;
     }));
     $class = $get_property_value($structure->class, array("if_closure" => function ($class) use($that) {
         return SmartUtil::run_callback($class, array($that));
     }, "if_array" => function ($class) {
         return implode(' ', $class);
     }));
     $color = $get_property_value($structure->color, array("if_closure" => function ($color) use($that) {
         return SmartUtil::run_callback($color, array($that));
     }, "if_other" => function ($color) {
         return $color ? 'jarviswidget-color-' . $color : '';
     }, "if_array" => function ($color) {
         SmartUI::err('SmartUI::Widget::color requires string');
     }));
     $id = $get_property_value($structure->id, array("if_closure" => function ($id) use($that) {
         return SmartUtil::run_callback($id, array($that));
     }, "if_array" => function ($id) {
         SmartUI::err('SmartUI::Widget::id requires string.');
         return '';
     }));
     $id = $id ? 'id="' . $id . '"' : '';
     $main_classes = array('jarviswidget', $color, $class);
     $main_attributes = array('class="' . trim(implode(' ', $main_classes)) . '"', $id, $options, $attr);
     $result = '<div ' . trim(implode(' ', $main_attributes)) . '>';
     $result .= '<header>' . $header . '</header>';
     $result .= '<div>' . $body . '</div>';
     $result .= '</div>';
     if ($return) {
         return $result;
     } else {
         echo $result;
     }
 }
<!-- ==========================CONTENT STARTS HERE ========================== -->
<!-- MAIN PANEL -->
<div id="main" role="main">
	<?php 
//configure ribbon (breadcrumbs) array("name"=>"url"), leave url empty if no url
//$breadcrumbs["New Crumb"] => "http://url.com"
$breadcrumbs["Misc"] = "";
include "inc/ribbon.php";
?>

	<!-- MAIN CONTENT -->
	<div id="content">
		<section id="widget-grid" class="">
			
			<?php 
$ui = new SmartUI();
$ui->start_track();
$items = array(ASSETS_URL . "/img/demo/m3.jpg", ASSETS_URL . "/img/demo/m1.jpg", ASSETS_URL . "/img/demo/m2.jpg");
$carousel1 = $ui->create_carousel($items);
$carousel1->caption(0, '<h4>Title 1</h4>
					<p>
						Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
					</p>
					<br>
					<a href="javascript:void(0);" class="btn btn-info btn-sm">Read more</a>');
$carousel2 = $ui->create_carousel(array('item1' => ASSETS_URL . "/img/demo/s1.jpg", 'item2' => array('img' => ASSETS_URL . "/img/demo/s2.jpg", 'caption' => '<h4>S2 Background Image</h4>
							<p>
								Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
							</p>
							<br>
							<a href="javascript:void(0);" class="btn btn-info btn-sm">Read more</a>'), 'item3' => array('img' => array('src' => ASSETS_URL . "/img/demo/s3.jpg", 'alt' => 'This is s3 image'))), 'fade');
示例#11
0
<!-- ==========================CONTENT STARTS HERE ========================== -->
<!-- MAIN PANEL -->
<div id="main" role="main">
	<?php 
//configure ribbon (breadcrumbs) array("name"=>"url"), leave url empty if no url
//$breadcrumbs["New Crumb"] => "http://url.com"
$breadcrumbs["Misc"] = "";
include "inc/ribbon.php";
?>

	<!-- MAIN CONTENT -->
	<div id="content">
		<section id="widget-grid" class="">
			
			<?php 
$ui = new SmartUI();
$ui->start_track();
// smartui code
$tabs = array('tab1' => 'My Tab', 'tab2' => 'My Tab 2', 'tab3' => 'My Tab 3');
$tab = $ui->create_tab($tabs);
$tab->content('tab1', function () {
    return 'test content';
})->content('tab2', 'Ths is Tab2 content')->content('tab3', 'this is Tab3 content');
$dropdown_items = array('<a href="javascript:void(0);">Some action</a>', '<a href="javascript:void(0);">Some other action</a>', '-', array('content' => '<a tabindex="-1" href="javascript:void(0);">Hover me for more options</a>', 'submenu' => array('<a tabindex="-1" href="javascript:void(0);">Second level</a>', array('content' => '<a href="javascript:void(0);">Even More..</a>', 'submenu' => array('<a href="javascript:void(0);">3rd level</a>', '<a href="javascript:void(0);">3rd level</a>')), '<a href="javascript:void(0);">Second level</a>', '<a href="javascript:void(0);">Second level</a>')));
$tab->dropdown('tab2', $dropdown_items);
$tab->options('bordered', true);
$tab->active('tab3', true);
$tab->title('tab3', 'New Tab 3 Title <span class="badge bg-color-pinkDark txt-color-white">99</span>');
$tab_html = $tab->print_html(true);
// tab in widget
$tab_widget = $ui->create_tab(array('My New Tab', 'This is a tab'));
示例#12
0
<!-- ==========================CONTENT STARTS HERE ========================== -->
<!-- MAIN PANEL -->
<div id="main" role="main">
	<?php 
//configure ribbon (breadcrumbs) array("name"=>"url"), leave url empty if no url
//$breadcrumbs["New Crumb"] => "http://url.com"
$breadcrumbs["Misc"] = "";
include "inc/ribbon.php";
?>

	<!-- MAIN CONTENT -->
	<div id="content">
		<section id="widget-grid" class="">
			
			<?php 
$ui = new SmartUI();
$ui->start_track();
$data = json_decode(file_get_contents(APP_URL . '/data/data.json'));
// SmartForm layout
$fields = array('fname' => array('type' => 'input', 'col' => 6, 'properties' => array('placeholder' => 'First name', 'icon' => 'fa-user', 'icon_append' => false)), 'lname' => array('type' => 'input', 'col' => 6, 'properties' => array('placeholder' => 'Last name', 'icon' => 'fa-user', 'icon_append' => false)), 'email' => array('type' => 'input', 'col' => 6, 'properties' => array('placeholder' => 'E-mail', 'icon' => 'fa-envelope', 'type' => 'email', 'icon_append' => false)), 'phone' => array('type' => 'input', 'col' => 6, 'properties' => array('placeholder' => 'Phone', 'icon' => 'fa-phone', 'type' => 'email', 'icon_append' => false)), 'country' => array('type' => 'select', 'col' => 5, 'properties' => array('data' => array(array('country' => 'Philippines'), array('country' => 'USA'), array('country' => 'Canada')))), 'city' => array('type' => 'input', 'col' => 4, 'properties' => array('placeholder' => 'City')), 'zip' => array('type' => 'input', 'col' => 3, 'properties' => array('placeholder' => 'Post Code')), 'address' => array('type' => 'input', 'properties' => 'Address'), 'other-info' => array('type' => 'textarea', 'properties' => 'Additional Info'), 'card' => array('type' => 'radio', 'properties' => array('items' => array(array('label' => 'Visa', 'checked' => true), 'MasterCard', 'American Express'), 'inline' => true)), 'name-on-card' => array('col' => 10, 'properties' => 'Name on card'), 'cvv' => array('col' => 2, 'properties' => 'CVV2'), 'card-label' => array('type' => 'label', 'col' => 4, 'properties' => 'Expiration Date'), 'card-month' => array('type' => 'select', 'col' => 5, 'properties' => array('data' => array(array('month' => 'January'), array('month' => 'February'), array('month' => '...')))), 'card-year' => array('col' => 3, 'properties' => 'Year'));
$form = $ui->create_smartform($fields);
$form->options('method', 'post');
$form->fieldset(0, array('fname', 'lname', 'email', 'phone'));
$form->fieldset(1, array('country', 'city', 'zip', 'address', 'other-info'));
$form->fieldset(2, array('card', 'name-on-card', 'cvv', 'card-label', 'card-month', 'card-year'));
$form->header('Automatic Layout Creation!');
$form->footer(function ($this) use($ui) {
    $btn = $ui->create_button('Submit', 'primary')->attr(array('type' => 'submit'));
    return $btn->print_html(true);
});
$form->title('<h2>Auto Layout</h2>');
 public function print_html($return = false)
 {
     $get_property_value = parent::_get_property_value_func();
     $that = $this;
     $structure = $this->_structure;
     $panels = $get_property_value($structure->panel, array('if_closure' => function ($panels) use($that) {
         return SmartUI::run_callback($panels, array($that));
     }, 'if_other' => function ($panels) {
         SmartUI::err('SmartUI::Accordion:panel requires array');
         return null;
     }));
     if (!is_array($panels)) {
         parent::err("SmartUI::Accordion:panel requires array");
         return null;
     }
     $panel_html_list = array();
     foreach ($panels as $panel_id => $panel_prop) {
         $panel_structure = array('header' => isset($structure->header[$panel_id]) ? $structure->header[$panel_id] : '', 'content' => isset($structure->content[$panel_id]) ? $structure->content[$panel_id] : '', 'expand' => isset($structure->expand[$panel_id]) ? $structure->expand[$panel_id] : false, 'padding' => isset($structure->padding[$panel_id]) ? $structure->padding[$panel_id] : null);
         $new_panel_prop = parent::get_clean_structure($panel_structure, $panel_prop, array($this, $panels), 'header');
         foreach ($new_panel_prop as $panel_prop_key => $panel_prop_vaue) {
             $new_panel_prop_value = $get_property_value($panel_prop_vaue, array('if_closure' => function ($prop_value) use($that, $panels) {
                 return SmartUI::run_callback($prop_value, array($that, $panels));
             }));
             $new_panel_prop[$panel_prop_key] = $new_panel_prop_value;
         }
         // header
         $header_structure = array('content' => '', 'container' => 'h4', 'icons' => isset($structure->icons[$panel_id]) ? $structure->icons[$panel_id] : $structure->options['global_icons']);
         $new_header_prop = parent::get_clean_structure($header_structure, $new_panel_prop['header'], array($that, $panels), 'content');
         $a_classes = array();
         if (!$new_panel_prop['expand']) {
             $a_classes[] = 'collapsed';
         }
         $a_attr = array();
         $a_attr[] = 'data-parent="#' . $structure->id . '"';
         $a_attr[] = 'href="#' . $panel_id . '"';
         $a_attr[] = 'data-toggle="collapse"';
         $icons = is_array($new_header_prop['icons']) ? implode(' ', array_map(function ($icon) {
             return '<i class="' . SmartUI::$icon_source . ' ' . $icon . '"></i> ';
         }, $new_header_prop['icons'])) : $new_header_prop['icons'];
         $body_classes = array();
         $body_classes[] = 'panel-body';
         if (isset($new_panel_prop['padding'])) {
             $body_classes[] = $new_panel_prop['padding'] ? 'padding-' . $new_panel_prop['padding'] : 'no-padding';
         }
         $panel_html = '<div class="panel panel-default">';
         $panel_html .= '	<div class="panel-heading">';
         $panel_html .= '		<' . $new_header_prop['container'] . ' class="panel-title">';
         $panel_html .= '			<a ' . implode(' ', $a_attr) . ' class="' . implode(' ', $a_classes) . '"> ';
         $panel_html .= $icons;
         $panel_html .= $new_header_prop['content'];
         $panel_html .= '			</a>';
         $panel_html .= '		</' . $new_header_prop['container'] . '>';
         $panel_html .= '	</div>';
         $panel_html .= '	<div id="' . $panel_id . '" class="panel-collapse collapse ' . ($new_panel_prop['expand'] ? 'in' : '') . '">';
         $panel_html .= '		<div class="' . implode(' ', $body_classes) . '">';
         $panel_html .= $new_panel_prop['content'];
         $panel_html .= '		</div>';
         $panel_html .= '	</div>';
         $panel_html .= '</div>';
         $panel_html_list[] = $panel_html;
     }
     $result = '<div class="panel-group smart-accordion-default" id="' . $structure->id . '">';
     $result .= implode('', $panel_html_list);
     $result .= '</div>';
     if ($return) {
         return $result;
     } else {
         echo $result;
     }
 }
    public function print_html($return = false)
    {
        $get_property_value = parent::_get_property_value_func();
        $that = $this;
        $structure = $this->_structure;
        $rows = $get_property_value($structure->data, array("if_array" => function ($data) use($that, $get_property_value, $structure) {
            $html_rows = array();
            foreach ($data as $row_index => $row_data) {
                $row_prop = array("hidden" => false, "checkbox" => true, "detail" => true, "class" => "", "attr" => "", "content" => true);
                $new_row_prop = $row_prop;
                if (isset($structure->row[$row_index + 1])) {
                    $row_prop_value = $structure->row[$row_index + 1];
                    if ($row_prop_value === false) {
                        $new_row_prop["hidden"] = true;
                    } else {
                        if ($row_prop_value === "") {
                            $new_row_prop["content"] = "";
                        } else {
                            $new_row_prop = SmartUtil::get_clean_structure($row_prop, $row_prop_value, array($row_data, $row_index), 'class');
                        }
                    }
                }
                $rows_html = '';
                foreach ($row_data as $col_name => $cell_value) {
                    $hide_class = '';
                    if (isset($structure->hide[$col_name]) && $structure->hide[$col_name] === true || in_array($col_name, $structure->hidden)) {
                        $hide_class = ' class="hidden"';
                    }
                    if (isset($new_row_prop["content"]) && !$new_row_prop["content"]) {
                        $rows_html .= '<td' . $hide_class . '></td>';
                        continue;
                    }
                    $cell_html = $cell_value;
                    if (isset($structure->cell[$col_name])) {
                        $cell_prop = $structure->cell[$col_name];
                        $cell_html = $get_property_value($cell_prop, array("if_closure" => function ($prop) use($that, $row_data, $row_index, $cell_value) {
                            return SmartUtil::run_callback($prop, array($row_data, $cell_value, $row_index));
                        }, "if_array" => function ($cell_prop) use($that, $row_data, $row_index, $cell_value, $get_property_value) {
                            //icon, content, color, url[href, title, tooltip, attr]
                            $cell_html = $cell_value;
                            //content
                            if (isset($cell_prop["content"])) {
                                $cell_html = $get_property_value($cell_prop["content"], array("if_closure" => function ($content) use($that, $row_data, $row_index, $cell_value) {
                                    $content_value = $that::replace_col_codes(SmartUtil::run_callback($content, array($row_data, $cell_value, $row_index)), $row_data);
                                    return $content_value;
                                }, "if_other" => function ($content) use($cell_html) {
                                    $cell_html = $content;
                                    return $cell_html;
                                }));
                            }
                            //url
                            if (isset($cell_prop["url"])) {
                                $map_url_prop = array("href" => "#", "target" => "_self", "title" => "", "attr" => "");
                                $map_url_prop = $get_property_value($cell_prop["url"], array("if_closure" => function ($prop) use($row_data, $row_index, $cell_value, $map_url_prop) {
                                    $url = SmartUtil::run_callback($prop, array($row_data, $cell_value, $row_index));
                                    $map_url_prop["href"] = $url;
                                    return $map_url_prop;
                                }, "if_array" => function ($url_prop) use($that, $row_data, $cell_html, $map_url_prop) {
                                    $map_url_prop["target"] = isset($url_prop['target']) ? $url_prop['target'] : "_self";
                                    $map_url_prop["href"] = isset($url_prop['href']) ? $that::replace_col_codes($url_prop['href'], $row_data, true) : '#';
                                    $map_url_prop["attr"] = isset($url_prop['attr']) && $url_prop['attr'] ? $url_prop['attr'] : '';
                                    $map_url_prop["title"] = isset($url_prop['title']) ? $that::replace_col_codes($url_prop['title'], $row_data, true) : '';
                                    return $map_url_prop;
                                }, "if_other" => function ($url_prop) use($that, $row_data, $cell_html, $map_url_prop) {
                                    $map_url_prop["href"] = $that::replace_col_codes($url_prop, SmartUtil::object_to_array($row_data), true);
                                    return $map_url_prop;
                                }));
                                $cell_html = '<a href="' . $map_url_prop["href"] . '" target="' . $map_url_prop["target"] . '" ' . $map_url_prop["attr"] . ' title="' . $map_url_prop["title"] . '">' . $cell_html . '</a>';
                            }
                            //icon
                            if (isset($cell_prop["icon"])) {
                                $cell_html = $get_property_value($cell_prop["icon"], array("if_closure" => function ($icon) use($row_data, $row_index, $cell_value, $cell_html) {
                                    $icon_value = SmartUtil::run_callback($prop, array($row_data, $cell_value, $row_index));
                                    return '<i class="fa ' . $icon_value . ' fa-md"></i> ' . $cell_html;
                                }, "if_other" => function ($icon) use($cell_html) {
                                    return '<i class="fa ' . $icon . ' fa-md"></i> ' . $cell_html;
                                }));
                            }
                            //color
                            if (isset($cell_prop["color"])) {
                                $cell_html = $get_property_value($cell_prop["color"], array("if_closure" => function ($color) use($row_data, $row_index, $cell_value, $cell_html) {
                                    $color_value = SmartUtil::run_callback($color, array($row_data, $cell_value, $row_index));
                                    return '<span class="' . $color_value . '">' . $cell_html . '</span>';
                                }, "if_other" => function ($color) use($cell_html) {
                                    return '<span class="' . $color . '">' . $cell_html . '</span>';
                                }));
                            }
                            //callback
                            if (isset($cell_prop["callback"]) && SmartUtil::is_closure($cell_prop["callback"])) {
                                $new_cell_html = SmartUtil::run_callback($cell_prop["callback"], array($row_data, $cell_html, $row_index));
                                if (trim($new_cell_html) != "") {
                                    $cell_html = $new_cell_html;
                                }
                            }
                            return $cell_html;
                        }, "if_other" => function ($cell_prop) use($that, $row_data) {
                            return $that::replace_col_codes($cell_prop, $row_data);
                        }));
                    }
                    $rows_html .= '<td' . $hide_class . '> ' . $cell_html . ' </td>';
                }
                $row_classes = array();
                if ($new_row_prop["class"]) {
                    $row_classes[] = $new_row_prop["class"];
                }
                if ($new_row_prop["hidden"] === true) {
                    $row_classes[] = 'hidden';
                }
                $attr = $new_row_prop["attr"] ? ' ' . $new_row_prop["attr"] : '';
                $row_class = $row_classes ? ' class="' . implode(' ', $row_classes) . '"' : '';
                $row_checkbox = '';
                $row_details = '';
                if (isset($structure->options["checkboxes"]) && $structure->options["checkboxes"]) {
                    $option = $structure->options["checkboxes"];
                    $checkbox_prop = array("name" => $structure->id . "_checkbox", "id" => "", "checked" => false);
                    $new_checkbox_prop = SmartUtil::get_clean_structure($checkbox_prop, $option, array($that, $row_data, $row_index), 'name');
                    $id = $new_checkbox_prop["id"] ? 'id="' . $new_checkbox_prop["id"] . '"' : '';
                    $content = '<label class="checkbox-inline">
		                          <input type="checkbox" ' . ($new_checkbox_prop["checked"] ? 'checked' : '') . ' class="checkbox style-0" name="' . $checkbox_prop["name"] . '[]" ' . $id . ' />
		                          <span></span>
		                        </label>';
                    if ($new_row_prop["checkbox"] === false) {
                        $content = '';
                    }
                    $row_checkbox = '
			                <td class="center" width="20px"> ' . $content . ' </td>';
                }
                if (isset($structure->options["row_details"]) && $structure->options["row_details"]) {
                    $option = $structure->options["row_details"];
                    $detail_prop = array("id" => "", "icon" => 'fa-plus-square', "title" => 'Show Details');
                    $new_detail_prop = SmartUtil::get_clean_structure($detail_prop, $option, array($that, $row_data, $row_index), 'icon');
                    $id = $new_detail_prop["id"] ? 'id="' . $new_detail_prop["id"] . '"' : '';
                    $content = '<a href="#" ' . $id . '>
									<i class="fa ' . $detail_prop['icon'] . ' fa-lg" data-toggle="row-detail" title="' . $detail_prop['title'] . '"></i>
								</a>';
                    if ($new_row_prop["detail"] === false) {
                        $content = '';
                    }
                    $row_details = '<td class="center" width="20px"> ' . $content . ' </td>';
                }
                $html_rows[] = '<tr' . $row_class . $attr . '>' . $row_details . $row_checkbox . $rows_html . '</tr>';
            }
            return implode('', $html_rows);
        }, "if_closure" => function ($data) {
            SmartUI::err('SmartUI::DataTable::data requires an array of objects/array');
            return '';
        }, "if_other" => function ($data) {
            SmartUI::err('SmartUI::DataTable::data requires an array of objects/array');
            return '';
        }));
        $cols = $get_property_value($structure->col, array("if_array" => function ($cols) use($that, $get_property_value, $structure) {
            $html_col_list = array();
            foreach ($cols as $col_name => $col_value) {
                if (is_null($col_value) || $col_value === false) {
                    continue;
                }
                $col_value_prop = array("name" => $col_name, "class" => "", "attr" => array(), "icon" => "", "hidden" => isset($structure->hide[$col_name]) && $structure->hide[$col_name] === true || in_array($col_name, $structure->hidden));
                $new_col_value = SmartUtil::get_clean_structure($col_value_prop, $col_value, array($that, $cols), 'name');
                if ($new_col_value['attr']) {
                    if (is_array($new_col_value["attr"])) {
                        foreach ($new_col_value["attr"] as $attr => $value) {
                            $attrs[] = $attr . '="' . $value . '"';
                        }
                    } else {
                        $attrs[] = $new_col_value["attr"];
                    }
                    $new_col_value["attr"] = $attrs;
                }
                $classes = array();
                if ($new_col_value['class']) {
                    $classes[] = $new_col_value['class'];
                }
                if ($new_col_value['hidden'] === true) {
                    $classes[] = "hidden";
                }
                $class = $classes ? 'class="' . implode(' ', $classes) . '"' : '';
                $main_attributes = array($class, implode(' ', $new_col_value['attr']));
                $htm_attrs = trim(implode(' ', $main_attributes));
                $htm_attrs = $htm_attrs ? ' ' . $htm_attrs : '';
                $html_col_list[] = '<th' . $htm_attrs . '>' . $new_col_value['icon'] . ' ' . $new_col_value['name'] . ' </th>';
            }
            $html_cols = implode('', $html_col_list);
            $checkbox_header = '';
            $detail_header = '';
            if (isset($structure->options["checkboxes"]) && $structure->options["checkboxes"]) {
                $checkbox_header = '
						<th class="center" width="20px">
							<label class="checkbox-inline">
								<input type="checkbox" class="checkbox style-0">
								<span></span>
							</label>
						</th>';
            }
            if (isset($structure->options["row_details"]) && $structure->options["row_details"]) {
                $detail_header = '
						<th class="center" width="20px"></th>';
            }
            return '<tr>' . $detail_header . $checkbox_header . $html_cols . '</tr>';
        }));
        $id = $get_property_value($structure->id, array("if_closure" => function ($prop) use($that) {
            return SmartUtil::run_callback($prop, array($that));
        }, "if_other" => function ($prop) {
            return $prop;
        }, "if_array" => function ($prop) use($structure) {
            SmartUI::err('SmartUI::Widget::id requires string.');
            return $structure->id;
        }));
        $id = $id ? 'id="' . $id . '"' : '';
        $table_html = '<table ' . $id . ' class="table table-striped table-bordered table-hover">';
        $table_html .= '<thead>';
        $table_html .= $cols;
        $table_html .= '</thead>';
        $table_html .= '<tbody>';
        $table_html .= $rows;
        $table_html .= '</tbody>';
        $table_html .= '</table>';
        $result = $table_html;
        if (isset($structure->options["in_widget"]) && $structure->options["in_widget"]) {
            // no need for widget's toolbar for datatable 1.10.x
            // if (!$structure->options["static"])
            // 	$structure->widget->body('toolbar', '');
            $structure->widget->body("content", $table_html);
            $result = $structure->widget->print_html(true);
        }
        if ($return) {
            return $result;
        } else {
            echo $result;
        }
    }
示例#15
0
						</div>
					</li>
				</ul>
			</div>
		</div>

		<!-- widget grid -->
		<section id="widget-grid" class="">
		
			<!-- row -->
			<div class="row">
				
				<!-- NEW WIDGET START -->
				<article class="col-xs-12">
					<?php 
$sui = new SmartUI();
$options = array("fullscreenbutton" => false);
$widget = $sui->create_widget($options);
//you can also set options this way
//$widget->options = $options;
//set a widget property by passing closure
$widget->attr = function ($widget) {
    return 'data-custom-attr="test" data-some-id="12341111"';
};
//set a widget property by passing an array
//$widget->attr = array("data-custom-attr"=>"test", "data-some-id" => "12341111");
//set a widget property by passing string (some properties are required only to have strings)
//$widget->attr = 'data-custom-attr="test" data-some-id="12341111"';
//same as attr example, you can do the same with other widget properties
//$widget->header = '<h2><strong>Default</strong> <i>Widget</i> PHP</h2>';
//Let's do some dynamic content on the header. Passing toolbar and content keys to $widget->header
 private static function _get_field_html($name, $field_type = self::FORM_FIELD_INPUT, $properties = array(), $field_html_only = false)
 {
     $field_class_map = array(self::FORM_FIELD_INPUT => 'input', self::FORM_FIELD_FILEINPUT => 'input input-file', self::FORM_FIELD_SELECT => 'select', self::FORM_FIELD_SELECT2 => 'select', self::FORM_FIELD_MULTISELECT => 'select select-multiple', self::FORM_FIELD_TEXTAREA => 'textarea', self::FORM_FIELD_CHECKBOX => 'checkbox', self::FORM_FIELD_RADIO => 'radio', self::FORM_FIELD_RATING => 'rating', self::FORM_FIELD_RATINGS => 'rating', self::FORM_FIELD_HIDDEN => '', self::FORM_FIELD_BLANK => '');
     $result = '';
     $field_html = '';
     $result_html = '';
     $notes = '';
     $label = '';
     $attrs = array();
     switch ($field_type) {
         case self::FORM_FIELD_LABEL:
             $default_prop = array('label' => '');
             $new_prop = parent::get_clean_structure($default_prop, $properties, array(), 'label');
             $result_html = $new_prop['label'];
             break;
         case self::FORM_FIELD_BLANK:
             $default_prop = array('content' => '');
             $new_prop = parent::get_clean_structure($default_prop, $properties, array(), 'content');
             $result_html = $new_prop['content'];
             break;
         case self::FORM_FIELD_RATINGS:
             $default_prop = array('items' => array(), 'icon' => SmartUI::$icon_source . '-star');
             $new_prop = parent::get_clean_structure($default_prop, $properties, array(), 'max');
             if (!is_array($new_prop['items'])) {
                 $new_prop['items'] = array($new_prop['items']);
             }
             $items = $new_prop['items'];
             $rating_html_list = array();
             foreach ($items as $item) {
                 $item_prop = array('max' => 5, 'icon' => $new_prop['icon'], 'name' => $name . '-' . SmartUtil::create_id(), 'label' => '');
                 $new_item_prop = parent::set_array_prop_def($item_prop, $item, 'max');
                 $field_html = self::_get_field_html($new_item_prop['name'], self::FORM_FIELD_RATING, $new_item_prop, true);
                 $field_html .= $new_item_prop['label'] ? $new_item_prop['label'] : '&nbsp;';
                 $result_html = '	<div class="' . $field_class_map[$field_type] . '">';
                 $result_html .= $field_html;
                 $result_html .= '	</div>';
                 $rating_html_list[] = $result_html;
             }
             $result_html = implode('', $rating_html_list);
             break;
         case self::FORM_FIELD_RATING:
             $default_prop = array('max' => 5, 'icon' => SmartUI::$icon_source . '-star');
             $new_prop = parent::get_clean_structure($default_prop, $properties, array(), 'max');
             $rating_html_list = array();
             for ($i = $new_prop['max']; $i >= 1; $i--) {
                 $rate_id = $name . '-' . $i;
                 $rating_html = self::_get_field_html($name, self::FORM_FIELD_INPUT, array('type' => 'radio', 'id' => $rate_id), true);
                 $rating_html .= '<label for="' . $rate_id . '"><i class="' . SmartUI::$icon_source . ' ' . $new_prop['icon'] . '"></i></label>';
                 $rating_html_list[] = $rating_html;
             }
             $field_html .= implode('', $rating_html_list);
             if ($field_html_only) {
                 return $field_html;
             }
             $result_html .= '	<label class="' . $field_class_map[$field_type] . '">';
             $result_html .= $field_html;
             $result_html .= '	</label>';
             break;
         case self::FORM_FIELD_TEXTAREA:
             $default_prop = array('rows' => 3, 'attr' => array(), 'class' => array(), 'icon' => '', 'icon_append' => true, 'value' => '', 'id' => '', 'type' => '', 'placeholder' => '', 'disabled' => false, 'wrapper' => 'label');
             $new_prop = parent::get_clean_structure($default_prop, $properties, array(), 'placeholder');
             $classes = array();
             $classes[] = 'custom-scroll';
             if ($new_prop['class']) {
                 array_push($classes, $new_prop['class']);
             }
             $attrs = array();
             $attrs[] = 'class="' . implode(' ', $classes) . '"';
             $attrs[] = 'rows="' . $new_prop['rows'] . '"';
             $attrs[] = 'name="' . $name . '"';
             if ($new_prop['disabled']) {
                 $attrs[] = 'disabled="disabled"';
             }
             if ($new_prop['id']) {
                 $attrs[] = 'id="' . $new_prop['id'] . '"';
             }
             if ($new_prop['placeholder']) {
                 $attrs[] = 'placeholder="' . $new_prop['placeholder'] . '"';
             }
             if ($new_prop['attr']) {
                 $attrs[] = implode(' ', $new_prop['attr']);
             }
             if ($new_prop['icon']) {
                 $field_html .= '<i class="icon-' . ($new_prop['icon_append'] ? 'append' : 'prepend') . ' ' . SmartUI::$icon_source . ' ' . $new_prop['icon'] . '"></i>';
             }
             $field_html .= '<textarea ' . implode(' ', $attrs) . '>';
             $field_html .= $new_prop['value'];
             $field_html .= '</textarea>';
             $field_class_map[self::FORM_FIELD_TEXTAREA] = 'textarea' . ($new_prop['type'] ? ' textarea-' . $new_prop['type'] : '');
             if ($field_html_only) {
                 return $field_html;
             }
             $result_html .= '	<' . $new_prop['wrapper'] . ' class="' . $field_class_map[$field_type] . '">';
             $result_html .= $field_html;
             $result_html .= '	</' . $new_prop['wrapper'] . '>';
             break;
         case self::FORM_FIELD_MULTISELECT:
             if (isset($properties['attr'])) {
                 array_push($properties['attr'], array('multiple="multiple"', 'class="custom-scroll"'));
             } else {
                 $properties['attr'] = array('multiple="multiple"');
             }
             if (isset($properties['class'])) {
                 array_push($properties['class'], array('custom-scroll'));
             } else {
                 $properties['class'] = array('custom-scroll');
             }
             $properties['icon'] = '';
             $field_html = self::_get_field_html($name, self::FORM_FIELD_SELECT, $properties, true);
             if ($field_html_only) {
                 return $field_html;
             }
             $result_html .= '	<label class="' . $field_class_map[$field_type] . '">';
             $result_html .= $field_html;
             $result_html .= '	</label>';
             break;
         case self::FORM_FIELD_SELECT2:
             if (!is_array($properties['class'])) {
                 $properties['class'] = array($properties['class']);
             }
             array_push($properties['class'], 'select2');
             $properties['icon'] = '';
             $field_html = self::_get_field_html($name, self::FORM_FIELD_SELECT, $properties, true);
             if ($field_html_only) {
                 return $field_html;
             }
             $result_html .= '	<label class="' . $field_class_map[$field_type] . '">';
             $result_html .= $field_html;
             $result_html .= '	</label>';
             break;
         case self::FORM_FIELD_SELECT:
             $default_prop = array('data' => array(), 'display' => '', 'value' => '', 'container' => 'select', 'selected' => false, 'id' => '', 'attr' => array(), 'class' => array(), 'icon' => '<i></i>', 'item_attr' => null, 'disabled' => false);
             $get_property_value = parent::_get_property_value_func();
             $new_prop = parent::get_clean_structure($default_prop, $properties, array(), 'data');
             $data = $new_prop['data'];
             if (!is_array($data)) {
                 parent::err('SmartUI::Form "data" is required for "select" field.');
                 return '';
             }
             if (!$data) {
                 $data = array(array('No Data'));
             }
             $data = SmartUtil::object_to_array($data);
             if (!$new_prop['display']) {
                 $display_key = array_keys($data[0]);
                 $new_prop['display'] = is_array($data[0]) && $display_key ? $display_key[0] : 0;
             }
             if (!$new_prop['value']) {
                 $value_key = array_keys($data[0]);
                 $new_prop['value'] = is_array($data[0]) && $value_key ? $value_key[0] : 0;
             }
             $option_list = array();
             foreach ($data as $row) {
                 $item_attr = '';
                 if (!is_array($row)) {
                     $row = array($row);
                 }
                 $selected = $row[$new_prop['value']] == $new_prop['selected'];
                 if (isset($new_prop['item_attr'])) {
                     $item_attr = $get_property_value($new_prop['item_attr'], array('if_closure' => function ($item_attr) use($row) {
                         return SmartUtil::run_callback($row);
                     }, 'if_array' => function ($item_attr) use($row) {
                         $attrs = array();
                         foreach ($item_attr as $attr) {
                             $attrs[] = SmartUtil::replace_col_codes($attr, $row);
                         }
                         return implode(' ', $attrs);
                     }, 'if_other' => function ($item_attr) use($row) {
                         return SmartUtil::replace_col_codes($item_attr, $row);
                     }));
                 }
                 $option_list[] = '<option value="' . $row[$new_prop['value']] . '"' . ($selected ? ' selected' : '') . ($item_attr ? ' ' . $item_attr : '') . '>' . $row[$new_prop['display']] . '</option>';
             }
             $attrs = array();
             $attrs[] = 'name="' . $name . '"';
             if ($new_prop['disabled']) {
                 $attrs[] = 'disabled="disabled"';
             }
             if ($new_prop['id']) {
                 $attrs[] = 'id="' . $new_prop['id'] . '"';
             }
             if ($new_prop['attr']) {
                 $attrs[] = implode(' ', $new_prop['attr']);
             }
             if ($new_prop['class']) {
                 $attrs[] = 'class="' . implode(' ', $new_prop['class']) . '"';
             }
             $field_html = '<' . $new_prop['container'] . ' ' . implode(' ', $attrs) . '>';
             $field_html .= implode('', $option_list);
             $field_html .= '</' . $new_prop['container'] . '>' . $new_prop['icon'];
             if ($field_html_only) {
                 return $field_html;
             }
             $result_html .= '	<label class="' . $field_class_map[$field_type] . '">';
             $result_html .= $field_html;
             $result_html .= '	</label>';
             break;
         case self::FORM_FIELD_FILEINPUT:
             $file_button = self::_get_field_html($name, self::FORM_FIELD_INPUT, array('type' => 'file', 'attr' => array_merge(array('onchange="this.parentNode.nextSibling.value = this.value"'), isset($properties['attr']) ? $properties['attr'] : array())), true);
             $field_html = '<span class="button">';
             $field_html .= $file_button;
             $field_html .= 'Browse</span>';
             $default_prop = array('icon' => false, 'tooltip' => false, 'attr' => array('readonly'), 'type' => 'text');
             if ($properties) {
                 foreach ($properties as $key => $value) {
                     if (!isset($default_prop[$key])) {
                         $default_prop[$key] = $value;
                     }
                 }
             }
             $field_html .= self::_get_field_html($name . '-display', self::FORM_FIELD_INPUT, $default_prop, true);
             if ($field_html_only) {
                 return $field_html;
             }
             $result_html .= '	<label class="' . $field_class_map[$field_type] . '">';
             $result_html .= $field_html;
             $result_html .= '	</label>';
             break;
         case self::FORM_FIELD_HIDDEN:
             $default_prop = array('icon' => false, 'tooltip' => false, 'type' => 'hidden', 'value' => '');
             $new_prop = parent::get_clean_structure($default_prop, $properties, array(), 'value');
             $field_html .= self::_get_field_html($name, self::FORM_FIELD_INPUT, $new_prop, true);
             return $field_html;
             break;
         case self::FORM_FIELD_INPUT:
             $default_prop = array('type' => 'text', 'attr' => array(), 'id' => '', 'icon' => '', 'icon_append' => true, 'placeholder' => '', 'value' => '', 'tooltip' => array(), 'disabled' => false, 'autocomplete' => false, 'size' => '', 'class' => array());
             $new_prop = parent::get_clean_structure($default_prop, $properties, array(), 'placeholder');
             $classes = array();
             if ($new_prop['class']) {
                 array_push($classes, $new_prop['class']);
             }
             if ($new_prop['size']) {
                 $classes[] = 'input-' . $new_prop['size'];
             }
             $attrs = array();
             $attrs[] = $classes ? 'class="' . implode(' ', $classes) . '"' : '';
             $attrs[] = 'type="' . $new_prop['type'] . '"';
             $attrs[] = 'name="' . $name . '"';
             if ($new_prop['attr']) {
                 $attrs[] = implode(' ', $new_prop['attr']);
             }
             if ($new_prop['id']) {
                 $attrs[] = 'id="' . $new_prop['id'] . '"';
             }
             $attrs[] = 'value="' . $new_prop['value'] . '"';
             if ($new_prop['placeholder']) {
                 $attrs[] = 'placeholder="' . $new_prop['placeholder'] . '"';
             }
             if ($new_prop['disabled']) {
                 $attrs[] = 'disabled="disabled"';
             }
             $ac_html = '';
             if ($new_prop['autocomplete']) {
                 $ac_prop = array('data' => array(), 'display' => '', 'value' => '');
                 if (!isset($new_prop['autocomplete']['data'])) {
                     $ac_prop['data'] = $new_prop['autocomplete'];
                 } else {
                     $ac_prop['data'] = $new_prop['autocomplete']['data'];
                     $ac_prop['display'] = isset($new_prop['autocomplete']['display']) ? $new_prop['autocomplete']['display'] : '';
                     $ac_prop['value'] = isset($new_prop['autocomplete']['value']) ? $new_prop['autocomplete']['value'] : '';
                 }
                 $list_name = 'list-' . $name . '-' . SmartUtil::create_id();
                 $ac_html = self::_get_field_html('', self::FORM_FIELD_SELECT, array('container' => 'datalist', 'data' => $ac_prop['data'], 'display' => $ac_prop['display'], 'value' => $ac_prop['value'], 'id' => $list_name), true);
                 $attrs[] = 'list="' . $list_name . '"';
             }
             if ($new_prop['icon']) {
                 $field_html .= '<i class="icon-' . ($new_prop['icon_append'] ? 'append' : 'prepend') . ' ' . SmartUI::$icon_source . ' ' . $new_prop['icon'] . '"></i>';
             }
             $field_html .= '<input ' . implode(' ', $attrs) . ' />';
             $field_html .= $ac_html;
             if ($new_prop['tooltip']) {
                 $tooltip_prop = array('content' => '', 'position' => 'top-right');
                 $new_tooltip_prop = parent::set_array_prop_def($tooltip_prop, $new_prop['tooltip'], 'content');
                 $field_html .= '<b class="tooltip tooltip-' . $new_tooltip_prop['position'] . '">' . $new_tooltip_prop['content'] . '</b>';
             }
             if ($field_html_only) {
                 return $field_html;
             }
             $result_html .= '	<label class="' . $field_class_map[$field_type] . '">';
             $result_html .= $field_html;
             $result_html .= '	</label>';
             break;
         case self::FORM_FIELD_RADIO:
             $default_prop = array('items' => array(), 'cols' => 0, 'inline' => false, 'toggle' => false);
             $new_prop = parent::get_clean_structure($default_prop, $properties, array(), 'items');
             if (!is_array($new_prop['items'])) {
                 $new_prop['items'] = array($new_prop['items']);
             }
             $items = $new_prop['items'];
             $item_list_html = array();
             foreach ($items as $item) {
                 $items_prop = array('name' => $name, 'checked' => false, 'value' => '', 'label' => '', 'id' => '', 'disabled' => false);
                 $new_item_prop = parent::set_array_prop_def($items_prop, $item, 'label');
                 $item_html = self::_get_field_html($new_item_prop['name'], self::FORM_FIELD_INPUT, array('type' => 'radio', 'attr' => $new_item_prop['checked'] ? array('checked') : null, 'value' => $new_item_prop['value'], 'id' => $new_item_prop['id']), true);
                 if ($new_prop['toggle']) {
                     $text_off = is_array($new_prop['toggle']) && isset($new_prop['toggle']['text-off']) ? $new_prop['toggle']['text-off'] : 'OFF';
                     $text_on = is_array($new_prop['toggle']) && isset($new_prop['toggle']['text-on']) ? $new_prop['toggle']['text-on'] : 'ON';
                     $item_html .= '<i data-swchon-text="' . $text_on . '" data-swchoff-text="' . $text_off . '"></i>';
                 } else {
                     $item_html .= '<i></i>';
                 }
                 $item_html .= $new_item_prop['label'];
                 $field_html = '	<label class="' . ($new_prop['toggle'] ? 'toggle' : $field_class_map[$field_type]) . ' ' . ($new_item_prop['disabled'] ? 'state-disabled' : '') . '">';
                 $field_html .= $item_html;
                 $field_html .= '	</label>';
                 $item_list_html[] = $field_html;
             }
             if ($new_prop['cols']) {
                 $result_html .= '<div class="row">';
                 $result_html .= self::print_col_items($item_list_html, function ($item) {
                     return $item;
                 }, $new_prop['cols'], true);
                 $result_html .= '</div>';
             } else {
                 $list_html = implode('', $item_list_html);
                 if ($new_prop['inline']) {
                     $result_html .= '<div class="inline-group">';
                     $result_html .= $list_html;
                     $result_html .= '</div>';
                 } else {
                     $result_html .= $list_html;
                 }
             }
             if ($field_html_only) {
                 return $result_html;
             }
             break;
         case self::FORM_FIELD_CHECKBOX:
             $default_prop = array('items' => array(), 'cols' => 0, 'inline' => false, 'toggle' => false);
             $new_prop = parent::get_clean_structure($default_prop, $properties, array(), 'items');
             if (!is_array($new_prop['items'])) {
                 $new_prop['items'] = array($new_prop['items']);
             }
             $items = $new_prop['items'];
             $item_list_html = array();
             foreach ($items as $item) {
                 $items_prop = array('name' => $name, 'checked' => false, 'value' => '', 'label' => '', 'id' => '', 'disabled' => false);
                 $new_item_prop = parent::set_array_prop_def($items_prop, $item, 'label');
                 $item_html = self::_get_field_html($new_item_prop['name'], self::FORM_FIELD_INPUT, array('type' => 'checkbox', 'attr' => $new_item_prop['checked'] ? array('checked') : null, 'value' => $new_item_prop['value'], 'id' => $new_item_prop['id']), true);
                 if ($new_prop['toggle']) {
                     $text_off = is_array($new_prop['toggle']) && isset($new_prop['toggle']['text-off']) ? $new_prop['toggle']['text-off'] : 'OFF';
                     $text_on = is_array($new_prop['toggle']) && isset($new_prop['toggle']['text-on']) ? $new_prop['toggle']['text-on'] : 'ON';
                     $item_html .= '<i data-swchon-text="' . $text_on . '" data-swchoff-text="' . $text_off . '"></i>';
                 } else {
                     $item_html .= '<i></i>';
                 }
                 $item_html .= $new_item_prop['label'];
                 $field_html = '	<label class="' . ($new_prop['toggle'] ? 'toggle' : $field_class_map[$field_type]) . ' ' . ($new_item_prop['disabled'] ? 'state-disabled' : '') . '">';
                 $field_html .= $item_html;
                 $field_html .= '	</label>';
                 $item_list_html[] = $field_html;
             }
             if ($new_prop['cols']) {
                 $result_html .= '<div class="row">';
                 $result_html .= self::print_col_items($item_list_html, function ($item) {
                     return $item;
                 }, $new_prop['cols'], true);
                 $result_html .= '</div>';
             } else {
                 $list_html = implode('', $item_list_html);
                 if ($new_prop['inline']) {
                     $result_html .= '<div class="inline-group">';
                     $result_html .= $list_html;
                     $result_html .= '</div>';
                 } else {
                     $result_html .= $list_html;
                 }
             }
             if ($field_html_only) {
                 return $result_html;
             }
             break;
     }
     if (is_array($properties)) {
         $notes = isset($properties['note']) ? '<div class="note">' . $properties['note'] . '</div>' : '';
         $label = isset($properties['label']) && $properties['label'] ? '<label class="label">' . $properties['label'] . '</label>' : '';
     }
     $result .= $label;
     $result .= $result_html;
     $result .= $notes;
     return $result;
 }
<div id="main" role="main">
	<?php 
//configure ribbon (breadcrumbs) array("name"=>"url"), leave url empty if no url
//$breadcrumbs["New Crumb"] => "http://url.com"
$breadcrumbs["Smart UI"] = "";
include "inc/ribbon.php";
?>

	<!-- MAIN CONTENT -->
	<div id="content">
		<section id="widget-grid" class="">
			<div class="row">
				<article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
					<?php 
$data = json_decode(file_get_contents(APP_URL . "/data/data.json"));
$ui = new SmartUI();
$dt = $ui->create_datatable($data, array("in_widget" => true));
$dt->options("checkboxes", true);
$dt->options("row_details", '
							<div class="alert alert-warning fade in">
								<i class="fa-fw fa fa-warning"></i>
								<strong>Warning</strong> The ID for {{Name}} is #{{ID}}.
							</div>');
$dt->cell = array("Company" => array("url" => function ($row, $value) {
    if ($value == "Pharetra Nam Industries") {
        return "http://facebook.com";
    } else {
        return "http://maps.google.com/maps?z=12&t=m&q=" . $row->City . "+" . $row->Zip;
    }
}, "icon" => "fa-external-link txt-color-red", "callback" => function ($row, $html_value) {
    // if you want to get the configured HTML cell, use this key
示例#18
0
?>
<!-- ==========================CONTENT STARTS HERE ========================== -->
<!-- MAIN PANEL -->
<div id="main" role="main">
	<?php 
//configure ribbon (breadcrumbs) array("name"=>"url"), leave url empty if no url
//$breadcrumbs["New Crumb"] => "http://url.com"
$breadcrumbs["Misc"] = "";
include "inc/ribbon.php";
?>

	<!-- MAIN CONTENT -->
	<div id="content">
		<section id="widget-grid" class="">
			<?php 
$ui = new SmartUI();
$btn_simple = $ui->create_button('Click Me!', 'danger')->attr('href', 'http://facebook.com')->attr('target', '_blank')->icon('fa-gear')->print_html(true);
$btn_spinning = $ui->create_button('', 'success')->class(array('bg-color-green', 'txt-color-white'))->icon('fa-refresh fa-4x fa-spin')->print_html(true);
$btn_circle = $ui->create_button('', 'primary')->class('btn-circle')->size('lg')->icon('fa-check')->print_html(true);
$btn_labeled = $ui->create_button('A Labeled Button', 'success')->icon('fa-check')->options('labeled', true)->print_html(true);
// dropdown
$items = array('<a href="javascript:void(0);">Some action</a>', '<a href="javascript:void(0);">Some other action</a>', '-', array('content' => '<a tabindex="-1" href="javascript:void(0);">Hover me for more options</a>', 'submenu' => array('<a tabindex="-1" href="javascript:void(0);">Second level</a>', array('content' => '<a href="javascript:void(0);">Even More..</a>', 'submenu' => array('<a href="javascript:void(0);">3rd level</a>', '<a href="javascript:void(0);">3rd level</a>')), '<a href="javascript:void(0);">Second level</a>', '<a href="javascript:void(0);">Second level</a>')));
$dropdown = $ui->create_button('Simple Dropdown')->dropdown('items', $items)->dropdown('split', false)->print_html(true);
$dropdown_split = $ui->create_button('Split Dropdown')->dropdown('items', $items)->dropdown('split', array('type' => 'success', 'disabled' => false, 'dropup' => false, 'class' => array('class-1', 'class-2', 'class-custom'), 'attr' => array('data-custom-attr' => '12345')))->dropdown('multilevel', true)->attr('href', 'http://twitter.com')->attr('data-custom-id', '34343')->size(Button::BUTTON_SIZE_XSMALL)->print_html(true);
$run_time = $ui->run_time(false);
$widget = $ui->create_widget();
$body = $btn_simple . $btn_spinning . $btn_circle . $btn_labeled . '
					<hr class="simple" />
					' . $dropdown . '
					<hr class="simple" />
					' . $dropdown_split;
示例#19
0
$breadcrumbs["Smart UI"] = "";
include "inc/ribbon.php";
?>

	<!-- MAIN CONTENT -->
	<div id="content">
		<!-- widget grid -->
		<section id="widget-grid" class="">
		
			<!-- row -->
			<div class="row">
				
				<!-- NEW WIDGET START -->
				<article class="col-xs-12">
					<?php 
$ui = new SmartUI();
$options = array("fullscreenbutton" => false);
$widget = $ui->create_widget($options);
//you can also set options this way
//$widget->options = $options;
//set a widget property by passing closure
$widget->attr = function ($widget) {
    return 'data-custom-attr="test" data-some-id="12341111"';
};
//set a widget property by passing an array
//$widget->attr = array("data-custom-attr"=>"test", "data-some-id" => "12341111");
//set a widget property by passing string (some properties are required only to have strings)
//$widget->attr = 'data-custom-attr="test" data-some-id="12341111"';
//same as attr example, you can do the same with other widget properties
//$widget->header = '<h2><strong>Default</strong> <i>Widget</i> PHP</h2>';
//Let's do some dynamic content on the header. Passing toolbar and content keys to $widget->header
 public function print_html($return = false)
 {
     $get_property_value = parent::_get_property_value_func();
     $that = $this;
     $structure = $this->_structure;
     $items = $get_property_value($structure->item, array('if_closure' => function ($items) use($that) {
         return SmartUI::run_callback($items, array($that));
     }, 'if_other' => function ($items) {
         SmartUI::err('SmartUI::Carousel:item requires array');
         return null;
     }));
     if (!is_array($items)) {
         parent::err("SmartUI::Carousel:item requires array");
         return null;
     }
     $indicators_list = array();
     $items_list = array();
     $has_active = false;
     $index = 0;
     foreach ($items as $item_key => $item) {
         $item_structure = array('img' => isset($structure->img[$item_key]) ? $structure->img[$item_key] : '', 'caption' => isset($structure->caption[$item_key]) ? $structure->caption[$item_key] : '', 'active' => isset($structure->active[$item_key]) ? $structure->active[$item_key] : '');
         $new_item_prop = parent::get_clean_structure($item_structure, $item, array($this, $items), 'img');
         foreach ($new_item_prop as $tab_item_key => $item_prop_value) {
             $new_item_prop_value = $get_property_value($item_prop_value, array('if_closure' => function ($prop_value) use($that, $items) {
                 return SmartUI::run_callback($prop_value, array($that, $items));
             }));
             $new_item_prop[$tab_item_key] = $new_item_prop_value;
         }
         $image_prop = array('src' => '', 'alt' => '');
         $new_image_prop = parent::get_clean_structure($image_prop, $new_item_prop['img'], array($this, $items, $new_item_prop), 'src');
         $indicator_classes = array();
         $item_classes = array();
         $item_classes[] = 'item';
         if (!$structure->active && !$has_active || $new_item_prop['active'] === true && !$has_active) {
             $has_active = true;
             $indicator_classes[] = 'active';
             $item_classes[] = 'active';
         }
         $indicators_list[] = '<li data-target="#' . $structure->id . '" data-slide-to="' . $index . '" class="' . implode(' ', $indicator_classes) . '"></li>';
         $item_html = '<div class="' . implode(' ', $item_classes) . '">';
         $item_html .= '		<img src="' . $new_image_prop['src'] . '" alt="' . $new_image_prop['alt'] . '">';
         $item_html .= '		<div class="carousel-caption">';
         $item_html .= $new_item_prop['caption'];
         $item_html .= '		</div>';
         $item_html .= '</div>';
         $items_list[] = $item_html;
         $index++;
     }
     $controls_html = '';
     if ($structure->options['controls']) {
         $controls_html .= '	<a class="left carousel-control" href="#' . $structure->id . '" data-slide="prev">';
         $controls_html .= $structure->options['controls'][0];
         $controls_html .= '	</a>';
         $controls_html .= '	<a class="right carousel-control" href="#' . $structure->id . '" data-slide="next">';
         $controls_html .= $structure->options['controls'][1];
         $controls_html .= '	</a>';
     }
     $result = '<div id="' . $structure->id . '" class="carousel ' . $structure->options['style'] . '">';
     $result .= '	<ol class="carousel-indicators">';
     $result .= implode('', $indicators_list);
     $result .= '	</ol>';
     $result .= '	<div class="carousel-inner">';
     $result .= implode('', $items_list);
     $result .= '	</div>';
     $result .= $controls_html;
     $result .= '</div>';
     if ($return) {
         return $result;
     } else {
         echo $result;
     }
 }
 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);
         $widget->header('title', $ul_html);
         $result = $widget->print_html(true);
     } else {
         if ($structure->options['bordered']) {
             $ul_classes[] = 'bordered';
         }
         if ($structure->options['pull']) {
             $ul_classes[] = 'tabs-pull-' . $structure->options['pull'];
         }
         $ul_html = '<ul class="' . implode(' ', $ul_classes) . '" ' . implode(' ', $ul_attr) . '>';
         $ul_html .= implode('', $li_list);
         $ul_html .= '</ul>';
         $container_classes = array();
         $container_classes[] = 'tabbable';
         switch ($structure->options['position']) {
             case 'right':
             case 'left':
                 $container_classes[] = 'tabs-' . $structure->options['position'];
                 $main_content_html = $ul_html . $content_html;
                 break;
             case 'below':
                 $container_classes[] = 'tabs-' . $structure->options['position'];
                 $main_content_html = $content_html . $ul_html;
                 break;
             default:
                 $main_content_html = $ul_html . $content_html;
                 break;
         }
         $result = '<div class="' . implode(' ', $container_classes) . '">';
         $result .= $main_content_html;
         $result .= '</div>';
     }
     if ($return) {
         return $result;
     } else {
         echo $result;
     }
 }
示例#22
0
 public function print_html($return = false)
 {
     switch ($this->_structure->options["type"]) {
         case Wizard::WIZARD_BOOTSTRAP:
             $result = self::_get_bootstrap_result();
             break;
         default:
             parent::err('SmartUI::Wizard Invalid Wizard Type: wizard "' . $this->_structure->options["type"] . '" not found.');
             break;
     }
     if ($return) {
         return $result;
     } else {
         echo $result;
     }
 }
示例#23
0
    $base_url .= str_replace(DIRECTORY_SEPARATOR, '/', substr($directory, strlen($document_root)));
}
defined("APP_URL") ? null : define("APP_URL", str_replace("/lib", "", $base_url));
//Assets URL, location of your css, img, js, etc. files
defined("ASSETS_URL") ? null : define("ASSETS_URL", APP_URL);
//require library files
//require_once("util.php");
require_once "func.global.php";
require_once "smartui/class.smartutil.php";
require_once "smartui/class.smartui.php";
// smart UI plugins
require_once "smartui/class.smartui-widget.php";
require_once "smartui/class.smartui-datatable.php";
require_once "smartui/class.smartui-button.php";
require_once "smartui/class.smartui-tab.php";
require_once "smartui/class.smartui-accordion.php";
require_once "smartui/class.smartui-carousel.php";
require_once "smartui/class.smartui-smartform.php";
require_once "smartui/class.smartui-nav.php";
SmartUI::$icon_source = 'fa';
// register our UI plugins
SmartUI::register('widget', 'Widget');
SmartUI::register('datatable', 'DataTable');
SmartUI::register('button', 'Button');
SmartUI::register('tab', 'Tab');
SmartUI::register('accordion', 'Accordion');
SmartUI::register('carousel', 'Carousel');
SmartUI::register('smartform', 'SmartForm');
SmartUI::register('nav', 'Nav');
require_once "class.html-indent.php";
require_once "class.parsedown.php";
示例#24
0
$document_root = realpath($_SERVER['DOCUMENT_ROOT']);
$base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
if (strpos($directory, $document_root) === 0) {
    $base_url .= str_replace(DIRECTORY_SEPARATOR, '/', substr($directory, strlen($document_root)));
}
defined("APP_URL") ? null : define("APP_URL", str_replace("/lib", "", $base_url));
//Assets URL, location of your css, img, js, etc. files
defined("ASSETS_URL") ? null : define("ASSETS_URL", APP_URL);
//require library files
//require_once("util.php");
require_once "func.global.php";
require_once "smartui/class.smartutil.php";
require_once "smartui/class.smartui.php";
// smart UI plugins
require_once "smartui/class.smartui-widget.php";
require_once "smartui/class.smartui-datatable.php";
require_once "smartui/class.smartui-button.php";
require_once "smartui/class.smartui-tab.php";
require_once "smartui/class.smartui-accordion.php";
require_once "smartui/class.smartui-carousel.php";
require_once "smartui/class.smartui-smartform.php";
// register our UI plugins
SmartUI::register('widget', 'Widget');
SmartUI::register('datatable', 'DataTable');
SmartUI::register('button', 'Button');
SmartUI::register('tab', 'Tab');
SmartUI::register('accordion', 'Accordion');
SmartUI::register('carousel', 'Carousel');
SmartUI::register('smartform', 'SmartForm');
require_once "class.html-indent.php";
require_once "class.parsedown.php";