Beispiel #1
0
 protected function Form_Create()
 {
     $this->objLocation = GrowthGroupLocation::Load(QApplication::PathInfo(0));
     if (!$this->objLocation) {
         $this->objLocation = GrowthGroupLocation::Load(2);
     }
     $this->dtrGrowthGroups = new QDataRepeater($this, 'dtrgg');
     $this->dtrGrowthGroups->Template = dirname(__FILE__) . '/dtrGrowthGroups.tpl.php';
     $this->dtrGrowthGroups->SetDataBinder('dtrGrowthGroups_Bind');
     $this->pnlNone = new QPanel($this, 'pnlnone');
     $this->pnlNone->Text = 'No results found.  Please use a less restrictive filter.';
     $this->intMarkerArray = array();
     $intMarkerNumber = 0;
     // Filter Out "inactive" groups
     //foreach ($this->objLocation->GetGrowthGroupArray(QQ::Equal(QQN::GrowthGroup()->Group->ActiveFlag, true),
     //QQ::Clause(QQ::OrderBy(QQN::GrowthGroup()->Group->Name))) as $objGroup) {
     foreach ($this->objLocation->GetGrowthGroupArray(QQ::OrderBy(QQN::GrowthGroup()->Group->Name)) as $objGroup) {
         if ($objGroup->Group->ActiveFlag == true) {
             $intMarkerNumber++;
             $this->intMarkerArray[$objGroup->GroupId] = $intMarkerNumber;
         }
     }
     $this->lstDays = new QListBox($this);
     $this->lstDays->AddItem('- View All Days -', null);
     $this->lstDays->AddAction(new QChangeEvent(), new QAjaxAction('dtrGrowthGroups_Bind'));
     foreach (GrowthGroupDayType::$NameArray as $intId => $strName) {
         $this->lstDays->AddItem($strName, $intId);
     }
     $this->lstTypes = new QListBox($this);
     $this->lstTypes->AddItem('- View All Types -', null);
     $this->lstTypes->AddAction(new QChangeEvent(), new QAjaxAction('dtrGrowthGroups_Bind'));
     foreach (GrowthGroupStructure::LoadAll(QQ::OrderBy(QQN::GrowthGroupStructure()->Name)) as $objStructure) {
         $this->lstTypes->AddItem($objStructure->Name, $objStructure->Id);
     }
 }
 /**
  * Refresh this MetaControl with Data from the local GroupRegistrations object.
  * @param boolean $blnReload reload GroupRegistrations from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objGroupRegistrations->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objGroupRegistrations->Id;
         }
     }
     if ($this->lstSourceList) {
         $this->lstSourceList->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstSourceList->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objSourceListArray = SourceList::LoadAll();
         if ($objSourceListArray) {
             foreach ($objSourceListArray as $objSourceList) {
                 $objListItem = new QListItem($objSourceList->__toString(), $objSourceList->Id);
                 if ($this->objGroupRegistrations->SourceList && $this->objGroupRegistrations->SourceList->Id == $objSourceList->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSourceList->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSourceListId) {
         $this->lblSourceListId->Text = $this->objGroupRegistrations->SourceList ? $this->objGroupRegistrations->SourceList->__toString() : null;
     }
     if ($this->calDateReceived) {
         $this->calDateReceived->DateTime = $this->objGroupRegistrations->DateReceived;
     }
     if ($this->lblDateReceived) {
         $this->lblDateReceived->Text = sprintf($this->objGroupRegistrations->DateReceived) ? $this->objGroupRegistrations->__toString($this->strDateReceivedDateTimeFormat) : null;
     }
     if ($this->txtFirstName) {
         $this->txtFirstName->Text = $this->objGroupRegistrations->FirstName;
     }
     if ($this->lblFirstName) {
         $this->lblFirstName->Text = $this->objGroupRegistrations->FirstName;
     }
     if ($this->txtLastName) {
         $this->txtLastName->Text = $this->objGroupRegistrations->LastName;
     }
     if ($this->lblLastName) {
         $this->lblLastName->Text = $this->objGroupRegistrations->LastName;
     }
     if ($this->txtGender) {
         $this->txtGender->Text = $this->objGroupRegistrations->Gender;
     }
     if ($this->lblGender) {
         $this->lblGender->Text = $this->objGroupRegistrations->Gender;
     }
     if ($this->txtAddress) {
         $this->txtAddress->Text = $this->objGroupRegistrations->Address;
     }
     if ($this->lblAddress) {
         $this->lblAddress->Text = $this->objGroupRegistrations->Address;
     }
     if ($this->txtPhone) {
         $this->txtPhone->Text = $this->objGroupRegistrations->Phone;
     }
     if ($this->lblPhone) {
         $this->lblPhone->Text = $this->objGroupRegistrations->Phone;
     }
     if ($this->txtEmail) {
         $this->txtEmail->Text = $this->objGroupRegistrations->Email;
     }
     if ($this->lblEmail) {
         $this->lblEmail->Text = $this->objGroupRegistrations->Email;
     }
     if ($this->txtComments) {
         $this->txtComments->Text = $this->objGroupRegistrations->Comments;
     }
     if ($this->lblComments) {
         $this->lblComments->Text = $this->objGroupRegistrations->Comments;
     }
     if ($this->lstGroupRole) {
         $this->lstGroupRole->RemoveAllItems();
         $this->lstGroupRole->AddItem(QApplication::Translate('- Select One -'), null);
         $objGroupRoleArray = GroupRole::LoadAll();
         if ($objGroupRoleArray) {
             foreach ($objGroupRoleArray as $objGroupRole) {
                 $objListItem = new QListItem($objGroupRole->__toString(), $objGroupRole->Id);
                 if ($this->objGroupRegistrations->GroupRole && $this->objGroupRegistrations->GroupRole->Id == $objGroupRole->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstGroupRole->AddItem($objListItem);
             }
         }
     }
     if ($this->lblGroupRoleId) {
         $this->lblGroupRoleId->Text = $this->objGroupRegistrations->GroupRole ? $this->objGroupRegistrations->GroupRole->__toString() : null;
     }
     if ($this->txtPreferredLocation1) {
         $this->txtPreferredLocation1->Text = $this->objGroupRegistrations->PreferredLocation1;
     }
     if ($this->lblPreferredLocation1) {
         $this->lblPreferredLocation1->Text = $this->objGroupRegistrations->PreferredLocation1;
     }
     if ($this->txtPreferredLocation2) {
         $this->txtPreferredLocation2->Text = $this->objGroupRegistrations->PreferredLocation2;
     }
     if ($this->lblPreferredLocation2) {
         $this->lblPreferredLocation2->Text = $this->objGroupRegistrations->PreferredLocation2;
     }
     if ($this->txtCity) {
         $this->txtCity->Text = $this->objGroupRegistrations->City;
     }
     if ($this->lblCity) {
         $this->lblCity->Text = $this->objGroupRegistrations->City;
     }
     if ($this->txtZipcode) {
         $this->txtZipcode->Text = $this->objGroupRegistrations->Zipcode;
     }
     if ($this->lblZipcode) {
         $this->lblZipcode->Text = $this->objGroupRegistrations->Zipcode;
     }
     if ($this->txtGroupDay) {
         $this->txtGroupDay->Text = $this->objGroupRegistrations->GroupDay;
     }
     if ($this->lblGroupDay) {
         $this->lblGroupDay->Text = $this->objGroupRegistrations->GroupDay;
     }
     if ($this->txtGroupsPlaced) {
         $this->txtGroupsPlaced->Text = $this->objGroupRegistrations->GroupsPlaced;
     }
     if ($this->lblGroupsPlaced) {
         $this->lblGroupsPlaced->Text = $this->objGroupRegistrations->GroupsPlaced;
     }
     if ($this->calDateProcessed) {
         $this->calDateProcessed->DateTime = $this->objGroupRegistrations->DateProcessed;
     }
     if ($this->lblDateProcessed) {
         $this->lblDateProcessed->Text = sprintf($this->objGroupRegistrations->DateProcessed) ? $this->objGroupRegistrations->__toString($this->strDateProcessedDateTimeFormat) : null;
     }
     if ($this->chkProcessedFlag) {
         $this->chkProcessedFlag->Checked = $this->objGroupRegistrations->ProcessedFlag;
     }
     if ($this->lblProcessedFlag) {
         $this->lblProcessedFlag->Text = $this->objGroupRegistrations->ProcessedFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->lstGrowthGroupStructuresAsGroupstructure) {
         $this->lstGrowthGroupStructuresAsGroupstructure->RemoveAllItems();
         $objAssociatedArray = $this->objGroupRegistrations->GetGrowthGroupStructureAsGroupstructureArray();
         $objGrowthGroupStructureArray = GrowthGroupStructure::LoadAll();
         if ($objGrowthGroupStructureArray) {
             foreach ($objGrowthGroupStructureArray as $objGrowthGroupStructure) {
                 $objListItem = new QListItem($objGrowthGroupStructure->__toString(), $objGrowthGroupStructure->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objGrowthGroupStructure->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstGrowthGroupStructuresAsGroupstructure->AddItem($objListItem);
             }
         }
     }
     if ($this->lblGrowthGroupStructuresAsGroupstructure) {
         $objAssociatedArray = $this->objGroupRegistrations->GetGrowthGroupStructureAsGroupstructureArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblGrowthGroupStructuresAsGroupstructure->Text = implode($strGlue, $strItems);
     }
 }
 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 GrowthGroup object.
  * @param boolean $blnReload reload GrowthGroup from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objGrowthGroup->Reload();
     }
     if ($this->lstGroup) {
         $this->lstGroup->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstGroup->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objGroupArray = Group::LoadAll();
         if ($objGroupArray) {
             foreach ($objGroupArray as $objGroup) {
                 $objListItem = new QListItem($objGroup->__toString(), $objGroup->Id);
                 if ($this->objGrowthGroup->Group && $this->objGrowthGroup->Group->Id == $objGroup->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstGroup->AddItem($objListItem);
             }
         }
     }
     if ($this->lblGroupId) {
         $this->lblGroupId->Text = $this->objGrowthGroup->Group ? $this->objGrowthGroup->Group->__toString() : null;
     }
     if ($this->lstGrowthGroupLocation) {
         $this->lstGrowthGroupLocation->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstGrowthGroupLocation->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objGrowthGroupLocationArray = GrowthGroupLocation::LoadAll();
         if ($objGrowthGroupLocationArray) {
             foreach ($objGrowthGroupLocationArray as $objGrowthGroupLocation) {
                 $objListItem = new QListItem($objGrowthGroupLocation->__toString(), $objGrowthGroupLocation->Id);
                 if ($this->objGrowthGroup->GrowthGroupLocation && $this->objGrowthGroup->GrowthGroupLocation->Id == $objGrowthGroupLocation->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstGrowthGroupLocation->AddItem($objListItem);
             }
         }
     }
     if ($this->lblGrowthGroupLocationId) {
         $this->lblGrowthGroupLocationId->Text = $this->objGrowthGroup->GrowthGroupLocation ? $this->objGrowthGroup->GrowthGroupLocation->__toString() : null;
     }
     if ($this->lstGrowthGroupDayType) {
         $this->lstGrowthGroupDayType->SelectedValue = $this->objGrowthGroup->GrowthGroupDayTypeId;
     }
     if ($this->lblGrowthGroupDayTypeId) {
         $this->lblGrowthGroupDayTypeId->Text = $this->objGrowthGroup->GrowthGroupDayTypeId ? GrowthGroupDayType::$NameArray[$this->objGrowthGroup->GrowthGroupDayTypeId] : null;
     }
     if ($this->txtMeetingBitmap) {
         $this->txtMeetingBitmap->Text = $this->objGrowthGroup->MeetingBitmap;
     }
     if ($this->lblMeetingBitmap) {
         $this->lblMeetingBitmap->Text = $this->objGrowthGroup->MeetingBitmap;
     }
     if ($this->txtStartTime) {
         $this->txtStartTime->Text = $this->objGrowthGroup->StartTime;
     }
     if ($this->lblStartTime) {
         $this->lblStartTime->Text = $this->objGrowthGroup->StartTime;
     }
     if ($this->txtEndTime) {
         $this->txtEndTime->Text = $this->objGrowthGroup->EndTime;
     }
     if ($this->lblEndTime) {
         $this->lblEndTime->Text = $this->objGrowthGroup->EndTime;
     }
     if ($this->txtAddress1) {
         $this->txtAddress1->Text = $this->objGrowthGroup->Address1;
     }
     if ($this->lblAddress1) {
         $this->lblAddress1->Text = $this->objGrowthGroup->Address1;
     }
     if ($this->txtAddress2) {
         $this->txtAddress2->Text = $this->objGrowthGroup->Address2;
     }
     if ($this->lblAddress2) {
         $this->lblAddress2->Text = $this->objGrowthGroup->Address2;
     }
     if ($this->txtCrossStreet1) {
         $this->txtCrossStreet1->Text = $this->objGrowthGroup->CrossStreet1;
     }
     if ($this->lblCrossStreet1) {
         $this->lblCrossStreet1->Text = $this->objGrowthGroup->CrossStreet1;
     }
     if ($this->txtCrossStreet2) {
         $this->txtCrossStreet2->Text = $this->objGrowthGroup->CrossStreet2;
     }
     if ($this->lblCrossStreet2) {
         $this->lblCrossStreet2->Text = $this->objGrowthGroup->CrossStreet2;
     }
     if ($this->txtZipCode) {
         $this->txtZipCode->Text = $this->objGrowthGroup->ZipCode;
     }
     if ($this->lblZipCode) {
         $this->lblZipCode->Text = $this->objGrowthGroup->ZipCode;
     }
     if ($this->txtLongitude) {
         $this->txtLongitude->Text = $this->objGrowthGroup->Longitude;
     }
     if ($this->lblLongitude) {
         $this->lblLongitude->Text = $this->objGrowthGroup->Longitude;
     }
     if ($this->txtLatitude) {
         $this->txtLatitude->Text = $this->objGrowthGroup->Latitude;
     }
     if ($this->lblLatitude) {
         $this->lblLatitude->Text = $this->objGrowthGroup->Latitude;
     }
     if ($this->txtAccuracy) {
         $this->txtAccuracy->Text = $this->objGrowthGroup->Accuracy;
     }
     if ($this->lblAccuracy) {
         $this->lblAccuracy->Text = $this->objGrowthGroup->Accuracy;
     }
     if ($this->txtDescription) {
         $this->txtDescription->Text = $this->objGrowthGroup->Description;
     }
     if ($this->lblDescription) {
         $this->lblDescription->Text = $this->objGrowthGroup->Description;
     }
     if ($this->lstGrowthGroupStructures) {
         $this->lstGrowthGroupStructures->RemoveAllItems();
         $objAssociatedArray = $this->objGrowthGroup->GetGrowthGroupStructureArray();
         $objGrowthGroupStructureArray = GrowthGroupStructure::LoadAll();
         if ($objGrowthGroupStructureArray) {
             foreach ($objGrowthGroupStructureArray as $objGrowthGroupStructure) {
                 $objListItem = new QListItem($objGrowthGroupStructure->__toString(), $objGrowthGroupStructure->Id);
                 foreach ($objAssociatedArray as $objAssociated) {
                     if ($objAssociated->Id == $objGrowthGroupStructure->Id) {
                         $objListItem->Selected = true;
                     }
                 }
                 $this->lstGrowthGroupStructures->AddItem($objListItem);
             }
         }
     }
     if ($this->lblGrowthGroupStructures) {
         $objAssociatedArray = $this->objGrowthGroup->GetGrowthGroupStructureArray();
         $strItems = array();
         foreach ($objAssociatedArray as $objAssociated) {
             $strItems[] = $objAssociated->__toString();
         }
         $this->lblGrowthGroupStructures->Text = implode($strGlue, $strItems);
     }
 }
Beispiel #5
0
 public function RenderGroupTypes(GroupRegistrations $objGroupRegistration)
 {
     $strReturn = '';
     foreach (GrowthGroupStructure::LoadAll() as $objGrowthGroupStructure) {
         if ($objGroupRegistration->IsGrowthGroupStructureAsGroupstructureAssociated($objGrowthGroupStructure)) {
             $strReturn .= $objGrowthGroupStructure->Name . ', ';
         }
     }
     return substr($strReturn, 0, strlen($strReturn) - 2);
 }
 print EscapeCsv($objGroupRegistrant->Address);
 print ",";
 print EscapeCsv($objGroupRegistrant->City);
 print ",";
 print EscapeCsv($objGroupRegistrant->Zipcode);
 print ",";
 print EscapeCsv($objGroupRegistrant->DateReceived->ToString('M/D/YYYY'));
 print ",";
 print EscapeCsv($objGroupRegistrant->PreferredLocation1);
 print ",";
 print EscapeCsv($objGroupRegistrant->PreferredLocation2);
 print ",";
 print EscapeCsv($objGroupRegistrant->GroupRole->Name);
 print ",";
 $strReturn = '';
 foreach (GrowthGroupStructure::LoadAll() as $objGrowthGroupStructure) {
     if ($objGroupRegistrant->IsGrowthGroupStructureAsGroupstructureAssociated($objGrowthGroupStructure)) {
         $strReturn .= $objGrowthGroupStructure->Name . ', ';
     }
 }
 $strReturn = substr($strReturn, 0, strlen($strReturn) - 2);
 print EscapeCsv($strReturn);
 print ",";
 print EscapeCsv($objGroupRegistrant->GroupDay);
 print ",";
 print EscapeCsv(SourceList::Load($objGroupRegistrant->SourceListId)->Name);
 print ",";
 if ($objGroupRegistrant->ProcessedFlag) {
     print 'Yes';
 } else {
     print 'No';