Example #1
0
    {
        if ($objLocation = Location::LoadByShortDescription($this->txtShortDescription->Text)) {
            $this->txtShortDescription->Warning = 'This Location Name is already in use. Please try another.';
        } else {
            try {
                $this->UpdateLocationFields();
                $this->objLocation->Save();
                $this->RedirectToListPage();
            } catch (QExtendedOptimisticLockingException $objExc) {
                $this->btnCancel->Warning = sprintf('This location has been updated by another user. You must <a href="location_edit.php?intLocationId=%s">Refresh</a> to edit this location.', $this->objLocation->LocationId);
            }
        }
    }
    protected function btnDelete_Click($strFormId, $strControlId, $strParameter)
    {
        try {
            $this->objLocation->Delete();
            $this->RedirectToListPage();
        } catch (QDatabaseExceptionBase $objExc) {
            if ($objExc->ErrorNumber == 1451) {
                $this->btnCancel->Warning = 'This location cannot be deleted because it is either not empty or associated with one or more transactions.';
            } else {
                throw new QDatabaseExceptionBase();
            }
        }
    }
}
// Go ahead and run this form object to render the page and its event handlers, using
// generated/location_edit.php.inc as the included HTML template file
LocationEditForm::Run('LocationEditForm', __DOCROOT__ . __SUBDIRECTORY__ . '/admin/location_edit.tpl.php');
Example #2
0
// 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 LocationEditFormBase
require __FORMBASE_CLASSES__ . '/LocationEditFormBase.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 Location class.  It extends from the code-generated
 * abstract LocationEditFormBase 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 LocationEditForm extends LocationEditFormBase
{
}
// Go ahead and run this form object to render the page and its event handlers, using
// generated/location_edit.tpl.php as the included HTML template file
LocationEditForm::Run('LocationEditForm', 'generated/location_edit.tpl.php');