_object_class_name) throw new lmbException('Object class name is not specified'); } function doCreate() { $this->item = new $this->_object_class_name(); $this->useForm($this->_form_name); $this->setFormDatasource($this->item); if($this->request->hasPost()) { $this->_import(); $this->_validateAndSave(true); } else { $this->_initCreateForm(); } } function doEdit() { $this->item = lmbActiveRecord :: findById($this->_object_class_name, $this->request->getInteger('id')); $this->useForm($this->_form_name); $this->setFormDatasource($this->item); if($this->request->hasPost()) { $this->_import(); $this->_validateAndSave(false); } else { $this->_initEditForm(); } } protected function _import() { $this->item->import($this->request); } protected function _validateAndSave($is_create = false) { $this->_onBeforeValidate(); $this->item->validate($this->error_list); $this->_onAfterValidate(); if($this->error_list->isValid()) { if($is_create) $this->_onBeforeCreate(); else $this->_onBeforeEdit(); $this->_onBeforeSave(); $this->item->saveSkipValidation(); $this->_onAfterSave(); if($is_create) $this->_onAfterCreate(); else $this->_onAfterEdit(); $this->closePopup(); } } protected function _initCreateForm() {} protected function _initEditForm() {} protected function _onBeforeSave() {} protected function _onAfterSave() {} protected function _onBeforeCreate() {} protected function _onAfterCreate() {} protected function _onBeforeEdit() {} protected function _onAfterEdit() {} protected function _onBeforeDelete() {} protected function _onAfterDelete() {} protected function _onBeforeValidate() {} protected function _onAfterValidate() {} function performPublishCommand() { $this->performCommand('limb/cms/src/command/lmbCmsPublishObjectCommand', $this->_object_class_name); } function performUnpublishCommand() { $this->performCommand('limb/cms/src/command/lmbCmsUnpublishObjectCommand', $this->_object_class_name); } function doDelete() { if($this->request->hasPost()) $this->_onBeforeDelete(); $this->performCommand('limb/cms/src/command/lmbCmsDeleteObjectCommand', $this->_object_class_name); if($this->request->hasPost()) $this->_onAfterDelete(); } } ?>