예제 #1
0
 public function jsonDataAction()
 {
     $component = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('componentId'), array('ignoreVisible' => true));
     $row = $component->getComponent()->getRow();
     $select = new Kwf_Model_Select();
     $select->whereEquals('component_id', $this->_getParam('componentId'));
     $columnTypes = Kwc_Abstract::getSetting($this->_getParam('class'), 'columns');
     $typeName = array_shift(array_keys($columnTypes));
     if ($row && $row->type) {
         $typeName = $row->type;
     }
     $difference = count($columnTypes[$typeName]['colSpans']) - $this->_model->countRows($select);
     while ($difference > 0) {
         $this->_model->createRow(array('component_id' => $this->_getParam('componentId'), 'visible' => true))->save();
         $difference--;
     }
     parent::jsonDataAction();
 }
 protected function _initColumns()
 {
     parent::_initColumns();
     $extConfig = Kwc_Admin::getInstance($this->_getParam('class'))->getExtConfig();
     $extConfig = $extConfig['list'];
     $i = 0;
     foreach ($extConfig['contentEditComponents'] as $ec) {
         if (isset($ec['title'])) {
             $name = $ec['title'];
             $icon = $ec['icon'];
         } else {
             $name = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($ec['componentClass'], 'componentName'));
             $icon = Kwc_Abstract::getSetting($ec['componentClass'], 'componentIcon');
             $icon = $icon->toString(array('arrow'));
         }
         $this->_columns->add(new Kwf_Grid_Column_Button('edit_' . $i, ' ', 20))->setNoIconWhenNew(true)->setColumnType('editContent')->setEditComponentClass($ec['componentClass'])->setEditType($ec['type'])->setEditIdTemplate($ec['idTemplate'])->setEditComponentIdSuffix($ec['componentIdSuffix'])->setButtonIcon($icon)->setTooltip(trlKwf('Edit {0}', $name));
         $i++;
     }
 }