예제 #1
0
 public function gridColumns()
 {
     $ret = array();
     $c = new Kwf_Grid_Column('string', trlKwf('Product'), 200);
     $c->setData(new Kwf_Component_Abstract_ToStringData($this->_class));
     $ret['string'] = $c;
     return $ret;
 }
예제 #2
0
 public function gridColumns()
 {
     $ret = parent::gridColumns();
     $c = new Kwf_Grid_Column('infotext', trlKwf('Descriptiontext'));
     $c->setData(new Kwf_Data_Kwc_Table(Kwc_Abstract::getSetting($this->_class, 'ownModel'), 'infotext', $this->_class));
     $c->setEditor(new Kwf_Form_Field_TextField());
     $ret['infotext'] = $c;
     return $ret;
 }
예제 #3
0
 public function gridColumns()
 {
     $ret = array();
     $c = new Kwf_Grid_Column('string', trlKwf('Link Text'));
     $c->setData(new Kwf_Component_Abstract_ToStringData($this->_class));
     $ret['string'] = $c;
     $ret = array_merge($ret, parent::gridColumns());
     return $ret;
 }
예제 #4
0
 public function __construct($dataIndex = null, $header = null, $width = 30)
 {
     parent::__construct($dataIndex, $header, $width);
     $this->setType('boolean');
     $this->setSortable(false);
     $this->setRenderer('boolean');
 }
 public function __construct($dataIndex = null, $header = '', $width = 30)
 {
     parent::__construct($dataIndex, $header, $width);
     $this->setShowIn(self::SHOW_IN_GRID);
     $this->setRenderer('booleanRtr');
     $this->setSortable(false);
     $this->setType('boolean');
 }
예제 #6
0
 public function gridColumns()
 {
     $ret = array();
     $c = new Kwf_Grid_Column('pic', trlKwf('Image'), 100);
     $c->setData(new Kwf_Data_Kwc_Image($this->_class, 'gridRow'))->setRenderer('mouseoverPic');
     $ret['pic'] = $c;
     $c = new Kwf_Grid_Column('pic_large');
     $c->setData(new Kwf_Data_Kwc_Image($this->_class, 'gridRowLarge'));
     $ret['pic_large'] = $c;
     if (Kwc_Abstract::getSetting($this->_class, 'imageCaption')) {
         $c = new Kwf_Grid_Column('image_caption', trlKwf('Image caption'));
         $c->setData(new Kwf_Data_Kwc_Table(Kwc_Abstract::getSetting($this->_class, 'ownModel'), 'image_caption', $this->_class));
         $c->setEditor(new Kwf_Form_Field_TextField());
         $ret['image_caption'] = $c;
     }
     return $ret;
 }
예제 #7
0
 public function __construct($dataIndex = null, $header = '', $width = 30)
 {
     parent::__construct($dataIndex, $header, $width);
     $this->setShowIn(self::SHOW_IN_GRID);
     $this->setRenderer('cellButton');
     $this->setSortable(false);
     $this->setColumnType('button');
     $this->setData(new Kwf_Data_Empty());
 }
예제 #8
0
 public function __construct($dataIndex = null, $header = null, $ruleKey = null)
 {
     parent::__construct($dataIndex, $header, 60);
     $this->setRenderer('image');
     $this->setRuleKey($ruleKey);
     $this->setSortable(false);
     $this->setMaxHeight(19);
     $this->setShowHoverImage(false);
 }
예제 #9
0
 public function load($row, $role, $info)
 {
     $ret = parent::load($row, $role, $info);
     $ret = substr($ret, 0, 10);
     if ($ret == '0000-00-00') {
         $ret = null;
     }
     //todo: datum formatieren wenn export; übersetzung berücksichtigen
     return $ret;
 }
예제 #10
0
 public function __construct($dataIndex = null, $header = null, $width = 110)
 {
     if (is_null($header)) {
         $header = trlKwf('Date');
     }
     parent::__construct($dataIndex, $header, $width);
     $this->setType('date');
     $this->setRenderer('localizedDatetime');
     $this->setDateFormat('Y-m-d H:i:s');
 }
예제 #11
0
 public function preDispatch()
 {
     parent::preDispatch();
     $addColumns = array();
     if (is_array($this->_columns)) {
         $addColumns = $this->_columns;
     }
     $this->_columns = new Kwf_Collection();
     foreach ($addColumns as $k => $column) {
         if (is_array($column)) {
             $columnObject = new Kwf_Grid_Column();
             foreach ($column as $propName => $propValue) {
                 $columnObject->setProperty($propName, $propValue);
             }
             $this->_columns[] = $columnObject;
         } else {
             $this->_columns[] = $column;
         }
     }
     if (!isset($this->_model) && isset($this->_tableName)) {
         $this->setTable(new $this->_tableName());
     }
     if (!isset($this->_model) && isset($this->_table)) {
         $this->setTable($this->_table);
     }
     if (!isset($this->_model) && isset($this->_modelName)) {
         $this->_model = Kwf_Model_Abstract::getInstance($this->_modelName);
     } else {
         if (isset($this->_model) && is_string($this->_model)) {
             $this->_model = Kwf_Model_Abstract::getInstance($this->_model);
         }
     }
     $filters = new Kwf_Controller_Action_Auto_FilterCollection();
     // Abwärtskompatibilität für Filterarray
     if (is_array($this->_filters)) {
         foreach ($this->_filters as $field => $config) {
             $filters->offsetSet($field, $config);
         }
     }
     $this->_filters = $filters;
     $this->_initColumns();
     // Abwärtskompatibilität falls Filterarray in initColumns gesetzt wurden
     if (is_array($this->_filters)) {
         $filters = new Kwf_Controller_Action_Auto_FilterCollection();
         foreach ($this->_filters as $field => $config) {
             $filters->offsetSet($field, $config);
         }
         $this->_filters = $filters;
     }
     $filters = is_array($this->_filters) ? $this->_filters : array();
     if ($this->_getParam('query') && !isset($this->_filters['text'])) {
         $this->_filters['text'] = true;
     }
     foreach ($this->_filters as $filter) {
         if ($this->_model) {
             $filter->setModel($this->_model);
         }
         // Abwärtskompatibilität für Textfilter mit queryFields und querySeparator
         if (!$filter instanceof Kwf_Controller_Action_Auto_Filter_Text) {
             continue;
         }
         if (!$filter->getProperty('queryFields', true)) {
             $queryFields = $this->_queryFields;
             if (!$queryFields) {
                 $queryFields = array();
                 foreach ($this->_columns as $column) {
                     $index = $column->getDataIndex();
                     if (isset($this->_model) && !in_array($index, $this->_model->getColumns())) {
                         continue;
                     }
                     $queryFields[] = $index;
                 }
             }
             $info = $this->_getTableInfo();
             if ($info && $this->_primaryKey && !in_array($this->_primaryKey, $queryFields) && !in_array($info['name'] . '.' . $this->_primaryKey, $queryFields)) {
                 $queryFields[] = $this->_primaryKey;
             }
             $filter->setQueryFields($queryFields);
         }
         if ($this->_querySeparator) {
             $filter->setQuerySeparator($this->_querySeparator);
         }
     }
     if (isset($this->_model) && !isset($this->_primaryKey)) {
         $this->_primaryKey = $this->_model->getPrimaryKey();
     }
     if (isset($this->_model) && $this->_position && !isset($this->_columns[$this->_position]) && in_array($this->_position, $this->_model->getColumns())) {
         $columnObject = new Kwf_Grid_Column($this->_position);
         $columnObject->setHeader(' ')->setWidth(35)->setType('int');
         if (isset($this->_permissions['save']) && $this->_permissions['save']) {
             $columnObject->setEditor('PosField');
         }
         $this->_columns->prepend($columnObject);
         $this->_sortable = false;
         $this->_defaultOrder = $this->_position;
     }
     if (isset($this->_model) && ($info = $this->_getTableInfo())) {
         foreach ($this->_columns as $column) {
             if (!$column->getType()) {
                 $column->setType((string) $this->_model->getColumnType($column->getDataIndex()));
             }
         }
     }
     if ($this->_primaryKey) {
         $primaryFound = false;
         foreach ($this->_columns as $column) {
             if ($column->getDataIndex() == $this->_primaryKey) {
                 $primaryFound = true;
             }
         }
         if (!$primaryFound) {
             //primary key hinzufügen falls er noch nicht in gridColumns existiert
             $columnObject = new Kwf_Grid_Column($this->_primaryKey);
             if (isset($this->_model)) {
                 $columnObject->setType((string) $this->_model->getColumnType($this->_primaryKey));
             } else {
                 // fallback
                 $columnObject->setType('string');
             }
             $this->_columns[] = $columnObject;
         }
     }
     if (!isset($this->_defaultOrder)) {
         $this->_defaultOrder = $this->_columns->first()->getDataIndex();
     }
     if (is_string($this->_defaultOrder)) {
         $this->_defaultOrder = array('field' => $this->_defaultOrder, 'direction' => 'ASC');
     }
     if (method_exists($this, '_getWhereQuery')) {
         throw new Kwf_Exception("_getWhereQuery doesn't exist anymore");
     }
     // Falls Filter einen Default-Wert hat:
     // - GET query-Parameter setzen,
     // - Im JavaScript nach rechts verschieben und Defaultwert setzen
     foreach ($this->_filters as $filter) {
         if ($filter instanceof Kwf_Controller_Action_Auto_Filter_Text) {
             continue;
         }
         $param = $filter->getParamName();
         if ($filter->getDefault() && !$this->_getParam($param)) {
             $this->_setParam($param, $filter->getDefault());
         }
     }
 }
예제 #12
0
 public function __construct($width = 30)
 {
     parent::__construct();
     $this->setWidth($width);
     $this->setHeader('');
 }