protected function _beforeUpdate() { parent::_beforeUpdate(); if ($this->is_home && !$this->visible) { throw new Kwf_ClientException(trlKwf('Cannot set Home Page invisible')); } if (in_array('parent_id', $this->getDirtyColumns()) && $this->getCleanValue('parent_id')) { $oldSubroot = Kwf_Component_Data_Root::getInstance()->getComponentById($this->getCleanValue('parent_id'), array('ignoreVisible' => true))->getSubroot(); $newSubroot = Kwf_Component_Data_Root::getInstance()->getComponentById($this->parent_id, array('ignoreVisible' => true))->getSubroot(); if ($oldSubroot != $newSubroot) { throw new Kwf_Exception_Client(trlKwf("Can't move Page to other Subroot")); } } }
protected function _beforeUpdate() { parent::_beforeUpdate(); if ($this->is_home && !$this->visible) { throw new Kwf_ClientException(trlKwf('Cannot set Home Page invisible')); } if (in_array('parent_id', $this->getDirtyColumns()) && $this->getCleanValue('parent_id')) { $oldSubroot = Kwf_Component_Data_Root::getInstance()->getComponentById($this->getCleanValue('parent_id'), array('ignoreVisible' => true))->getSubroot(); $newSubroot = Kwf_Component_Data_Root::getInstance()->getComponentById($this->parent_id, array('ignoreVisible' => true))->getSubroot(); if ($oldSubroot != $newSubroot) { throw new Kwf_Exception_Client(trlKwf("Can't move Page to other Subroot")); } } if (in_array('filename', $this->getDirtyColumns())) { $model = Kwf_Component_Data_Root::getInstance()->getComponentById($this->id, array('ignoreVisible' => true))->generator->getHistoryModel(); $data = array('page_id' => $this->id, 'parent_id' => $this->parent_id, 'filename' => $this->getCleanValue('filename')); $row = $model->createRow($data); $row->save(); } }