protected function Form_Create()
 {
     // Create the Header Menu
     $this->ctlHeaderMenu_Create();
     $this->ctlShortcutMenu_Create();
     if ($_GET && $_GET['method'] == 'delete') {
         $objAudit = Audit::Load($_GET['intAuditId']);
         if ($objAudit) {
             $objAudit->Delete();
             QApplication::Redirect("./inventory_audit_list.php");
         }
     }
     // Load an array of Audit objects using join on UserAccount.
     $this->objAuditArray = Audit::LoadArrayByEntityQtypeId(2, QQ::Clause(QQ::Expand(QQN::Audit()->CreatedByObject)));
 }
Example #2
0
 protected function Form_Create()
 {
     // Create the Header Menu
     $this->ctlHeaderMenu_Create();
     $this->ctlShortcutMenu_Create();
     //QApplication::$Database[1]->EnableProfiling();
     if ($_GET && $_GET['method'] == 'delete') {
         $objAudit = Audit::Load($_GET['intAuditId']);
         if ($objAudit) {
             // Set the relationship to ON DELETE CASCADE so that the AuditScans will be automatically deleted when deleting the Audit Object
             $objAudit->Delete();
             QApplication::Redirect("./asset_audit_list.php");
         }
     }
     // Load an array of Audit objects using join on UserAccount.
     $this->objAuditArray = Audit::LoadAll(QQ::Clause(QQ::Expand(QQN::Audit()->CreatedByObject)));
 }
 protected function SetupAudit()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intAuditId = QApplication::QueryString('intAuditId');
     if ($intAuditId) {
         $this->objAudit = Audit::Load($intAuditId);
         if (!$this->objAudit) {
             throw new Exception('Could not find a Audit object with PK arguments: ' . $intAuditId);
         }
         $this->strTitleVerb = QApplication::Translate('Edit');
         $this->blnEditMode = true;
     } else {
         $this->objAudit = new Audit();
         $this->strTitleVerb = QApplication::Translate('Create');
         $this->blnEditMode = false;
     }
 }
 public function btnEdit_Click($strFormId, $strControlId, $strParameter)
 {
     $strParameterArray = explode(',', $strParameter);
     $objAudit = Audit::Load($strParameterArray[0]);
     $objEditPanel = new AuditEditPanel($this, $this->strCloseEditPanelMethod, $objAudit);
     $strMethodName = $this->strSetEditPanelMethod;
     $this->objForm->{$strMethodName}($objEditPanel);
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this AuditMetaControl
  * @param integer $intAuditId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing Audit object creation - defaults to CreateOrEdit
  * @return AuditMetaControl
  */
 public static function Create($objParentObject, $intAuditId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intAuditId)) {
         $objAudit = Audit::Load($intAuditId);
         // Audit was found -- return it!
         if ($objAudit) {
             return new AuditMetaControl($objParentObject, $objAudit);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a Audit object with PK arguments: ' . $intAuditId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new AuditMetaControl($objParentObject, new Audit());
 }
 /**
  * Override method to perform a property "Get"
  * This will get the value of $strName
  *
  * @param string $strName Name of the property to get
  * @return mixed
  */
 public function __get($strName)
 {
     switch ($strName) {
         ///////////////////
         // Member Variables
         ///////////////////
         case 'AuditScanId':
             // Gets the value for intAuditScanId (Read-Only PK)
             // @return integer
             return $this->intAuditScanId;
         case 'AuditId':
             // Gets the value for intAuditId (Not Null)
             // @return integer
             return $this->intAuditId;
         case 'LocationId':
             // Gets the value for intLocationId (Not Null)
             // @return integer
             return $this->intLocationId;
         case 'EntityId':
             // Gets the value for intEntityId
             // @return integer
             return $this->intEntityId;
         case 'Count':
             // Gets the value for intCount
             // @return integer
             return $this->intCount;
         case 'SystemCount':
             // Gets the value for intSystemCount
             // @return integer
             return $this->intSystemCount;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Audit':
             // Gets the value for the Audit object referenced by intAuditId (Not Null)
             // @return Audit
             try {
                 if (!$this->objAudit && !is_null($this->intAuditId)) {
                     $this->objAudit = Audit::Load($this->intAuditId);
                 }
                 return $this->objAudit;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Location':
             // Gets the value for the Location object referenced by intLocationId (Not Null)
             // @return Location
             try {
                 if (!$this->objLocation && !is_null($this->intLocationId)) {
                     $this->objLocation = Location::Load($this->intLocationId);
                 }
                 return $this->objLocation;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             ////////////////////////////
             // Virtual Object References (Many to Many and Reverse References)
             // (If restored via a "Many-to" expansion)
             ////////////////////////////
         ////////////////////////////
         // Virtual Object References (Many to Many and Reverse References)
         // (If restored via a "Many-to" expansion)
         ////////////////////////////
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Example #7
0
 /**
  * Reload this Audit from the database.
  * @return void
  */
 public function Reload()
 {
     // Make sure we are actually Restored from the database
     if (!$this->__blnRestored) {
         throw new QCallerException('Cannot call Reload() on a new, unsaved Audit object.');
     }
     // Reload the Object
     $objReloaded = Audit::Load($this->intAuditId);
     // Update $this's local variables to match
     $this->EntityQtypeId = $objReloaded->EntityQtypeId;
     $this->CreatedBy = $objReloaded->CreatedBy;
     $this->dttCreationDate = $objReloaded->dttCreationDate;
     $this->ModifiedBy = $objReloaded->ModifiedBy;
     $this->strModifiedDate = $objReloaded->strModifiedDate;
 }