protected function SetupChildEditControls() { $this->lstGrowthGroupLocation = $this->mctGrowthGroup->lstGrowthGroupLocation_Create(); $this->lstGrowthGroupStructure = $this->mctGrowthGroup->lstGrowthGroupStructures_Create(); $this->lstGrowthGroupStructure->Rows = 10; $this->lstGrowthGroupStatus = new QListBox($this); foreach (AvailabilityStatus::LoadAll() as $objStatus) { $this->lstGrowthGroupStatus->AddItem($objStatus->Name, $objStatus->Id); } $this->lstGrowthGroupDayType = $this->mctGrowthGroup->lstGrowthGroupDayType_Create(); $this->txtStartTime = $this->mctGrowthGroup->txtStartTime_Create(); $this->txtEndTime = $this->mctGrowthGroup->txtEndTime_Create(); $this->txtAddress1 = $this->mctGrowthGroup->txtAddress1_Create(); $this->txtAddress2 = $this->mctGrowthGroup->txtAddress2_Create(); $this->txtCrossStreet1 = $this->mctGrowthGroup->txtCrossStreet1_Create(); $this->txtCrossStreet2 = $this->mctGrowthGroup->txtCrossStreet2_Create(); $this->txtZipCode = $this->mctGrowthGroup->txtZipCode_Create(); $this->txtLongitude = $this->mctGrowthGroup->txtLongitude_Create(); $this->txtLatitude = $this->mctGrowthGroup->txtLatitude_Create(); $this->txtAccuracy = $this->mctGrowthGroup->txtAccuracy_Create(); $this->txtAccuracy->Instructions = 'as reported by Google Maps -- this should ideally be 7'; $this->txtDescription = $this->mctGrowthGroup->txtDescription_Create(); $this->btnRefresh = new QButton($this); $this->btnRefresh->Text = 'Lookup Using Google Maps'; $this->btnRefresh->AddAction(new QClickEvent(), new QToggleEnableAction($this->btnRefresh)); $this->btnRefresh->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnRefresh_Click')); $this->cblMeetings = new QCheckBoxList($this, 'days'); $this->cblMeetings->Name = 'Meetings per Month'; foreach (array('1st', '2nd', '3rd', '4th', '5th', 'Every Other') as $intKey => $strName) { $intValue = pow(2, $intKey); $this->cblMeetings->AddItem($strName, $intValue, $this->mctGrowthGroup->GrowthGroup->MeetingBitmap & $intValue); } QApplication::ExecuteJavaScript('document.getElementById("days[5]").onclick = EveryOtherClicked;'); }
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; }
/** * Refresh this MetaControl with Data from the local Group object. * @param boolean $blnReload reload Group from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objGroup->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objGroup->Id; } } if ($this->lstGroupType) { $this->lstGroupType->SelectedValue = $this->objGroup->GroupTypeId; } if ($this->lblGroupTypeId) { $this->lblGroupTypeId->Text = $this->objGroup->GroupTypeId ? GroupType::$NameArray[$this->objGroup->GroupTypeId] : null; } if ($this->lstMinistry) { $this->lstMinistry->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstMinistry->AddItem(QApplication::Translate('- Select One -'), null); } $objMinistryArray = Ministry::LoadAll(); if ($objMinistryArray) { foreach ($objMinistryArray as $objMinistry) { $objListItem = new QListItem($objMinistry->__toString(), $objMinistry->Id); if ($this->objGroup->Ministry && $this->objGroup->Ministry->Id == $objMinistry->Id) { $objListItem->Selected = true; } $this->lstMinistry->AddItem($objListItem); } } } if ($this->lblMinistryId) { $this->lblMinistryId->Text = $this->objGroup->Ministry ? $this->objGroup->Ministry->__toString() : null; } if ($this->txtName) { $this->txtName->Text = $this->objGroup->Name; } if ($this->lblName) { $this->lblName->Text = $this->objGroup->Name; } if ($this->txtDescription) { $this->txtDescription->Text = $this->objGroup->Description; } if ($this->lblDescription) { $this->lblDescription->Text = $this->objGroup->Description; } if ($this->lstParentGroup) { $this->lstParentGroup->RemoveAllItems(); $this->lstParentGroup->AddItem(QApplication::Translate('- Select One -'), null); $objParentGroupArray = Group::LoadAll(); if ($objParentGroupArray) { foreach ($objParentGroupArray as $objParentGroup) { $objListItem = new QListItem($objParentGroup->__toString(), $objParentGroup->Id); if ($this->objGroup->ParentGroup && $this->objGroup->ParentGroup->Id == $objParentGroup->Id) { $objListItem->Selected = true; } $this->lstParentGroup->AddItem($objListItem); } } } if ($this->lblParentGroupId) { $this->lblParentGroupId->Text = $this->objGroup->ParentGroup ? $this->objGroup->ParentGroup->__toString() : null; } if ($this->txtHierarchyLevel) { $this->txtHierarchyLevel->Text = $this->objGroup->HierarchyLevel; } if ($this->lblHierarchyLevel) { $this->lblHierarchyLevel->Text = $this->objGroup->HierarchyLevel; } if ($this->txtHierarchyOrderNumber) { $this->txtHierarchyOrderNumber->Text = $this->objGroup->HierarchyOrderNumber; } if ($this->lblHierarchyOrderNumber) { $this->lblHierarchyOrderNumber->Text = $this->objGroup->HierarchyOrderNumber; } if ($this->chkConfidentialFlag) { $this->chkConfidentialFlag->Checked = $this->objGroup->ConfidentialFlag; } if ($this->lblConfidentialFlag) { $this->lblConfidentialFlag->Text = $this->objGroup->ConfidentialFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->lstEmailBroadcastType) { $this->lstEmailBroadcastType->SelectedValue = $this->objGroup->EmailBroadcastTypeId; } if ($this->lblEmailBroadcastTypeId) { $this->lblEmailBroadcastTypeId->Text = $this->objGroup->EmailBroadcastTypeId ? EmailBroadcastType::$NameArray[$this->objGroup->EmailBroadcastTypeId] : null; } if ($this->txtToken) { $this->txtToken->Text = $this->objGroup->Token; } if ($this->lblToken) { $this->lblToken->Text = $this->objGroup->Token; } if ($this->chkActiveFlag) { $this->chkActiveFlag->Checked = $this->objGroup->ActiveFlag; } if ($this->lblActiveFlag) { $this->lblActiveFlag->Text = $this->objGroup->ActiveFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->lstStatusObject) { $this->lstStatusObject->RemoveAllItems(); $this->lstStatusObject->AddItem(QApplication::Translate('- Select One -'), null); $objStatusObjectArray = AvailabilityStatus::LoadAll(); if ($objStatusObjectArray) { foreach ($objStatusObjectArray as $objStatusObject) { $objListItem = new QListItem($objStatusObject->__toString(), $objStatusObject->Id); if ($this->objGroup->StatusObject && $this->objGroup->StatusObject->Id == $objStatusObject->Id) { $objListItem->Selected = true; } $this->lstStatusObject->AddItem($objListItem); } } } if ($this->lblStatus) { $this->lblStatus->Text = $this->objGroup->StatusObject ? $this->objGroup->StatusObject->__toString() : null; } if ($this->lstGroupCategory) { $this->lstGroupCategory->RemoveAllItems(); $this->lstGroupCategory->AddItem(QApplication::Translate('- Select One -'), null); $objGroupCategoryArray = GroupCategory::LoadAll(); if ($objGroupCategoryArray) { foreach ($objGroupCategoryArray as $objGroupCategory) { $objListItem = new QListItem($objGroupCategory->__toString(), $objGroupCategory->GroupId); if ($objGroupCategory->GroupId == $this->objGroup->Id) { $objListItem->Selected = true; } $this->lstGroupCategory->AddItem($objListItem); } } // Because GroupCategory's GroupCategory is not null, if a value is already selected, it cannot be changed. if ($this->lstGroupCategory->SelectedValue) { $this->lstGroupCategory->Enabled = false; } else { $this->lstGroupCategory->Enabled = true; } } if ($this->lblGroupCategory) { $this->lblGroupCategory->Text = $this->objGroup->GroupCategory ? $this->objGroup->GroupCategory->__toString() : null; } if ($this->lstGrowthGroup) { $this->lstGrowthGroup->RemoveAllItems(); $this->lstGrowthGroup->AddItem(QApplication::Translate('- Select One -'), null); $objGrowthGroupArray = GrowthGroup::LoadAll(); if ($objGrowthGroupArray) { foreach ($objGrowthGroupArray as $objGrowthGroup) { $objListItem = new QListItem($objGrowthGroup->__toString(), $objGrowthGroup->GroupId); if ($objGrowthGroup->GroupId == $this->objGroup->Id) { $objListItem->Selected = true; } $this->lstGrowthGroup->AddItem($objListItem); } } // Because GrowthGroup's GrowthGroup is not null, if a value is already selected, it cannot be changed. if ($this->lstGrowthGroup->SelectedValue) { $this->lstGrowthGroup->Enabled = false; } else { $this->lstGrowthGroup->Enabled = true; } } if ($this->lblGrowthGroup) { $this->lblGrowthGroup->Text = $this->objGroup->GrowthGroup ? $this->objGroup->GrowthGroup->__toString() : null; } if ($this->lstSmartGroup) { $this->lstSmartGroup->RemoveAllItems(); $this->lstSmartGroup->AddItem(QApplication::Translate('- Select One -'), null); $objSmartGroupArray = SmartGroup::LoadAll(); if ($objSmartGroupArray) { foreach ($objSmartGroupArray as $objSmartGroup) { $objListItem = new QListItem($objSmartGroup->__toString(), $objSmartGroup->GroupId); if ($objSmartGroup->GroupId == $this->objGroup->Id) { $objListItem->Selected = true; } $this->lstSmartGroup->AddItem($objListItem); } } // Because SmartGroup's SmartGroup is not null, if a value is already selected, it cannot be changed. if ($this->lstSmartGroup->SelectedValue) { $this->lstSmartGroup->Enabled = false; } else { $this->lstSmartGroup->Enabled = true; } } if ($this->lblSmartGroup) { $this->lblSmartGroup->Text = $this->objGroup->SmartGroup ? $this->objGroup->SmartGroup->__toString() : null; } }