Пример #1
0
 public function dtgStaff_Bind()
 {
     $objConditions = QQ::All();
     if ($this->lstMinistry->SelectedValue) {
         $objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Login()->Ministry->MinistryId, $this->lstMinistry->SelectedValue));
     }
     if ($this->lstActiveFlag->SelectedValue) {
         $objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Login()->DomainActiveFlag, true), QQ::Equal(QQN::Login()->LoginActiveFlag, true));
     } else {
         $objConditions = QQ::AndCondition($objConditions, QQ::OrCondition(QQ::Equal(QQN::Login()->DomainActiveFlag, false), QQ::Equal(QQN::Login()->LoginActiveFlag, false)));
     }
     $this->dtgStaff->TotalItemCount = Login::QueryCount($objConditions);
     // Setup the $objClauses Array
     $objClauses = array();
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->dtgStaff->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgStaff->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from Login, given the clauses above
     $this->dtgStaff->DataSource = Login::QueryArray($objConditions, $objClauses);
 }
 public function testConditionalExpansion2()
 {
     $clauses = QQ::Clause(QQ::Expand(QQN::Login()->Person->ProjectAsManager, QQ::Equal(QQN::Login()->Person->ProjectAsManager->ProjectStatusTypeId, ProjectStatusType::Open)), QQ::ExpandAsArray(QQN::Login()->Person->ProjectAsManager->Milestone), QQ::ExpandAsArray(QQN::Login()->Person->Address), QQ::OrderBy(QQN::Login()->Person->Id));
     $cond = QQ::In(QQN::Login()->PersonId, [1, 3, 7]);
     $targetLoginArray = Login::QueryArray($cond, $clauses);
     $targetLogin = reset($targetLoginArray);
     $this->assertEquals($targetLogin->Person->Id, 1, "Person 1 found.");
     $this->assertNotNull($targetLogin->Person->_ProjectAsManager, "Person 1 has an open project.");
     $targetLogin = next($targetLoginArray);
     $this->assertEquals($targetLogin->Person->Id, 3, "Person 3 found.");
     $this->assertNull($targetLogin->Person->_ProjectAsManager, "Person 3 does not have an open project.");
     $targetLogin = next($targetLoginArray);
     $this->assertEquals($targetLogin->Person->Id, 7, "Person 7 found.");
     $this->assertNull($targetLogin->Person->_ProjectAsManager, "Person 7 does have an open project.");
 }
Пример #3
0
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = Login::QueryCount($objCondition, $objClauses);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from Login, given the clauses above
     $this->DataSource = Login::QueryArray($objCondition, $objClauses);
 }
Пример #4
0
 /**
  * Load an array of Ministry objects for a given Ministry
  * via the ministry_login_assn table
  * @param integer $intMinistryId
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return Login[]
  */
 public static function LoadArrayByMinistry($intMinistryId, $objOptionalClauses = null)
 {
     // Call Login::QueryArray to perform the LoadArrayByMinistry query
     try {
         return Login::QueryArray(QQ::Equal(QQN::Login()->Ministry->MinistryId, $intMinistryId), $objOptionalClauses);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }