示例#1
0
 /**
  * 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 'Id':
             // Gets the value for intId (Read-Only PK)
             // @return integer
             return $this->intId;
         case 'SearchQueryId':
             // Gets the value for intSearchQueryId
             // @return integer
             return $this->intSearchQueryId;
         case 'OrQueryConditionId':
             // Gets the value for intOrQueryConditionId (Unique)
             // @return integer
             return $this->intOrQueryConditionId;
         case 'QueryOperationId':
             // Gets the value for intQueryOperationId (Not Null)
             // @return integer
             return $this->intQueryOperationId;
         case 'QueryNodeId':
             // Gets the value for intQueryNodeId (Not Null)
             // @return integer
             return $this->intQueryNodeId;
         case 'Value':
             // Gets the value for strValue
             // @return string
             return $this->strValue;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'SearchQuery':
             // Gets the value for the SearchQuery object referenced by intSearchQueryId
             // @return SearchQuery
             try {
                 if (!$this->objSearchQuery && !is_null($this->intSearchQueryId)) {
                     $this->objSearchQuery = SearchQuery::Load($this->intSearchQueryId);
                 }
                 return $this->objSearchQuery;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'OrQueryCondition':
             // Gets the value for the QueryCondition object referenced by intOrQueryConditionId (Unique)
             // @return QueryCondition
             try {
                 if (!$this->objOrQueryCondition && !is_null($this->intOrQueryConditionId)) {
                     $this->objOrQueryCondition = QueryCondition::Load($this->intOrQueryConditionId);
                 }
                 return $this->objOrQueryCondition;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'QueryOperation':
             // Gets the value for the QueryOperation object referenced by intQueryOperationId (Not Null)
             // @return QueryOperation
             try {
                 if (!$this->objQueryOperation && !is_null($this->intQueryOperationId)) {
                     $this->objQueryOperation = QueryOperation::Load($this->intQueryOperationId);
                 }
                 return $this->objQueryOperation;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'QueryNode':
             // Gets the value for the QueryNode object referenced by intQueryNodeId (Not Null)
             // @return QueryNode
             try {
                 if (!$this->objQueryNode && !is_null($this->intQueryNodeId)) {
                     $this->objQueryNode = QueryNode::Load($this->intQueryNodeId);
                 }
                 return $this->objQueryNode;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'QueryConditionAsOr':
             // Gets the value for the QueryCondition object that uniquely references this QueryCondition
             // by objQueryConditionAsOr (Unique)
             // @return QueryCondition
             try {
                 if ($this->objQueryConditionAsOr === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objQueryConditionAsOr) {
                     $this->objQueryConditionAsOr = QueryCondition::LoadByOrQueryConditionId($this->intId);
                 }
                 return $this->objQueryConditionAsOr;
             } 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;
             }
     }
 }
 /**
  * This will save this object's SmartGroup instance,
  * updating only the fields which have had a control created for it.
  */
 public function SaveSmartGroup()
 {
     try {
         // Update any fields for controls that have been created
         if ($this->lstGroup) {
             $this->objSmartGroup->GroupId = $this->lstGroup->SelectedValue;
         }
         if ($this->txtQuery) {
             $this->objSmartGroup->Query = $this->txtQuery->Text;
         }
         if ($this->calDateRefreshed) {
             $this->objSmartGroup->DateRefreshed = $this->calDateRefreshed->DateTime;
         }
         if ($this->txtProcessTimeMs) {
             $this->objSmartGroup->ProcessTimeMs = $this->txtProcessTimeMs->Text;
         }
         // Update any UniqueReverseReferences (if any) for controls that have been created for it
         if ($this->lstSearchQuery) {
             $this->objSmartGroup->SearchQuery = SearchQuery::Load($this->lstSearchQuery->SelectedValue);
         }
         // Save the SmartGroup object
         $this->objSmartGroup->Save();
         // Finally, update any ManyToManyReferences (if any)
     } 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 SearchQueryMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing SearchQuery object creation - defaults to CreateOrEdit
  * @return SearchQueryMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objSearchQuery = SearchQuery::Load($intId);
         // SearchQuery was found -- return it!
         if ($objSearchQuery) {
             return new SearchQueryMetaControl($objParentObject, $objSearchQuery);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a SearchQuery object with PK arguments: ' . $intId);
             }
         }
         // 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 SearchQueryMetaControl($objParentObject, new SearchQuery());
 }
示例#4
0
 /**
  * Reload this SearchQuery 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 SearchQuery object.');
     }
     // Reload the Object
     $objReloaded = SearchQuery::Load($this->intId);
     // Update $this's local variables to match
     $this->strDescription = $objReloaded->strDescription;
     $this->SmartGroupId = $objReloaded->SmartGroupId;
     $this->PersonId = $objReloaded->PersonId;
 }