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); } }
public static function GetSoapArrayFromArray($objArray) { if (!$objArray) { return null; } $objArrayToReturn = array(); foreach ($objArray as $objObject) { array_push($objArrayToReturn, GrowthGroupLocation::GetSoapObjectFromObject($objObject, true)); } return unserialize(serialize($objArrayToReturn)); }
public static function GenerateGroup(Ministry $objMinistry, Group $objParentGroup = null) { $strName = QDataGen::GenerateTitle(1, 4); $strToken = strtolower(str_replace(' ', '_', $strName)); while (Group::LoadByToken($strToken)) { $strName = QDataGen::GenerateTitle(1, 4); $strToken = strtolower(str_replace(' ', '_', $strName)); } $strDescription = QDataGen::GenerateContent(rand(0, 1), 5, 20); $intGroupTypeId = QDataGen::GenerateFromArray(array_keys(GroupType::$NameArray)); $objGroup = Group::CreateGroupForMinistry($objMinistry, $intGroupTypeId, $strName, $strDescription, $objParentGroup); // Set folder options $objGroup->ConfidentialFlag = !rand(0, 8); // Email if (!rand(0, 3)) { $objGroup->EmailBroadcastTypeId = QDataGen::GenerateFromArray(array_keys(EmailBroadcastType::$NameArray)); $objGroup->Token = $strToken; } $objGroup->Save(); switch ($objGroup->GroupTypeId) { case GroupType::GrowthGroup: $objGrowthGroup = new GrowthGroup(); $objGrowthGroup->Group = $objGroup; $objGrowthGroup->GrowthGroupLocationId = rand(1, GrowthGroupLocation::CountAll()); $objGrowthGroup->Save(); break; case GroupType::SmartGroup: $objSmartGroup = new SmartGroup(); $objSmartGroup->Group = $objGroup; $objSmartGroup->Save(); break; case GroupType::GroupCategory: $objGroupCategory = new GroupCategory(); $objGroupCategory->Group = $objGroup; $objGroupCategory->Save(); // Create Subgroups $intSubFolderCount = rand(0, 5); for ($intCount = 0; $intCount < $intSubFolderCount; $intCount++) { self::GenerateGroup($objMinistry, $objGroup); } break; } // Create Participants $objGroupRoleArray = GroupRole::LoadArrayByMinistryId($objMinistry->Id); switch ($objGroup->GroupTypeId) { case GroupType::GrowthGroup: case GroupType::RegularGroup: $intParticipantCount = rand(1, 8); for ($intIndex = 0; $intIndex < $intParticipantCount; $intIndex++) { $dttStartDate = QDataGen::GenerateDateTime(self::$SystemStartDate, QDateTime::Now()); $dttEndDate = rand(0, 4) ? null : QDataGen::GenerateDateTime($dttStartDate, QDateTime::Now()); $objGroup->AddPerson(Person::Load(rand(1, self::$MaxPersonId)), QDataGen::GenerateFromArray($objGroupRoleArray)->Id, $dttStartDate, $dttEndDate); } break; } }
public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) { if ($objObject->objGroup) { $objObject->objGroup = Group::GetSoapObjectFromObject($objObject->objGroup, false); } else { if (!$blnBindRelatedObjects) { $objObject->intGroupId = null; } } if ($objObject->objGrowthGroupLocation) { $objObject->objGrowthGroupLocation = GrowthGroupLocation::GetSoapObjectFromObject($objObject->objGrowthGroupLocation, false); } else { if (!$blnBindRelatedObjects) { $objObject->intGrowthGroupLocationId = null; } } return $objObject; }
$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; $objGroupCategory->Save(); $objGgResult = $objMySqli->Query('SELECT * FROM growth_group WHERE growth_group_location_id=' . $objRow['id'] . ' ORDER BY id'); while ($objGgRow = $objGgResult->fetch_array()) { $objGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::GrowthGroup, $objGgRow['name'], 'Growth Group for ' . $objGgRow['name'], $objParentGroup); $objGrowthGroup = new GrowthGroup(); $objGrowthGroup->Group = $objGroup;
/** * 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 = GrowthGroupLocation::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 GrowthGroupLocation, given the clauses above $this->DataSource = GrowthGroupLocation::QueryArray($objCondition, $objClauses); }
public function RenderLocationRegion(GrowthGroup $objGrowthGroup) { return GrowthGroupLocation::Load($objGrowthGroup->GrowthGroupLocationId)->Location; }
/** * 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 GrowthGroupLocationMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing GrowthGroupLocation object creation - defaults to CreateOrEdit * @return GrowthGroupLocationMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objGrowthGroupLocation = GrowthGroupLocation::Load($intId); // GrowthGroupLocation was found -- return it! if ($objGrowthGroupLocation) { return new GrowthGroupLocationMetaControl($objParentObject, $objGrowthGroupLocation); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a GrowthGroupLocation 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 GrowthGroupLocationMetaControl($objParentObject, new GrowthGroupLocation()); }
/** * 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); } }
<?php } } ?> } google.maps.event.addDomListener(window, 'load', initialize); </script> <script type="text/javascript" src="/scripts/growthgroups.js"></script> <div id="map_canvas" style="width: 980px; height: 400px; border: 1px solid black; float: left; margin-bottom:10px;"></div> <h2 style="color:#fffac9; font-size:24px;">Growth Group Regions</h2> <div style="background-color: #2F6C61; width: 980px; height: 72px; float:left; box-shadow: 10px 10px 5px #444444;"> <ul class="mapnav"> <?php foreach (GrowthGroupLocation::LoadAll(QQ::OrderBy(QQN::GrowthGroupLocation()->Id)) as $objLocation) { $strStyle = null; if ($objLocation->Id == $this->objLocation->Id) { $strLocation = QApplication::HtmlEntities($objLocation->Location); $strLocation = str_replace(' (', '<br/><span style="font-size: 14px; font-weight: normal; font-family: arial;">(', $strLocation); $strLocation = str_replace(')', ')</span>', $strLocation); $strLocation = str_replace('including', 'incl.', $strLocation); $strLocation = str_replace('to San', 'to<br/>San', $strLocation); printf('<li class="selected"%s>%s</li>', $strStyle, $strLocation); } else { $strLocation = QApplication::HtmlEntities($objLocation->Location); if (strpos($strLocation, '(')) { $strLocation = str_replace(' (', '</a><br/><span style="font-size: 14px; font-weight: normal; font-family: arial; ">(', $strLocation); $strLocation = str_replace(')', ')</span>', $strLocation); $strLocation = str_replace('including', 'incl.', $strLocation); printf('<li%s><a href="/index.php/%s">%s</li>', $strStyle, $objLocation->Id, $strLocation);