public function btnSubmit_Click($strFormId, $strControlId, $strParameter) { // Create a login object with the information $objLogin = new Login(); $objLogin->FirstName = $this->strFirstName->Text; $objLogin->LastName = $this->strLastName->Text; $objLogin->Username = $this->strUserName->Text; $objLogin->RoleTypeId = RoleType::Volunteer; if (strlen(trim($this->strEmail->Text)) > 0) { $objLogin->Email = $this->strEmail->Text; } $objLogin->SetPasswordCache($this->strPassword->Text); $objLogin->LoginActiveFlag = $this->lstActiveFlag->SelectedValue; $objLogin->DomainActiveFlag = false; $intBitmap = 0; foreach ($this->rblPermissionArray as $rblPermission) { $intBitmap = $intBitmap | $rblPermission->SelectedValue; } $objLogin->PermissionBitmap = $intBitmap; $objLogin->Save(); // Update ministries associated $objLogin->UnassociateAllMinistries(); foreach ($this->rblMinistryArray as $rblMinistry) { $objMinistry = Ministry::LoadById($rblMinistry->SelectedValue); if ($objMinistry) { $objMinistry->AssociateLogin($objLogin); } } QApplication::Redirect('/admin/externusers/'); }
protected function Form_Create() { $this->dtgStaff = new LoginDataGrid($this); $this->dtgStaff->FontSize = 11; $this->dtgStaff->AddColumn(new QDataGridColumn('View', '<?= $_FORM->RenderView($_ITEM); ?>', 'HtmlEntities=false', 'Width=30px')); $this->dtgStaff->MetaAddColumn(QQN::Login()->Username, 'Width=75px'); $this->dtgStaff->MetaAddColumn(QQN::Login()->FirstName, 'Name=Name', 'Html=<?= $_ITEM->Name; ?>', 'Width=110px'); $this->dtgStaff->AddColumn(new QDataGridColumn('Acct Disabled', '<?= (!$_ITEM->DomainActiveFlag || !$_ITEM->LoginActiveFlag) ? "Disabled":""; ?>', 'Width=60px')); $this->dtgStaff->MetaAddTypeColumn('RoleTypeId', 'RoleType', 'Name=Role', 'Width=120px'); foreach (PermissionType::$NameArray as $intId => $strName) { $this->dtgStaff->AddColumn(new QDataGridColumn('<span style="font-size: 10px;">' . $strName . '</span>', '<?= $_FORM->RenderPermission(' . $intId . ', $_ITEM); ?>', 'Width=50px', 'HtmlEntities=false')); } $this->dtgStaff->SetDataBinder('dtgStaff_Bind'); $this->dtgStaff->SortColumnIndex = 1; $this->dtgStaff->SortDirection = 0; $this->dtgStaff->Paginator = new QPaginator($this->dtgStaff); $this->dtgStaff->ItemsPerPage = 100; $this->lstActiveFlag = new QListBox($this); $this->lstActiveFlag->Name = 'Active'; $this->lstActiveFlag->AddItem('Active', true, true); $this->lstActiveFlag->AddItem('Inactive', false); $this->lstActiveFlag->AddAction(new QChangeEvent(), new QAjaxAction('dtgStaff_Refresh')); $this->lstMinistry = new QListBox($this); $this->lstMinistry->Name = 'Ministry'; $this->lstMinistry->AddItem('- View All -', null); foreach (Ministry::LoadAll(QQ::OrderBy(QQN::Ministry()->Name)) as $objMinistry) { $this->lstMinistry->AddItem($objMinistry->Name, $objMinistry->Id); } $this->lstMinistry->AddAction(new QChangeEvent(), new QAjaxAction('dtgStaff_Refresh')); }
public function getAllMinistry($field = null) { $rs = Ministry::whereNotNull('ministry_id'); if (isset($field)) { $rs = $rs->get(array('ministry_id', 'full_th_name'))->toArray(); return $rs; } else { return $rs->get(); } }
protected function Form_Create() { $this->btnReturnToGroup = new QButton($this); $this->btnReturnToGroup->CssClass = 'primary'; $this->btnReturnToGroup->AddAction(new QClickEvent(), new QAjaxAction('btnReturnToGroup_Click')); $this->btnReturnToGroup->Name = "Return to Growth Groups"; $this->btnReturnToGroup->Text = "Return to Growth Groups"; $this->btnReturnToGroup->Visible = true; $this->dtgGroups = new QDataGrid($this); $this->dtgGroups->AddColumn(new QDataGridColumn('Name', '<?= $_FORM->RenderName($_ITEM); ?>', 'HtmlEntities=false', 'Width=270px')); $this->dtgGroups->AddColumn(new QDataGridColumn('Group Type', '<?= $_ITEM->Type; ?>', 'Width=270px')); $this->dtgGroups->AddColumn(new QDataGridColumn('Count', '<?= $_FORM->RenderCount($_ITEM); ?>', 'HtmlEntities=false', 'Width=270px')); $groupArray = Group::LoadOrderedArrayByMinistryIdAndConfidentiality(17, Ministry::Load(17)->IsLoginCanAdminMinistry(QApplication::$Login), true); $this->dtgGroups->DataSource = $groupArray; }
protected function SetupPanel() { $this->lstMinistries = new QListBox($this); $this->lstMinistries->Name = 'Select a Ministry'; $this->lstMinistries->AddItem('- Select One -'); foreach (Ministry::LoadArrayByActiveFlag(true, QQ::OrderBy(QQN::Ministry()->Name)) as $objMinistry) { if ($objMinistry->IsLoginCanAdminMinistry(QApplication::$Login)) { $this->lstMinistries->AddItem($objMinistry->Name, $objMinistry->Id); } } $this->dtgGroups = new QDataGrid($this); $this->dtgGroups->Name = ' '; $this->dtgGroups->AddColumn(new QDataGridColumn('Group Name', '<?= $_CONTROL->ParentControl->RenderName($_ITEM); ?>', 'HtmlEntities=false')); $this->dtgGroups->AddColumn(new QDataGridColumn('Type', '<?= $_ITEM->Type; ?>')); $this->dtgGroups->SetDataBinder('dtgGroups_Bind', $this); $this->lstMinistries->AddAction(new QChangeEvent(), new QAjaxControlAction($this->dtgGroups, 'Refresh')); }
public function dtgMinistries_Bind() { $objConditions = QQ::All(); // Setup the $objClauses Array $objClauses = array(); // 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->dtgMinistries->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->dtgMinistries->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be a Query result from Login, given the clauses above $this->dtgMinistries->DataSource = Ministry::QueryArray($objConditions, $objClauses); }
/** * Main DataGen Runner * @return void */ public static function Run() { self::$SystemStartDate = new QDateTime('2004-01-01'); self::$MaximumPersonId = Person::QuerySingle(QQ::All(), QQ::OrderBy(QQN::Person()->Id, false))->Id; self::DisplayForEachTaskStart($strDescription = 'Generating Signup Forms for Ministry', Ministry::CountByActiveFlag(true)); foreach (Ministry::LoadArrayByActiveFlag(true) as $objMinistry) { self::DisplayForEachTaskNext($strDescription); $intCount = rand(self::FormsPerMinistryMinimum, self::FormsPerMinistryMaximum); self::DisplayForEachTaskStart($strDescriptionInside = ' Generating Signup Forms', $intCount); for ($i = 0; $i < $intCount; $i++) { self::DisplayForEachTaskNext($strDescriptionInside); self::GenerateFormInMinistry($objMinistry); } self::DisplayForEachTaskEnd($strDescriptionInside, true); } self::DisplayForEachTaskEnd($strDescription); }
protected function Form_Create() { $this->objMinistry = Ministry::Load(QApplication::PathInfo(0)); if (!$this->objMinistry) { QApplication::Redirect('/groups/'); } if (!$this->objMinistry->IsLoginCanAdminMinistry(QApplication::$Login)) { QApplication::Redirect('/groups/'); } $this->dtgRoles = new QDataGrid($this); $this->dtgRoles->SetDataBinder('dtgRoles_Bind'); $this->dtgRoles->AddColumn(new QDataGridColumn('Edit', '<?= $_FORM->RenderEdit($_ITEM); ?>', 'HtmlEntities=false', 'Width=50px')); $this->dtgRoles->AddColumn(new QDataGridColumn('Name', '<?= $_ITEM->Name; ?>', 'Width=200px')); $this->dtgRoles->AddColumn(new QDataGridColumn('Type', '<?= GroupRoleType::$NameArray[$_ITEM->GroupRoleTypeId]; ?>', 'Width=500px')); $this->pxyEditRole = new QControlProxy($this); $this->pxyEditRole->AddAction(new QClickEvent(), new QAjaxAction('pxyEditRole_Click')); $this->pxyEditRole->AddAction(new QClickEvent(), new QTerminateAction()); $this->pnlEditRole = new QPanel($this); $this->pnlEditRole->Template = dirname(__FILE__) . '/pnlEditRole.tpl.php'; $this->pnlEditRole->Visible = false; $this->txtName = new QTextBox($this->pnlEditRole); $this->txtName->Name = 'Role Name'; $this->txtName->Required = true; $this->txtName->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->lstType = new QListBox($this->pnlEditRole); $this->lstType->Name = 'Role Type'; $this->lstType->Required = true; foreach (GroupRoleType::$NameArray as $intId => $strName) { $this->lstType->AddItem($strName, $intId); } $this->btnSave = new QButton($this->pnlEditRole); $this->btnSave->CausesValidation = true; $this->btnSave->Text = 'Save'; $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click')); $this->btnCancel = new QLinkButton($this->pnlEditRole); $this->btnCancel->Text = 'Cancel'; $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click')); $this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction()); }
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'); }
protected function Form_Create() { $this->lblLabel = new QLabel($this); $this->lblLabel->HtmlEntities = false; $this->lblLabel->Text = "<h2>Generate Volunteers Report for: </h2>"; $this->btnGenerateReport = new QButton($this); $this->btnGenerateReport->Text = "Generate Report"; $this->btnGenerateReport->CssClass = "primary"; $this->btnGenerateReport->AddAction(new QClickEvent(), new QAjaxAction('generateReport_Click')); $afterArray = explode(",", QApplication::PathInfo(1)); $this->lstAfterMonth = new QListBox($this); $this->lstAfterMonth->AddItem('Jan', 'Jan'); $this->lstAfterMonth->AddItem('Feb', 'Feb'); $this->lstAfterMonth->AddItem('Mar', 'Mar'); $this->lstAfterMonth->AddItem('Apr', 'Apr'); $this->lstAfterMonth->AddItem('May', 'May'); $this->lstAfterMonth->AddItem('Jun', 'Jun'); $this->lstAfterMonth->AddItem('Jul', 'Jul'); $this->lstAfterMonth->AddItem('Aug', 'Aug'); $this->lstAfterMonth->AddItem('Sep', 'Sep'); $this->lstAfterMonth->AddItem('Oct', 'Oct'); $this->lstAfterMonth->AddItem('Nov', 'Nov'); $this->lstAfterMonth->AddItem('Dec', 'Dec'); if (QApplication::PathInfo(1)) { $this->lstAfterMonth->SelectedValue = $afterArray[0]; } $this->lstAfterYear = new QListBox($this); $this->lstAfterYear->AddItem('2010', '2010'); $this->lstAfterYear->AddItem('2011', '2011'); $this->lstAfterYear->AddItem('2012', '2012'); $this->lstAfterYear->AddItem('2013', '2013'); $this->lstAfterYear->AddItem('2014', '2014'); if (QApplication::PathInfo(1)) { $this->lstAfterYear->SelectedValue = $afterArray[1]; } $beforeArray = explode(",", QApplication::PathInfo(0)); $this->lstBeforeMonth = new QListBox($this); $this->lstBeforeMonth->AddItem('Jan', 'Jan'); $this->lstBeforeMonth->AddItem('Feb', 'Feb'); $this->lstBeforeMonth->AddItem('Mar', 'Mar'); $this->lstBeforeMonth->AddItem('Apr', 'Apr'); $this->lstBeforeMonth->AddItem('May', 'May'); $this->lstBeforeMonth->AddItem('Jun', 'Jun'); $this->lstBeforeMonth->AddItem('Jul', 'Jul'); $this->lstBeforeMonth->AddItem('Aug', 'Aug'); $this->lstBeforeMonth->AddItem('Sep', 'Sep'); $this->lstBeforeMonth->AddItem('Oct', 'Oct'); $this->lstBeforeMonth->AddItem('Nov', 'Nov'); $this->lstBeforeMonth->AddItem('Dec', 'Dec'); if (QApplication::PathInfo(0)) { $this->lstBeforeMonth->SelectedValue = $beforeArray[0]; } $this->lstBeforeYear = new QListBox($this); $this->lstBeforeYear->AddItem('2010', '2010'); $this->lstBeforeYear->AddItem('2011', '2011'); $this->lstBeforeYear->AddItem('2012', '2012'); $this->lstBeforeYear->AddItem('2013', '2013'); $this->lstBeforeYear->AddItem('2014', '2014'); if (QApplication::PathInfo(0)) { $this->lstBeforeYear->SelectedValue = $beforeArray[1]; } $this->lstMinistryDepartments = new QListBox($this); QApplication::PathInfo(2) == 'Select' ? $this->lstMinistryDepartments->AddItem('-- Select A Department Or Ministry --', 'Select', true) : $this->lstMinistryDepartments->AddItem('-- Select A Department Or Ministry --', 'Select'); QApplication::PathInfo(2) == 'All' ? $this->lstMinistryDepartments->AddItem('All', 'All', true) : $this->lstMinistryDepartments->AddItem('All', 'All'); QApplication::PathInfo(2) == 'OutreachEvangelismCare' ? $this->lstMinistryDepartments->AddItem('Department: Outreach, Evangelism, and Care', 'OutreachEvangelismCare', true) : $this->lstMinistryDepartments->AddItem('Department: Outreach, Evangelism, and Care', 'OutreachEvangelismCare'); QApplication::PathInfo(2) == 'AdministrativeOperations' ? $this->lstMinistryDepartments->AddItem('Department: Administrative Operations', 'AdministrativeOperations', true) : $this->lstMinistryDepartments->AddItem('Department: Administrative Operations', 'AdministrativeOperations'); QApplication::PathInfo(2) == 'Discipleship' ? $this->lstMinistryDepartments->AddItem('Department: Discipleship', 'Discipleship', true) : $this->lstMinistryDepartments->AddItem('Department: Discipleship', 'Discipleship'); QApplication::PathInfo(2) == 'MinistryOperations' ? $this->lstMinistryDepartments->AddItem('Department: Ministry Operations', 'MinistryOperations', true) : $this->lstMinistryDepartments->AddItem('Department: Ministry Operations', 'MinistryOperations'); QApplication::PathInfo(2) == 'WorshipArts' ? $this->lstMinistryDepartments->AddItem('Department: Worship Arts', 'WorshipArts', true) : $this->lstMinistryDepartments->AddItem('Department: Worship Arts', 'WorshipArts'); QApplication::PathInfo(2) == 'WorshipService' ? $this->lstMinistryDepartments->AddItem('Department: Worship Service', 'WorshipService', true) : $this->lstMinistryDepartments->AddItem('Department: Worship Service', 'WorshipService'); foreach (Ministry::LoadAll() as $objMinistry) { QApplication::PathInfo(2) == $objMinistry->Token ? $this->lstMinistryDepartments->AddItem('Ministry: ' . $objMinistry->Name, $objMinistry->Token, true) : $this->lstMinistryDepartments->AddItem('Ministry: ' . $objMinistry->Name, $objMinistry->Token); } // May or may not display a table $this->dtgVolunteers = new QDataGrid($this); $this->dtgVolunteers->AddColumn(new QDataGridColumn('Month and Year', '<?= $_ITEM->month; ?>', 'Width=270px')); $this->dtgVolunteers->AddColumn(new QDataGridColumn('# of Volunteers', '<?= $_ITEM->count; ?>', 'Width=270px')); // Extract information based off the selections if ($this->lstAfterMonth->SelectedValue && $this->lstAfterYear->SelectedValue && $this->lstBeforeMonth->SelectedValue && $this->lstBeforeYear->SelectedValue) { $this->startDate = new QDateTime($this->lstAfterMonth->SelectedIndex + 1 . '/1/' . $this->lstAfterYear->SelectedValue); $this->endDate = new QDateTime($this->lstBeforeMonth->SelectedIndex + 1 . '/1/' . $this->lstBeforeYear->SelectedValue); // Initialize output values $this->objPersonArray = array(); $this->monthCount = array(); $this->tempDate = new QDateTime($this->lstAfterMonth->SelectedIndex + 1 . '/1/' . $this->lstAfterYear->SelectedValue); while ($this->tempDate->IsEarlierOrEqualTo($this->endDate)) { $this->monthCount[$this->tempDate->__toString('MMM YYYY')] = 0; $this->objPersonArray[$this->tempDate->__toString('MMM YYYY')] = array(); $this->tempDate->AddMonths(1); } // Figure out which groups to search first. /* +----+------------------+----------------------------+ | id | token | name | +----+------------------+----------------------------+ | 1 | bc | Biblical Counseling | | 2 | hr | HR | | 3 | appurch | AP/Purchasing | | 4 | busops | Business Operations | | 5 | finance | Finance | | 6 | officemanagement | Office Management | | 7 | et | ETM | | 8 | evangoutreach | Evangelism and Outreach | | 9 | events | Events | | 10 | family | Family Ministry | | 11 | ibs | IBS | | 12 | music | Music | | 13 | pp | Pastor Paul | | 14 | volunteers | Volunteers | | 15 | worshiparts | Worship Arts | | 16 | facilities | Facilities | | 17 | growth | Growth Groups | | 18 | it | IT | | 19 | mc | Member Care | | 20 | mit | Ministry Involvement | | 21 | prayer | Prayer and Visitation | | 22 | safari | Safari Kids | | 23 | services | Worship Service Ministries | | 24 | videoprod | Video Production | | 25 | website | Website | | 26 | sp | Strategic Partnerships | | 27 | comm | Communications | | 28 | sm | Student Ministries | | 29 | payroll | Payroll | | 30 | mens | Men's Fellowship | | 31 | yam | Young Adult Ministry | | 32 | donations | Donations and Resources | | 33 | womens | Women's Ministry | | 34 | gmt | Global Ministry Team | | 35 | pastors | Pastoral Board | | 36 | recovery | Recovery | | 37 | singles | Singles | | 38 | seniors | Seniors | | 39 | minops | Ministry Operations | | 40 | stewardship | Stewardship | +----+------------------+----------------------------+- */ $objGroupCursor = Group::QueryCursor(QQ::In(QQN::Group()->GroupTypeId, array(GroupType::RegularGroup, GroupType::GrowthGroup))); while ($objGroup = Group::InstantiateCursor($objGroupCursor)) { switch (QApplication::PathInfo(2)) { case 'All': // increment all the appropriate arrays $this->calculateValues($objGroup); break; case 'OutreachEvangelismCare': // Biblical Counseling, Evangelism and Outreach, Global Ministry Team, Prayer and Visitation, Recovery, Strategic Partnerships if ($objGroup->MinistryId == 1 || $objGroup->MinistryId == 8 || $objGroup->MinistryId == 34 || $objGroup->MinistryId == 21 || $objGroup->MinistryId == 36 || $objGroup->MinistryId == 26) { $this->calculateValues($objGroup); } break; case 'AdministrativeOperations': // Communications, IT, Stewardship if ($objGroup->MinistryId == 27 || $objGroup->MinistryId == 18 || $objGroup->MinistryId == 40) { $this->calculateValues($objGroup); } break; case 'Discipleship': // Family Ministry, Growth Groups, IBS, Men's Fellowship if ($objGroup->MinistryId == 10 || $objGroup->MinistryId == 17 || $objGroup->MinistryId == 11 || $objGroup->MinistryId == 30) { $this->calculateValues($objGroup); } break; case 'MinistryOperations': // Member Care, Ministry Involvement, Ministry Operations, Safari Kids, Seniors, Singles, Student Ministries, Women's Ministry, Young Adult Ministry if ($objGroup->MinistryId == 19 || $objGroup->MinistryId == 20 || $objGroup->MinistryId == 39 || $objGroup->MinistryId == 22 || $objGroup->MinistryId == 38 || $objGroup->MinistryId == 37 || $objGroup->MinistryId == 28 || $objGroup->MinistryId == 33 || $objGroup->MinistryId == 31) { $this->calculateValues($objGroup); } break; case 'WorshipArts': // Video Production, Worship Arts if ($objGroup->MinistryId == 24 || $objGroup->MinistryId == 15) { $this->calculateValues($objGroup); } break; case 'WorshipService': // Worship Service Ministries if ($objGroup->MinistryId == 23) { $this->calculateValues($objGroup); } break; default: $objMinistry = Ministry::LoadByToken(QApplication::PathInfo(2)); if ($objMinistry->Token == $objGroup->MinistryId) { // Get all participants in the group $this->calculateValues($objGroup); } break; } } //print "Finished Processing\n"; /* foreach($this->monthCount as $key=>$value) { print "In ".$key.' there were '.$value. " unique volunteers\n"; } */ /* foreach($objPersonArray as $key=>$value) { print "In ".$key.' there were '.count($value). " unique volunteers\n"; } */ $chartArray = array(); foreach ($this->monthCount as $key => $value) { $objItem = new volunteerArray(); $objItem->month = $key; $objItem->count = $value; $chartArray[] = $objItem; } QApplication::ExecuteJavaScript('initializeChart(' . json_encode($chartArray) . ');'); $this->dtgVolunteers->DataSource = $chartArray; } }
protected function Form_ProcessHash() { $strParameter = $this->strUrlHash; if ($strParameter != $this->intMinistryId) { $intOldMinistryId = $this->intMinistryId; $this->intMinistryId = $strParameter; $this->pnlMinistry_Refresh($intOldMinistryId); $this->pnlMinistry_Refresh($this->intMinistryId); $this->lblMinistry_Refresh(); $this->dtgSignupForms->Refresh(); $objMinistry = Ministry::Load($this->intMinistryId); if ($objMinistry && $objMinistry->IsLoginCanAdminMinistry(QApplication::$Login)) { $this->chkViewAll->Visible = true; $this->lstSignupFormType->Visible = true; $this->lstSignupFormType->RemoveAllItems(); $this->lstSignupFormType->AddItem('- Create New... -'); foreach (SignupFormType::$NameArray as $intId => $strName) { if ($objMinistry->SignupFormTypeBitmap & $intId) { $this->lstSignupFormType->AddItem($strName, $intId); } } } else { $this->lstSignupFormType->Visible = false; } } }
/** * Refresh this MetaControl with Data from the local GroupRole object. * @param boolean $blnReload reload GroupRole from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objGroupRole->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objGroupRole->Id; } } 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->objGroupRole->Ministry && $this->objGroupRole->Ministry->Id == $objMinistry->Id) { $objListItem->Selected = true; } $this->lstMinistry->AddItem($objListItem); } } } if ($this->lblMinistryId) { $this->lblMinistryId->Text = $this->objGroupRole->Ministry ? $this->objGroupRole->Ministry->__toString() : null; } if ($this->txtName) { $this->txtName->Text = $this->objGroupRole->Name; } if ($this->lblName) { $this->lblName->Text = $this->objGroupRole->Name; } if ($this->lstGroupRoleType) { $this->lstGroupRoleType->SelectedValue = $this->objGroupRole->GroupRoleTypeId; } if ($this->lblGroupRoleTypeId) { $this->lblGroupRoleTypeId->Text = $this->objGroupRole->GroupRoleTypeId ? GroupRoleType::$NameArray[$this->objGroupRole->GroupRoleTypeId] : null; } }
<?php $objAcsDatabase = new mysqli('localhost', 'root', '', 'alcf_acs'); // The following is indexed by Noah Ministry ID and then ACS GroupId // The array value [0] is the Name of the Group (if the Group is to be migrated over wholesale) // The array value [1] is a boolean on whether or not the group's ELEMENT1 that should be made into an individual group, // true means use ALL reserveids // or an array of awgrresf.reserveid's to use just the specified subset within that group // (thus ignoring the ACS Group for the groupid) $objGroupArray = array(21 => array(63 => array('Alter Prayer Ministry', false), 26 => array('Prayer Ministry', array(104, 105, 106, 272, 314, 364, 374, 375, 383, 401)), 36 => array('PrayerWorks', false), 35 => array('Worship Warriors', false)), 23 => array(53 => array('Information Center', false), 28 => array('Worship Services', array(123, 115, 116, 278, 121, 254, 124)), 19 => array('Hospitality', false))); foreach ($objGroupArray as $intMinistryId => $objAcsGroupArray) { $objMinistry = Ministry::Load($intMinistryId); $objRoleArray = $objMinistry->GetGroupRoleArray(); $objRole = $objRoleArray[0]; foreach ($objAcsGroupArray as $intAcsGroupId => $objDescriptionArray) { if (!$objDescriptionArray[1]) { $objGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::RegularGroup, $objDescriptionArray[0], null); CreateGroupParticipations($objAcsDatabase, $objGroup, $objRole, $intAcsGroupId, null); } else { $objGroupCategory = Group::CreateGroupForMinistry($objMinistry, GroupType::GroupCategory, $objDescriptionArray[0], null); $objGroupCategoryDetail = new GroupCategory(); $objGroupCategoryDetail->GroupId = $objGroupCategory->Id; $objGroupCategoryDetail->Save(); foreach ($objDescriptionArray[1] as $intAcsReserveId) { $objResult = $objAcsDatabase->query(sprintf('select * from awgrresf where groupid=%s AND reserveid=%s;', $intAcsGroupId, $intAcsReserveId)); while ($objRow = $objResult->fetch_array()) { $objGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::RegularGroup, $objRow['value'], null, $objGroupCategory); CreateGroupParticipations($objAcsDatabase, $objGroup, $objRole, $intAcsGroupId, $intAcsReserveId); } } }
public function SetUp() { $this->objMinistry = Ministry::LoadByToken('ert'); if (!$this->objMinistry) { $this->objMinistry = new Ministry(); $this->objMinistry->Token = 'ert'; } $this->objMinistry->Name = 'Test Ministry'; $this->objMinistry->ActiveFlag = true; $this->objMinistry->Save(); if ($objGroupRoleArray = $this->objMinistry->GetGroupRoleArray()) { $this->objGroupRole = $objGroupRoleArray[0]; } else { $this->objGroupRole = new GroupRole(); $this->objGroupRole->Ministry = $this->objMinistry; $this->objGroupRole->Name = 'ERT'; $this->objGroupRole->GroupRoleTypeId = GroupRoleType::Participant; $this->objGroupRole->Save(); } $this->objLoginLeader = Login::LoadByUsername('ert1'); if (!$this->objLoginLeader) { $this->objLoginLeader = new Login(); $this->objLoginLeader->Username = '******'; } else { $this->objLoginLeader->UnassociateAllMinistries(); } $this->objLoginLeader->RoleTypeId = RoleType::StaffMember; $this->objLoginLeader->Email = '*****@*****.**'; $this->objLoginLeader->Save(); $this->objLoginLeader->AssociateMinistry($this->objMinistry); $this->objLoginNonLeader = Login::LoadByUsername('ert2'); if (!$this->objLoginNonLeader) { $this->objLoginNonLeader = new Login(); $this->objLoginNonLeader->Username = '******'; } else { $this->objLoginNonLeader->UnassociateAllMinistries(); } $this->objLoginNonLeader->RoleTypeId = RoleType::StaffMember; $this->objLoginNonLeader->Email = '*****@*****.**'; $this->objLoginNonLeader->Save(); $this->objPersonArray = array(); $this->objPersonArray['ert1'] = Person::CreatePerson('Test', 'E', 'User', true, '*****@*****.**', null, null); $this->objPersonArray['ert2'] = Person::CreatePerson('Test', 'E', 'User', true, '*****@*****.**', null, null); $this->objPersonArray['ert3'] = Person::CreatePerson('Test', 'E', 'User', true, '*****@*****.**', null, null); $objPerson = Person::CreatePerson('Test', 'E', 'User', true, null, null, null); $objEmail = new Email(); $objEmail->Address = '*****@*****.**'; $objEmail->Person = $objPerson; $objEmail->Save(); $this->objPersonArray['ert4'] = $objPerson; $objPerson = Person::CreatePerson('Test', 'E', 'User', true, null, null, null); $objEmail = new Email(); $objEmail->Address = '*****@*****.**'; $objEmail->Person = $objPerson; $objEmail->Save(); $objEmail = new Email(); $objEmail->Address = '*****@*****.**'; $objEmail->Person = $objPerson; $objEmail->Save(); $this->objPersonArray['ert5'] = $objPerson; $this->objGroup1 = Group::LoadByToken('ert1'); if (!$this->objGroup1) { $this->objGroup1 = new Group(); $this->objGroup1->Token = 'ert1'; } $this->objGroup1->GroupTypeId = GroupType::RegularGroup; $this->objGroup1->Ministry = $this->objMinistry; $this->objGroup1->EmailBroadcastTypeId = EmailBroadcastType::PrivateList; $this->objGroup1->Name = 'ERT Test Group 1'; $this->objGroup1->Save(); $this->objGroup2 = Group::LoadByToken('ert2'); if (!$this->objGroup2) { $this->objGroup2 = new Group(); $this->objGroup2->Token = 'ert2'; } $this->objGroup2->GroupTypeId = GroupType::RegularGroup; $this->objGroup2->Ministry = $this->objMinistry; $this->objGroup2->EmailBroadcastTypeId = EmailBroadcastType::AnnouncementOnly; $this->objGroup2->Name = 'ERT Test Group 2'; $this->objGroup2->Save(); $this->objGroup1->DeleteAllGroupParticipations(); $this->objGroup2->DeleteAllGroupParticipations(); $objParticipation = new GroupParticipation(); $objParticipation->Person = $this->objPersonArray['ert1']; $objParticipation->Group = $this->objGroup1; $objParticipation->GroupRole = $this->objGroupRole; $objParticipation->DateStart = new QDateTime('2005-01-01'); $objParticipation->Save(); $objParticipation = new GroupParticipation(); $objParticipation->Person = $this->objPersonArray['ert1']; $objParticipation->Group = $this->objGroup2; $objParticipation->GroupRole = $this->objGroupRole; $objParticipation->DateStart = new QDateTime('2005-01-01'); $objParticipation->Save(); }
protected function Form_ProcessHash() { if ($this->IsPollingActive()) { $this->ClearPollingProcessor(); } // Cleanup and Tokenize UrlHash Contents $strUrlHash = trim(strtolower($this->strUrlHash)); $strUrlHashTokens = explode('/', $strUrlHash); // Create a New Group? if ($strUrlHashTokens[0] == 'new') { if (count($strUrlHashTokens) != 3) { QApplication::Redirect('/groups/'); } // Validate the GroupType $strConstantName = QString::ConvertToCamelCase($strUrlHashTokens[1]); if (!defined('GroupType::' . $strConstantName)) { QApplication::Redirect('/groups/'); } // Validate the Ministry $objMinistry = Ministry::Load($strUrlHashTokens[2]); if (!$objMinistry) { QApplication::Redirect('/groups/'); } if (!$objMinistry->IsLoginCanAdminMinistry(QApplication::$Login)) { QApplication::Redirect('/groups/'); } // Create the Group Object $objGroup = new Group(); $objGroup->GroupTypeId = constant('GroupType::' . $strConstantName); $objGroup->Ministry = $objMinistry; $objGroup->ActiveFlag = true; } else { // Get the Group from the Hash and Refresh the Label $objGroup = Group::Load($strUrlHashTokens[0]); if (!$objGroup) { QApplication::Redirect('/groups/'); } } $intOldGroupId = $this->objGroup ? $this->objGroup->Id : null; $blnRefreshGroupsPanel = !$this->objGroup || $this->objGroup->MinistryId != $objGroup->MinistryId ? true : false; $this->objGroup = $objGroup; $this->pnlGroup_Refresh($this->objGroup); if ($intOldGroupId) { $this->pnlGroup_Refresh($intOldGroupId); } if ($blnRefreshGroupsPanel) { $this->pnlGroups_Refresh(); $this->pnlAdminOptions_Refresh(); } $this->lblMinistry_Refresh(); $this->pnlContent_Refresh($strUrlHashTokens); }
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; } } }
?> <br clear="all"/> <?php } ?> </div> <?php if (QApplication::$Login) { ?> <div class="navbar" style="background-color: #766; width: 100%; border-top: 2px solid #766; border-bottom: 2px solid #766; height: 19px;"> <div style="width: 980px; margin: auto; font-size: 11px;"> <div id="ministryMenu" onmouseout="mmTimer = setTimeout('ToggleMinistryMenu();', 350);" onmouseover="clearTimeout(mmTimer);"> <?php foreach (Ministry::LoadArrayByActiveFlag(true, QQ::OrderBy(QQN::Ministry()->Name)) as $objMinistry) { $strCssClass = null; if (QApplication::$Ministry && QApplication::$Ministry->Id == $objMinistry->Id) { $strCssClass = ' class="selected"'; } printf('<a href="/%s"%s>%s</a>', $objMinistry->Token, $strCssClass, $objMinistry->Name); } if (QApplication::$Ministry) { $strLabel = 'Ministry: ' . QApplication::$Ministry->Name; } else { $strLabel = 'Ministries & Depts'; } ?> </div> <ul> <li id="ministryTab"><a href="#" onclick="return ToggleMinistryMenu();" id="ministryTabLink" <?php
<?php require dirname(__FILE__) . '/../../includes/prepend.inc.php'; QApplication::Authenticate(); // Get the array of all growth groups $groupArray = Group::LoadOrderedArrayByMinistryIdAndConfidentiality(17, Ministry::Load(17)->IsLoginCanAdminMinistry(QApplication::$Login), true); $intTotalCount = 0; $intGroupCount = 0; // Disable strict no-cache for IE due to IE issues with downloading no-cache items if (QApplication::IsBrowser(QBrowserType::InternetExplorer)) { header("Pragma:"); header("Expires:"); } header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename=growthgroupreport.csv'); function EscapeCsv($strString) { return '"' . str_replace('"', '""', $strString) . '"'; } print "Growth Group,First Name,Last Name,E-mail,Phone,Address,City,State,Zip Code\r\n"; foreach ($groupArray as $objGroup) { // If it's a growth group then display the details if ($objGroup->Type != GroupType::$NameArray[GroupType::GroupCategory]) { $objPersonCursor = Person::QueryCursor(QQ::AndCondition(QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $objGroup->Id), QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd)), QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName), QQ::Distinct())); $intGroupCount++; while ($objPerson = Person::InstantiateCursor($objPersonCursor)) { print EscapeCsv($objGroup->Name); print ","; print EscapeCsv($objPerson->FirstName); print ","; print EscapeCsv($objPerson->LastName);
protected function Form_Create() { $this->objGroupRegistration = new GroupRegistrations(); $this->mcGroupRegistration = new GroupRegistrationsMetaControl($this, $this->objGroupRegistration); $this->txtFirstName = $this->mcGroupRegistration->txtFirstName_Create(); $this->txtFirstName->Select(); $this->txtFirstName->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->txtFirstName->Required = true; $this->txtLastName = $this->mcGroupRegistration->txtLastName_Create(); $this->txtLastName->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->txtLastName->Required = true; $this->lstGender = new QListBox($this); $this->lstGender->Name = 'Gender'; $this->lstGender->AddItem('- Select One -'); $this->lstGender->AddItem('Female', 'F'); $this->lstGender->AddItem('Male', 'M'); $this->txtAddress = $this->mcGroupRegistration->txtAddress_Create(); $this->txtAddress->Name = 'Address'; $this->txtAddress->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->txtAddress->Required = true; $this->txtCity = $this->mcGroupRegistration->txtCity_Create(); $this->txtCity->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->txtCity->Required = true; $this->txtZipCode = $this->mcGroupRegistration->txtZipcode_Create(); $this->txtZipCode->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->txtZipCode->Required = true; $this->txtPhoneNumber = $this->mcGroupRegistration->txtPhone_Create(); $this->txtPhoneNumber->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->txtPhoneNumber->Required = true; $this->txtEmail = $this->mcGroupRegistration->txtEmail_Create(); $this->txtEmail->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->txtEmail->Required = true; $this->txtComments = $this->mcGroupRegistration->txtComments_Create(); $this->txtComments->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->lstSource = new QListBox($this); $this->lstSource->Name = 'How did you hear about us? '; $this->lstSource->Width = 250; $this->lstSource->AddItem('Choose...', 0); foreach (SourceList::LoadAll() as $objSourceList) { $this->lstSource->AddItem($objSourceList->Name, $objSourceList->Id); } $this->lstParticipationType = new QListBox($this); $this->lstParticipationType->Name = 'What would you like to be?'; $objRoleArray = Ministry::Load(17)->GetGroupRoleArray(QQ::OrderBy(QQN::GroupRole()->Name)); $this->lstParticipationType->AddItem('-Select One-'); foreach ($objRoleArray as $objRole) { $this->lstParticipationType->AddItem($objRole->Name, $objRole->Id); } $this->lstParticipationType->AddAction(new QChangeEvent(), new QAjaxAction('lstParticipationType_Change')); $this->lblMessage = new QLabel($this); $this->lblMessage->Text = ''; $this->lblMessage->ForeColor = 'red'; $this->lblMessage->HtmlEntities = false; $this->chkDaysAvailable = array(); foreach (GrowthGroupDayType::$NameArray as $key => $value) { $objChkDay = new QCheckBox($this); $objChkDay->Text = $value; $objChkDay->Name = $key; $this->chkDaysAvailable[] = $objChkDay; } $this->chkGroupType = array(); $objCondition = QQ::All(); $objGrowthGroupStructureCursor = GrowthGroupStructure::QueryCursor($objCondition); while ($objGrowthGroupStructure = GrowthGroupStructure::InstantiateCursor($objGrowthGroupStructureCursor)) { $objListItem = new QCheckBox($this); $objListItem->Text = $objGrowthGroupStructure->__toString(); $objListItem->Name = $objGrowthGroupStructure->Id; $this->chkGroupType[] = $objListItem; } $this->lstLocationFirst = new QListBox($this); $this->lstLocationFirst->Name = 'First Preference'; $this->lstLocationFirst->AddItem('Belmont'); $this->lstLocationFirst->AddItem('East Palo Alto'); $this->lstLocationFirst->AddItem('Fremont'); $this->lstLocationFirst->AddItem('Los Altos'); $this->lstLocationFirst->AddItem('Milpitas'); $this->lstLocationFirst->AddItem('Mountain View'); $this->lstLocationFirst->AddItem('Newark '); $this->lstLocationFirst->AddItem('Oakland'); $this->lstLocationFirst->AddItem('Palo Alto'); $this->lstLocationFirst->AddItem('San Francisco'); $this->lstLocationFirst->AddItem('San Jose'); $this->lstLocationFirst->AddItem('Santa Clara'); $this->lstLocationFirst->AddItem('South San Jose'); $this->lstLocationFirst->AddItem('Sunnyvale'); $this->lstLocationSecond = new QListBox($this); $this->lstLocationSecond->Name = 'Second Preference'; $this->lstLocationSecond->AddItem('Belmont'); $this->lstLocationSecond->AddItem('East Palo Alto'); $this->lstLocationSecond->AddItem('Fremont'); $this->lstLocationSecond->AddItem('Los Altos'); $this->lstLocationSecond->AddItem('Milpitas'); $this->lstLocationSecond->AddItem('Mountain View'); $this->lstLocationSecond->AddItem('Newark '); $this->lstLocationSecond->AddItem('Oakland'); $this->lstLocationSecond->AddItem('Palo Alto'); $this->lstLocationSecond->AddItem('San Francisco'); $this->lstLocationSecond->AddItem('San Jose'); $this->lstLocationSecond->AddItem('Santa Clara'); $this->lstLocationSecond->AddItem('South San Jose'); $this->lstLocationSecond->AddItem('Sunnyvale'); $this->btnSubmit = new QButton($this); $this->btnSubmit->Name = 'Submit'; $this->btnSubmit->Text = 'Submit'; $this->btnSubmit->CssClass = 'primary'; $this->btnSubmit->AddAction(new QClickEvent(), new QAjaxAction('btnSubmit_Click')); $this->btnSubmit->CausesValidation = true; $this->btnCancel = new QButton($this); $this->btnCancel->Name = 'Cancel'; $this->btnCancel->Text = 'Cancel'; $this->btnCancel->CssClass = 'primary'; }
public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) { if ($objObject->objMinistry) { $objObject->objMinistry = Ministry::GetSoapObjectFromObject($objObject->objMinistry, false); } else { if (!$blnBindRelatedObjects) { $objObject->intMinistryId = null; } } if ($objObject->objDonationStewardshipFund) { $objObject->objDonationStewardshipFund = StewardshipFund::GetSoapObjectFromObject($objObject->objDonationStewardshipFund, false); } else { if (!$blnBindRelatedObjects) { $objObject->intDonationStewardshipFundId = null; } } if ($objObject->dttDateCreated) { $objObject->dttDateCreated = $objObject->dttDateCreated->__toString(QDateTime::FormatSoap); } return $objObject; }
/** * Refresh this MetaControl with Data from the local SignupForm object. * @param boolean $blnReload reload SignupForm from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objSignupForm->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objSignupForm->Id; } } if ($this->lstSignupFormType) { $this->lstSignupFormType->SelectedValue = $this->objSignupForm->SignupFormTypeId; } if ($this->lblSignupFormTypeId) { $this->lblSignupFormTypeId->Text = $this->objSignupForm->SignupFormTypeId ? SignupFormType::$NameArray[$this->objSignupForm->SignupFormTypeId] : 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->objSignupForm->Ministry && $this->objSignupForm->Ministry->Id == $objMinistry->Id) { $objListItem->Selected = true; } $this->lstMinistry->AddItem($objListItem); } } } if ($this->lblMinistryId) { $this->lblMinistryId->Text = $this->objSignupForm->Ministry ? $this->objSignupForm->Ministry->__toString() : null; } if ($this->txtName) { $this->txtName->Text = $this->objSignupForm->Name; } if ($this->lblName) { $this->lblName->Text = $this->objSignupForm->Name; } if ($this->txtToken) { $this->txtToken->Text = $this->objSignupForm->Token; } if ($this->lblToken) { $this->lblToken->Text = $this->objSignupForm->Token; } if ($this->chkActiveFlag) { $this->chkActiveFlag->Checked = $this->objSignupForm->ActiveFlag; } if ($this->lblActiveFlag) { $this->lblActiveFlag->Text = $this->objSignupForm->ActiveFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->chkConfidentialFlag) { $this->chkConfidentialFlag->Checked = $this->objSignupForm->ConfidentialFlag; } if ($this->lblConfidentialFlag) { $this->lblConfidentialFlag->Text = $this->objSignupForm->ConfidentialFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->txtDescription) { $this->txtDescription->Text = $this->objSignupForm->Description; } if ($this->lblDescription) { $this->lblDescription->Text = $this->objSignupForm->Description; } if ($this->txtInformationUrl) { $this->txtInformationUrl->Text = $this->objSignupForm->InformationUrl; } if ($this->lblInformationUrl) { $this->lblInformationUrl->Text = $this->objSignupForm->InformationUrl; } if ($this->txtSupportEmail) { $this->txtSupportEmail->Text = $this->objSignupForm->SupportEmail; } if ($this->lblSupportEmail) { $this->lblSupportEmail->Text = $this->objSignupForm->SupportEmail; } if ($this->txtEmailNotification) { $this->txtEmailNotification->Text = $this->objSignupForm->EmailNotification; } if ($this->lblEmailNotification) { $this->lblEmailNotification->Text = $this->objSignupForm->EmailNotification; } if ($this->chkAllowOtherFlag) { $this->chkAllowOtherFlag->Checked = $this->objSignupForm->AllowOtherFlag; } if ($this->lblAllowOtherFlag) { $this->lblAllowOtherFlag->Text = $this->objSignupForm->AllowOtherFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->chkAllowMultipleFlag) { $this->chkAllowMultipleFlag->Checked = $this->objSignupForm->AllowMultipleFlag; } if ($this->lblAllowMultipleFlag) { $this->lblAllowMultipleFlag->Text = $this->objSignupForm->AllowMultipleFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->txtSignupLimit) { $this->txtSignupLimit->Text = $this->objSignupForm->SignupLimit; } if ($this->lblSignupLimit) { $this->lblSignupLimit->Text = $this->objSignupForm->SignupLimit; } if ($this->txtSignupMaleLimit) { $this->txtSignupMaleLimit->Text = $this->objSignupForm->SignupMaleLimit; } if ($this->lblSignupMaleLimit) { $this->lblSignupMaleLimit->Text = $this->objSignupForm->SignupMaleLimit; } if ($this->txtSignupFemaleLimit) { $this->txtSignupFemaleLimit->Text = $this->objSignupForm->SignupFemaleLimit; } if ($this->lblSignupFemaleLimit) { $this->lblSignupFemaleLimit->Text = $this->objSignupForm->SignupFemaleLimit; } if ($this->txtFundingAccount) { $this->txtFundingAccount->Text = $this->objSignupForm->FundingAccount; } if ($this->lblFundingAccount) { $this->lblFundingAccount->Text = $this->objSignupForm->FundingAccount; } if ($this->lstDonationStewardshipFund) { $this->lstDonationStewardshipFund->RemoveAllItems(); $this->lstDonationStewardshipFund->AddItem(QApplication::Translate('- Select One -'), null); $objDonationStewardshipFundArray = StewardshipFund::LoadAll(); if ($objDonationStewardshipFundArray) { foreach ($objDonationStewardshipFundArray as $objDonationStewardshipFund) { $objListItem = new QListItem($objDonationStewardshipFund->__toString(), $objDonationStewardshipFund->Id); if ($this->objSignupForm->DonationStewardshipFund && $this->objSignupForm->DonationStewardshipFund->Id == $objDonationStewardshipFund->Id) { $objListItem->Selected = true; } $this->lstDonationStewardshipFund->AddItem($objListItem); } } } if ($this->lblDonationStewardshipFundId) { $this->lblDonationStewardshipFundId->Text = $this->objSignupForm->DonationStewardshipFund ? $this->objSignupForm->DonationStewardshipFund->__toString() : null; } if ($this->calDateCreated) { $this->calDateCreated->DateTime = $this->objSignupForm->DateCreated; } if ($this->lblDateCreated) { $this->lblDateCreated->Text = sprintf($this->objSignupForm->DateCreated) ? $this->objSignupForm->__toString($this->strDateCreatedDateTimeFormat) : null; } if ($this->chkLoginNotRequiredFlag) { $this->chkLoginNotRequiredFlag->Checked = $this->objSignupForm->LoginNotRequiredFlag; } if ($this->lblLoginNotRequiredFlag) { $this->lblLoginNotRequiredFlag->Text = $this->objSignupForm->LoginNotRequiredFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->lstClassMeeting) { $this->lstClassMeeting->RemoveAllItems(); $this->lstClassMeeting->AddItem(QApplication::Translate('- Select One -'), null); $objClassMeetingArray = ClassMeeting::LoadAll(); if ($objClassMeetingArray) { foreach ($objClassMeetingArray as $objClassMeeting) { $objListItem = new QListItem($objClassMeeting->__toString(), $objClassMeeting->SignupFormId); if ($objClassMeeting->SignupFormId == $this->objSignupForm->Id) { $objListItem->Selected = true; } $this->lstClassMeeting->AddItem($objListItem); } } // Because ClassMeeting's ClassMeeting is not null, if a value is already selected, it cannot be changed. if ($this->lstClassMeeting->SelectedValue) { $this->lstClassMeeting->Enabled = false; } else { $this->lstClassMeeting->Enabled = true; } } if ($this->lblClassMeeting) { $this->lblClassMeeting->Text = $this->objSignupForm->ClassMeeting ? $this->objSignupForm->ClassMeeting->__toString() : null; } if ($this->lstEventSignupForm) { $this->lstEventSignupForm->RemoveAllItems(); $this->lstEventSignupForm->AddItem(QApplication::Translate('- Select One -'), null); $objEventSignupFormArray = EventSignupForm::LoadAll(); if ($objEventSignupFormArray) { foreach ($objEventSignupFormArray as $objEventSignupForm) { $objListItem = new QListItem($objEventSignupForm->__toString(), $objEventSignupForm->SignupFormId); if ($objEventSignupForm->SignupFormId == $this->objSignupForm->Id) { $objListItem->Selected = true; } $this->lstEventSignupForm->AddItem($objListItem); } } // Because EventSignupForm's EventSignupForm is not null, if a value is already selected, it cannot be changed. if ($this->lstEventSignupForm->SelectedValue) { $this->lstEventSignupForm->Enabled = false; } else { $this->lstEventSignupForm->Enabled = true; } } if ($this->lblEventSignupForm) { $this->lblEventSignupForm->Text = $this->objSignupForm->EventSignupForm ? $this->objSignupForm->EventSignupForm->__toString() : null; } }
/** * Refresh this MetaControl with Data from the local StewardshipFund object. * @param boolean $blnReload reload StewardshipFund from the database * @return void */ public function Refresh($blnReload = false) { if ($blnReload) { $this->objStewardshipFund->Reload(); } if ($this->lblId) { if ($this->blnEditMode) { $this->lblId->Text = $this->objStewardshipFund->Id; } } if ($this->lstMinistry) { $this->lstMinistry->RemoveAllItems(); $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->objStewardshipFund->Ministry && $this->objStewardshipFund->Ministry->Id == $objMinistry->Id) { $objListItem->Selected = true; } $this->lstMinistry->AddItem($objListItem); } } } if ($this->lblMinistryId) { $this->lblMinistryId->Text = $this->objStewardshipFund->Ministry ? $this->objStewardshipFund->Ministry->__toString() : null; } if ($this->txtName) { $this->txtName->Text = $this->objStewardshipFund->Name; } if ($this->lblName) { $this->lblName->Text = $this->objStewardshipFund->Name; } if ($this->txtExternalName) { $this->txtExternalName->Text = $this->objStewardshipFund->ExternalName; } if ($this->lblExternalName) { $this->lblExternalName->Text = $this->objStewardshipFund->ExternalName; } if ($this->txtAccountNumber) { $this->txtAccountNumber->Text = $this->objStewardshipFund->AccountNumber; } if ($this->lblAccountNumber) { $this->lblAccountNumber->Text = $this->objStewardshipFund->AccountNumber; } if ($this->txtFundNumber) { $this->txtFundNumber->Text = $this->objStewardshipFund->FundNumber; } if ($this->lblFundNumber) { $this->lblFundNumber->Text = $this->objStewardshipFund->FundNumber; } if ($this->chkActiveFlag) { $this->chkActiveFlag->Checked = $this->objStewardshipFund->ActiveFlag; } if ($this->lblActiveFlag) { $this->lblActiveFlag->Text = $this->objStewardshipFund->ActiveFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } if ($this->chkExternalFlag) { $this->chkExternalFlag->Checked = $this->objStewardshipFund->ExternalFlag; } if ($this->lblExternalFlag) { $this->lblExternalFlag->Text = $this->objStewardshipFund->ExternalFlag ? QApplication::Translate('Yes') : QApplication::Translate('No'); } }
public function btnSave_Click() { $this->objLogin = new Login(); $this->objLogin->Username = $this->txtUsername->Text; $this->objLogin->FirstName = $this->txtFirstName->Text; $this->objLogin->LastName = $this->txtLastName->Text; $this->objLogin->LoginActiveFlag = $this->rblLoginActive->SelectedValue; $this->objLogin->DomainActiveFlag = true; $this->objLogin->RoleTypeId = $this->lstRoleType->SelectedValue; $this->objLogin->Save(); $this->objLogin->Email = $this->txtEmail->Text; $intBitmap = 0; foreach ($this->rblPermissionArray as $rblPermission) { $intBitmap = $intBitmap | $rblPermission->SelectedValue; } // Update ministries associated foreach ($this->rblMinistryArray as $rblMinistry) { $objMinistry = Ministry::LoadById($rblMinistry->SelectedValue); if ($objMinistry) { $objMinistry->AssociateLogin($this->objLogin); } } $this->objLogin->PermissionBitmap = $intBitmap; if ($this->txtNewPassword->Text == $this->txtConfirmPassword->Text) { if (strlen(trim($this->txtNewPassword->Text)) != 0) { $this->objLogin->SetPasswordCache($this->txtNewPassword->Text); } } $this->objLogin->Save(); QApplication::Redirect('/admin/users/'); }
protected function lblMinistry_Refresh() { $objMinistry = Ministry::Load($this->intMinistryId); if ($objMinistry) { $this->lblMinistry->Visible = true; $this->lblMinistry->Text = 'Email Lists in ' . $objMinistry->Name; } else { $this->lblMinistry->Visible = false; } }
public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) { if ($objObject->objMinistry) { $objObject->objMinistry = Ministry::GetSoapObjectFromObject($objObject->objMinistry, false); } else { if (!$blnBindRelatedObjects) { $objObject->intMinistryId = null; } } return $objObject; }
<?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;
/** * [agencyAdd description] * @return [type] [description] */ public function agencyAdd($flag = null) { if (!$flag) { $ministry = new Ministry(); $ministry_list = $ministry->getAllMinistry('get'); return View::make('agency.add')->with('ministry_list', $ministry_list); } else { $data = Input::all(); $rules = array('ministry_id' => 'required', 'department_id' => 'required'); // Build the custom messages array. $messages = array('ministry_id.required' => 'กรุณาระบุชื่อกระทรวง', 'department_id.required' => 'กรุณาระบุชื่อกรม'); // Create a new validator instance. $validator = Validator::make($data, $rules, $messages); if ($validator->passes()) { $dep_obj = new Department(); $agency = new Agency(); $code = $dep_obj->getDepartmentCodeById($data['department_id']); $rs_check = $agency->checkAgency($code); if ($rs_check) { $dep_info = $dep_obj->getDeparmentInfoById($data['department_id']); $agency->tname = $dep_info[0]['full_th_name']; $agency->ministry_id = $dep_info[0]['ministry_id']; $agency->status = true; $agency->code = $dep_info[0]['department_code']; $agency->save(); return Redirect::to('agency/list')->with('success', 'บันทึกสำเร็จ'); } else { return Redirect::to('agency/add')->with('warning', 'มีชื่อข้อมูลอยู่ในระบบแล้ว'); } } else { // $errors = $validator->messages(); return Redirect::to('agency/add')->withErrors($validator); } } //end else }
public function btnSave_Click() { if ($this->strPassword->Text == $this->strConfirmPassword->Text) { if (strlen(trim($this->strPassword->Text)) != 0) { $this->objLogin->SetPasswordCache($this->strPassword->Text); } $this->objLogin->LoginActiveFlag = $this->rblLoginActive->SelectedValue; $intBitmap = 0; foreach ($this->rblPermissionArray as $rblPermission) { $intBitmap = $intBitmap | $rblPermission->SelectedValue; } $this->objLogin->PermissionBitmap = $intBitmap; $this->objLogin->Save(); // Update ministries associated $this->objLogin->UnassociateAllMinistries(); foreach ($this->rblMinistryArray as $rblMinistry) { $objMinistry = Ministry::LoadById($rblMinistry->SelectedValue); if ($objMinistry) { $objMinistry->AssociateLogin($this->objLogin); } } QApplication::Redirect('/admin/externusers/'); } else { $this->lblMessage->Text = 'Password and Confirm Password do not match'; $this->lblMessage->FontBold = true; $this->strPassword->Blink(); $this->strConfirmPassword->Blink(); $this->strPassword->Focus(); } }
public function UpdateLocalPeople() { foreach ($this->arrPeople as $intKey => $arrResult) { // Get the Fields $intUserAccountControl = intval($arrResult['useraccountcontrol'][0]); $blnActive = !($intUserAccountControl & 2); $strUsername = strtolower($arrResult['samaccountname'][0]); $strFirstName = $arrResult['givenname'][0]; $strMiddleInitial = array_key_exists('initials', $arrResult) ? $arrResult['initials'][0] : null; $strLastName = array_key_exists('sn', $arrResult) ? $arrResult['sn'][0] : null; $strEmail = strtolower(trim(array_key_exists('mail', $arrResult) ? strtolower($arrResult['mail'][0]) : null)); $strPasswordLastSet = $arrResult['pwdlastset'][0]; // Set/Update Login Record $objLogin = Login::LoadByUsername($strUsername); if (!$objLogin) { $objLogin = new Login(); $objLogin->Username = $strUsername; if (array_key_exists($strUsername, self::$ChmsAdminArray)) { $objLogin->RoleTypeId = RoleType::ChMSAdministrator; } else { $objLogin->RoleTypeId = RoleType::StaffMember; } if (!$blnActive) { $objLogin->LoginActiveFlag = false; $objLogin->DomainActiveFlag = false; } else { $objLogin->LoginActiveFlag = true; } } $objLogin->DomainActiveFlag = $blnActive; // Update the PWD Last Set and clear the cache (if applicable) if ($objLogin->PasswordLastSet != $strPasswordLastSet) { $objLogin->PasswordLastSet = $strPasswordLastSet; $objLogin->PasswordCache = null; } if ($strEmail && strpos($strEmail, '@alcf.net') !== false) { $objLoginToCheck = Login::LoadByEmail($strEmail); if ($objLoginToCheck && $objLoginToCheck->Id != $objLogin->Id) { throw new Exception('Duplicate Email "' . $strEmail . '" Found while processing ldap user "' . $strUsername . '" -- duplicate is ' . $objLoginToCheck->Username); } $objLogin->Email = $strEmail; } else { $objLogin->LoginActiveFlag = false; $objLogin->Email = null; } $objLogin->FirstName = $strFirstName; $objLogin->MiddleInitial = $strMiddleInitial; $objLogin->LastName = $strLastName; // Shortcut if ($objLogin->Username == 'mho') { $objLogin->PermissionBitmap = 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 | 1024; } $objLogin->Save(); // Group Memberships $objLogin->UnassociateAllMinistries(); if (array_key_exists('memberof', $arrResult)) { unset($arrResult['memberof']['count']); foreach ($arrResult['memberof'] as $strPath) { $strArray = AlcfLdap::GetValuesFromPath($strPath); $strCn = $strArray['CN'][0]; if (substr($strCn, 0, 3) == 'gg_') { $strGroupToken = strtolower(substr($strCn, 3)); $objMinistry = Ministry::LoadByToken($strGroupToken); if ($objMinistry) { $objMinistry->AssociateLogin($objLogin); } } } } } }
/** * Retrieves a list of Groups that can be managed by a given login * @param Login $objLogin * @return Group[] */ public static function LoadArrayByManagedByLogin(Login $objLogin) { if ($objLogin->RoleTypeId == RoleType::ChMSAdministrator) { $intMinistryIdArray = array(); foreach (Ministry::LoadArrayByActiveFlag(true) as $objMinistry) { $intMinistryIdArray[] = $objMinistry->Id; } } else { $intMinistryIdArray = array(); foreach ($objLogin->GetMinistryArray() as $objMinistry) { $intMinistryIdArray[] = $objMinistry->Id; } } return Group::QueryArray(QQ::AndCondition(QQ::Equal(QQN::Group()->GroupTypeId, GroupType::RegularGroup), QQ::In(QQN::Group()->MinistryId, $intMinistryIdArray), QQ::Equal(QQN::Group()->ActiveFlag, true)), QQ::OrderBy(QQN::Group()->Name)); }