Example #1
0
 public function dtgGroups_Bind()
 {
     if ($this->chkViewAll->Checked) {
         $objClause = QQ::AndCondition(QQ::Equal(QQN::Group()->GroupParticipation->PersonId, $this->objPerson->Id), QQ::In(QQN::Group()->GroupTypeId, array(GroupType::RegularGroup, GroupType::GrowthGroup)));
     } else {
         $objClause = QQ::AndCondition(QQ::Equal(QQN::Group()->GroupParticipation->PersonId, $this->objPerson->Id), QQ::IsNull(QQN::Group()->GroupParticipation->DateEnd), QQ::In(QQN::Group()->GroupTypeId, array(GroupType::RegularGroup, GroupType::GrowthGroup)));
     }
     // Admins can view anything
     if (QApplication::$Login->RoleTypeId == RoleType::ChMSAdministrator) {
     } else {
         // Non-Admins can only view non-confidential groups
         // OR groups that they are associated with
         $intMinistryIdArray = array();
         foreach (QApplication::$Login->GetMinistryArray() as $objMinistry) {
             $intMinistryIdArray[] = $objMinistry->Id;
         }
         $objSubClause = QQ::OrCondition(QQ::Equal(QQN::Group()->ConfidentialFlag, false), QQ::In(QQN::Group()->MinistryId, $intMinistryIdArray));
         $objClause = QQ::AndCondition($objClause, $objSubClause);
     }
     $this->dtgGroups->DataSource = Group::QueryArray($objClause, QQ::Distinct());
 }
Example #2
0
 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;
     }
 }
Example #3
0
 /**
  * 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));
 }
Example #4
0
 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a Group-based QQNode.
  * It will also verify that it is a proper Group-based QQNode, and will throw an exception otherwise.
  *
  * @param mixed $mixContent
  * @return QQNode
  */
 protected function ResolveContentItem($mixContent)
 {
     if ($mixContent instanceof QQNode) {
         if (!$mixContent->_ParentNode) {
             throw new QCallerException('Content QQNode cannot be a Top Level Node');
         }
         if ($mixContent->_RootTableName == 'group') {
             if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             }
             $objCurrentNode = $mixContent;
             while ($objCurrentNode = $objCurrentNode->_ParentNode) {
                 if (!$objCurrentNode instanceof QQNode) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
                 if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
             }
             return $mixContent;
         } else {
             throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "group".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'Id':
                     return QQN::Group()->Id;
                 case 'GroupTypeId':
                     return QQN::Group()->GroupTypeId;
                 case 'MinistryId':
                     return QQN::Group()->MinistryId;
                 case 'Ministry':
                     return QQN::Group()->Ministry;
                 case 'Name':
                     return QQN::Group()->Name;
                 case 'Description':
                     return QQN::Group()->Description;
                 case 'ParentGroupId':
                     return QQN::Group()->ParentGroupId;
                 case 'ParentGroup':
                     return QQN::Group()->ParentGroup;
                 case 'HierarchyLevel':
                     return QQN::Group()->HierarchyLevel;
                 case 'HierarchyOrderNumber':
                     return QQN::Group()->HierarchyOrderNumber;
                 case 'ConfidentialFlag':
                     return QQN::Group()->ConfidentialFlag;
                 case 'EmailBroadcastTypeId':
                     return QQN::Group()->EmailBroadcastTypeId;
                 case 'Token':
                     return QQN::Group()->Token;
                 case 'ActiveFlag':
                     return QQN::Group()->ActiveFlag;
                 case 'Status':
                     return QQN::Group()->Status;
                 case 'StatusObject':
                     return QQN::Group()->StatusObject;
                 case 'GroupCategory':
                     return QQN::Group()->GroupCategory;
                 case 'GrowthGroup':
                     return QQN::Group()->GrowthGroup;
                 case 'SmartGroup':
                     return QQN::Group()->SmartGroup;
                 default:
                     throw new QCallerException('Simple Property not found in GroupDataGrid content: ' . $mixContent);
             }
         } else {
             if ($mixContent instanceof QQAssociationNode) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             } else {
                 throw new QCallerException('Invalid Content type');
             }
         }
     }
 }
Example #5
0
| 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 ($ministrydepartment) {
        case 'All':
            // increment all the appropriate arrays
            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) {
                calculateValues($objGroup);
            }
            break;
        case 'AdministrativeOperations':
            // Communications, IT, Stewardship
            if ($objGroup->MinistryId == 27 || $objGroup->MinistryId == 18 || $objGroup->MinistryId == 40) {
Example #6
0
 /**
  * Count Groups
  * by Status Index(es)
  * @param integer $intStatus
  * @return int
  */
 public static function CountByStatus($intStatus, $objOptionalClauses = null)
 {
     // Call Group::QueryCount to perform the CountByStatus query
     return Group::QueryCount(QQ::Equal(QQN::Group()->Status, $intStatus), $objOptionalClauses);
 }