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); } }
/** * 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 = GrowthGroupStructure::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 GrowthGroupStructure, given the clauses above $this->DataSource = GrowthGroupStructure::QueryArray($objCondition, $objClauses); }
public static function GetSoapArrayFromArray($objArray) { if (!$objArray) { return null; } $objArrayToReturn = array(); foreach ($objArray as $objObject) { array_push($objArrayToReturn, GrowthGroupStructure::GetSoapObjectFromObject($objObject, true)); } return unserialize(serialize($objArrayToReturn)); }
public function btnSubmit_Click($strFormId, $strControlId, $strParameter) { $this->objGroupRegistration->DateReceived = new QDateTime(QDateTime::Now); $this->objGroupRegistration->FirstName = $this->txtFirstName->Text; $this->objGroupRegistration->LastName = $this->txtLastName->Text; $this->objGroupRegistration->Address = $this->txtAddress->Text; $this->objGroupRegistration->City = $this->txtCity->Text; $this->objGroupRegistration->Zipcode = $this->txtZipCode->Text; $this->objGroupRegistration->Email = $this->txtEmail->Text; $this->objGroupRegistration->Phone = $this->txtPhoneNumber->Text; $this->objGroupRegistration->Comments = $this->txtComments->Text; foreach (SourceList::LoadAll() as $objSourceList) { if ($objSourceList->Name == $this->lstSource->SelectedName) { $this->objGroupRegistration->SourceListId = $objSourceList->Id; break; } } $this->objGroupRegistration->Gender = $this->lstGender->SelectedName; $this->objGroupRegistration->GroupRoleId = $this->lstParticipationType->SelectedValue; $strDays = ''; foreach ($this->chkDaysAvailable as $chkDays) { if ($chkDays->Checked) { $strDays .= $chkDays->Text . ', '; } } $strDays = substr($strDays, 0, strlen($strDays) - 1); $this->objGroupRegistration->GroupDay = $strDays; $this->objGroupRegistration->PreferredLocation1 = $this->lstLocationFirst->SelectedName; $this->objGroupRegistration->PreferredLocation2 = $this->lstLocationSecond->SelectedName; $this->objGroupRegistration->Save(); foreach ($this->chkGroupType as $chkGroup) { if ($chkGroup->Checked) { $this->objGroupRegistration->AssociateGrowthGroupStructureAsGroupstructure(GrowthGroupStructure::Load($chkGroup->Name)); } } // Send Facilitator Application if user selected to be a Facilitator if ($this->lstParticipationType->SelectedName == 'Facilitator') { $this->SendMessage(); } //Send notification $this->SendNotification(); QApplication::Redirect('/success.php'); }
/** * Counts all many-to-many associated GrowthGroupStructures * @return int */ public function CountGrowthGroupStructures() { if (is_null($this->intGroupId)) { return 0; } return GrowthGroupStructure::CountByGrowthGroup($this->intGroupId); }
protected function lstGrowthGroupStructuresAsGroupstructure_Update() { if ($this->lstGrowthGroupStructuresAsGroupstructure) { $this->objGroupRegistrations->UnassociateAllGrowthGroupStructuresAsGroupstructure(); $objSelectedListItems = $this->lstGrowthGroupStructuresAsGroupstructure->SelectedItems; if ($objSelectedListItems) { foreach ($objSelectedListItems as $objListItem) { $this->objGroupRegistrations->AssociateGrowthGroupStructureAsGroupstructure(GrowthGroupStructure::Load($objListItem->Value)); } } } }
<?php $objParameters = new QCliParameterProcessor('growth-group-import', 'ALCF Growth Group Importer Script'); $objParameters->AddDefaultParameter('server', QCliParameterType::String, 'Server/Host of the MySQL Database'); $objParameters->AddDefaultParameter('dbname', QCliParameterType::String, 'Database Name of the MySQL Database'); $objParameters->AddDefaultParameter('username', QCliParameterType::String, 'Username of the MySQL user'); $objParameters->Run(); $objMySqli = new mysqli($objParameters->GetDefaultValue('server'), $objParameters->GetDefaultValue('username'), null, $objParameters->GetDefaultValue('dbname')); $objMinistry = Ministry::LoadByToken('growth'); if (!$objMinistry) { exit('No GG Ministry Found'); } $objResult = $objMySqli->Query('SELECT * FROM growth_group_structure order by id;'); while ($objRow = $objResult->fetch_array()) { $objStructure = new GrowthGroupStructure(); $objStructure->Name = $objRow['name']; $objStructure->Save(); } $objResult = $objMySqli->Query('SELECT * FROM growth_group_location order by id;'); $objParentGroupArray = array(); while ($objRow = $objResult->fetch_array()) { $objGrowthGroupLocation = new GrowthGroupLocation(); $objGrowthGroupLocation->Location = $objRow['location']; $objGrowthGroupLocation->Longitude = $objRow['longitude']; $objGrowthGroupLocation->Latitude = $objRow['latitude']; $objGrowthGroupLocation->Zoom = $objRow['zoom']; $objGrowthGroupLocation->Save(); $strTokens = explode('(', $objGrowthGroupLocation->Location); $objParentGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::GroupCategory, trim($strTokens[0]), 'Growth Groups in ' . $objGrowthGroupLocation->Location); $objGroupCategory = new GroupCategory(); $objGroupCategory->Group = $objParentGroup;
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; }
/** * 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 GrowthGroupStructureMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing GrowthGroupStructure object creation - defaults to CreateOrEdit * @return GrowthGroupStructureMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objGrowthGroupStructure = GrowthGroupStructure::Load($intId); // GrowthGroupStructure was found -- return it! if ($objGrowthGroupStructure) { return new GrowthGroupStructureMetaControl($objParentObject, $objGrowthGroupStructure); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a GrowthGroupStructure 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 GrowthGroupStructureMetaControl($objParentObject, new GrowthGroupStructure()); }
/** * Counts all many-to-many associated GrowthGroupStructuresAsGroupstructure * @return int */ public function CountGrowthGroupStructuresAsGroupstructure() { if (is_null($this->intId)) { return 0; } return GrowthGroupStructure::CountByGroupRegistrationsAsGroupstructure($this->intId); }
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';