Exemplo n.º 1
0
 public function __construct($config = array())
 {
     if (!isset($this->_default['content'])) {
         $this->_default['content'] = '<p>' . Kwc_Abstract::LOREM_IPSUM . '</p>';
     }
     parent::__construct($config);
 }
Exemplo n.º 2
0
 protected function _init()
 {
     parent::_init();
     $this->_referenceMap = array('Author' => array('refModel' => Kwf_Registry::get('userModel'), 'column' => 'author_id'));
     $this->_exprs['author_firstname'] = new Kwf_Model_Select_Expr_Parent('Author', 'firstname');
     $this->_exprs['author_lastname'] = new Kwf_Model_Select_Expr_Parent('Author', 'lastname');
 }
 protected function _init()
 {
     parent::_init();
     if (!count($this->_referenceMap['Item'])) {
         throw new Kwf_Exception("Reference 'Item' must be set in model '" . get_class($this) . "'");
     }
 }
Exemplo n.º 4
0
 public function __construct($config = array())
 {
     $this->_tableName = uniqid('dbtest_child');
     $config['table'] = $this->_tableName;
     $this->_referenceMap = array('Parent' => 'parent_id->Kwf_Model_DbWithConnection_ProxyReferences_ParentModel', 'Parent2' => 'parent2_id->Kwf_Model_DbWithConnection_ProxyReferences_Parent2Model');
     parent::__construct($config);
 }
Exemplo n.º 5
0
 protected function _init()
 {
     parent::_init();
     if (Kwf_Config::getValue('aws.uploadsBucket')) {
         $this->_rowClass = 'Kwf_Util_Aws_Uploads_S3Row';
     }
 }
Exemplo n.º 6
0
 public function __construct($config = array())
 {
     $this->_tableName = uniqid('dbtest_parent');
     $config['proxyModel'] = new Kwf_Model_Db(array('table' => $this->_tableName));
     $this->_dependentModels['Childs'] = 'Kwf_Model_DbWithConnection_ParentExprIf_ChildModel';
     parent::__construct($config);
 }
 public function getReferencedModel($ref)
 {
     if ($ref == 'Component') {
         return Kwc_Basic_Text_ModelFactory::getModelInstance(array('componentClass' => $this->_componentClass));
     } else {
         return parent::getReferencedModel($ref);
     }
 }
Exemplo n.º 8
0
 public function hasColumn($col)
 {
     if ($col == 'component_id') {
         return in_array($col, $this->getOwnColumns());
         // component_id must not be in siblings
     }
     if ($col == 'component') {
         return false;
     }
     return parent::hasColumn($col);
 }
Exemplo n.º 9
0
 protected function _createDependentModel($rule)
 {
     if ($rule == 'ChildComponents') {
         if (!isset($this->_childComponentsModel)) {
             $c = $this->_dependentModels[$rule];
             $this->_childComponentsModel = new $c(array('componentClass' => $this->_componentClass));
         }
         return $this->_childComponentsModel;
     } else {
         return parent::_createDependentModel($rule);
     }
 }
 public function update()
 {
     // daten von kwc_columns in kwc_composite_list kopieren
     $columnsModel = new Kwf_Model_Db_Proxy(array('table' => 'kwc_columns'));
     $listModel = new Kwf_Model_Db_Proxy(array('table' => 'kwc_composite_list', 'siblingModels' => array(new Kwf_Model_Field(array('fieldName' => 'data')))));
     foreach ($columnsModel->getRows() as $colRow) {
         $listRow = $listModel->createRow();
         $listRow->component_id = $colRow->component_id;
         $listRow->pos = $colRow->pos;
         $listRow->visible = 1;
         $listRow->width = $colRow->width;
         $listRow->save();
         // ersetzungen für master
         $action = new Kwf_Update_Action_Component_ConvertComponentIds(array('search' => $colRow->component_id . '-' . $colRow->id, 'replace' => $listRow->component_id . '-' . $listRow->id));
         $action->checkSettings();
         $action->update();
         // ersetzungen für trl
         $action = new Kwf_Update_Action_Component_ConvertComponentIds(array('search' => $colRow->component_id . '-' . $colRow->id, 'replace' => $listRow->component_id . '-' . $listRow->id, 'pattern' => 'root-%\\_' . $colRow->component_id . '-' . $colRow->id . '%'));
         $action->checkSettings();
         $action->update();
     }
 }
Exemplo n.º 11
0
 public function deleteRows($where)
 {
     $whereEquals = $where->getPart('whereEquals');
     if (!$whereEquals || !isset($whereEquals['newsletter_id'])) {
         throw new Kwf_Exception('No newsletter_id set');
     }
     $select = new Kwf_Model_Select();
     $select->whereEquals('id', $whereEquals['newsletter_id']);
     $newsletter = $this->getReferencedModel('Newsletter')->getRow($select);
     if (!$newsletter) {
         throw new Kwf_Exception('No Newsletter found');
     }
     if (in_array($newsletter->status, array('start', 'stop', 'finished', 'sending'))) {
         throw new Kwf_ClientException(trlKwf('Can only remove users from a paused newsletter'));
     }
     parent::deleteRows($where);
 }
Exemplo n.º 12
0
 public function createRow(array $data = array())
 {
     $row = parent::createRow($data);
     if (!is_instance_of($this->_mailerClass, 'Kwf_Mail')) {
         throw new Kwf_Exception("mailerClass must be instance of 'Kwf_Mail'. '" . $this->_mailerClass . "' given.");
     }
     if (empty($this->_mailTemplate)) {
         throw new Kwf_Exception("mail template not set for class '" . get_class($this) . "' in construct-config");
     }
     if (!is_string($this->_mailTemplate)) {
         throw new Kwf_Exception("mail template must be of type 'string' but type '" . gettype($this->_mailTemplate) . "' has been set");
     }
     $row->setTemplate($this->_mailTemplate);
     $row->setMailerClass($this->_mailerClass);
     $row->setSpamFields($this->_spamFields);
     if ($this->_mailMasterTemplate) {
         $row->setMasterTemplate($this->_mailMasterTemplate);
     }
     return $row;
 }
 protected function _setupFilters()
 {
     parent::_setupFilters();
     $this->_filters['pos'] = new Kwf_Filter_Row_Numberize();
     $this->_filters['pos']->setGroupBy('component_id');
 }
 protected function _setupFilters()
 {
     parent::_setupFilters();
     $this->_filters['filename'] = new Kwc_Root_Category_Trl_FilenameFilter();
 }
Exemplo n.º 15
0
 protected function _init()
 {
     $userModelClass = get_class(Kwf_Registry::get('userModel'));
     $this->_referenceMap['InsertUser']['refModelClass'] = $userModelClass;
     parent::_init();
 }
Exemplo n.º 16
0
 protected function _init()
 {
     $this->_siblingModels[] = new Kwf_Model_Field(array('fieldName' => 'data'));
     parent::_init();
 }
Exemplo n.º 17
0
 protected function _init()
 {
     parent::_init();
     $this->_siblingModels['styles'] = new Kwf_Model_Field(array('fieldName' => 'styles'));
 }
Exemplo n.º 18
0
 protected function _init()
 {
     parent::_init();
     $this->_referenceMap['Parent'] = array('column' => 'parent_id', 'refModel' => $this);
     $this->_dependentModels['Childs'] = $this;
 }