示例#1
0
 public static function trs($depth = 0)
 {
     $trs = array();
     foreach (\GCore\Helpers\DataPresenter::$cells_data as $k => $column_data) {
         $tds = array();
         $row = \GCore\Helpers\DataPresenter::$cells_rows[$k];
         foreach (\GCore\Helpers\DataPresenter::$columns as $column) {
             $data = $column_data[$column];
             $info = !empty(\GCore\Helpers\DataPresenter::$columns_info[$column]) ? \GCore\Helpers\DataPresenter::$columns_info[$column] : array();
             $indent_class = '';
             /*if(!empty(\GCore\Helpers\DataPresenter::$config['children']) AND \GCore\Helpers\DataPresenter::$config['indent_column'] == $column){
             			$indent_class = " depth-".$depth;
             		}*/
             $class = !empty($info['class']) ? \GCore\Helpers\Html::addClass($info['class'], "td-" . $column . $indent_class) : "td-" . $column . $indent_class;
             $tds[] = \GCore\Helpers\Html::container('td', $data, array("class" => $class, "style" => empty($info['style']) ? '' : \GCore\Helpers\Html::styles($info['style'])));
         }
         self::$count = 1 - self::$count;
         $row['k'] = $k;
         $tr_contents = \GCore\Libs\Str::replacer(implode("\n", $tds), $row, array('escape' => true));
         //$tr_contents = \GCore\Helpers\DataLoader::load($tr_contents, $row);
         $trs[] = \GCore\Helpers\Html::container('tr', $tr_contents, array("class" => "row" . self::$count . " tr-list-" . self::$count));
         //check children
         /*if(!empty(\GCore\Helpers\DataPresenter::$config['children'])){
         			$children = \GCore\Libs\Arr::getVal($row, array(\GCore\Helpers\DataPresenter::$config['model_alias'], 'children'));
         			if(!empty($children)){
         				$trs = array_merge($trs, self::trs($children, $depth + 1));
         			}
         		}*/
     }
     return $trs;
 }
示例#2
0
 public static function html_input($name, $params = array())
 {
     if (!in_array($params['type'], array('radio', 'checkbox', 'checkbox_group'))) {
         $params['class'] = \GCore\Helpers\Html::addClass(array('form-control'), $params['class']);
     }
     if (in_array($params['type'], array('file'))) {
         $params['class'] = \GCore\Helpers\Html::addClass(array('gcore-height-auto'), $params['class']);
     }
     if (!array_intersect(explode(' ', $params['class']), array('A', 'F', 'SSS', 'SS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'))) {
         $params['class'] = \GCore\Helpers\Html::addClass(array('A'), $params['class']);
     }
     return \GCore\Helpers\Html::html_input($name, $params);
 }
示例#3
0
 public static function html_formInput($name, $params = array(), $formInputParams = array())
 {
     $fixed_width_classes = array_intersect(explode(' ', $params['class']), array('A', 'SSS', 'SS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'));
     if (!$fixed_width_classes) {
         $fixed_width_classes = array('A');
         $params['class'] = \GCore\Helpers\Html::addClass($fixed_width_classes, $params['class']);
     }
     if (!empty($params['inputs'])) {
         $inputs = array();
         foreach ($params['inputs'] as $sub_input) {
             if (!empty($sub_input['name'])) {
                 $generated_input = \GCore\Helpers\Html::formLine($sub_input['name'], $sub_input);
                 $inputs[] = $generated_input;
             }
         }
         $input = implode("\n", $inputs);
     } else {
         $input = self::html_input($name, $params);
     }
     //$input = str_replace('gcore-radio-item', 'gcore-radio-item ui radio checkbox', $input);
     //$input = str_replace('gcore-checkbox-item', 'gcore-checkbox-item ui checkbox', $input);
     if ($params['type'] == 'multi') {
         return $input;
     }
     $tags = array();
     $input_class = array('ui', 'left', 'input');
     $input_class[] = 'gcore-display-table';
     if (!empty($params['horizontal'])) {
         $input_class[] = 'gcore-multiple-column';
     }
     $input_class[] = implode(' ', $fixed_width_classes);
     if (in_array($params['type'], array('button', 'reset', 'submit'))) {
         $input_class = array('ui', 'left');
     }
     $input_attachments = array();
     if (!empty($params['icon'])) {
         $input_class[] = 'icon';
         $input_attachments[] = $params['icon'];
     }
     if (!empty($params['labeled'])) {
         $input_class[] = 'labeled';
         $input_attachments[] = '<div class="ui corner label">' . $params['labeled'] . '</div>';
     }
     $tags[] = '<div class="' . implode(' ', $input_class) . '">';
     $tags[] = $input;
     $tags = array_merge($tags, $input_attachments);
     $tags[] = '</div>';
     return implode("\n", $tags);
 }
示例#4
0
 public static function html_input($name, $params = array())
 {
     if (!in_array($params['type'], array('radio', 'checkbox', 'checkbox_group', 'submit', 'button', 'reset'))) {
         $params['class'] = \GCore\Helpers\Html::addClass(array('form-control'), $params['class']);
     }
     if (in_array($params['type'], array('file'))) {
         $params['class'] = \GCore\Helpers\Html::addClass(array('gcore-height-auto'), $params['class']);
     }
     if (in_array($params['type'], array('radio', 'checkbox_group'))) {
         $params['label_input'] = true;
     }
     if (!array_intersect(explode(' ', $params['class']), array('A', 'F', 'SSS', 'SS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'))) {
         //$params['class'] = \GCore\Helpers\Html::addClass(array('A'), $params['class']); //bspure fix
     }
     $return = \GCore\Helpers\Html::html_input($name, $params);
     //bspure fix
     if (in_array($params['type'], array('multi'))) {
         $return .= '<div class="clearfix"></div>';
     }
     return $return;
 }