try { // Get an instance of the database $objDatabase = QApplication::$Database[1]; // Begin a MySQL Transaction to be either committed or rolled back $objDatabase->TransactionBegin(); $objCustomFieldArray = $this->objManufacturer->objCustomFieldArray; $this->objManufacturer->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 manufacturer cannot be deleted because it is associated with one or more models.'; } else { throw new QDatabaseExceptionBase(); } } } // Protected Update Methods protected function UpdateManufacturerFields() { $this->objManufacturer->ShortDescription = $this->txtShortDescription->Text; $this->objManufacturer->LongDescription = $this->txtLongDescription->Text; } } // Go ahead and run this form object to render the page and its event handlers, using // generated/manufacturer_edit.php.inc as the included HTML template file ManufacturerEditForm::Run('ManufacturerEditForm', __DOCROOT__ . __SUBDIRECTORY__ . '/admin/manufacturer_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 ManufacturerEditFormBase require __FORMBASE_CLASSES__ . '/ManufacturerEditFormBase.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 Manufacturer class. It extends from the code-generated * abstract ManufacturerEditFormBase 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 ManufacturerEditForm extends ManufacturerEditFormBase { } // Go ahead and run this form object to render the page and its event handlers, using // generated/manufacturer_edit.tpl.php as the included HTML template file ManufacturerEditForm::Run('ManufacturerEditForm', 'generated/manufacturer_edit.tpl.php');