Ejemplo n.º 1
0
 /**
  * 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 QueryNodeMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing QueryNode object creation - defaults to CreateOrEdit
  * @return QueryNodeMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objQueryNode = QueryNode::Load($intId);
         // QueryNode was found -- return it!
         if ($objQueryNode) {
             return new QueryNodeMetaControl($objParentObject, $objQueryNode);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a QueryNode 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 QueryNodeMetaControl($objParentObject, new QueryNode());
 }
Ejemplo n.º 2
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;
             }
     }
 }
Ejemplo n.º 3
0
 /**
  * Reload this QueryNode 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 QueryNode object.');
     }
     // Reload the Object
     $objReloaded = QueryNode::Load($this->intId);
     // Update $this's local variables to match
     $this->strName = $objReloaded->strName;
     $this->QueryNodeTypeId = $objReloaded->QueryNodeTypeId;
     $this->strQcodoQueryNode = $objReloaded->strQcodoQueryNode;
     $this->QueryDataTypeId = $objReloaded->QueryDataTypeId;
     $this->strNodeDetail = $objReloaded->strNodeDetail;
 }
Ejemplo n.º 4
0
 public function lstOperation_Refresh($intIndex, $blnCreating)
 {
     $lstNode = $this->objForm->GetControl('lstNode' . $intIndex);
     $lstOperation = $this->objForm->GetControl('lstOperation' . $intIndex);
     $lstOperation->RemoveAllItems();
     if (!$lstNode->SelectedValue) {
         $lstOperation->AddItem('--');
         $lstOperation->SelectedIndex = 0;
         $lstOperation->Enabled = false;
         $lstOperation->Required = false;
     } else {
         $objNode = QueryNode::Load($lstNode->SelectedValue);
         $lstOperation->Enabled = true;
         $lstOperation->Required = true;
         $lstOperation->AddItem('- None -');
         foreach ($this->objOperationArray as $objQueryOperation) {
             if ($objQueryOperation->QueryDataTypeBitmap & $objNode->QueryDataTypeId) {
                 $lstOperation->AddItem($objQueryOperation->Name, $objQueryOperation->Id, $blnCreating && array_key_exists($intIndex, $this->objQueryConditionArray) && $this->objQueryConditionArray[$intIndex]->QueryOperationId == $objQueryOperation->Id);
             }
         }
     }
 }