$objControl->Blink(); } return $blnToReturn; } // Button Event Handlers protected function btnSave_Click($strFormId, $strControlId, $strParameter) { // Delegate "Save" processing to the CategoryMetaControl $this->mctCategory->SaveCategory(); $this->RedirectToListPage(); } protected function btnDelete_Click($strFormId, $strControlId, $strParameter) { // Delegate "Delete" processing to the CategoryMetaControl $this->mctCategory->DeleteCategory(); $this->RedirectToListPage(); } protected function btnCancel_Click($strFormId, $strControlId, $strParameter) { $this->RedirectToListPage(); } // Other Methods protected function RedirectToListPage() { QApplication::Redirect(__VIRTUAL_DIRECTORY__ . __FORM_DRAFTS__ . '/category_list.php'); } } // Go ahead and run this form object to render the page and its event handlers, implicitly using // category_edit.tpl.php as the included HTML template file CategoryEditForm::Run('CategoryEditForm');
$objDatabase = QApplication::$Database[1]; // Begin a MySQL Transaction to be either committed or rolled back $objDatabase->TransactionBegin(); $objCustomFieldArray = $this->objCategory->objCustomFieldArray; $this->objCategory->Delete(); // Commit the transaction to the database $objDatabase->TransactionCommit(); $this->RedirectToListPage(); } catch (QDatabaseExceptionBase $objExc) { // Rollback the database transaction $objDatabase->TransactionRollback(); if ($objExc->ErrorNumber == 1451) { $this->btnCancel->Warning = 'This category cannot be deleted because it is associated with one or more models.'; } else { throw new QDatabaseExceptionBase(); } } } // Protected Update Methods protected function UpdateCategoryFields() { $this->objCategory->ShortDescription = $this->txtShortDescription->Text; $this->objCategory->LongDescription = $this->txtLongDescription->Text; $this->objCategory->AssetFlag = $this->chkAssetFlag->Checked; $this->objCategory->InventoryFlag = $this->chkInventoryFlag->Checked; } } // Go ahead and run this form object to render the page and its event handlers, using // generated/category_edit.php.inc as the included HTML template file CategoryEditForm::Run('CategoryEditForm', __DOCROOT__ . __SUBDIRECTORY__ . '/admin/category_edit.tpl.php');
// Include prepend.inc to load Qcodo require '../includes/prepend.inc.php'; /* if you DO NOT have "includes/" in your include_path */ // require('prepend.inc.php'); /* if you DO have "includes/" in your include_path */ // Include the classfile for CategoryEditFormBase require __FORMBASE_CLASSES__ . '/CategoryEditFormBase.class.php'; // Security check for ALLOW_REMOTE_ADMIN // To allow access REGARDLESS of ALLOW_REMOTE_ADMIN, simply remove the line below QApplication::CheckRemoteAdmin(); /** * This is a quick-and-dirty draft form object to do Create, Edit, and Delete functionality * of the Category class. It extends from the code-generated * abstract CategoryEditFormBase class. * * Any display customizations and presentation-tier logic can be implemented * here by overriding existing or implementing new methods, properties and variables. * * Additional qform control objects can also be defined and used here, as well. * * @package My Application * @subpackage FormDraftObjects * */ class CategoryEditForm extends CategoryEditFormBase { } // Go ahead and run this form object to render the page and its event handlers, using // generated/category_edit.tpl.php as the included HTML template file CategoryEditForm::Run('CategoryEditForm', 'generated/category_edit.tpl.php');