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;');
 }
示例#2
0
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, AvailabilityStatus::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 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 AvailabilityStatusMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing AvailabilityStatus object creation - defaults to CreateOrEdit
  * @return AvailabilityStatusMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objAvailabilityStatus = AvailabilityStatus::Load($intId);
         // AvailabilityStatus was found -- return it!
         if ($objAvailabilityStatus) {
             return new AvailabilityStatusMetaControl($objParentObject, $objAvailabilityStatus);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a AvailabilityStatus 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 AvailabilityStatusMetaControl($objParentObject, new AvailabilityStatus());
 }
 /**
  * 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 = AvailabilityStatus::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 AvailabilityStatus, given the clauses above
     $this->DataSource = AvailabilityStatus::QueryArray($objCondition, $objClauses);
 }
 protected function SetupPanel()
 {
     if (!$this->objGroup->IsLoginCanView(QApplication::$Login)) {
         $this->ReturnTo('/groups/');
     }
     $this->SetupViewControls(true, false);
     // Set up additional column specifically for Growth Groups
     $this->dtgMembers->AddColumn(new QDataGridColumn('Current Group Member', '<?= $_CONTROL->ParentControl->RenderCurrentMember($_ITEM); ?>', 'HtmlEntities=true', 'Width=80px', array('OrderByClause' => QQ::OrderBy(QQN::Person()->GroupParticipation->DateEnd), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->GroupParticipation->DateEnd, false))));
     $this->dtgMembers->AddColumn(new QDataGridColumn('Group Role', '<?= $_CONTROL->ParentControl->RenderRole($_ITEM); ?>', 'HtmlEntities=true', 'Width=80px', array('OrderByClause' => QQ::OrderBy(QQN::Person()->GroupParticipation->GroupRole), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->GroupParticipation->GroupRole, false))));
     $this->dtgMembers->SetDataBinder('dtgMembers_Bind', $this);
     $strFacilitatorArray = array();
     $strHostArray = array();
     foreach ($this->objGroup->GetActiveGroupParticipationArray() as $objParticipant) {
         if ($objParticipant->GroupRole->Name == 'Facilitator') {
             $strFacilitatorArray[] = $objParticipant->Person->Name;
         } else {
             if ($objParticipant->GroupRole->Name == 'Host') {
                 $strHostArray[] = $objParticipant->Person->Name;
             }
         }
     }
     $this->lblFacilitator = new QLabel($this);
     $this->lblFacilitator->Name = 'Facilitator';
     if (count($strFacilitatorArray)) {
         $this->lblFacilitator->Text = implode(', ', $strFacilitatorArray);
     } else {
         $this->lblFacilitator->CssClass = 'na';
         $this->lblFacilitator->Text = 'Not Specified';
     }
     $this->lblHost = new QLabel($this);
     $this->lblHost->Name = 'Host';
     if (count($strHostArray)) {
         $this->lblHost->Text = implode(', ', $strHostArray);
     } else {
         $this->lblHost->CssClass = 'na';
         $this->lblHost->Text = 'Not Specified';
     }
     $this->lblRegion = new QLabel($this);
     $this->lblRegion->Name = 'Growth Group Region';
     $this->lblRegion->Text = $this->objGroup->GrowthGroup->GrowthGroupLocation->Location;
     $this->lblMeeting = new QLabel($this);
     $this->lblMeeting->Name = 'Meeting Information';
     $this->lblMeeting->Text = $this->objGroup->GrowthGroup->MeetingInfo;
     $this->lblAddress = new QLabel($this);
     $this->lblAddress->Name = 'Address';
     $this->lblAddress->Text = $this->objGroup->GrowthGroup->AddressInfo;
     $this->lblStructure = new QLabel($this);
     $this->lblStructure->Name = 'Structure';
     $this->lblStructure->Text = $this->objGroup->GrowthGroup->StructuresHtml;
     $this->lblStructure->HtmlEntities = false;
     $this->lblStatus = new QLabel($this);
     $this->lblStatus->Name = 'Availability Status';
     $this->lblStatus->Text = AvailabilityStatus::Load($this->objGroup->Status) ? AvailabilityStatus::Load($this->objGroup->Status)->Name : 'None';
     $this->lblStatus->HtmlEntities = false;
     $this->lblDescription = new QLabel($this);
     $this->lblDescription->Name = 'Description';
     $this->lblDescription->Text = $this->objGroup->GrowthGroup->Description;
     $this->lblDescription->HtmlEntities = false;
     if ($this->objGroup->CountEmailMessageRoutes()) {
         $this->SetupEmailMessageControls();
     }
     $this->SetupSmsControls();
     $this->chkViewAll = new QCheckBox($this);
     $this->chkViewAll->Text = 'View "Inactive/Past" Members as well';
     $this->chkViewAll->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'chkViewAll_Click'));
 }
示例#7
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objMinistry) {
         $objObject->objMinistry = Ministry::GetSoapObjectFromObject($objObject->objMinistry, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intMinistryId = null;
         }
     }
     if ($objObject->objParentGroup) {
         $objObject->objParentGroup = Group::GetSoapObjectFromObject($objObject->objParentGroup, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intParentGroupId = null;
         }
     }
     if ($objObject->objStatusObject) {
         $objObject->objStatusObject = AvailabilityStatus::GetSoapObjectFromObject($objObject->objStatusObject, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intStatus = null;
         }
     }
     return $objObject;
 }
示例#8
0
 /**
  * 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;
     }
 }