Ejemplo n.º 1
0
 protected function _initColumns()
 {
     parent::_initColumns();
     $this->_columns->add(new Kwf_Grid_Column('id'));
     //shows editDialog
     $this->_columns->add(new Kwf_Grid_Column_Button('properties', ' ', 20))->setButtonIcon('/assets/silkicons/newspaper.png')->setTooltip(trlKwf('Properties'));
     if (is_instance_of(Kwc_Abstract::getSetting($this->_getParam('class'), 'extConfig'), 'Kwc_Directories_Item_Directory_ExtConfigEditButtons')) {
         $extConfigType = 'extConfig';
     } else {
         if (is_instance_of(Kwc_Abstract::getSetting($this->_getParam('class'), 'extConfigControllerIndex'), 'Kwc_Directories_Item_Directory_ExtConfigEditButtons')) {
             $extConfigType = 'extConfigControllerIndex';
         }
     }
     $extConfig = Kwf_Component_Abstract_ExtConfig_Abstract::getInstance($this->_getParam('class'), $extConfigType)->getConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_DEFAULT);
     $extConfig = $extConfig['items'];
     if (count($extConfig['countDetailClasses']) > 1 && !$this->_getModel()->hasColumn('component')) {
         throw new Kwf_Exception('If you have more than one detail-component your table has to have a column named "component"');
     }
     $i = 0;
     foreach ($extConfig['contentEditComponents'] as $ec) {
         $name = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($ec['componentClass'], 'componentName'));
         $icon = Kwc_Abstract::getSetting($ec['componentClass'], 'componentIcon');
         $icon = new Kwf_Asset($icon);
         $this->_columns->add(new Kwc_Directories_Item_Directory_Trl_ControllerEditButton('edit_' . $i, ' ', 20))->setColumnType('editContent')->setEditComponentClass($ec['componentClass'])->setEditComponent($ec['component'])->setEditType($ec['type'])->setEditIdTemplate($ec['idTemplate'])->setEditComponentIdSuffix($ec['componentIdSuffix'])->setButtonIcon($icon->toString(array('arrow')))->setTooltip(trlKwf('Edit {0}', $name));
         $i++;
     }
 }
 protected function _formatNode($row)
 {
     $component = $row->getData();
     $data = parent::_formatNode($row);
     $data['uiProvider'] = 'Kwf.Component.PagesNode';
     $nodeConfig = $this->_getNodeConfig($component);
     if (is_null($nodeConfig)) {
         return null;
     }
     $data = array_merge($data, $nodeConfig);
     $icon = $data['icon'];
     if (is_string($icon)) {
         $icon = new Kwf_Asset($icon);
     }
     $data['bIcon'] = $icon->toString($data['iconEffects']);
     if (isset($data['icon'])) {
         unset($data['icon']);
     }
     if (!$data['expanded']) {
         $openedNodes = $this->_saveSessionNodeOpened(null, null);
         if ($data['disabled'] && !array_key_exists($row->id, $openedNodes)) {
             $data['expanded'] = true;
         }
     }
     if ($data['loadChildren'] || $data['expanded'] || $data['disabled']) {
         $data['children'] = $this->_formatNodes($component->componentId);
     }
     return $data;
 }
Ejemplo n.º 3
0
 public static function getFavicon()
 {
     if (Kwf_Registry::get('config')->ext->favicon) {
         return Kwf_Registry::get('config')->ext->favicon;
     } else {
         if (file_exists('images/favicon.ico')) {
             $ico = new Kwf_Asset('images/favicon.ico', 'web');
             $fx = Kwf_Registry::get('config')->ext->faviconFx;
             if (!$fx) {
                 $fx = array();
             } else {
                 if (is_string($fx)) {
                     $fx = array($fx);
                 }
             }
             return $ico->toString($fx);
         }
     }
     return null;
 }
 protected function _changeVisibility(Kwf_Model_Row_Interface $row)
 {
     parent::_changeVisibility($row);
     $row->getData()->visible = $row->visible;
     $config = $row->getData()->generator->getPagesControllerConfig($row->getData());
     $icon = new Kwf_Asset($config['icon']);
     $this->view->icon = $icon->toString($config['iconEffects']);
     if (isset($row->getData()->isHome) && $row->getData()->isHome) {
         throw new Kwf_ClientException(trlKwf('Cannot set Home Page invisible'));
     }
     if (!$row->visible) {
         $this->_checkRowIndependence($row, trlKwf('hide'));
     }
 }