public function dtrGrowthGroups_Bind() { $objCondition = QQ::Equal(QQN::GrowthGroup()->GrowthGroupLocationId, $this->objLocation->Id); if ($this->lstDays->SelectedValue) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::GrowthGroup()->GrowthGroupDayTypeId, $this->lstDays->SelectedValue)); } if ($this->lstTypes->SelectedValue) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::GrowthGroup()->GrowthGroupStructure->GrowthGroupStructureId, $this->lstTypes->SelectedValue)); } // Filter Out "inactive" groups $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::GrowthGroup()->Group->ActiveFlag, true)); $this->dtrGrowthGroups->DataSource = GrowthGroup::QueryArray($objCondition, QQ::OrderBy(QQN::GrowthGroup()->Group->Name)); // Results? $this->pnlNone->Visible = !count($this->dtrGrowthGroups->DataSource); // Markers QApplication::ExecuteJavaScript('hideAllMarkers();'); foreach ($this->dtrGrowthGroups->DataSource as $objGroup) { QApplication::ExecuteJavaScript('showMarker(' . ($this->intMarkerArray[$objGroup->GroupId] - 1) . ');'); } }
/** * Load an array of GrowthGroupStructure objects for a given GrowthGroupStructure * via the growthgroupstructure_growthgroup_assn table * @param integer $intGrowthGroupStructureId * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query * @return GrowthGroup[] */ public static function LoadArrayByGrowthGroupStructure($intGrowthGroupStructureId, $objOptionalClauses = null) { // Call GrowthGroup::QueryArray to perform the LoadArrayByGrowthGroupStructure query try { return GrowthGroup::QueryArray(QQ::Equal(QQN::GrowthGroup()->GrowthGroupStructure->GrowthGroupStructureId, $intGrowthGroupStructureId), $objOptionalClauses); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
/** * 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 = GrowthGroup::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 GrowthGroup, given the clauses above $this->DataSource = GrowthGroup::QueryArray($objCondition, $objClauses); }
public function dtgGroups_Bind() { $objConditions = QQ::All(); $objClauses = array(); $objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::GrowthGroup()->Group->ActiveFlag, true)); if ($this->chkDayOfWeek->Checked) { // Map to Days of Week $dayArray = array(); foreach (GrowthGroupDayType::$NameArray as $key => $value) { if (strpos(strtolower($this->objRegistrant->GroupDay), strtolower($value)) !== false) { $dayArray[] = $key; } } $objConditions = QQ::AndCondition($objConditions, QQ::In(QQN::GrowthGroup()->GrowthGroupDayTypeId, $dayArray)); } $growthGroupArray = GrowthGroup::QueryArray($objConditions); if ($this->chkGroupType->Checked) { $requestedGroupStructureArray = array(); foreach (GrowthGroupStructure::LoadAll() as $objGroupStructure) { if ($this->objRegistrant->IsGrowthGroupStructureAsGroupstructureAssociated($objGroupStructure)) { $requestedGroupStructureArray[] = $objGroupStructure; } } $newGrowthGroupArray = array(); foreach ($growthGroupArray as $objGroup) { foreach ($requestedGroupStructureArray as $objGroupStructure) { if ($objGroup->IsGrowthGroupStructureAssociated($objGroupStructure)) { $newGrowthGroupArray[] = $objGroup; break; } } } $growthGroupArray = $newGrowthGroupArray; } if ($this->chkAvailability->Checked) { $newGrowthGroupArray = array(); $intClosed = 0; foreach (AvailabilityStatus::LoadAll() as $objStatus) { if ($objStatus->Name == 'Closed') { $intClosed = $objStatus->Id; } } foreach ($growthGroupArray as $objGroup) { $intStatus = Group::Load($objGroup->GroupId)->Status; if ($intStatus != $intClosed) { $newGrowthGroupArray[] = $objGroup; } } $growthGroupArray = $newGrowthGroupArray; } if ($this->chkLocation->Checked) { // Map to our existing Growth Group Locations $locationIdArray = array(); $strLocationArray = array($this->objRegistrant->PreferredLocation1, $this->objRegistrant->PreferredLocation2); for ($i = 0; $i < 2; $i++) { if (null != $strLocationArray[$i]) { switch ($strLocationArray[$i]) { case 'Foster City': case 'San Bruno': case 'San Carlos': case 'San Mateo': case 'San Francisco': case 'South San Francisco': $locationIdArray[] = 1; break; case 'East Palo Alto': case 'Mountain View': case 'Menlo Park': case 'Palo Alto': case 'Redwood City': $locationIdArray[] = 2; break; case 'Campbell': case 'Cupertino': case 'Los Altos': case 'Sunnyvale': $locationIdArray[] = 3; break; case 'San Jose': case 'South San Jose': case 'Santa Clara': $locationIdArray[] = 4; break; case 'Fremont': case 'Milpitas': case 'Newark ': case 'Pleasanton': case 'Tracy': $locationIdArray[] = 5; break; case 'Oakland': case 'Clayton': $locationIdArray[] = 6; break; } } } $newGrowthGroupArray = array(); foreach ($growthGroupArray as $objGroup) { if (in_array($objGroup->GrowthGroupLocationId, $locationIdArray)) { $newGrowthGroupArray[] = $objGroup; } } $growthGroupArray = $newGrowthGroupArray; } $this->dtgGroups->DataSource = $growthGroupArray; }