Example #1
0
 public function category()
 {
     $col_name = "placement_category_id";
     $category = null;
     if (isset($this->{$col_name}) && is_numeric($this->{$col_name})) {
         $category_id = $this->{$col_name};
         $entry = $this->entry();
         if (empty($entry)) {
             return null;
         }
         if ($entry->class === 'entry') {
             require_once 'class.mt_category.php';
             $category = new Category();
             $loaded = $category->Load("category_id = {$category_id}");
         } else {
             require_once 'class.mt_folder.php';
             $category = new Folder();
             $loaded = $category->Load("category_id = {$category_id}");
         }
         if (!$loaded) {
             $category = null;
         }
     }
     return $category;
 }
 public function category()
 {
     $col_name = "fileinfo_category_id";
     $category = null;
     if (isset($this->{$col_name}) && is_numeric($this->{$col_name})) {
         $category_id = $this->{$col_name};
         require_once 'class.mt_category.php';
         $category = new Category();
         $category->Load("category_id = {$category_id}");
     }
     return $category;
 }
 protected function SetupCategory()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intCategoryId = QApplication::QueryString('intCategoryId');
     if ($intCategoryId) {
         $this->objCategory = Category::Load($intCategoryId);
         if (!$this->objCategory) {
             throw new Exception('Could not find a Category object with PK arguments: ' . $intCategoryId);
         }
         $this->strTitleVerb = QApplication::Translate('Edit');
         $this->blnEditMode = true;
     } else {
         $this->objCategory = new Category();
         $this->strTitleVerb = QApplication::Translate('Create');
         $this->blnEditMode = false;
     }
 }
 /**
  * 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 'InventoryModelId':
             /**
              * Gets the value for intInventoryModelId (Read-Only PK)
              * @return integer
              */
             return $this->intInventoryModelId;
         case 'CategoryId':
             /**
              * Gets the value for intCategoryId 
              * @return integer
              */
             return $this->intCategoryId;
         case 'ManufacturerId':
             /**
              * Gets the value for intManufacturerId 
              * @return integer
              */
             return $this->intManufacturerId;
         case 'InventoryModelCode':
             /**
              * Gets the value for strInventoryModelCode (Unique)
              * @return string
              */
             return $this->strInventoryModelCode;
         case 'ShortDescription':
             /**
              * Gets the value for strShortDescription (Not Null)
              * @return string
              */
             return $this->strShortDescription;
         case 'LongDescription':
             /**
              * Gets the value for strLongDescription 
              * @return string
              */
             return $this->strLongDescription;
         case 'ImagePath':
             /**
              * Gets the value for strImagePath 
              * @return string
              */
             return $this->strImagePath;
         case 'Price':
             /**
              * Gets the value for fltPrice 
              * @return double
              */
             return $this->fltPrice;
         case 'CreatedBy':
             /**
              * Gets the value for intCreatedBy 
              * @return integer
              */
             return $this->intCreatedBy;
         case 'CreationDate':
             /**
              * Gets the value for dttCreationDate 
              * @return QDateTime
              */
             return $this->dttCreationDate;
         case 'ModifiedBy':
             /**
              * Gets the value for intModifiedBy 
              * @return integer
              */
             return $this->intModifiedBy;
         case 'ModifiedDate':
             /**
              * Gets the value for strModifiedDate (Read-Only Timestamp)
              * @return string
              */
             return $this->strModifiedDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Category':
             /**
              * Gets the value for the Category object referenced by intCategoryId 
              * @return Category
              */
             try {
                 if (!$this->objCategory && !is_null($this->intCategoryId)) {
                     $this->objCategory = Category::Load($this->intCategoryId);
                 }
                 return $this->objCategory;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Manufacturer':
             /**
              * Gets the value for the Manufacturer object referenced by intManufacturerId 
              * @return Manufacturer
              */
             try {
                 if (!$this->objManufacturer && !is_null($this->intManufacturerId)) {
                     $this->objManufacturer = Manufacturer::Load($this->intManufacturerId);
                 }
                 return $this->objManufacturer;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreatedByObject':
             /**
              * Gets the value for the UserAccount object referenced by intCreatedBy 
              * @return UserAccount
              */
             try {
                 if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) {
                     $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy);
                 }
                 return $this->objCreatedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ModifiedByObject':
             /**
              * Gets the value for the UserAccount object referenced by intModifiedBy 
              * @return UserAccount
              */
             try {
                 if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) {
                     $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy);
                 }
                 return $this->objModifiedByObject;
             } 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 '_InventoryLocation':
             /**
              * Gets the value for the private _objInventoryLocation (Read-Only)
              * if set due to an expansion on the inventory_location.inventory_model_id reverse relationship
              * @return InventoryLocation
              */
             return $this->_objInventoryLocation;
         case '_InventoryLocationArray':
             /**
              * Gets the value for the private _objInventoryLocationArray (Read-Only)
              * if set due to an ExpandAsArray on the inventory_location.inventory_model_id reverse relationship
              * @return InventoryLocation[]
              */
             return (array) $this->_objInventoryLocationArray;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 /**
  * 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 CategoryMetaControl
  * @param integer $intCategoryId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing Category object creation - defaults to CreateOrEdit
  * @return CategoryMetaControl
  */
 public static function Create($objParentObject, $intCategoryId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intCategoryId)) {
         $objCategory = Category::Load($intCategoryId);
         // Category was found -- return it!
         if ($objCategory) {
             return new CategoryMetaControl($objParentObject, $objCategory);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a Category object with PK arguments: ' . $intCategoryId);
             }
         }
         // 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 CategoryMetaControl($objParentObject, new Category());
 }
Example #6
0
 /**
  * Reload this Category 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 Category object.');
     }
     // Reload the Object
     $objReloaded = Category::Load($this->intCategoryId);
     // Update $this's local variables to match
     $this->strShortDescription = $objReloaded->strShortDescription;
     $this->strLongDescription = $objReloaded->strLongDescription;
     $this->strImagePath = $objReloaded->strImagePath;
     $this->blnAssetFlag = $objReloaded->blnAssetFlag;
     $this->blnInventoryFlag = $objReloaded->blnInventoryFlag;
     $this->CreatedBy = $objReloaded->CreatedBy;
     $this->dttCreationDate = $objReloaded->dttCreationDate;
     $this->ModifiedBy = $objReloaded->ModifiedBy;
     $this->strModifiedDate = $objReloaded->strModifiedDate;
 }
 public function btnEdit_Click($strFormId, $strControlId, $strParameter)
 {
     $strParameterArray = explode(',', $strParameter);
     $objCategory = Category::Load($strParameterArray[0]);
     $objEditPanel = new CategoryEditPanel($this, $this->strCloseEditPanelMethod, $objCategory);
     $strMethodName = $this->strSetEditPanelMethod;
     $this->objForm->{$strMethodName}($objEditPanel);
 }
Example #8
0
 /**
  * Reload this Category 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 Category object.');
     }
     // Reload the Object
     $objReloaded = Category::Load($this->intId);
     // Update $this's local variables to match
     $this->intParentId = $objReloaded->intParentId;
     $this->strName = $objReloaded->strName;
 }
 /**
  * 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 'InventoryModelId':
             // Gets the value for intInventoryModelId (Read-Only PK)
             // @return integer
             return $this->intInventoryModelId;
         case 'CategoryId':
             // Gets the value for intCategoryId
             // @return integer
             return $this->intCategoryId;
         case 'ManufacturerId':
             // Gets the value for intManufacturerId
             // @return integer
             return $this->intManufacturerId;
         case 'InventoryModelCode':
             // Gets the value for strInventoryModelCode (Unique)
             // @return string
             return $this->strInventoryModelCode;
         case 'ShortDescription':
             // Gets the value for strShortDescription (Not Null)
             // @return string
             return $this->strShortDescription;
         case 'LongDescription':
             // Gets the value for strLongDescription
             // @return string
             return $this->strLongDescription;
         case 'ImagePath':
             // Gets the value for strImagePath
             // @return string
             return $this->strImagePath;
         case 'Price':
             // Gets the value for fltPrice
             // @return double
             return $this->fltPrice;
         case 'CreatedBy':
             // Gets the value for intCreatedBy
             // @return integer
             return $this->intCreatedBy;
         case 'CreationDate':
             // Gets the value for dttCreationDate
             // @return QDateTime
             return $this->dttCreationDate;
         case 'ModifiedBy':
             // Gets the value for intModifiedBy
             // @return integer
             return $this->intModifiedBy;
         case 'ModifiedDate':
             // Gets the value for strModifiedDate (Read-Only Timestamp)
             // @return string
             return $this->strModifiedDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Category':
             // Gets the value for the Category object referenced by intCategoryId
             // @return Category
             try {
                 if (!$this->objCategory && !is_null($this->intCategoryId)) {
                     $this->objCategory = Category::Load($this->intCategoryId);
                 }
                 return $this->objCategory;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Manufacturer':
             // Gets the value for the Manufacturer object referenced by intManufacturerId
             // @return Manufacturer
             try {
                 if (!$this->objManufacturer && !is_null($this->intManufacturerId)) {
                     $this->objManufacturer = Manufacturer::Load($this->intManufacturerId);
                 }
                 return $this->objManufacturer;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'CreatedByObject':
             // Gets the value for the UserAccount object referenced by intCreatedBy
             // @return UserAccount
             try {
                 if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) {
                     $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy);
                 }
                 return $this->objCreatedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ModifiedByObject':
             // Gets the value for the UserAccount object referenced by intModifiedBy
             // @return UserAccount
             try {
                 if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) {
                     $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy);
                 }
                 return $this->objModifiedByObject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'InventoryModelCustomFieldHelper':
             // Gets the value for the InventoryModelCustomFieldHelper object that uniquely references this InventoryModel
             // by objInventoryModelCustomFieldHelper (Unique)
             // @return InventoryModelCustomFieldHelper
             try {
                 if ($this->objInventoryModelCustomFieldHelper === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objInventoryModelCustomFieldHelper) {
                     $this->objInventoryModelCustomFieldHelper = InventoryModelCustomFieldHelper::LoadByInventoryModelId($this->intInventoryModelId);
                 }
                 return $this->objInventoryModelCustomFieldHelper;
             } 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 '_InventoryLocation':
             // Gets the value for the private _objInventoryLocation (Read-Only)
             // if set due to an expansion on the inventory_location.inventory_model_id reverse relationship
             // @return InventoryLocation
             return $this->_objInventoryLocation;
         case '_InventoryLocationArray':
             // Gets the value for the private _objInventoryLocationArray (Read-Only)
             // if set due to an ExpandAsArray on the inventory_location.inventory_model_id reverse relationship
             // @return InventoryLocation[]
             return (array) $this->_objInventoryLocationArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 /**
  * 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 'CategoryId':
             // Gets the value for intCategoryId (PK)
             // @return integer
             return $this->intCategoryId;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Category':
             // Gets the value for the Category object referenced by intCategoryId (PK)
             // @return Category
             try {
                 if (!$this->objCategory && !is_null($this->intCategoryId)) {
                     $this->objCategory = Category::Load($this->intCategoryId);
                 }
                 return $this->objCategory;
             } 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;
             }
     }
 }