public function saveData($aGroupData) { if ($this->iGroupId === null) { $oGroup = new Group(); } else { $oGroup = GroupQuery::create()->findPk($this->iGroupId); } $oGroup->setName($aGroupData['name']); if ($oGroup->isNew() && count(self::$ROLES) > 0) { foreach (self::$ROLES as $sRoleKey) { $oGroupRole = new GroupRole(); $oGroupRole->setRoleKey($sRoleKey); $oGroup->addGroupRole($oGroupRole); } } else { foreach ($oGroup->getGroupRoles() as $oGroupRole) { $oGroupRole->delete(); } foreach ($aGroupData['roles'] as $sRoleKey) { $oGroupRole = new GroupRole(); $oGroupRole->setRoleKey($sRoleKey); $oGroup->addGroupRole($oGroupRole); } } return $oGroup->save(); }
public function createOrFind(Group $oGroup, Role $oRole) { $oGroupRole = $this->filterByGroup($oGroup)->filterByRole($oRole)->findOne(); if (!$oGroupRole) { $oGroupRole = new GroupRole(); $oGroupRole->setRole($oRole); $oGroupRole->setGroup($oGroup); $oGroupRole->save(); } return $oGroupRole; }
public function RefreshParticipationList() { $fltStartTime = microtime(true); $objGroupRole = GroupRole::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::GroupRole()->MinistryId, $this->Group->MinistryId), QQ::Equal(QQN::GroupRole()->GroupRoleTypeId, GroupRoleType::Participant)), QQ::OrderBy(QQN::GroupRole()->Id)); if (!$objGroupRole) { $objGroupRole = new GroupRole(); $objGroupRole->MinistryId = $this->Group->MinistryId; $objGroupRole->Name = 'Participant'; $objGroupRole->GroupRoleTypeId = GroupRoleType::Participant; $objGroupRole->Save(); } $this->Group->DeleteAllGroupParticipations(); $objPersonCursor = $this->SearchQuery->Execute(); while ($objPerson = Person::InstantiateCursor($objPersonCursor)) { $this->Group->AddPerson($objPerson, $objGroupRole->Id); } $fltEndTime = microtime(true); $this->dttDateRefreshed = QDateTime::Now(); $this->ProcessTimeMs = round(($fltEndTime - $fltStartTime) * 1000); $this->Save(); }
public function RenderRole(Person $objPerson) { $strReturn = ''; $objArrayGroup = $objPerson->GetGroupParticipationArray(); foreach ($objArrayGroup as $objParticipation) { if ($objParticipation->GroupId == $this->objGroup->Id) { $objGroupRole = GroupRole::load($objParticipation->GroupRoleId); $strReturn = $objGroupRole->Name; if ($objParticipation->DateEnd == null) { return $strReturn; break; } } } return $strReturn; }
protected function pxyEditRole_Click($strFormId, $strControlId, $strParameter) { $objGroupRole = GroupRole::Load($strParameter); if (!$objGroupRole || $objGroupRole->MinistryId != $this->objMinistry->Id) { $this->objGroupRole = new GroupRole(); $this->objGroupRole->Ministry = $this->objMinistry; $this->btnSave->Text = 'Create New Role'; $this->txtName->Text = null; $this->lstType->SelectedValue = null; } else { $this->objGroupRole = $objGroupRole; $this->btnSave->Text = 'Update Role'; $this->txtName->Text = $objGroupRole->Name; $this->lstType->SelectedValue = $objGroupRole->GroupRoleTypeId; } $this->txtName->Focus(); $this->pnlEditRole->Visible = true; }
/** * Refresh this MetaControl with Data from the local GroupParticipation object. * @param boolean $blnReload reload GroupParticipation from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objGroupParticipation->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objGroupParticipation->Id; } } if ($this->lstPerson) { $this->lstPerson->RemoveAllItems(); if (!$this->blnEditMode) { $this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null); } $objPersonArray = Person::LoadAll(); if ($objPersonArray) { foreach ($objPersonArray as $objPerson) { $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id); if ($this->objGroupParticipation->Person && $this->objGroupParticipation->Person->Id == $objPerson->Id) { $objListItem->Selected = true; } $this->lstPerson->AddItem($objListItem); } } } if ($this->lblPersonId) { $this->lblPersonId->Text = $this->objGroupParticipation->Person ? $this->objGroupParticipation->Person->__toString() : null; } 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->objGroupParticipation->Group && $this->objGroupParticipation->Group->Id == $objGroup->Id) { $objListItem->Selected = true; } $this->lstGroup->AddItem($objListItem); } } } if ($this->lblGroupId) { $this->lblGroupId->Text = $this->objGroupParticipation->Group ? $this->objGroupParticipation->Group->__toString() : null; } 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->objGroupParticipation->GroupRole && $this->objGroupParticipation->GroupRole->Id == $objGroupRole->Id) { $objListItem->Selected = true; } $this->lstGroupRole->AddItem($objListItem); } } } if ($this->lblGroupRoleId) { $this->lblGroupRoleId->Text = $this->objGroupParticipation->GroupRole ? $this->objGroupParticipation->GroupRole->__toString() : null; } if ($this->calDateStart) { $this->calDateStart->DateTime = $this->objGroupParticipation->DateStart; } if ($this->lblDateStart) { $this->lblDateStart->Text = sprintf($this->objGroupParticipation->DateStart) ? $this->objGroupParticipation->__toString($this->strDateStartDateTimeFormat) : null; } if ($this->calDateEnd) { $this->calDateEnd->DateTime = $this->objGroupParticipation->DateEnd; } if ($this->lblDateEnd) { $this->lblDateEnd->Text = sprintf($this->objGroupParticipation->DateEnd) ? $this->objGroupParticipation->__toString($this->strDateEndDateTimeFormat) : null; } if ($this->txtStatus) { $this->txtStatus->Text = $this->objGroupParticipation->Status; } if ($this->lblStatus) { $this->lblStatus->Text = $this->objGroupParticipation->Status; } if ($this->calDateFollowup) { $this->calDateFollowup->DateTime = $this->objGroupParticipation->DateFollowup; } if ($this->lblDateFollowup) { $this->lblDateFollowup->Text = sprintf($this->objGroupParticipation->DateFollowup) ? $this->objGroupParticipation->__toString($this->strDateFollowupDateTimeFormat) : null; } }
/** * Filter the query by a related GroupRole object * * @param GroupRole|PropelObjectCollection $groupRole the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return GroupQuery The current query, for fluid interface * @throws PropelException - if the provided filter is invalid. */ public function filterByGroupRole($groupRole, $comparison = null) { if ($groupRole instanceof GroupRole) { return $this->addUsingAlias(GroupPeer::ID, $groupRole->getGroupId(), $comparison); } elseif ($groupRole instanceof PropelObjectCollection) { return $this->useGroupRoleQuery()->filterByPrimaryKeys($groupRole->getPrimaryKeys())->endUse(); } else { throw new PropelException('filterByGroupRole() only accepts arguments of type GroupRole or PropelCollection'); } }
public static function GetSoapArrayFromArray($objArray) { if (!$objArray) { return null; } $objArrayToReturn = array(); foreach ($objArray as $objObject) { array_push($objArrayToReturn, GroupRole::GetSoapObjectFromObject($objObject, true)); } return unserialize(serialize($objArrayToReturn)); }
public function RenderGroupRole(GroupRegistrations $objGroupRegistration) { if ($objGroupRegistration->GroupRoleId) { return GroupRole::Load($objGroupRegistration->GroupRoleId)->Name; } else { return 'Not Selected'; } }
/** * 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 = GroupRole::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 GroupRole, given the clauses above $this->DataSource = GroupRole::QueryArray($objCondition, $objClauses); }
public function __construct($objParentObject, $objRegistrant, $intPersonId, $strMethodCallBack, $strControlId = null) { // First, let's call the Parent's __constructor try { parent::__construct($objParentObject, $strControlId); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } $this->strTemplate = dirname(__FILE__) . '/' . get_class($this) . '.tpl.php'; // Next, we set the local registrant object $this->objRegistrant = $objRegistrant; $this->intPersonId = $intPersonId; $this->strMethodCallBack = $strMethodCallBack; $strGroupTypes = ''; foreach (GrowthGroupStructure::LoadAll() as $objGroupStructure) { if ($this->objRegistrant->IsGrowthGroupStructureAsGroupstructureAssociated($objGroupStructure)) { $strGroupTypes .= $objGroupStructure->Name . ', '; } } $strGroupTypes = substr($strGroupTypes, 0, strlen($strGroupTypes) - 1); $this->lblRegistrantInfo = new QLabel($this); $this->lblRegistrantInfo->HtmlEntities = false; $this->lblRegistrantInfo->HtmlBefore = 'For: '; $this->lblRegistrantInfo->Text = sprintf('%s %s<br>Requested Group Types: %s<br>Requested Days: %s<br>Preferred Locations: %s, %s', $this->objRegistrant->FirstName, $this->objRegistrant->LastName, $strGroupTypes, $this->objRegistrant->GroupDay, $this->objRegistrant->PreferredLocation1, $this->objRegistrant->PreferredLocation2); $this->chkLocation = new QCheckBox($this); $this->chkLocation->Text = 'Location'; $this->chkLocation->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'dtgGroups_Refresh')); $this->chkGroupType = new QCheckBox($this); $this->chkGroupType->Text = 'Group Type'; $this->chkGroupType->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'dtgGroups_Refresh')); $this->chkDayOfWeek = new QCheckBox($this); $this->chkDayOfWeek->Text = 'Day Of Week'; $this->chkDayOfWeek->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'dtgGroups_Refresh')); $this->chkAvailability = new QCheckBox($this); $this->chkAvailability->Text = 'Availability'; $this->chkAvailability->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'dtgGroups_Refresh')); $this->rbtnSelectArray = array(); // Now initialize the controls $this->dtgGroups = new GrowthGroupDataGrid($this); $this->dtgGroups->Paginator = new QPaginator($this->dtgGroups); $this->dtgGroups->AddColumn(new QDataGridColumn('', '<?= $_CONTROL->ParentControl->RenderSelectGroup($_ITEM); ?>', 'HtmlEntities=false')); $this->dtgGroups->AddColumn(new QDataGridColumn('Name', '<?= $_CONTROL->ParentControl->RenderName($_ITEM); ?>', 'HtmlEntities=false')); $this->dtgGroups->AddColumn(new QDataGridColumn('Description', '<?= $_CONTROL->ParentControl->RenderDescription($_ITEM); ?>', 'HtmlEntities=false')); $this->dtgGroups->AddColumn(new QDataGridColumn('Group Type', '<?= $_CONTROL->ParentControl->RenderGroupStructure($_ITEM); ?>', 'HtmlEntities=false')); $this->dtgGroups->MetaAddTypeColumn('GrowthGroupDayTypeId', 'GrowthGroupDayType'); $this->dtgGroups->AddColumn(new QDataGridColumn('Location Region', '<?= $_CONTROL->ParentControl->RenderLocationRegion($_ITEM); ?>', 'HtmlEntities=false')); $this->dtgGroups->AddColumn(new QDataGridColumn('Group Facilitator', '<?= $_CONTROL->ParentControl->RenderFacilitator($_ITEM); ?>', 'HtmlEntities=false')); $this->dtgGroups->NoDataHtml = 'No results found. Please use a less-restrictive filter.'; $this->dtgGroups->SetDataBinder('dtgGroups_Bind', $this); $this->btnAssign = new QButton($this); $this->btnAssign->Text = 'Assign ' . $this->objRegistrant->FirstName . ' ' . $this->objRegistrant->LastName . ' to the selected groups'; $this->btnAssign->CssClass = 'primary'; $this->btnAssign->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnAssign_Click')); $this->intFacilitatorRoleId = 0; $this->intGroupContactRoleId = 0; foreach (GroupRole::LoadAll() as $objGroupRole) { if ($objGroupRole->Name == 'Facilitator' && $objGroupRole->MinistryId == Ministry::LoadByToken('growth')->Id) { $this->intFacilitatorRoleId = $objGroupRole->Id; } if ($objGroupRole->Name == 'Group Contact' && $objGroupRole->MinistryId == Ministry::LoadByToken('growth')->Id) { $this->intGroupContactRoleId = $objGroupRole->Id; } } }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param GroupRole $obj A GroupRole object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool($obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = serialize(array((string) $obj->getGroupId(), (string) $obj->getRoleKey())); } // if key === null GroupRolePeer::$instances[$key] = $obj; } }
/** * Exclude object from result * * @param GroupRole $groupRole Object to remove from the list of results * * @return GroupRoleQuery The current query, for fluid interface */ public function prune($groupRole = null) { if ($groupRole) { $this->addCond('pruneCond0', $this->getAliasedColName(GroupRolePeer::GROUP_ID), $groupRole->getGroupId(), Criteria::NOT_EQUAL); $this->addCond('pruneCond1', $this->getAliasedColName(GroupRolePeer::ROLE_KEY), $groupRole->getRoleKey(), Criteria::NOT_EQUAL); $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); } return $this; }
public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) { if ($objObject->objSourceList) { $objObject->objSourceList = SourceList::GetSoapObjectFromObject($objObject->objSourceList, false); } else { if (!$blnBindRelatedObjects) { $objObject->intSourceListId = null; } } if ($objObject->dttDateReceived) { $objObject->dttDateReceived = $objObject->dttDateReceived->__toString(QDateTime::FormatSoap); } if ($objObject->objGroupRole) { $objObject->objGroupRole = GroupRole::GetSoapObjectFromObject($objObject->objGroupRole, false); } else { if (!$blnBindRelatedObjects) { $objObject->intGroupRoleId = null; } } if ($objObject->dttDateProcessed) { $objObject->dttDateProcessed = $objObject->dttDateProcessed->__toString(QDateTime::FormatSoap); } return $objObject; }
<?php require '../include/init.inc.php'; $group_id = $province_id = ''; $menu_ids = array(); extract($_REQUEST, EXTR_IF_EXISTS); $group_id = $group_id == "" ? 2 : intval($group_id); $group_option_list = GroupRole::getGroupForOptions(); unset($group_option_list[1]); $group_info = UserGroup::getGroupById($group_id); if (!$group_info) { $group_id = 1; $group_info = UserGroup::getGroupById($group_id); } $role_list = GroupRole::getGroupRoles($group_id); unset($role_list[0]); $group_role = $group_info['group_role']; $group_role_array = explode(',', $group_role); if (Common::isPost()) { if ($group_id == 1) { $temp = array(); foreach ($group_role_array as $group_role) { //系统预留菜单id为100以内 if ($group_role > 100) { $temp[] = $group_role; } } $admin_role = array_diff($group_role_array, $temp); $menu_ids = array_merge($admin_role, $menu_ids); $menu_ids = array_unique($menu_ids); asort($menu_ids);
/** * 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); } }
/** * @param GroupRole $groupRole The groupRole object to add. */ protected function doAddGroupRole($groupRole) { $this->collGroupRoles[] = $groupRole; $groupRole->setGroup($this); }
public static function GenerateMinistries() { QDataGen::DisplayForEachTaskStart('Generating Minsitries', count(self::$MinistryArray)); foreach (self::$MinistryArray as $strToken => $strMinistry) { QDataGen::DisplayForEachTaskNext('Generating Minsitries'); $objMinistry = new Ministry(); $objMinistry->Token = $strToken; $objMinistry->Name = $strMinistry; $objMinistry->ActiveFlag = true; $objMinistry->Save(); $objFund = new StewardshipFund(); $objFund->Ministry = $objMinistry; $objFund->Name = 'Ministry - ' . $objMinistry->Name; $objFund->AccountNumber = rand(100, 999); $objFund->Save(); $strArray = array('Member' => GroupRoleType::Participant, 'Participant' => GroupRoleType::Participant, 'Volunteer' => GroupRoleType::Volunteer, 'Leader' => GroupRoleType::Volunteer); foreach ($strArray as $strName => $intGroupRoleTypeId) { $objGroupRole = new GroupRole(); $objGroupRole->Ministry = $objMinistry; $objGroupRole->Name = $strName; $objGroupRole->GroupRoleTypeId = $intGroupRoleTypeId; $objGroupRole->Save(); } } self::$MinistryArray = Ministry::LoadAll(); QDataGen::DisplayForEachTaskEnd('Generating Minsitries'); }
/** * Deletes all associated GroupRoles * @return void */ public function DeleteAllGroupRoles() { if (is_null($this->intId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateGroupRole on this unsaved Ministry.'); } // Get the Database Object for this Class $objDatabase = Ministry::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (GroupRole::LoadArrayByMinistryId($this->intId) as $objGroupRole) { $objGroupRole->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `group_role` WHERE `ministry_id` = ' . $objDatabase->SqlVariable($this->intId) . ' '); }
/** * 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 GroupRoleMetaControl * @param integer $intId primary key value * @param QMetaControlCreateType $intCreateType rules governing GroupRole object creation - defaults to CreateOrEdit * @return GroupRoleMetaControl */ public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intId)) { $objGroupRole = GroupRole::Load($intId); // GroupRole was found -- return it! if ($objGroupRole) { return new GroupRoleMetaControl($objParentObject, $objGroupRole); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a GroupRole 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 GroupRoleMetaControl($objParentObject, new GroupRole()); }
public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) { if ($objObject->objPerson) { $objObject->objPerson = Person::GetSoapObjectFromObject($objObject->objPerson, false); } else { if (!$blnBindRelatedObjects) { $objObject->intPersonId = null; } } if ($objObject->objGroup) { $objObject->objGroup = Group::GetSoapObjectFromObject($objObject->objGroup, false); } else { if (!$blnBindRelatedObjects) { $objObject->intGroupId = null; } } if ($objObject->objGroupRole) { $objObject->objGroupRole = GroupRole::GetSoapObjectFromObject($objObject->objGroupRole, false); } else { if (!$blnBindRelatedObjects) { $objObject->intGroupRoleId = null; } } if ($objObject->dttDateStart) { $objObject->dttDateStart = $objObject->dttDateStart->__toString(QDateTime::FormatSoap); } if ($objObject->dttDateEnd) { $objObject->dttDateEnd = $objObject->dttDateEnd->__toString(QDateTime::FormatSoap); } if ($objObject->dttDateFollowup) { $objObject->dttDateFollowup = $objObject->dttDateFollowup->__toString(QDateTime::FormatSoap); } return $objObject; }