function CompanyEditForm() { $current_company = $this->getCompany(); if (!$current_company) { $current_company = $this->CurrentCompany(); } if (is_null($current_company)) { return $this->httpError(404, 'Sorry that company could not be found'); } $CompanyEditForm = new CompanyEditForm($this, 'CompanyEditForm', $current_company); $CompanyEditForm->disableSecurityToken(); // Fill in the form if ($current_company) { Session::set('CompanyID', $current_company->ID); $CompanyEditForm->loadDataFrom($current_company, False); return $CompanyEditForm; } elseif ($this->request->isPost()) { // SS is returning to the form controller to post data return $CompanyEditForm; } else { // Attempted to load the edit form, but the id was missing or didn't match an id in the database return $this->httpError(404, 'Sorry that company could not be found'); } }
} } //Set display logic of the Create New Contact protected function UpdateContactAccess() { //checks if the entity has edit authorization $objRoleEntityQtypeBuiltInAuthorization = RoleEntityQtypeBuiltInAuthorization::LoadByRoleIdEntityQtypeIdAuthorizationId(QApplication::$objRoleModule->RoleId, EntityQtype::Contact, 2); if ($objRoleEntityQtypeBuiltInAuthorization && $objRoleEntityQtypeBuiltInAuthorization->AuthorizedFlag) { $this->btnCreateContact->Visible = true; } else { $this->btnCreateContact->Visible = false; } } //Set display logic of the Create New Contact protected function UpdateAddressAccess() { //checks if the entity has edit authorization $objRoleEntityQtypeBuiltInAuthorization = RoleEntityQtypeBuiltInAuthorization::LoadByRoleIdEntityQtypeIdAuthorizationId(QApplication::$objRoleModule->RoleId, EntityQtype::Address, 2); if ($objRoleEntityQtypeBuiltInAuthorization && $objRoleEntityQtypeBuiltInAuthorization->AuthorizedFlag) { $this->btnCreateAddress->Visible = true; } else { $this->btnCreateAddress->Visible = false; } } protected function getNextTabIndex() { return $this->intTabIndex++; } } CompanyEditForm::Run('CompanyEditForm', __DOCROOT__ . __SUBDIRECTORY__ . '/contacts/company_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 CompanyEditFormBase require __FORMBASE_CLASSES__ . '/CompanyEditFormBase.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 Company class. It extends from the code-generated * abstract CompanyEditFormBase 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 CompanyEditForm extends CompanyEditFormBase { } // Go ahead and run this form object to render the page and its event handlers, using // generated/company_edit.tpl.php as the included HTML template file CompanyEditForm::Run('CompanyEditForm', 'generated/company_edit.tpl.php');