示例#1
0
 /**
  * Construct
  *
  * @param string $template
  * @param string $title
  * @param string $icon
  * @param int $width
  */
 public function __construct($template, $title, $icon = null, $width = 160)
 {
     parent::__construct(null, null, false, false, $width, false, null);
     $this->_template = $template;
     $this->_templateTitle = $title;
     $this->_icon = $icon;
 }
示例#2
0
 /**
  * Constructor
  * 
  * @param string $title
  * @param string|array $path
  * @param string $column
  * @param string $orderBy
  * @param string $separator
  * @param int $count
  * @param int $width
  */
 public function __construct($title, $path = null, $column = null, $orderBy = null, $separator = ',', $count = 5, $width = 450, $isEditable = true)
 {
     parent::__construct($title, null, false, false, $width, $isEditable, null);
     $this->_path = $path;
     $this->_column = $column;
     $this->_orderBy = $orderBy;
     $this->_separator = $separator;
     $this->_count = $count;
 }
示例#3
0
 /**
  * Set grid object and init grid column key.
  *
  * @param \Engine\Crud\Grid $grid
  * @param string $key
  * @return \Engine\Crud\Grid\Column
  */
 public function init(Grid $grid, $key)
 {
     parent::init($grid, $key);
     foreach ($this->_columns as $k => $column) {
         if (!$column instanceof Column) {
             throw new \Engine\Exception("Column '{$k}' not instance of Column");
         }
         $column->init($grid, $k);
     }
 }
示例#4
0
 /**
  * Render string model column type
  *
  * @param \Engine\Crud\Grid\Column $column
  * @return string
  */
 public static function _string(Column $column)
 {
     $columnCode = [];
     $columnCode[] = "text: '" . $column->getTitle() . "'";
     $columnCode[] = "dataIndex: '" . $column->getKey() . "'";
     $columnCode[] = "width: " . $column->getWidth();
     if ($column->isSortable()) {
         $columnCode[] = "sortable: true";
     }
     if ($column->isHidden()) {
         $columnCode[] = "hidden: true";
     }
     if ($column->isEditable()) {
         $columnCode[] = "field: 'textfield'";
     }
     return forward_static_call(['static', '_implode'], $columnCode);
 }
示例#5
0
 /**
  * Render string model column type
  *
  * @param \Engine\Crud\Grid\Column $column
  * @return string
  */
 public static function _string(Column $column)
 {
     $field = $column->getKey();
     $columnCode = "\n                    {\n                        name: '" . $field . "',\n                        type: 'string'\n                    }";
     return $columnCode;
 }