Esempio n. 1
0
<?php

$toolbar = $ui->getAttribute('toolbar.enable', true);
//if(empty($toolbar))
//{
//	return;
//}
$rows = $ui->getRows();
$actionCreateButton = $ui->getActionCreateButton();
if (zbase_is_mobile()) {
    if (!empty($actionCreateButton)) {
        zbase_view_placeholder_add('topActionBar', $ui->id() . 'createAction', '<li><a href="' . $actionCreateButton->href() . '">' . $actionCreateButton->getLabel() . '</a></li>');
    }
}
if (zbase_is_mobile()) {
    ?>
	<div role="toolbar" class="btn-toolbar">
		<div class="col-md-12">
			<?php 
    echo zbase_view_render(zbase_view_file_contents('ui.datatable.pagination'), ['paginator' => $rows, 'ui' => $ui]);
    ?>
		</div>
	</div>
<?php 
} else {
    ?>
	<div role="toolbar" class="btn-toolbar">
		<div class="toolbar-wraper col-md-6 pull-left">
			<?php 
    echo zbase_view_render(zbase_view_file_contents('ui.datatable.pagination'), ['paginator' => $rows, 'ui' => $ui]);
    ?>
Esempio n. 2
0
 /**
  * PostPreparation
  * @return void
  */
 protected function _post()
 {
     /**
      * SEnd the UI to a placeholder
      */
     $placeholder = $this->_v('view.placeholder', null);
     if (!empty($placeholder)) {
         zbase_view_placeholder_add($placeholder, $this->id(), $this->render());
     }
 }
Esempio n. 3
0
 /**
  * Return/Create a Widget
  * @param string|array $widget
  * @param array $config Configuration
  * @param boolean $clone Will clone if widget was already created
  * @param array $overrideConfig Confiuration will be overriden
  *
  * @return \Zbase\Widgets\WidgetInterface[] | null
  */
 public function widget($widget, $config = [], $clone = null, $overrideConfig = [])
 {
     if (is_array($widget)) {
         $name = !empty($widget['id']) ? $widget['id'] : null;
         $config = !empty($widget['config']) ? $widget['config'] : [];
         $type = !empty($widget['type']) ? $widget['type'] : [];
     } else {
         $name = $widget;
     }
     if (!empty($name)) {
         if (!empty($this->widgets[$name]) && $this->widgets[$name] instanceof \Zbase\Widgets\WidgetInterface) {
             if (!empty($clone)) {
                 return clone $this->widgets[$name];
             }
             return $this->widgets[$name];
         }
         if (empty($config)) {
             if (is_array($this->widgets[$name])) {
                 $config = $this->widgets[$name];
             }
         }
         if (!empty($config)) {
             if (!empty($overrideConfig)) {
                 $config = array_replace_recursive($config, $overrideConfig);
             }
             $name = !empty($config['id']) ? $config['id'] : null;
             $type = !empty($config['type']) ? $config['type'] : [];
             $config = !empty($config['config']) ? $config['config'] : [];
             if (strtolower($type) == 'form') {
                 $w = new \Zbase\Widgets\Type\Form($name, $config);
             }
             if (strtolower($type) == 'datatable') {
                 $w = new \Zbase\Widgets\Type\Datatable($name, $config);
             }
             if (strtolower($type) == 'treeview') {
                 $w = new \Zbase\Widgets\Type\TreeView($name, $config);
             }
             if (strtolower($type) == 'view') {
                 $w = new \Zbase\Widgets\Type\View($name, $config);
             }
             if (strtolower($type) == 'placeholder') {
                 $w = new \Zbase\Widgets\Type\Placeholder($name, $config);
             }
             if (strtolower($type) == 'db') {
                 $w = new \Zbase\Widgets\Type\Db($name, $config);
             }
             if (!empty($w) && $w instanceof \Zbase\Widgets\WidgetInterface) {
                 if ($w->enabled()) {
                     if (strtolower($type) == 'placeholder') {
                         zbase_view_placeholder_add($w->getPlaceholder(), $w->id(), $w);
                     }
                     return $this->widgets[$name] = $w;
                 }
             }
         }
     }
     return null;
 }