Example #1
0
 protected function _beforeInsert()
 {
     parent::_beforeInsert();
     if (!$this->visible) {
         $this->visible = 0;
     }
 }
Example #2
0
 public function _beforeDelete()
 {
     parent::_beforeDelete();
     $pk = $this->getModel()->getPrimaryKey();
     $sourceRow = $this->getModel()->getSourceModel()->getRow($this->{$pk});
     $sourceRow->delete();
 }
Example #3
0
 public function delete()
 {
     $this->_model->deleteCacheDataRow($this->_getRow());
     $ret = parent::delete();
     $this->_model->clearCacheStore();
     return $ret;
 }
Example #4
0
 protected function _afterDelete()
 {
     parent::_afterDelete();
     if ($this->getModel()->useRecursiveIdsCache()) {
         $this->getModel()->getRecursiveIdsCache()->clean();
     }
 }
Example #5
0
 protected function _beforeSave()
 {
     parent::_beforeSave();
     if (!$this->component) {
         throw new Kwf_Exception("component can not be empty");
     }
 }
Example #6
0
 public function toArray()
 {
     $ret = parent::toArray();
     if ($this->_trlRow) {
         $ret = array_merge(parent::toArray(), $this->_trlRow->toArray());
     }
     return $ret;
 }
 protected function _beforeDelete()
 {
     $newsletter = $this->getParentRow('Newsletter');
     if (in_array($newsletter->status, array('start', 'stop', 'finished'))) {
         throw new Kwf_ClientException(trlKwf('Can only add users to a paused newsletter'));
     }
     parent::_beforeDelete();
 }
Example #8
0
 public function __get($name)
 {
     if ($name == 'columns') {
         throw new Kwf_Exception("Theres no field named 'columns' anymore. Getting the column count is implemented in Kwc_Basic_Table_Component->getColumnCount()");
     } else {
         return parent::__get($name);
     }
 }
 protected function _afterInsert()
 {
     Kwf_Model_Proxy_Row::_afterInsert();
     //nicht parent!!
     //_buildContentAndSetToRow() hier nicht aufrufen, weil wir den contents selbst setzen (in der Component.php)
     $this->is_spam = $this->_checkIsSpam();
     //sendMail() hier nicht aufrufen, da wir das selbst aufrufen nachdem der content gesetzt wurde
 }
 protected function _afterInsert()
 {
     parent::_afterInsert();
     $r = Kwf_Model_Abstract::getInstance('Kwf_Crm_Customer_Model_Comments')->createRow();
     $r->customer_id = $this->id;
     $authedUser = Kwf_Registry::get('userModel')->getAuthedUser();
     $r->value = trlKwf('Customer added by {0}', $authedUser ? $authedUser->__toString() : 'Import');
     $r->save();
 }
 protected function _beforeUpdate()
 {
     parent::_beforeUpdate();
     if (in_array('filename', $this->getDirtyColumns())) {
         $model = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->component_id, array('ignoreVisible' => true))->generator->getHistoryModel();
         $data = array('component_id' => $this->component_id, 'filename' => $this->getCleanValue('filename'));
         $row = $model->createRow($data);
         $row->save();
     }
 }
Example #12
0
 public function __construct(array $config)
 {
     parent::__construct($config);
     if (!$this->sitemap_priority) {
         $this->sitemap_priority = 0.5;
     }
     if (!$this->sitemap_changefreq) {
         $this->sitemap_changefreq = 'weekly';
     }
 }
 public function __get($name)
 {
     $ret = null;
     if ($this->_trlRow->hasColumn($name)) {
         $ret = $this->_trlRow->{$name};
     }
     if ($name != 'visible' && !$ret) {
         $ret = parent::__get($name);
     }
     return $ret;
 }
Example #14
0
 protected function _beforeSave()
 {
     parent::_beforeSave();
     if (is_null($this->filename)) {
         $fRow = $this->getParentRow('File');
         if ($fRow) {
             $filter = new Kwf_Filter_Ascii();
             $this->filename = $filter->filter($fRow->filename);
         }
     }
 }
Example #15
0
 public function __set($name, $value)
 {
     if ($name == $this->_getPrimaryKey()) {
         // wenn das implementiert wird vorsicht wegen user-model. bei dem
         // darf der primary key zB wirklich (!) nicht geändert werden
         throw new Kwf_Exception_NotYetImplemented("Primary key may not be changed when using a MirrorCache");
     }
     if (in_array($name, $this->getModel()->getOwnColumns()) && $this->{$name} != $value) {
         $this->_doSyncOnUpdate = true;
     }
     parent::__set($name, $value);
 }
Example #16
0
 public function __get($name)
 {
     if ($name == 'info_short') {
         $info = $this->getInfo();
         return $info['shortText'];
     } else {
         if ($name == 'info') {
             $info = $this->getInfo();
             return $info['text'];
         } else {
             if ($name == 'subject') {
                 $model = $this->getModel()->getDependentModel('Mail');
                 $id = $this->component_id . '_' . $this->id . '_mail';
                 $mailRow = $model->getRow($id);
                 if ($mailRow) {
                     return $mailRow->subject;
                 }
                 return '';
             } else {
                 return parent::__get($name);
             }
         }
     }
 }
Example #17
0
 public function getProxiedRow()
 {
     $this->_loadRow();
     return parent::getProxiedRow();
 }
 protected function _afterUpdate()
 {
     parent::_afterUpdate();
     if ($this->_logChangedUser) {
         $this->writeLog('user_edited');
         $this->_logChangedUser = false;
     }
 }
Example #19
0
 protected function _beforeDelete()
 {
     parent::_beforeDelete();
     $this->_deleteFile();
 }
Example #20
0
 protected function _afterUpdate()
 {
     parent::_afterUpdate();
     if ($this->_logChangedUser) {
         $this->getModel()->writeLog(array('user_id' => $this->id, 'message_type' => 'user_edited'));
         $this->_logChangedUser = false;
     }
 }
Example #21
0
 public function duplicate(array $data = array())
 {
     $ret = parent::duplicate($data);
     $this->_duplicateDependentModel($ret, 'FlashVars');
     return $ret;
 }
Example #22
0
 protected function _init()
 {
     parent::_init();
     $this->_componentClass = $this->getModel()->getComponentClass();
     $this->_classes = Kwc_Abstract::getChildComponentClasses($this->_componentClass, 'child');
 }
Example #23
0
 protected function _afterInsert()
 {
     parent::_afterInsert();
     $this->_buildContentAndSetToRow();
     $this->is_spam = $this->_checkIsSpam();
     $this->sendMail();
 }
Example #24
0
 protected function _beforeInsert()
 {
     parent::_beforeInsert();
     $this->insert_date = date('Y-m-d H:i:s');
 }
 protected function _afterDelete()
 {
     parent::_afterDelete();
     $this->getModel()->removeCache();
 }