public function preDispatch() { $this->setModel(new Kwc_Directories_Item_Directory_Trl_AdminModel(array('proxyModel' => Kwc_Abstract::createChildModel(Kwc_Abstract::getSetting($this->_getParam('class'), 'masterComponentClass')), 'trlModel' => Kwc_Abstract::createChildModel($this->_getParam('class'))))); parent::preDispatch(); $url = Kwc_Admin::getInstance($this->_getParam('class'))->getControllerUrl('Form'); $this->_editDialog['controllerUrl'] = $url; }
public function preDispatch() { if (!isset($this->_model) && !isset($this->_tableName) && !isset($this->_modelName)) { $this->setModel(Kwc_Abstract::createChildModel($this->_getParam('class'))); } parent::preDispatch(); }
protected function _getModel() { if (!$this->_model) { if (isset($this->_settings['model'])) { if (is_string($this->_settings['model'])) { $this->_model = Kwf_Model_Abstract::getInstance($this->_settings['model']); } else { $this->_model = $this->_settings['model']; } } else { if (isset($this->_settings['table'])) { if (is_string($this->_settings['table'])) { $table = new $this->_settings['table'](); } else { $table = $this->_settings['table']; } if (!$table instanceof Zend_Db_Table_Abstract) { throw new Kwf_Exception("table setting for generator in {$this->_class} is not a Zend_Db_Table"); } $this->_model = new Kwf_Model_Db(array('table' => $table)); } else { if ($this->_loadTableFromComponent) { $this->_model = Kwc_Abstract::createChildModel($this->_class); } else { throw new Kwf_Exception("Can't create model for generator '{$this->getGeneratorKey()}' in '{$this->_class}'"); } } } if (!$this->_model) { throw new Kwf_Exception('model has to be set for table generator in ' . $this->_class); } } return $this->_model; }
public function getListeners() { $ret = parent::getListeners(); $model = Kwc_Abstract::createChildModel($this->_class); $siblingModels = $model->getSiblingModels(); $ret[] = array('class' => get_class($siblingModels[0]), 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onLanguageUpdate'); return $ret; }
public function getListeners() { $ret = parent::getListeners(); $m = Kwc_Abstract::createChildModel($this->_class); $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onOwnRowEvent'); $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onOwnRowEvent'); $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onOwnRowEvent'); return $ret; }
public function preDispatch() { if (!isset($this->_model) && !isset($this->_tableName)) { $this->setModel(Kwc_Abstract::createChildModel($this->_getParam('class'))); } parent::preDispatch(); $url = Kwc_Admin::getInstance($this->_getParam('class'))->getControllerUrl('Comment'); $this->_editDialog['controllerUrl'] = $url; }
public function _initFields() { $this->_form->setModel(Kwc_Abstract::createChildModel($this->_getParam('class'))); $this->_form->add(new Kwf_Form_Field_ShowField('create_time', trlKwf('Created'))); $this->_form->add(new Kwf_Form_Field_Checkbox('visible', trlKwf('Visible'))); $this->_form->add(new Kwf_Form_Field_TextField('name', trlKwf('Name')))->setWidth(300); $this->_form->add(new Kwf_Form_Field_TextField('email', trlKwf('E-Mail')))->setWidth(300); $this->_form->add(new Kwf_Form_Field_TextArea('content', trlKwf('Content')))->setWidth(300)->setHeight(160); }
public function getTrlRowByData(Kwf_Component_Data $data) { $ret = $this->_getRow($data->dbId); if (!$ret) { $m = Kwc_Abstract::createChildModel($this->_class); $ret = $m->createRow(); $ret->component_id = $data->dbId; } return $ret; }
public function getListeners() { $ret = parent::getListeners(); foreach (Kwc_Abstract::getComponentClasses() as $class) { if (in_array('Kwc_Advanced_SearchEngineReferer_Component', Kwc_Abstract::getParentClasses($class))) { $m = Kwc_Abstract::createChildModel($class); $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onRowInsert'); } } return $ret; }
public function getListeners() { $ret = parent::getListeners(); $m = Kwc_Abstract::createChildModel($this->_class); $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onRowUpdate'); $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onRowUpdate'); $masterComponentClass = Kwc_Abstract::getSetting($this->_class, 'masterComponentClass'); $m = Kwc_Abstract::createChildModel($masterComponentClass); $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onMasterRowUpdate'); $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onMasterRowDelete'); return $ret; }
public function getListeners() { $ret = parent::getListeners(); $generators = Kwc_Abstract::getSetting($this->_class, 'generators'); foreach ($generators['paragraphs']['component'] as $component) { $ret[] = array('class' => $component, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onChildHasContentChange'); } $m = Kwc_Abstract::createChildModel($this->_class); $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onRowUpdate'); $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onRowInsertOrDelete'); $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onRowInsertOrDelete'); return $ret; }
public function postUpdate() { foreach (Kwc_Abstract::getComponentClasses() as $c) { if (is_instance_of($c, 'Kwc_Root_TrlRoot_Component')) { if ($m = Kwc_Abstract::createChildModel($c)) { foreach ($m->getRows() as $r) { $r->visible = true; $r->save(); } } } } }
public function setComponentId($componentId) { $c = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($componentId, array('ignoreVisible' => true)); $s = new Kwf_Component_Select(); $s->ignoreVisible(); $s->whereGenerator('paragraphs'); $chainedModel = Kwc_Abstract::createChildModel($c->componentClass); foreach ($c->getChildComponents($s) as $c) { $chainedRow = $chainedModel->getRow($c->dbId); if (!$chainedRow) { $chainedRow = $chainedModel->createRow(array('component_id' => $c->dbId, 'visible' => false)); } $this->_data[$c->componentId] = array('id' => $c->chained->row->id, 'component_id' => $componentId, 'component_class' => $c->componentClass, 'component_name' => Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($c->componentClass, 'componentName')), 'component_icon' => (string) new Kwf_Asset(Kwc_Abstract::getSetting($c->componentClass, 'componentIcon')), 'row' => $chainedRow, 'visible' => $chainedRow->visible, 'pos' => $c->chained->row->pos); } }
public function getListeners() { $ret = parent::getListeners(); $masterGeneratorModel = $this->_getChainedGenerator()->getModel(); $ret[] = array('class' => get_class($masterGeneratorModel), 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onMasterRowUpdate'); $ret[] = array('class' => get_class($masterGeneratorModel), 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onMasterRowAdd'); $ret[] = array('class' => get_class($masterGeneratorModel), 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onMasterRowDelete'); $ret[] = array('class' => get_class($masterGeneratorModel), 'event' => 'Kwf_Events_Event_Model_Updated', 'callback' => 'onMasterModelUpdate'); $m = Kwc_Abstract::createChildModel($this->_class); if ($m) { $ret[] = array('class' => get_class($m), 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onRowUpdate'); $ret[] = array('class' => get_class($m), 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onRowUpdate'); } return $ret; }
public function getListeners() { $ret = parent::getListeners(); foreach (Kwc_Abstract::getComponentClasses() as $class) { if (is_instance_of($class, 'Kwc_Directories_Category_Directory_Component') && $this->_canCreateUsIndirectly($class)) { $childReference = Kwc_Abstract::hasSetting($class, 'childReferenceName') ? Kwc_Abstract::getSetting($class, 'childReferenceName') : 'Categories'; foreach (call_user_func(array($this->_class, 'getItemDirectoryClasses'), $this->_class) as $dirCls) { $dirModel = Kwc_Abstract::createChildModel($dirCls); $relModel = $dirModel->getDependentModel($childReference); $ret[] = array('class' => $relModel, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onUpdateRow'); $ret[] = array('class' => $relModel, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onUpdateRow'); $ret[] = array('class' => $relModel, 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onUpdateRow'); } } } return $ret; }
protected function _initFields() { $class = $this->_getParam('class'); $this->_form->setModel(Kwc_Abstract::createChildModel($class)); $this->_form->setIdTemplate(null); if (is_instance_of(Kwc_Abstract::getSetting($class, 'extConfig'), 'Kwc_Directories_Item_Directory_ExtConfigTabs') || is_instance_of(Kwc_Abstract::getSetting($class, 'extConfigControllerIndex'), 'Kwc_Directories_Item_Directory_ExtConfigTabs')) { $this->_buttons['save'] = true; } $detailClasses = Kwc_Abstract::getChildComponentClasses($class, 'detail'); $forms = array(); foreach ($detailClasses as $key => $detailClass) { $formClass = Kwc_Admin::getComponentClass($detailClass, 'Form'); $form = new $formClass($key, $detailClass, $class); $form->setIdTemplate('{0}'); $form->setModel(Kwc_Abstract::createChildModel($class)); $forms[$key] = $form; } if (count($forms) == 1) { $this->_form->add(reset($forms)); } else { $cards = $this->_form->add(new Kwf_Form_Container_Cards('component', trlKwf('Type')))->setDefaultValue(reset(array_keys($detailClasses))); $cards->getCombobox()->setWidth(250)->setListWidth(250)->setAllowBlank(false); foreach ($forms as $key => $form) { $card = $cards->add(); $card->add($form); $card->setTitle(Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($form->getClass(), 'componentName'))); $card->setName($key); $card->setNamePrefix($key); } $cards->getCombobox()->getData()->cards = $cards->fields; } $classes = Kwc_Abstract::getChildComponentClasses($class); foreach ($classes as $class) { $formName = Kwc_Admin::getComponentClass($class, 'ItemEditForm'); if ($formName) { $this->_form->add(new $formName('detail', $class, $this->_getParam('componentId'))); } } }
protected function _getModel() { if (!$this->_model) { if (isset($this->_settings['model'])) { if (is_string($this->_settings['model'])) { $this->_model = Kwf_Model_Abstract::getInstance($this->_settings['model']); } else { $this->_model = $this->_settings['model']; } } else { if ($this->_loadTableFromComponent) { $this->_model = Kwc_Abstract::createChildModel($this->_class); } else { throw new Kwf_Exception("Can't create model for generator '{$this->getGeneratorKey()}' in '{$this->_class}'"); } } if (!$this->_model) { throw new Kwf_Exception('model has to be set for table generator in ' . $this->_class); } } return $this->_model; }
public function _initFields() { $class = $this->_getParam('class'); $this->_form->setModel(Kwc_Abstract::createChildModel($class)); $gen = Kwf_Component_Generator_Abstract::getInstance($this->_getParam('class'), 'detail'); $detailClasses = Kwc_Abstract::getChildComponentClasses($class, 'detail'); $forms = array(); foreach ($detailClasses as $key => $detailClass) { $formClass = Kwc_Admin::getComponentClass($detailClass, 'Form'); $form = new $formClass($key, $detailClass, $class); $form->setIdTemplate('{0}'); $form->setCreateMissingRow(true); $form->setModel($this->_form->getModel()); $forms[$key] = $form; } if (count($forms) == 1) { $this->_form->add(reset($forms)); } else { $cards = $this->_form->add(new Kwf_Form_Container_Cards('component', trlKwf('Type')))->setComboBox(new Kwf_Form_Field_Hidden('component')); $cards->getCombobox()->setWidth(250)->setListWidth(250)->setAllowBlank(false)->setData(new Kwc_Directories_Item_Directory_Trl_FormController_ComponentData('component')); foreach ($forms as $key => $form) { $card = $cards->add(); $card->add($form); $card->setTitle(Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($form->getClass(), 'componentName'))); $card->setName($key); $card->setNamePrefix($key); } $cards->getCombobox()->getData()->cards = $cards->fields; } $classes = Kwc_Abstract::getChildComponentClasses($class); foreach ($classes as $class) { $formName = Kwc_Admin::getComponentClass($class, 'ItemEditForm'); if ($formName) { $this->_form->add(new $formName('detail', $class, $this->_getParam('componentId'))); } } }
protected function _initColumns() { $this->setModel(Kwc_Abstract::createChildModel($this->_getParam('class'))); $this->_columns->add(new Kwf_Grid_Column_Visible()); $this->_columns->add(new Kwf_Grid_Column('name', trlKwf('Category'), 300))->setEditor(new Kwf_Form_Field_TextField()); }
public function duplicateChild($source, $parentTarget) { if ($source->generator !== $this) { throw new Kwf_Exception("you must call this only with the correct source"); } //Annahme: sourceChildren und targetChildren müssen in der gleichen Reinhenfolge daherkommen //gibt es einen generator ohne pos oder datum oder ähnlichem? $sourceChildren = array_values($source->generator->getChildData($source->parent, array('ignoreVisible' => true))); $targetChildren = array_values($this->getChildData($parentTarget, array('ignoreVisible' => true))); $target = null; foreach ($sourceChildren as $i => $sc) { if ($sc->componentId == $source->componentId) { $target = $targetChildren[$i]; } } if ($m = Kwc_Abstract::createChildModel($this->_class)) { $targetRow = $this->_getRow($target->dbId); if (!$targetRow) { $targetRow = $m->createRow(); $targetRow->component_id = $target->dbId; } $sourceRow = $this->_getRow($source->dbId); if ($sourceRow) { foreach ($sourceRow->toArray() as $k => $i) { if ($this->_getRow($source->dbId)->getModel()->getPrimaryKey() != $k) { $targetRow->{$k} = $i; } } } $targetRow->save(); } Kwc_Admin::getInstance($source->componentClass)->duplicate($source, $target); return $target; }
public function preDispatch() { parent::preDispatch(); $this->setModel(Kwc_Abstract::createChildModel($this->_getParam('class'))); }
protected function _initColumns() { parent::_initColumns(); $this->setModel(Kwc_Abstract::createChildModel($this->_getParam('class'))); $this->_columns->add(new Kwf_Grid_Column('tag_text', trlKwf('Tag'))); }
public function getModel() { return Kwc_Abstract::createChildModel($this->_class); }