$this->btnQuickAdd->Warning = ''; if (strlen(trim($this->txtQuickAdd->Text)) == 0) { $blnError = true; $this->btnQuickAdd->Warning = 'You must enter a Location name'; } // Check for dupes $objLocationDuplicate = Location::QuerySingle(QQ::Equal(QQN::Location()->ShortDescription, $this->txtQuickAdd->Text)); if ($objLocationDuplicate) { $blnError = true; $this->btnQuickAdd->Warning = 'This Location Name is already in use. Please try another.'; } if (!$blnError) { $objLocation = new Location(); $objLocation->ShortDescription = $this->txtQuickAdd->Text; $objLocation->EnabledFlag = '1'; $objLocation->AssetFlag = '1'; $objLocation->InventoryFlag = '1'; $objLocation->CreatedBy = QApplication::$objUserAccount->UserAccountId; $objLocation->CreationDate = QDateTime::Now(); $objLocation->Save(); $this->dtgLocation->Refresh(); $this->txtQuickAdd->Text = ''; } $this->txtQuickAdd->Focus(); $this->txtQuickAdd->Select(); } } // Go ahead and run this form object to generate the page and event handlers, using // generated/Location_edit.php.inc as the included HTML template file LocationListForm::Run('LocationListForm', __DOCROOT__ . __SUBDIRECTORY__ . '/admin/location_list.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 LocationListFormBase require __FORMBASE_CLASSES__ . '/LocationListFormBase.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 the List All functionality * of the Location class. It extends from the code-generated * abstract LocationListFormBase 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 LocationListForm extends LocationListFormBase { } // Go ahead and run this form object to generate the page and event handlers, using // generated/location_list.tpl.php as the included HTML template file LocationListForm::Run('LocationListForm', 'generated/location_list.tpl.php');