/**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     $regSummaries = new RegSummaryTools();
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     $path = $this->pathModuleRoot . 'templates/';
     // Otherwise use the standard Templates for the site:
     //$path = SITE_PATH_TEMPLATES;
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     $event = new RowManager_EventManager($this->event_id);
     $this->labels->setLabelTag('[Instr]', '[eventName]', $event->getEventName());
     // NOTE:  this parent method prepares the $this->template with the
     // common Display data.
     $this->prepareTemplate($path);
     // pass in the labels for the outer template
     //		$labels = new MultiLingual_Labels( GPC_SITE_LABEL, GPC_SERIES_LABEL, TEMPLATE_PAGE, $langID );
     //		$page->set('labels', $labels );
     // get privileges for the current viewer
     $privManager = new PrivilegeManager($this->viewer->getID());
     if ($privManager->isEventAdmin($this->event_id) == true) {
         $this->template->set('isEventAdmin', true);
         // display messages based on balance owing recalculation status
         switch ($this->recalcStatus) {
             // display balance owing recalculation COMPLETED message
             case FinancialTools::RECALC_COMPLETE:
                 $this->template->set('isRecalculated', true);
                 $completedMsg = $this->labels->getLabel('[RecalcCompleteMsg]');
                 $this->template->set('recalcMessage', $completedMsg);
                 break;
                 // display balance owing recalculation NEEDED message
             // display balance owing recalculation NEEDED message
             case FinancialTools::RECALC_NEEDED:
                 $this->template->set('needsRecalculation', true);
                 $completedMsg = $this->labels->getLabel('[RecalcNeededMsg]');
                 $this->template->set('recalcMessage', $completedMsg);
                 break;
             default:
                 break;
         }
     }
     $this->template->set('backLink', $this->linkValues['BackLink']);
     //$superAdminPrefix = 'superAdmin_';
     //$this->template->set('superAdminPrefix', $superAdminPrefix );
     $superAdminLevelLinks = array();
     $campusLevelLinks = array();
     $eventLevelLinks = array();
     $financeLevelLinks = array();
     if ($privManager->isSuperAdmin() == true) {
         $this->template->set('isSuperAdmin', true);
         //Super Admin Level links (order is important == viewing order)
         $superAdminLevelLinks['AddSuperAdmins'] = $this->linkValues['AddSuperAdmins'];
         $superAdminLevelLinks['EditPrivilegeTypes'] = $this->linkValues['EditPrivilegeTypes'];
         $superAdminLevelLinks['EditFieldTypes'] = $this->linkValues['EditFieldTypes'];
         $superAdminLevelLinks['EditPriceRuleTypes'] = $this->linkValues['EditPriceRuleTypes'];
         $superAdminLevelLinks['EditCreditCardTypes'] = $this->linkValues['EditCreditCardTypes'];
         $superAdminLevelLinks['EditStatusTypes'] = $this->linkValues['EditStatusTypes'];
         $this->template->set('superAdminLevelLinks', $superAdminLevelLinks);
     }
     //Campus Level links
     /** TODO: move the below code into an earlier page and pass on priv. info OR put in helper function ***/
     /** ALSO: make use of this or similar code for restricting access to campus-level registrations **/
     /** CHECK PRIVILEGE LEVEL IN ORDER TO DETERMINE WHICH CAMPUS REGISTRATION LINKS TO SHOW **/
     //         $viewer_id = $this->viewer->getViewerID();
     //         $accessAll = false;
     //         $accessCampuses = array();
     //
     //         $superAdmin = new RowManager_SuperAdminAssignmentManager();
     //         $superAdmin->setViewerID($viewer_id);
     //         $superAdminList = new ListIterator($superAdmin);
     //   		  $superAdminArray = $superAdminList->getDropListArray();
     // //     		echo "super: <pre>".print_r($superAdminArray, true)."</pre>";
     //
     // 			// all campuses can be accessed if user/viewer is super-admin
     //         if (count($superAdminArray) > 0)
     //         {
     // 	        $accessAll = true;
     //         }
     //         else	// check if viewer is finance-level, event-level, or campus-level admin
     //         {
     // 	        // TODO: retrieve these constants from the database using PrivilegeTypeManager
     // 	         $EVENT_LEVEL = 3;
     // 	         $FINANCE_LEVEL = 2;
     // 	         $CAMPUS_LEVEL = 4;
     //
     // 	         $eventAdmin = new RowManager_EventAdminAssignmentManager();
     //         		$eventAdmin->setEventID($this->event_id);
     //         		$eventAdmin->setViewerID($viewer_id);
     //         		$eventAdmin->setPrivilege($EVENT_LEVEL." or ".$FINANCE_LEVEL);
     //         		$eventAdminList = new ListIterator($eventAdmin);
     //         		$eventAdminArray = $eventAdminList->getDropListArray();
     // //        		echo "eventAdmin: <pre>".print_r($eventAdminArray, true)."</pre>";
     // 				// grant access to all campuses if viewer is event-level or finance-level admin
     //         		if (count($eventAdminArray) < 0)
     //         		{
     // 	        		$accessAll = true;
     //   				}
     //   				else 	// TODO: retrieve campus list if viewer has campus-level admin privileges
     //   				{
     // 	  				$eventAdmin2 = new RowManager_EventAdminAssignmentManager();
     // 	        		$eventAdmin2->setEventID($this->event_id);
     // 	        		$eventAdmin2->setViewerID($viewer_id);
     // 	  				$eventAdmin2->setPrivilege($CAMPUS_LEVEL);
     // 	        		$eventAdminList2 = new ListIterator($eventAdmin2);
     // 	        		$eventAdminArray2 = $eventAdminList2->getDropListArray();
     // //	        		echo "eventAdmin2: <pre>".print_r($eventAdminArray2, true)."</pre>";
     //         		}
     //
     //       	}
     /** END PRIVILEGE CHECKING **/
     //       	$is_campus_admin = false;
     if ($privManager->isBasicAdmin($this->event_id) == true) {
         $this->template->set('isCampusAdmin', true);
         /** RETRIEVE CAMPUS REGISTRATION SUMMARY DATA ***/
         //TODO?: put some/all of this into a helper method
         // initialized template arrays
         $campusLevelLinks = array();
         $summaryTotals = array();
         $summaryTotals['numMales'] = 0;
         $summaryTotals['numFemales'] = 0;
         $summaryTotals['campusTotal'] = 0;
         $summaryTotals['cancellations'] = 0;
         // get all campuses
         $campuses = new RowManager_CampusManager();
         $campuses->setSortOrder('campus_desc');
         $campusList = $campuses->getListIterator();
         $campusArray = $campusList->getDataList();
         reset($campusArray);
         // 	     		echo 'campus array = <pre>'.print_r($campusArray,true).'</pre>';
         // retrieve cancellations (for current event)
         $results_cancelled = array();
         $results_cancelled = $regSummaries->getCampusRegistrations($this->event_id, '', true);
         // retrieve total registrations and total females registered (for current event)
         $results = array();
         $results_female = array();
         $results = $regSummaries->getCampusRegistrations($this->event_id, '');
         $results_female = $regSummaries->getCampusRegistrations($this->event_id, 'female');
         // retrieve total complete registrations and total incomplete registrations (for current event)
         $results_complete = array();
         $results_incomplete = array();
         $results_complete = $regSummaries->getCampusRegistrations($this->event_id, '', false, '', '', RowManager_RegistrationManager::STATUS_REGISTERED);
         $results_incomplete = $regSummaries->getCampusRegistrations($this->event_id, '', false, '', '', RowManager_RegistrationManager::STATUS_INCOMPLETE);
         //      	 $results = array_merge( $results_male, $results_female );
         reset($results);
         //      	 reset($results_male);
         //      	 reset($results_female);
         // go through total registrations in parallel with other results
         foreach (array_keys($campusArray) as $k) {
             $total = current($results);
             $regCampusID = key($results);
             $campusID = key($campusArray);
             //key($results);
             // retrieve campus name given the campus ID
             $campus = new RowManager_CampusManager($campusID);
             $campusName = $campus->getDesc();
             // process registration total if it matches the current campus ID
             if ($regCampusID == $campusID) {
                 // set total valid non-cancelled registrations for current campus (and event)
                 if (isset($results_cancelled[$campusID])) {
                     $cancelled = $results_cancelled[$campusID];
                     // 							$total = $total - $cancelled;
                 } else {
                     $cancelled = 0;
                 }
                 // set total females registered for current campus (and event)
                 if (isset($results_female[$campusID])) {
                     $females = $results_female[$campusID];
                 } else {
                     $females = 0;
                 }
                 // set total complete registrations for current campus (and event)
                 if (isset($results_complete[$campusID])) {
                     $completes = $results_complete[$campusID];
                 } else {
                     $completes = 0;
                 }
                 // set total incomplete registrations for current campus (and event)
                 if (isset($results_incomplete[$campusID])) {
                     $incompletes = $results_incomplete[$campusID];
                 } else {
                     $incompletes = 0;
                 }
                 //				$females = current($results_female);
                 //				$males = $results_male[$campusName];
                 // set total registered males
                 $males = $total - $females;
                 //current($results_male);//
                 //        		echo $campusName.': '.$total.' : '.$males.' : '.$females.'<br>';
                 //        		echo 'cancelled : '.$cancelled.'<br>';
                 // set registration summary values for current campus
                 $aCampus = array();
                 $aCampus['campus_desc'] = $campusName;
                 $aCampus['regLink'] = '#';
                 //$this->linkValues[ 'CampusLink' ].$campusID;//$this->event_id."_".$campusID;
                 $aCampus['numMales'] = $males;
                 $aCampus['numFemales'] = $females;
                 $aCampus['campusTotal'] = $total;
                 $aCampus['cancellations'] = $cancelled;
                 $aCampus['completes'] = $completes;
                 $aCampus['incompletes'] = $incompletes;
                 // 		        		$summaryTotals['numMales'] += $males;
                 // 		        		$summaryTotals['numFemales'] += $females;
                 // 		        		$summaryTotals['campusTotal'] += $total;
                 // 		        		$summaryTotals['cancellations'] += $cancelled;
                 next($results);
                 // increment array-pointer for registration totals array
             } else {
                 // set registration summary values for current campus
                 $aCampus = array();
                 $aCampus['campus_desc'] = $campusName;
                 $aCampus['regLink'] = '#';
                 //$this->linkValues[ 'CampusLink' ].$campusID;//$this->event_id."_".$campusID;
                 $aCampus['numMales'] = 0;
                 $aCampus['numFemales'] = 0;
                 $aCampus['campusTotal'] = 0;
                 $aCampus['cancellations'] = 0;
                 $aCampus['completes'] = 0;
                 $aCampus['incompletes'] = 0;
             }
             //       		        $editLink = $this->getCallBack( modulecim_reg::PAGE_ADMINEVENTHOME, $this->sortBy, $parameters );
             //       $editLink .= "&". modulecim_reg::REG_ID . "=";
             //       CampusLink
             if ($privManager->isCampusAdmin($this->event_id, $campusID) == true) {
                 $aCampus['regLink'] = $this->linkValues['CampusLink'] . $campusID;
                 //$this->event_id."_".$campusID;
             }
             // <START> USED TO BE INSIDE CAMPUS ADMIN PRIV. CHECK
             // BUT NOW ALL CAMPUS ADMINS CAN SEE SUMMARY DATA... ONLY REGISTRATION LINKS NOT SHOWN FOR INVALID CAMPUSES
             // store campus summary info in array indexed by campus name
             $campusLevelLinks[$campusName] = $aCampus;
             // 	        		if ($is_campus_admin == false) {
             // 		        		$this->template->set('isCampusAdmin', true);
             // 		        		$is_campus_admin = true;
             // 	        		}
             // <END>
             next($campusArray);
             //				next($results_female);
             //				next($results_male);
         }
         /*** END CAMPUS REGISTRATION SUMMARY DATA RETRIEVAL ***/
         $this->template->set('linkText', 'Registrations');
         $this->template->set('campusLevelLinks', $campusLevelLinks);
         /**** SET TOTAL  *UNIQUE*  REGISTRATIONS *******/
         $totalRegs = array();
         $totalRegs = $regSummaries->getUniqueRegistrations($this->event_id);
         // 				echo "Total unique regs: ".count($totalRegs);
         $femaleRegs = array();
         $gender = 'female';
         $femaleRegs = $regSummaries->getUniqueRegistrations($this->event_id, $gender);
         // 				echo "<br>Total male regs: ".(count($totalRegs)-count($femaleRegs));
         // 				echo "<br>Total female regs: ".count($femaleRegs);
         $cancelledRegs = array();
         $gender = '';
         $areCancelled = true;
         $cancelledRegs = $regSummaries->getUniqueRegistrations($this->event_id, $gender, $areCancelled);
         // 				echo "<br>Total cancelled regs: ".count($cancelledRegs);
         $completeRegs = array();
         $gender = '';
         $areCancelled = false;
         $status = RowManager_RegistrationManager::STATUS_REGISTERED;
         $completeRegs = $regSummaries->getUniqueRegistrations($this->event_id, $gender, $areCancelled, $status);
         $incompleteRegs = array();
         $gender = '';
         $areCancelled = false;
         $status = RowManager_RegistrationManager::STATUS_INCOMPLETE;
         $incompleteRegs = $regSummaries->getUniqueRegistrations($this->event_id, $gender, $areCancelled, $status);
         $summaryTotals['numMales'] = count($totalRegs) - count($femaleRegs);
         $summaryTotals['numFemales'] = count($femaleRegs);
         $summaryTotals['campusTotal'] = count($totalRegs);
         $summaryTotals['cancellations'] = count($cancelledRegs);
         $summaryTotals['completes'] = count($completeRegs);
         $summaryTotals['incompletes'] = count($incompleteRegs);
         $this->template->set('summaryTotals', $summaryTotals);
     }
     if ($privManager->isEventAdmin($this->event_id) == true) {
         //Event Level links
         $eventLevelLinks['AddEventAdmins'] = $this->linkValues['AddEventAdmins'];
         $eventLevelLinks['AddCampusAdmins'] = $this->linkValues['AddCampusAdmins'];
         $eventLevelLinks['RecalculateBalances'] = $this->linkValues['RecalculateBalances'];
         $eventLevelLinks['EditEventDetails'] = $this->linkValues['EditEventDetails'];
         $eventLevelLinks['EditEventFormFields'] = $this->linkValues['EditEventFormFields'];
         $eventLevelLinks['EditEventPriceRules'] = $this->linkValues['EditEventPriceRules'];
         $eventLevelLinks['EventDataDump'] = $this->linkValues['EventDataDump'];
         $eventLevelLinks['EventScholarshipList'] = $this->linkValues['EventScholarshipList'];
         $this->template->set('eventLevelLinks', $eventLevelLinks);
         //$editEventDetailsLink = $this->linkValues[ 'editEventDetailsLink' ];
         //$this->template->set('editEventDetailsLink', $editEventDetailsLink );
     }
     if ($privManager->isFinanceAdmin($this->event_id) == true) {
         $this->template->set('isFinanceAdmin', true);
         //Finance Level links
     }
     // uncomment this line if you are creating a template for this page
     $templateName = 'page_AdminEventHome.php';
     // otherwise use the generic site template
     //$templateName = '';
     return $this->template->fetch($templateName);
 }
 /**
  * function __construct
  * <pre>
  * Initialize the object.
  * </pre>
  * @param $pathModuleRoot [STRING] The path to the module's root dir.
  * @param $viewer [OBJECT] The viewer object.
  * @param $sortBy [STRING] Field data to sort listManager by.
  * @param $managerInit [INTEGER] Initialization value for the listManager.
  * @return [void]
  */
 function __construct($pathModuleRoot, $viewer, $sortBy, $year_id = "", $campus_id = "")
 {
     parent::__construct(page_ViewStudentYearInSchool::DISPLAY_FIELDS);
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $this->year_id = $year_id;
     $this->campus_id = $campus_id;
     // echo 'campusID['.$this->campus_id.']<br/>';
     //        $this->managerInit = $managerInit;
     // Now load the access Priviledge manager of this viewer
     $this->adminManager = new RowManager_AdminManager();
     // Get the person ID
     $accessManager = new RowManager_AccessManager();
     $accessManager->loadByViewerID($this->viewer->getViewerID());
     $personID = $accessManager->getPersonID();
     // Get the permissions the person has.
     $this->adminManager->loadByPersonID($personID);
     // need to filter displayed data by campus associated with campus admin
     $campusAdminSearchCondition = '';
     if ($this->adminManager->hasSitePriv()) {
         $campusManager = new RowManager_CampusManager();
         $campusManager->setSortOrder('campus_desc');
         $this->campusList = $campusManager->getListIterator();
         $this->accessibleCampuses = $this->campusList->getDropListArray();
     } else {
         if ($this->adminManager->hasCampusPriv()) {
             $campusAdminManager = new RowManager_CampusAdminManager();
             $adminID = $this->adminManager->getID();
             // echo 'adminID['.$adminID.']<br/>';
             $campusAdminManager->setAdminID($adminID);
             $campusList = $campusAdminManager->getListIterator();
             //$multiTableManager->getListIterator();
             $campusArray = $campusList->getDataList();
             $campusIDsList = "";
             // init the CSV of campus IDs associated with admin
             reset($campusArray);
             foreach (array_keys($campusArray) as $k) {
                 $record = current($campusArray);
                 $campusIDsList .= $record['campus_id'] . ',';
                 // create list of admin campuses
                 next($campusArray);
             }
             $campusIDsList = substr($campusIDsList, 0, -1);
             // remove last comma
             $campusAdminSearchCondition = 'cim_hrdb_assignment.campus_id in (' . $campusIDsList . ')';
         } else {
             if ($this->adminManager->isStaff($viewer->getID())) {
                 $staffManager = new RowManager_StaffManager();
                 $staffManager->setPersonID($personID);
                 $multiTableManager = new MultiTableManager();
                 $multiTableManager->addRowManager($staffManager);
                 $multiTableManager->setSortOrder('campus_desc');
                 $assignmentManager = new RowManager_AssignmentsManager();
                 $multiTableManager->addRowManager($assignmentManager, new JoinPair($assignmentManager->getJoinOnPersonID(), $staffManager->getJoinOnPersonID()));
                 $campusManager = new RowManager_CampusManager();
                 $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $assignmentManager->getJoinOnCampusID()));
                 $this->campusList = $multiTableManager->getListIterator();
                 $campusIDsList = "";
                 // init the CSV of campus IDs associated with admin
                 $this->campusList->setFirst();
                 while ($this->campusList->moveNext()) {
                     $campusAssignObject = $this->campusList->getCurrent(new RowManager_AssignmentsManager());
                     $campusObject = $this->campusList->getCurrent(new RowManager_CampusManager());
                     $campusIDsList .= $campusAssignObject->getCampusID() . ',';
                     // create list of admin campuses
                 }
                 $campusIDsList = substr($campusIDsList, 0, -1);
                 // remove last comma
                 $campusAdminSearchCondition = 'cim_hrdb_assignment.campus_id in (' . $campusIDsList . ')';
             }
         }
     }
     $yearManager = new RowManager_YearInSchoolManager();
     $yearManager->setSortOrder('year_id');
     $this->yearValueList = $yearManager->getListIterator();
     $this->yearValues = $this->yearValueList->getDropListArray();
     // Add value to drop-list for showing person data for people not having person_year record
     $keys = array_keys($this->yearValues);
     $this->UNASSIGNED_IDX = $keys[count($this->yearValues) - 1] + 1;
     // assumes autoincrement is active on table
     $this->yearValues[$this->UNASSIGNED_IDX] = page_ViewStudentYearInSchool::UNASSIGNED;
     // 					echo 'values = <pre>'.print_r($this->yearValues, true).'</pre>';
     // modify the year_id if necessary
     if ($this->year_id == page_ViewStudentYearInSchool::DISPLAY_ALL_ID) {
         // setting the year_id to blank will get entries from all the years
         $this->year_id = '';
     } else {
         if ($this->year_id == '') {
             // no campus has been specified
             // choose a default campus if none specified
             // echo 'No campus specified<br/>';
             // get the first element from the accessible list
             foreach ($this->yearValues as $key => $value) {
                 $this->year_id = $key;
                 break;
             }
             // assert campus_id should now be something
             if ($this->year_id == '') {
                 die("ERROR - year_id not set to anything<br/>");
             }
         }
     }
     $dataAccessObject = new MultiTableManager();
     // Check if regular choice made (i.e. person has some year_in_school record)
     if ($this->year_id != $this->UNASSIGNED_IDX) {
         $personYearManager = new RowManager_PersonYearManager();
         $personYearManager->setYear($this->year_id);
         // SOMEWHAT REDUNDANT GIVEN addSearchCondition (which is required)
         $dataAccessObject->addRowManager($personYearManager);
         $yearManager = new RowManager_YearInSchoolManager();
         $joinPair = new JoinPair($personYearManager->getJoinOnYearID(), $yearManager->getJoinOnYearID());
         $dataAccessObject->addRowManager($yearManager, $joinPair);
         $personManager = new RowManager_PersonManager();
         $joinPair1 = new JoinPair($personManager->getJoinOnPersonID(), $personYearManager->getJoinOnPersonID());
         $dataAccessObject->addRowManager($personManager, $joinPair1);
         $assignmentManager = new RowManager_AssignmentsManager();
         $joinPair2 = new JoinPair($personYearManager->getJoinOnPersonID(), $assignmentManager->getJoinOnPersonID());
         $dataAccessObject->addRowManager($assignmentManager, $joinPair2);
         $campusManager = new RowManager_CampusManager();
         $joinPair3 = new JoinPair($assignmentManager->getJoinOnCampusID(), $campusManager->getJoinOnCampusID());
         $dataAccessObject->addRowManager($campusManager, $joinPair3);
         if ($sortBy == '') {
             $sortBy = 'campus_shortDesc,person_lname';
         }
         if ($this->year_id != '') {
             $dataAccessObject->addSearchCondition('cim_hrdb_person_year.year_id = ' . $this->year_id);
         }
         // filter by campuses assigned to this campus admin
         if ($campusAdminSearchCondition != '') {
             $dataAccessObject->addSearchCondition($campusAdminSearchCondition);
         }
         $dataAccessObject->setSortOrder($sortBy);
         $this->listManager = $dataAccessObject->getListIterator();
     } else {
         // 	        $personYearManager = new RowManager_PersonYearManager();
         // 	        $personYearManager->setYear($this->year_id);	// SOMEWHAT REDUNDANT GIVEN addSearchCondition (which is required)
         // 	        $dataAccessObject->addRowManager( $personYearManager );
         //
         // 	        $yearManager = new RowManager_YearInSchoolManager();
         // 	        $joinPair = new JoinPair($personYearManager->getJoinOnYearID(), $yearManager->getJoinOnYearID());
         // 	        $dataAccessObject->addRowManager( $yearManager, $joinPair );
         $personManager = new RowManager_PersonManager();
         $dataAccessObject->addRowManager($personManager);
         $assignmentManager = new RowManager_AssignmentsManager();
         $joinPair2 = new JoinPair($personManager->getJoinOnPersonID(), $assignmentManager->getJoinOnPersonID());
         $dataAccessObject->addRowManager($assignmentManager, $joinPair2);
         $campusManager = new RowManager_CampusManager();
         $joinPair3 = new JoinPair($assignmentManager->getJoinOnCampusID(), $campusManager->getJoinOnCampusID());
         $dataAccessObject->addRowManager($campusManager, $joinPair3);
         if ($sortBy == '') {
             $sortBy = 'campus_shortDesc,person_lname';
         }
         // get sub-query data for filtering out registrants that have already been registered for event
         $subManager = new RowManager_PersonYearManager();
         $personYearManager = new MultiTableManager();
         $personYearManager->addRowManager($subManager);
         $personYearManager->setFieldList('person_id');
         $registered_SQL = $personYearManager->createSQL();
         //          echo "<br>CREATED SQL 1 = ".$registered_SQL;
         // actually creates the sub-query ensuring that registrants listed do NOT have personyear records
         $negateSubQuery = true;
         $addSubQuery = true;
         $dataAccessObject->constructSubQuery('person_id', $registered_SQL, $negateSubQuery, $addSubQuery);
         // filter by campuses assigned to this campus admin
         if ($campusAdminSearchCondition != '') {
             $dataAccessObject->addSearchCondition($campusAdminSearchCondition);
         }
         $dataAccessObject->setSortOrder($sortBy);
         $this->listManager = $dataAccessObject->getListIterator();
     }
     /** TEST **/
     //         $values = $this->listManager->getDataList();
     //         echo 'values found = <pre>'.print_r($values,true).'</pre>';
     /** END TEST **/
     // now initialize the labels for this page
     // start by loading the default field labels for this Module
     $languageID = $viewer->getLanguageID();
     $seriesKey = modulecim_hrdb::MULTILINGUAL_SERIES_KEY;
     $pageKey = modulecim_hrdb::MULTILINGUAL_PAGE_FIELDS;
     $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey);
     // then load the page specific labels for this page
     $pageKey = page_ViewStudentYearInSchool::MULTILINGUAL_PAGE_KEY;
     $this->labels->loadPageLabels($pageKey);
     $this->labels->setSeriesKey(SITE_LABEL_SERIES_SITE);
     $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORM_LINKS);
 }
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     $path = $this->pathModuleRoot . 'templates/';
     // Otherwise use the standard Templates for the site:
     //$path = SITE_PATH_TEMPLATES;
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     $regionJumpLinkSelectedValue = $this->linkValues['regionJumpLink'] . $this->region_id;
     $semesterJumpLinkSelectedValue = $this->linkValues['semesterJumpLink'] . $this->semester_id;
     // NOTE:  this parent method prepares the $this->template with the
     // common Display data.
     $this->prepareTemplate($path);
     $this->template->set('regionJumpLinkSelectedValue', $regionJumpLinkSelectedValue);
     $this->template->set('semesterJumpLinkSelectedValue', $semesterJumpLinkSelectedValue);
     // changed by RM on June 4, 2009 to reflect new reporting guidelines
     // $fieldsOfInterest = "weeklyReport_1on1SpConv,weeklyReport_1on1SpConvStd,weeklyReport_1on1GosPres,weeklyReport_1on1GosPresStd,weeklyReport_1on1HsPres,weeklyReport_1on1HsPresStd,weeklyReport_7upCompleted,weeklyReport_7upCompletedStd,weeklyReport_cjVideo,weeklyReport_mda,weeklyReport_otherEVMats,weeklyReport_rlk,weeklyReport_siq";
     $fieldsOfInterest = "weeklyReport_1on1SpConv,weeklyReport_1on1SpConvStd,weeklyReport_1on1GosPres,weeklyReport_1on1GosPresStd,weeklyReport_1on1HsPres";
     $fieldsArray = explode(",", $fieldsOfInterest);
     // changed by RM on June 4, 2009 to reflect new reporting guidelines, we are no longer collecting these measurements
     // $semesterReportFields = 'semesterreport_avgPrayer,semesterreport_avgWklyMtg,semesterreport_numStaffChall,semesterreport_numInternChall,semesterreport_numFrosh,semesterreport_numStaffDG,semesterreport_numInStaffDG,semesterreport_numStudentDG,semesterreport_numInStudentDG,semesterreport_numSpMultStaffDG,semesterreport_numSpMultStdDG';
     $semesterReportFields = '';
     $semesterReportFieldArray = explode(",", $semesterReportFields);
     // other 'weekly campus stats', based on exposure type
     /*
     // no longer need the exposure type fields of interest - RM June 4, 2009
             $exposureFieldsOfInterest = "";
             $exposureFieldsArray = array();
             $exposureTypePrefix = "expType";
             $isFirst = true;
             $exposureTypeManager = new RowManager_ExposureTypeManager();
             $exIt = $exposureTypeManager->getListIterator();
             $exIt->setFirst();
             while( $exIt->moveNext() )
             {
                 $anEx = $exIt->getCurrent( new RowManager_ExposureTypeManager() );
                 $typeID = $anEx->getID();
                 $fieldName = $exposureTypePrefix.$typeID;
                 $exposureFieldsArray[$typeID] = $fieldName;
                 if ( !$isFirst )
                 {
                     $exposureFieldsOfInterest .= ',';
                 }
                 $exposureFieldsOfInterest .= $fieldName;
                 $isFirst = false;
             } // while
     */
     // removed concatentation of $semesterReportFields and $exposureFieldsOfInterest - June 4, 2009 by RM
     // $fieldsOfInterest = 'prcTotal,'.$fieldsOfInterest . ',' . $semesterReportFields . ','. $exposureFieldsOfInterest;
     $fieldsOfInterest = 'prcTotal,' . $fieldsOfInterest;
     // get all the campuses for the given region
     $campusManager = new RowManager_CampusManager();
     $campusManager->setRegionID($this->region_id);
     $campusListIt = $campusManager->getListIterator();
     $campusInfoArray = array();
     $campusListIt->setFirst();
     while ($campusListIt->moveNext()) {
         $sumArray = array();
         foreach ($fieldsArray as $key => $fieldName) {
             $sumArray[$fieldName] = 0;
         }
         $campusObj = $campusListIt->getCurrent(new RowManager_CampusManager());
         $campusID = $campusObj->getID();
         $indCampusInfo = new IndCampusSemesterInfo();
         $indCampusInfo->campusID = $campusID;
         $indCampusInfo->shortName = $campusObj->getShortDesc();
         // check if an entry exists in the table for
         $weeklyReport = new RowManager_WeeklyReportManager();
         $weeklyReport->setCampusID($campusID);
         $weekManager = new RowManager_WeekManager();
         $weekManager->setSemesterID($this->semester_id);
         $multiTableManager = new MultiTableManager();
         $multiTableManager->addRowManager($weeklyReport);
         $multiTableManager->addRowManager($weekManager, new JoinPair($weeklyReport->getJoinOnWeekID(), $weekManager->getJoinOnWeekID()));
         $listIterator = $multiTableManager->getListIterator();
         $listIterator->setFirst();
         $dataArray = array();
         while ($listIterator->moveNext()) {
             $aWklyReport = $listIterator->getCurrent(new RowManager_WeeklyReportManager());
             $dataArray = $aWklyReport->getArrayOfValues();
             $this->combineValues($sumArray, $dataArray);
         }
         // $indCampusInfo->dataArray = array('weeklyReport_1on1SpConv'=>7,'weeklyReport_1on1SpConvStd'=>21);
         $indCampusInfo->dataArray = $sumArray;
         // get semster stats
         $semesterCampusReport = new RowManager_SemesterReportManager($this->semester_id, $campusID);
         $campusDataArray = $semesterCampusReport->getArrayOfValues();
         if (count($campusDataArray) <= 0) {
             // no data
             // echo 'no data<br/>';
             foreach ($semesterReportFieldArray as $key => $semFieldName) {
                 // put zeros into the array
                 $campusDataArray[$semFieldName] = 0;
             }
         }
         // echo '<pre>'.print_r($campusDataArray, true).'</pre>';
         // combine personal ministry totals array with other semester stats
         $indCampusInfo->dataArray = array_merge($indCampusInfo->dataArray, $campusDataArray);
         // add the 'campus weekly stats'
         $exposureTypeManager = new RowManager_ExposureTypeManager();
         $exIt = $exposureTypeManager->getListIterator();
         $exIt->setFirst();
         while ($exIt->moveNext()) {
             $anEx = $exIt->getCurrent(new RowManager_ExposureTypeManager());
             // echo $anEx->getLabel().'->'.$anEx->getID().'<br/>';
             $typeID = $anEx->getID();
             $sumThisType = 0;
             // get the sum of all the exposures of this type, this semester
             $moreManager = new RowManager_MoreStatsManager();
             $moreManager->setCampusID($campusID);
             $moreManager->setExposureTypeID($typeID);
             $wkManager = new RowManager_WeekManager();
             $wkManager->setSemesterID($this->semester_id);
             $multiTableManager = new MultiTableManager();
             $multiTableManager->addRowManager($moreManager);
             $multiTableManager->addRowManager($wkManager, new JoinPair($moreManager->getJoinOnWeekID(), $wkManager->getJoinOnWeekID()));
             $listIterator = $multiTableManager->getListIterator();
             $listIterator->setFirst();
             while ($listIterator->moveNext()) {
                 $moreStatsObj = $listIterator->getCurrent(new RowManager_MoreStatsManager());
                 $sumThisType += $moreStatsObj->getNumExposures();
             }
             // while
             // echo 'campusID['.$campusID.'] semesterID['.$this->semester_id.'] typeID['.$typeID.'] total['.$sumThisType.']<br/>';
             $indCampusInfo->dataArray[$exposureFieldsArray[$typeID]] = $sumThisType;
         }
         // while
         // add the number of indicated decisions
         $prcManager = new RowManager_PRCManager();
         $prcManager->setSemester($this->semester_id);
         $prcManager->setCampus($campusID);
         $prcList = $prcManager->getListIterator();
         $numPRC = $prcList->getNumRows();
         // echo $numPRC.'<br/>';
         $indCampusInfo->dataArray['prcTotal'] = $numPRC;
         $campusInfoArray[] = $indCampusInfo;
     }
     $this->template->set('campusInfoArray', $campusInfoArray);
     $this->template->set('fieldsOfInterest', $fieldsOfInterest);
     $campusSummaryJumpLink = $this->linkValues['campusSummaryJumpLink'];
     $campusSummaryJumpLink = str_replace('SSS', $this->semester_id, $campusSummaryJumpLink);
     // in case where semester was not provided (usual case)
     // look up the year associated with this semester
     $semObj = new RowManager_SemesterManager($this->semester_id);
     $year_id = $semObj->getYearID();
     $campusSummaryJumpLink = str_replace('YYY', $year_id, $campusSummaryJumpLink);
     // in case where semester was not provided (usual case)
     /*$personalMinLink = $this->linkValues['campusPersonalJumpLink'];
             $personalMinLink = str_replace( 'SSS', $this->semester_id, $personalMinLink ); // in case where semester was not provided (usual case)
             
             $campusWideLink =  $this->linkValues['campusWideJumpLink'];
             $campusWideLink =  str_replace( 'SSS', $this->semester_id, $campusWideLink ); // in case where semester was not provided (usual case)
             
             $indicatedDecLink =  $this->linkValues['indicatedDecLink'];
             $indicatedDecLink =  str_replace( 'SSS', $this->semester_id, $indicatedDecLink ); // in case where semester was not provided (usual case)
     
             $this->template->set('linksArray', array('[personalMin]'=>$personalMinLink, '[campusWideMin]'=>$campusWideLink, '[decLink]'=>$indicatedDecLink ) );*/
     $this->template->set('linksArray', array('[campusSummaryJumpLink]' => $campusSummaryJumpLink));
     // semester list
     $jumpLink = $this->linkValues['semesterJumpLink'];
     $semesterArray = array();
     $semesterManager = new RowManager_SemesterManager();
     $semesterListIterator = $semesterManager->getListIterator();
     $semesterListIterator->setFirst();
     while ($semesterListIterator->moveNext()) {
         $semesterObject = $semesterListIterator->getCurrent(new RowManager_SemesterManager());
         $semesterArray[$jumpLink . $semesterObject->getID()] = $semesterObject->getLabel();
     }
     // echo '<pre>'.print_r($campusArray, true ).'</pre>';
     $this->template->set('list_semester_id', $semesterArray);
     // region list
     $jumpLink = $this->linkValues['regionJumpLink'];
     $regionManager = new RowManager_RegionManager();
     $regionListIt = new ListIterator($regionManager);
     $regionArray = $regionListIt->getDropListArray(null, $jumpLink);
     // echo '<pre>'.print_r( $regionArray, true ).'</pre>';
     $this->template->set('list_region_id', $regionArray);
     // uncomment this line if you are creating a template for this page
     $templateName = 'page_RegionalSemesterReport.php';
     // otherwise use the generic site template
     //$templateName = '';
     return $this->template->fetch($templateName);
 }
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     //$path = $this->pathModuleRoot.'templates/';
     // Otherwise use the standard Templates for the site:
     $path = SITE_PATH_TEMPLATES;
     /*
      * store the link values
      */
     // example:
     // $this->linkValues[ 'view' ] = 'add/new/href/data/here';
     // store the link labels
     $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]');
     $this->linkLabels['del'] = $this->labels->getLabel('[Delete]');
     $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]');
     // $this->linkLabels[ 'view' ] = 'new link label here';
     /*
      * store any additional link Columns
      */
     // example:
     //$title = $this->labels->getLabel( '[title_groups]');
     //$columnLabel = $this->labels->getLabel( '[groups]');
     //$link = $this->linkValues[ 'groups' ];
     //$fieldName = 'accessgroup_id';
     //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName);
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     // NOTE:  this parent method prepares the $this->template with the
     // common AdminBox data.
     $this->prepareTemplate($path);
     // store the statevar id to edit
     $this->template->set('editEntryID', $this->assignment_id);
     // store all the fields to the template
     $this->setFormFieldsToTemplate();
     /*
      * Form related Template variables:
      */
     /*
      * Insert the date start/end values for the following date fields:
      */
     // example:
     //$this->template->set( 'startYear_[fieldName]', 2000);
     //$this->template->set( 'endYear_[fieldName]', 2010);
     /*
      * List related Template variables :
      */
     // Store the XML Node name for the Data Access Field List
     $xmlNodeName = RowManager_EditCampusAssignmentManager::XML_NODE_NAME;
     $this->template->set('rowManagerXMLNodeName', $xmlNodeName);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'assignment_id');
     // store data list to the template
     // NOTE: we initialize it here to make sure we capture any new data
     // from a recent processData() call.
     $dataAccessManager = new RowManager_EditCampusAssignmentManager();
     $dataAccessManager->setPersonID($this->person_id);
     $dataAccessManager->setSortOrder($this->sortBy);
     //        $this->dataList = new EditCampusAssignmentList( $this->sortBy );
     $this->dataList = $dataAccessManager->getListIterator();
     $this->template->setXML('dataList', $this->dataList->getXML());
     /*
      * Add any additional data required by the template here
      */
     $campusManager = new RowManager_CampusManager();
     $campusManager->setSortOrder('campus_desc');
     $campusList = $campusManager->getListIterator();
     $campusArray = $campusList->getDropListArray();
     $this->template->set('list_campus_id', $campusArray);
     // TODO - we probably should restrict this list of options, since people
     // could assign themselves as staff and that could (implementation dependent)
     // allow them access to other systems
     $statusManager = new RowManager_CampusAssignmentStatusManager();
     $statusList = $statusManager->getListIterator();
     $statusArray = $statusList->getDropListArray();
     $this->template->set('list_assignmentstatus_id', $statusArray);
     $templateName = 'siteAdminBox.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_EditMyCampusAssignment.php';
     return $this->template->fetch($templateName);
 }
 /**
  * function __construct
  * <pre>
  * Initialize the object.
  * </pre>
  * @param $pathModuleRoot [STRING] The path to the module's root dir.
  * @param $viewer [OBJECT] The viewer object.
  * @param $sortBy [STRING] Field data to sort listManager by.
  * @param $managerInit [INTEGER] Initialization value for the listManager.
  * @return [void]
  */
 function __construct($pathModuleRoot, $viewer, $sortBy, $campus_id = "")
 {
     parent::__construct(page_PeoplebyCampuses::DISPLAY_FIELDS);
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $this->campus_id = $campus_id;
     // echo 'campusID['.$this->campus_id.']<br/>';
     //        $this->managerInit = $managerInit;
     // Now load the access Priviledge manager of this viewer
     $this->adminManager = new RowManager_AdminManager();
     // Get the person ID
     $accessManager = new RowManager_AccessManager();
     $accessManager->loadByViewerID($this->viewer->getViewerID());
     $personID = $accessManager->getPersonID();
     // Get the permissions the person has.
     $this->adminManager->loadByPersonID($personID);
     if ($this->adminManager->hasSitePriv()) {
         $campusManager = new RowManager_CampusManager();
         $campusManager->setSortOrder('campus_desc');
         $this->campusList = $campusManager->getListIterator();
         $this->accessibleCampuses = $this->campusList->getDropListArray();
     } else {
         if ($this->adminManager->hasCampusPriv()) {
             $campusAdminManager = new RowManager_CampusAdminManager();
             $adminID = $this->adminManager->getID();
             // echo 'adminID['.$adminID.']<br/>';
             $campusAdminManager->setAdminID($adminID);
             $multiTableManager = new MultiTableManager();
             $multiTableManager->addRowManager($campusAdminManager);
             $multiTableManager->setSortOrder('campus_desc');
             $campusManager = new RowManager_CampusManager();
             $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $campusAdminManager->getJoinOnCampusID()));
             $this->campusList = $multiTableManager->getListIterator();
             $this->accessibleCampuses = array();
             $this->campusList->setFirst();
             while ($this->campusList->moveNext()) {
                 $campusAdminObject = $this->campusList->getCurrent(new RowManager_CampusAdminManager());
                 $campusObject = $this->campusList->getCurrent(new RowManager_CampusManager());
                 $this->accessibleCampuses[$campusAdminObject->getCampusID()] = $campusObject->getLabel();
             }
         } else {
             if ($this->adminManager->isStaff($viewer->getID())) {
                 $staffManager = new RowManager_StaffManager();
                 $staffManager->setPersonID($personID);
                 $multiTableManager = new MultiTableManager();
                 $multiTableManager->addRowManager($staffManager);
                 $multiTableManager->setSortOrder('campus_desc');
                 $assignmentManager = new RowManager_AssignmentsManager();
                 $multiTableManager->addRowManager($assignmentManager, new JoinPair($assignmentManager->getJoinOnPersonID(), $staffManager->getJoinOnPersonID()));
                 $campusManager = new RowManager_CampusManager();
                 $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $assignmentManager->getJoinOnCampusID()));
                 $this->campusList = $multiTableManager->getListIterator();
                 $this->accessibleCampuses = array();
                 $this->campusList->setFirst();
                 while ($this->campusList->moveNext()) {
                     $campusAssignObject = $this->campusList->getCurrent(new RowManager_AssignmentsManager());
                     $campusObject = $this->campusList->getCurrent(new RowManager_CampusManager());
                     $this->accessibleCampuses[$campusAssignObject->getCampusID()] = $campusObject->getLabel();
                 }
             } else {
                 $campusManager = new RowManager_CampusManager();
                 $campusManager->setSortOrder('campus_desc');
                 $this->campusList = $campusManager->getListIterator();
                 $this->accessibleCampuses = $this->campusList->getDropListArray();
             }
         }
     }
     // modify the campus_id if necessary
     if ($this->campus_id == page_PeoplebyCampuses::DISPLAY_ALL_ID) {
         // setting the campus id to blank will get entries from all the campuses
         $this->campus_id = '';
     } else {
         if ($this->campus_id == '') {
             // no campus has been specified
             // choose a default campus if none specified
             // echo 'No campus specified<br/>';
             // get the first element from the accessible list
             foreach ($this->accessibleCampuses as $key => $value) {
                 $this->campus_id = $key;
                 break;
             }
             // assert campus_id should now be something
             if ($this->campus_id == '') {
                 die("ERROR - campusID not set to anything<br/>");
             }
         }
     }
     $dataAccessObject = new MultiTableManager();
     $assignmentsManager = new RowManager_AssignmentsManager();
     $assignmentsManager->setCampusID($this->campus_id);
     $dataAccessObject->addRowManager($assignmentsManager);
     $personManager = new RowManager_PersonManager();
     $joinPair = new JoinPair($personManager->getJoinOnPersonID(), $assignmentsManager->getJoinOnPersonID());
     $dataAccessObject->addRowManager($personManager, $joinPair);
     $this->accessManager = new RowManager_AccessManager();
     $joinPair2 = new JoinPair($personManager->getJoinOnPersonID(), $this->accessManager->getJoinOnPersonID(), JOIN_TYPE_LEFT);
     $dataAccessObject->addRowManager($this->accessManager, $joinPair2);
     $this->viewerManager = new RowManager_UserManager();
     $joinPair3 = new JoinPair($this->accessManager->getJoinOnViewerID(), $this->viewerManager->getJoinOnViewerID(), JOIN_TYPE_LEFT);
     $dataAccessObject->addRowManager($this->viewerManager, $joinPair3);
     if ($sortBy == '') {
         $sortBy = 'person_lname';
     }
     $dataAccessObject->setSortOrder($sortBy);
     $this->listManager = $dataAccessObject->getListIterator();
     // now initialize the labels for this page
     // start by loading the default field labels for this Module
     $languageID = $viewer->getLanguageID();
     $seriesKey = modulecim_hrdb::MULTILINGUAL_SERIES_KEY;
     $pageKey = modulecim_hrdb::MULTILINGUAL_PAGE_FIELDS;
     $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey);
     // then load the page specific labels for this page
     $pageKey = page_PeoplebyCampuses::MULTILINGUAL_PAGE_KEY;
     $this->labels->loadPageLabels($pageKey);
     $this->labels->setSeriesKey(SITE_LABEL_SERIES_SITE);
     $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORM_LINKS);
 }
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Make a new Template object
     $path = $this->pathModuleRoot . 'templates/';
     // Replace $path with the following line if you want to create a
     // template tailored for this page:
     //$path = $this->pathModuleRoot.'templates/';
     // store the link values
     // $this->linkValues[ 'view' ] = 'add/new/href/data/here';
     // store the link labels
     $this->linkLabels['add'] = $this->labels->getLabel('[Add]');
     $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]');
     $this->linkLabels['del'] = $this->labels->getLabel('[Delete]');
     $this->linkLabels['cont'] = $this->labels->getLabel('[GoBack]');
     $this->linkLabels['CampusEventDataDump'] = 'Download Campus-specific Event Registration Summary';
     $this->linkLabels['CampusEventScholarshipList'] = 'Download Campus-specific Scholarship List';
     $this->linkLabels['EmailCampusRegistrants'] = $this->labels->getLabel('[EmailCampusRegistrants]');
     // $this->linkLabels[ 'view' ] = 'new link label here';
     // store any additional link Columns
     // example:
     //$title = $this->labels->getLabel( '[title_groups]');
     //$columnLabel = $this->labels->getLabel( '[groups]');
     //$link = $this->linkValues[ 'groups' ];
     //$fieldName = 'accessgroup_id';
     //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName);
     // store the page labels
     // NOTE: use this location to update any label tags ...
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     $this->prepareTemplate($path);
     // has viewer just returned from offline registration process?
     if ($this->is_in_reg_process == 'TRUE') {
         $this->template->set('regCompleted', $this->is_in_reg_process);
         $reg_result = $this->setRegistrationStatus();
         // uses reg_id from offline reg process to get status
         $result_array = explode('|', $reg_result);
         $reg_status = $result_array[0];
         $reg_message = $result_array[1];
         $this->template->set('regStatus', $reg_status);
         // only send e-mail if all pertinent registration info has been stored (including cash/CC event deposit, if applicable)
         if ($reg_status == RowManager_StatusManager::REGISTERED) {
             if (!defined('IGNORE_EMAILS')) {
                 $reg_message = $this->sendConfirmationEmail();
                 // since reg_message = '' if REGISTERED, use for e-mail status message
             }
         }
         $this->template->set('regMessage', $reg_message);
     }
     $campuses = new RowManager_CampusManager();
     $campuses->setCampusID($this->campus_id);
     $campusList = $campuses->getListIterator();
     $campusArray = $campusList->getDataList();
     // only 1 campus per campus_id
     $the_campus = current($campusArray);
     $this->campus_name = $the_campus['campus_desc'];
     $this->template->set('campusName', $this->campus_name);
     // store the Row Manager's XML Node Name
     //        $this->template->set( 'rowManagerXMLNodeName', RowManager_RegistrationManager::XML_NODE_NAME );
     $this->template->set('rowManagerXMLNodeName', MultiTableManager::XML_NODE_NAME);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'registration_id');
     $boolArray = array();
     $boolArray['0'] = 'no';
     $boolArray['1'] = 'yes';
     $this->template->set('list_cctransaction_processed', $boolArray);
     $this->template->set('list_cashtransaction_recd', $boolArray);
     $this->template->set('owingArray', $this->owingArray);
     // load offline registrations registrant drop-down list
     $this->template->set('offlineRegistrationBox', $this->generateRegistrantsDroplist());
     // TODO: somehow merge the primary join with the balance owing join.... for efficiency
     /*
      *  Set up any additional data transfer to the Template here...
      */
     //         $this->template->set( 'dataList', $this->dataList);
     $templateName = 'page_EditCampusRegistrations.tpl.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_EditCampusRegistrations.php';
     return $this->template->fetch($templateName);
 }
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     //$path = $this->pathModuleRoot.'templates/';
     // Otherwise use the standard Templates for the site:
     $path = SITE_PATH_TEMPLATES;
     /*
      * store the link values
      */
     // example:
     // $this->linkValues[ 'view' ] = 'add/new/href/data/here';
     // store the link labels
     $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]');
     $this->linkLabels['del'] = $this->labels->getLabel('[Delete]');
     $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]');
     // $this->linkLabels[ 'view' ] = 'new link label here';
     /*
      * store any additional link Columns
      */
     // example:
     //$title = $this->labels->getLabel( '[title_groups]');
     //$columnLabel = $this->labels->getLabel( '[groups]');
     //$link = $this->linkValues[ 'groups' ];
     //$fieldName = 'accessgroup_id';
     //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName);
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     // NOTE:  this parent method prepares the $this->template with the
     // common AdminBox data.
     $this->prepareTemplate($path);
     // store the statevar id to edit
     $this->template->set('editEntryID', $this->assignment_id);
     $this->template->set('notice', $this->notice);
     $this->template->set('errorMessage', $this->error_message);
     // store all the fields to the template
     $this->setFormFieldsToTemplate();
     /*
      * Form related Template variables:
      */
     /*
      * Insert the date start/end values for the following date fields:
      */
     // example:
     //$this->template->set( 'startYear_[fieldName]', 2000);
     //$this->template->set( 'endYear_[fieldName]', 2010);
     /*
      * List related Template variables :
      */
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'assignment_id');
     // store data list to the template
     // NOTE: we initialize it here to make sure we capture any new data
     // from a recent processData() call.
     $dataAccessManager = new RowManager_EditCampusAssignmentManager();
     $dataAccessManager->setPersonID($this->person_id);
     if ($this->campus_id != '') {
         $dataAccessManager->setCampusID($this->campus_id);
     }
     $dataAccessManager->setSortOrder($this->sortBy);
     $this->dataList = $dataAccessManager->getListIterator();
     // Store the XML Node name for the Data Access Field List
     $xmlNodeName = $this->dataList->getRowManagerXMLNodeName();
     //RowManager_EditCampusAssignmentManager::XML_NODE_NAME;
     $this->template->set('rowManagerXMLNodeName', $xmlNodeName);
     $this->template->setXML('dataList', $this->dataList->getXML());
     // enable drop-down list for adding new person assignments
     $personManager = new RowManager_PersonManager();
     $campusManager = new RowManager_CampusManager();
     /*        $combinedManager = new MultiTableManager();
             $combinedManager->addRowManager($personManager);
             $combinedManager->addRowManager($dataAccessManager, new JoinPair($personManager->getJoinOnPersonID(),$dataAccessManager->getJoinOnPersonID()));
          //   $combinedManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(),$dataAccessManager->getJoinOnCampusID()));
           if ($this->person_id!='') {
             		$combinedManager->constructSearchCondition( 'person_id', '=', $this->person_id, true );
          	  }
             if ($this->campus_id!='') {
             		$combinedManager->constructSearchCondition( 'campus_id', '=', $this->campus_id, true );
          	  }    
          	
          	  
          	  $dataList = $combinedManager->getListIterator();   
          	  $dataArray = $dataList->getDropListArray();     /**/
     //   	    $personManager = new RowManager_PersonManager($this->person_id);
     //    $personList = $personManager->getListIterator();
     //    $personArray = $personList ->getDropListArray();
     //     $this->template->set( 'list_person_id', $personArray );
     //       $personList = $combinedManager->getListIterator();
     $personManager->setPersonID($this->person_id);
     $personManager->setLabelTemplateLastNameFirstName();
     $personList = $personManager->getListIterator();
     $personArray = $personList->getDropListArray();
     $this->template->set('list_person_id', $personArray);
     // enable drop-down list for adding new campus assignments
     if ($this->campus_id != '') {
         $campusManager->setCampusID($this->campus_id);
     }
     $campusList = $campusManager->getListIterator();
     //  $campusList = $combinedManager->getListIterator();
     $campusArray = $campusList->getDropListArray();
     $this->template->set('list_campus_id', $campusArray);
     // enable drop-down list for adding new campus assignments
     $statusManager = new RowManager_CampusAssignmentStatusManager();
     $statusList = $statusManager->getListIterator();
     //		  $statusList = $combinedManager->getListIterator();
     $statusArray = $statusList->getDropListArray();
     $this->template->set('list_assignmentstatus_id', $statusArray);
     //     $dataAccessManager->setPersonID($this->person_id);
     //     $dataAccessManager->setCampusID($this->campus_id);
     //        $this->dataList = new EditCampusAssignmentList( $this->sortBy );
     //       $this->dataList = $combinedManager->getListIterator();
     /*
      * Add any additional data required by the template here
      */
     //          $this->displayValues =
     $templateName = 'siteAdminBox.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_EditCampusAssignment.php';
     return $this->template->fetch($templateName);
 }
Esempio n. 8
0
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     //$path = $this->pathModuleRoot.'templates/';
     // Otherwise use the standard Templates for the site:
     $path = SITE_PATH_TEMPLATES;
     /*
      * store the link values
      */
     // example:
     // $this->linkValues[ 'view' ] = 'add/new/href/data/here';
     // store the link labels
     $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]');
     $this->linkLabels['del'] = $this->labels->getLabel('[Delete]');
     $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]');
     // $this->linkLabels[ 'view' ] = 'new link label here';
     /*
      * store any additional link Columns
      */
     // example:
     //$title = $this->labels->getLabel( '[title_groups]');
     //$columnLabel = $this->labels->getLabel( '[groups]');
     //$link = $this->linkValues[ 'groups' ];
     //$fieldName = 'accessgroup_id';
     //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName);
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     // NOTE:  this parent method prepares the $this->template with the
     // common AdminBox data.
     $this->prepareTemplate($path);
     // echo 'the campus_id['.$this->campus_id.']<br/>';
     // store the statevar id to edit
     $this->template->set('editEntryID', $this->campus_id);
     //         if ($this->db_error_msg != '')		// MOVED INTO GENERAL PageDisplay CLASS
     //         {
     // 	       $this->template->set( 'error_msg', $this->db_error_msg );
     //         }
     // store all the fields to the template
     $this->setFormFieldsToTemplate();
     /*
      * Form related Template variables:
      */
     /*
      * Insert the date start/end values for the following date fields:
      */
     // example:
     //$this->template->set( 'startYear_[fieldName]', 2000);
     //$this->template->set( 'endYear_[fieldName]', 2010);
     /*
      * List related Template variables :
      */
     // Store the XML Node name for the Data Access Field List
     $xmlNodeName = RowManager_CampusManager::XML_NODE_NAME;
     $this->template->set('rowManagerXMLNodeName', $xmlNodeName);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'campus_id');
     // store data list to the template
     // NOTE: we initialize it here to make sure we capture any new data
     // from a recent processData() call.
     $dataAccessManager = new RowManager_CampusManager();
     if ($this->sortBy == '') {
         $this->sortBy = 'campus_desc';
     }
     $dataAccessManager->setSortOrder($this->sortBy);
     // $this->dataList = new CampusList( $this->campus_id, $this->sortBy );
     $this->dataList = $dataAccessManager->getListIterator();
     // echo "<pre>".print_r( $this->dataList, true )."</pre>";
     $this->template->setXML('dataList', $this->dataList->getXML());
     /*
      * Add any additional data required by the template here
      */
     $regionManager = new RowManager_RegionManager();
     $regionList = $regionManager->getListIterator();
     $regionArray = $regionList->getDropListArray();
     $this->template->set('list_region_id', $regionArray);
     $templateName = 'siteAdminBox.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_Campuses.php';
     return $this->template->fetch($templateName);
 }
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     $path = $this->pathModuleRoot . 'templates/';
     // Otherwise use the standard Templates for the site:
     //$path = SITE_PATH_TEMPLATES;
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     $semesterJumpLinkSelectedValue = $this->linkValues['semesterJumpLink'] . $this->semester_id;
     // NOTE:  this parent method prepares the $this->template with the
     // common Display data.
     $this->prepareTemplate($path);
     $this->template->set('semesterJumpLinkSelectedValue', $semesterJumpLinkSelectedValue);
     $campusPRCArray = array();
     $pageTotal = 0;
     // get a list of all the campuses
     $campusManager = new RowManager_CampusManager();
     $campusManager->setSortOrder('campus_desc');
     $campusList = $campusManager->getListIterator();
     while ($campus = $campusList->getNext()) {
         $totalPRC = 0;
         $item = array();
         $item['desc'] = $campus->getDesc();
         $item['link'] = '#';
         $prcManager = new RowManager_PRCManager();
         $prcManager->setSemester($this->semester_id);
         $prcManager->setCampus($campus->getID());
         $prcList = $prcManager->getListIterator();
         while ($prcList->getNext()) {
             $totalPRC++;
         }
         $item['totalPRC'] = $totalPRC;
         $pageTotal += $totalPRC;
         $campusPRCArray[] = $item;
     }
     $this->template->set('campusPRCArray', $campusPRCArray);
     $this->template->set('pageTotal', $pageTotal);
     // semester list
     $jumpLink = $this->linkValues['semesterJumpLink'];
     $semesterArray = array();
     $semesterManager = new RowManager_SemesterManager();
     $semesterListIterator = $semesterManager->getListIterator();
     $semesterListIterator->setFirst();
     while ($semesterListIterator->moveNext()) {
         $semesterObject = $semesterListIterator->getCurrent(new RowManager_SemesterManager());
         $semesterArray[$jumpLink . $semesterObject->getID()] = $semesterObject->getLabel();
     }
     // echo '<pre>'.print_r($campusArray, true ).'</pre>';
     $this->template->set('list_semester_id', $semesterArray);
     // uncomment this line if you are creating a template for this page
     $templateName = 'page_PRC_ReportByCampus.php';
     // otherwise use the generic site template
     //$templateName = '';
     return $this->template->fetch($templateName);
 }
 /**
  * function __construct
  * <pre>
  * Initialize the object.
  * </pre>
  * @param $pathModuleRoot [STRING] The path to this module's root directory
  * @param $viewer [OBJECT] The viewer object.
  * @param $formAction [STRING] The action on a form submit
  * @param $ [INTEGER] Value used to initialize the rowManager
  * @return [void]
  */
 function __construct($pathModuleRoot, $viewer, $formAction, $person_id, $campus_id, $person_year_id = '')
 {
     // NOTE: be sure to call the parent constructor before trying to
     //       use the ->formXXX arrays...
     parent::__construct($formAction, FormProcessor_EditStudentYearInSchool::FORM_FIELDS, FormProcessor_EditStudentYearInSchool::FORM_FIELD_TYPES);
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $this->formAction = $formAction;
     $this->campus_id = $campus_id;
     $this->person_id = $person_id;
     $this->person_year_id = $person_year_id;
     //        if ($person_year_id == '')
     //        {
     // 	       if (isset($person_id))
     // 	       {
     // 		       if (isset($campus_id))
     // 		       {
     // 		       }
     // 	       }
     //        }
     /**** Check privileges and initialize campus drop-down list ***/
     // Now load the access Priviledge manager of this viewer
     $this->adminManager = new RowManager_AdminManager();
     // Get the person ID
     $accessManager = new RowManager_AccessManager();
     $accessManager->loadByViewerID($this->viewer->getViewerID());
     $personID = $accessManager->getPersonID();
     // Get the permissions the person has.
     $this->adminManager->loadByPersonID($personID);
     if ($this->adminManager->hasSitePriv()) {
         $campusManager = new RowManager_CampusManager();
         $campusManager->setSortOrder('campus_desc');
         $this->campusList = $campusManager->getListIterator();
         $this->accessibleCampuses = $this->campusList->getDropListArray();
     } else {
         if ($this->adminManager->hasCampusPriv()) {
             $campusAdminManager = new RowManager_CampusAdminManager();
             $adminID = $this->adminManager->getID();
             // echo 'adminID['.$adminID.']<br/>';
             $campusAdminManager->setAdminID($adminID);
             $multiTableManager = new MultiTableManager();
             $multiTableManager->addRowManager($campusAdminManager);
             $multiTableManager->setSortOrder('campus_desc');
             $campusManager = new RowManager_CampusManager();
             $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $campusAdminManager->getJoinOnCampusID()));
             $this->campusList = $multiTableManager->getListIterator();
             $this->accessibleCampuses = array();
             $this->campusList->setFirst();
             while ($this->campusList->moveNext()) {
                 $campusAdminObject = $this->campusList->getCurrent(new RowManager_CampusAdminManager());
                 $campusObject = $this->campusList->getCurrent(new RowManager_CampusManager());
                 $this->accessibleCampuses[$campusAdminObject->getCampusID()] = $campusObject->getLabel();
             }
         } else {
             if ($this->adminManager->isStaff($viewer->getID())) {
                 $staffManager = new RowManager_StaffManager();
                 $staffManager->setPersonID($personID);
                 $multiTableManager = new MultiTableManager();
                 $multiTableManager->addRowManager($staffManager);
                 $multiTableManager->setSortOrder('campus_desc');
                 $assignmentManager = new RowManager_AssignmentsManager();
                 $multiTableManager->addRowManager($assignmentManager, new JoinPair($assignmentManager->getJoinOnPersonID(), $staffManager->getJoinOnPersonID()));
                 $campusManager = new RowManager_CampusManager();
                 $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $assignmentManager->getJoinOnCampusID()));
                 $this->campusList = $multiTableManager->getListIterator();
                 $this->accessibleCampuses = array();
                 $this->campusList->setFirst();
                 while ($this->campusList->moveNext()) {
                     $campusAssignObject = $this->campusList->getCurrent(new RowManager_AssignmentsManager());
                     $campusObject = $this->campusList->getCurrent(new RowManager_CampusManager());
                     $this->accessibleCampuses[$campusAssignObject->getCampusID()] = $campusObject->getLabel();
                 }
             } else {
                 $campusManager = new RowManager_CampusManager();
                 $campusManager->setSortOrder('campus_desc');
                 $this->campusList = $campusManager->getListIterator();
                 $this->accessibleCampuses = $this->campusList->getDropListArray();
             }
         }
     }
     // modify the campus_id if necessary
     if ($this->campus_id == FormProcessor_EditStudentYearInSchool::DISPLAY_ALL_ID) {
         // setting the campus id to blank will get entries from all the campuses
         $this->campus_id = '';
     } else {
         if ($this->campus_id == '') {
             // no campus has been specified
             // choose a default campus if none specified
             // echo 'No campus specified<br/>';
             // get the first element from the accessible list
             foreach ($this->accessibleCampuses as $key => $value) {
                 $this->campus_id = $key;
                 break;
             }
             // assert campus_id should now be something
             if ($this->campus_id == '') {
                 die("ERROR - campusID not set to anything<br/>");
             }
         }
     }
     /*** end privilege checking and campus droplist setup ***/
     //         echo 'campus = '.$this->campus_id;
     // create new rowManager (a List Iterator obj.)
     $statuses = '0,1,6';
     // filter by assignment status in ('undefined', 'current student', 'unknown')
     $this->rowManager = new PersonYearList($this->campus_id, $statuses, 'year_id,person_lname');
     // figure out the important fields for the rowItems
     $fieldsOfInterest = implode(',', $this->formFields);
     $this->primaryIDs = array();
     // for each row item ...
     $this->rowManager->setFirst();
     $i = 0;
     $valid_values = explode(',', RowManager_PersonYearManager::FIELD_LIST);
     while ($rowItem = $this->rowManager->getNext()) {
         // make sure rowItems have valid entries in the DB
         if (!$rowItem->isLoaded()) {
             $rowItem->createNewEntry();
         }
         // set the fields of interest ...
         $rowItem->setFieldsOfInterest($fieldsOfInterest);
         // get the primaryID of this rowItem
         $primaryID = $rowItem->getPrimaryKeyValue();
         $this->primaryIDs[$i] = $primaryID;
         $person_id = -1;
         // now initialize beginning form values from rowItem object
         for ($indx = 0; $indx < count($this->formFields); $indx++) {
             $key = $this->formFields[$indx];
             if (in_array($key, $valid_values)) {
                 $this->formValues[$key . $primaryID] = $rowItem->getValueByFieldName($key);
                 if ($key == 'person_id') {
                     $person_id = $this->formValues[$key . $primaryID];
                 }
             } else {
                 if ($person_id != '-1') {
                     $person_manager = new RowManager_PersonManager($person_id);
                     $this->formValues[$key . $primaryID] = $person_manager->getValueByFieldName($key);
                 } else {
                     $this->formValues[$key . $primaryID] = "";
                 }
             }
         }
         // next field
         $i++;
     }
     // next rowItem in rowManager
     //         echo 'array = <pre>'.print_r($this->formValues,true).'</pre>';
     // now initialize the labels for this page
     // start by loading the default field labels for this Module
     $languageID = $viewer->getLanguageID();
     $seriesKey = modulecim_hrdb::MULTILINGUAL_SERIES_KEY;
     $pageKey = modulecim_hrdb::MULTILINGUAL_PAGE_FIELDS;
     $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey);
     // then load the page specific labels for this page
     $pageKey = FormProcessor_EditStudentYearInSchool::MULTILINGUAL_PAGE_KEY;
     $this->labels->loadPageLabels($pageKey);
     // load the site default form link labels
     $this->labels->setSeriesKey(SITE_LABEL_SERIES_SITE);
     $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORM_LINKS);
 }
Esempio n. 11
0
 function displayGroups()
 {
     // This array get passed back to the template multiple time
     $groupCollectionArray = array();
     $multiTableManager = new MultiTableManager();
     $groupManager = new RowManager_GroupManager();
     $superAdminManager = new RowManager_PermissionsSuperAdminManager();
     //SUPER ADMIN
     //Check if user's Viewer_id is in the PermissionSuperAdmin table
     //If the user is a super admin then show all gorups per campus including public groups
     if ($superAdminManager->loadByViewerID($this->viewer->getViewerID())) {
         // the viewer is a super admin
         echo "ViewerID[" . $this->viewer->getViewerID() . "] is a super admin<br/>";
         $campusManager = new RowManager_CampusManager();
         $campusArray = array();
         $this->listIterator = $campusManager->getListIterator();
         $this->listIterator->setFirst();
         while ($this->listIterator->moveNext()) {
             $group = $this->listIterator->getCurrent(new RowManager_CampusManager());
             $campusArray[] = $group->getCampusID();
         }
         //echo "<pre>".print_r($campusArray)."</pre>";
         foreach ($campusArray as $key => $campusID) {
             $campusManager = new RowManager_CampusManager($campusID);
             $campusGroupManager = new RowManager_CampusGroupManager();
             $campusGroupManager->setCampusID($campusID);
             $groupManager = new RowManager_GroupManager();
             $multiTableManager = new MultiTableManager();
             $multiTableManager->addRowManager($groupManager);
             $multiTableManager->addRowManager($campusGroupManager, new JoinPair($campusGroupManager->getJoinOnGroupID(), $groupManager->getJoinOnGroupID(), JOIN_TYPE_RIGHT));
             $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $campusGroupManager->getJoinOnCampusID(), JOIN_TYPE_RIGHT));
             //Go through the result and save all the groups of that campus to an array
             $campusGroupArray = array();
             $this->listIterator = $multiTableManager->getListIterator();
             $this->listIterator->setFirst();
             while ($this->listIterator->moveNext()) {
                 $group = $this->listIterator->getCurrent(new RowManager_CampusGroupManager());
                 $campusGroupArray[] = $group;
             }
             //set the campusID and CampusDesc for the $campusGroupArray
             $groupCollectionArray[] = new GroupCollection($campusManager->getShortDesc(), $campusID, $campusGroupArray);
         }
         //TODO - not a correct join
         //TODO - get all campus ID and groups
         //TODO - get all public groups
     } else {
         //STAFF OR STUDENT
         //If the user is a student or staff then they should have campus assignmnets in cim_hrdb_assignment
         //Find all the campuses and save them in the $campusAssigment array
         $campusAssignments = array();
         $statusArray = array();
         $statusArray[] = CA_STAFF;
         $statusArray[] = CA_STUDENT;
         foreach ($statusArray as $key => $statusID) {
             // filter from the cim_hrdb_assignment table
             $assignmentManager = new RowManager_AssignmentsManager();
             $assignmentManager->setPersonID($this->personID);
             $assignmentManager->setAssignmentStatus($statusID);
             $assignmentList = new ListIterator($assignmentManager);
             $assignmentList->setFirst();
             while ($assignmentList->moveNext()) {
                 $assManager = $assignmentList->getCurrent(new RowManager_AssignmentsManager());
                 $campusAssignments[] = $assManager->getCampusID();
             }
         }
         //CAMPUS ADMIN
         //some users can be admin to a campus that they are neither a student or staff for
         //Check cim_sch_permissionsCampusAdmin for the viewer id of the user
         //for each found save the campusID in the $campusAssignments table
         $permissionsCampusAdmin = new RowManager_PermissionsCampusAdminManager();
         $permissionsCampusAdmin->setViewerID($this->viewer->getViewerID());
         $campusAdminList = new ListIterator($permissionsCampusAdmin);
         $campusAdminList->setFirst();
         while ($campusAdminList->moveNext()) {
             $permCampus = $campusAdminList->getCurrent(new RowManager_PermissionsCampusAdminManager());
             //for each campuses found, store in array
             $campusAssignments[] = $permCampus->getCampusID();
         }
         //remove any duplicate campus ID in the array
         $campusAssignments = array_unique($campusAssignments);
         //After collection all the campusIDs lets go through each campusID and get the groups
         //for each campusID find all the groups in $campusGroupManager table
         //Save the groups in an array taged with the campusID, Shortdesc
         foreach ($campusAssignments as $key => $campusID) {
             //Set the campusID so we can get the shortDesc at the end
             $campusManager = new RowManager_CampusManager($campusID);
             //Join cim_sch_Group and cim_sch_campusgroup
             $campusGroupManager = new RowManager_CampusGroupManager();
             $campusGroupManager->setCampusID($campusID);
             $multiTableManager = new MultiTableManager();
             $multiTableManager->addRowManager($campusGroupManager);
             $groupManager = new RowManager_GroupManager();
             $multiTableManager->addRowManager($groupManager, new JoinPair($campusGroupManager->getJoinOnGroupID(), $groupManager->getJoinOnGroupID()));
             //Go through the result and save all the groups of that campus to an array
             $campusGroupArray = array();
             $this->listIterator = $multiTableManager->getListIterator();
             $this->listIterator->setFirst();
             while ($this->listIterator->moveNext()) {
                 $group = $this->listIterator->getCurrent(new RowManager_GroupManager());
                 $campusGroupArray[] = $group;
             }
             //set the campusID and CampusDesc for the $campusGroupArray
             $groupCollectionArray[] = new GroupCollection($campusManager->getShortDesc(), $campusID, $campusGroupArray);
         }
         //GROUP ADMIN
         //The user might be a group admin so we should display that group as well
         //We have to find the which groups the user is admin for in cim_sch_permissionsGroupAdmin
         //For each of these gorups, look in cim_sch_campusGroup table and find and store the campusID in an array
         //Use the campusID array and for each campusID and only save the gorups with the same campusID
         //Save all the gorups in the $gorupCollectionArray
         //Set a fillter for only show results if its the user's ViewerID
         $permissionsGroupAdminManager = new RowManager_PermissionsGroupAdminManager();
         $permissionsGroupAdminManager->setViewerID($this->viewer->getViewerID());
         //Set Fillter to only show results that are a campus group
         $groupManager = new RowManager_GroupManager();
         $groupManager->setGroupTypeID(1);
         //Make the join of tables cim_sch_group, cim_sch_campusGroup, cim_sch_permissionsGroupAdmin
         $campusGroupManager = new RowManager_CampusGroupManager();
         $multiTableManager = new MultiTableManager();
         $multiTableManager->addRowManager($groupManager);
         $multiTableManager->addRowManager($campusGroupManager, new JoinPair($campusGroupManager->getJoinOnGroupID(), $groupManager->getJoinOnGroupID(), JOIN_TYPE_RIGHT));
         $multiTableManager->addRowManager($permissionsGroupAdminManager, new JoinPair($permissionsGroupAdminManager->getJoinOnGroupID(), $groupManager->getJoinOnGroupID(), JOIN_TYPE_RIGHT));
         //Go through the results and save the campusID of that group
         $campusGroupArray = array();
         $this->listIterator = $multiTableManager->getListIterator();
         $this->listIterator->setFirst();
         while ($this->listIterator->moveNext()) {
             $group = $this->listIterator->getCurrent(new RowManager_CampusGroupManager());
             $campusGroupArray[] = $group->getCampusID();
         }
         //For each campus found, go through the result again and fillter by campusID
         //Only the groups of the same campusID are saved together
         foreach ($campusGroupArray as $key => $campusID) {
             //This allows us to get the campus shortDesc at the end
             $campusManager = new RowManager_CampusManager($campusID);
             //same code as before to join the tables
             $permissionsGroupAdminManager = new RowManager_PermissionsGroupAdminManager();
             $permissionsGroupAdminManager->setViewerID($this->viewer->getViewerID());
             $campusGroupManager = new RowManager_CampusGroupManager();
             $campusGroupManager->setCampusID($campusID);
             $groupManager = new RowManager_GroupManager();
             $groupManager->setGroupTypeID(1);
             $multiTableManager = new MultiTableManager();
             $multiTableManager->addRowManager($groupManager);
             $multiTableManager->addRowManager($campusGroupManager, new JoinPair($campusGroupManager->getJoinOnGroupID(), $groupManager->getJoinOnGroupID(), JOIN_TYPE_RIGHT));
             $multiTableManager->addRowManager($permissionsGroupAdminManager, new JoinPair($permissionsGroupAdminManager->getJoinOnGroupID(), $groupManager->getJoinOnGroupID(), JOIN_TYPE_RIGHT));
             //go through the results and save the gorups
             $campusGroupArray = array();
             $this->listIterator = $multiTableManager->getListIterator();
             $this->listIterator->setFirst();
             while ($this->listIterator->moveNext()) {
                 $group = $this->listIterator->getCurrent(new RowManager_GroupManager());
                 $campusGroupArray[] = $group;
             }
             //set the campusID and CampusDesc for the $campusGroupArray
             $groupCollectionArray[] = new GroupCollection($campusManager->getShortDesc(), $campusID, $campusGroupArray);
         }
         //PUBLIC Groups
         //Show all groups in cim_sch_group with the groupTypeID of 2 (public)
         //The public gorup does not have a campus assign
         $campusID = 0;
         //The public gorup desc is public, this is shown in the template
         $publicGroupDesc = "Public";
         //Set the public gorup fillter
         $thisIsAPublicGroup = 2;
         $groupManager = new RowManager_GroupManager();
         $groupManager->setGroupTypeID($thisIsAPublicGroup);
         //go through the results and save the groups
         $groupArray = array();
         $this->listIterator = $groupManager->getListIterator();
         $this->listIterator->setFirst();
         while ($this->listIterator->moveNext()) {
             $group = $this->listIterator->getCurrent(new RowManager_GroupManager());
             $groupArray[] = $group;
         }
         //save the public groups to the array
         $groupCollectionArray[] = new GroupCollection($publicGroupDesc, $campusID, $groupArray);
     }
     //END OF IF
     //KSL
     //NORMAL
     /*
     		 $campusAssignments = array();
     
     		 $statusArray = array();
     		 $statusArray[] = CA_STAFF;
     		 $statusArray[] = CA_STUDENT;
     		 foreach( $statusArray as $key=>$statusID )
     		 {
     		 // filter from the cim_hrdb_assignment table
     		 $assignmentManager = new RowManager_AssignmentsManager();
     		 $assignmentManager->setPersonID( $this->personID );
     		 $assignmentManager->setAssignmentStatus( $statusID );
     
     		  
     
     		 $assignmentList = new ListIterator( $assignmentManager );
     		 $assignmentList->setFirst();
     		 while ( $assignmentList->moveNext() )
     		 {
     		 $assManager = $assignmentList->getCurrent( new RowManager_AssignmentsManager() );
     		 $campusAssignments[] = $assManager->getCampusID();
     		 }
     
     		 }
     		 // echo "<pre>".print_r($campusAssignments, true)."</pre>";
     
     		 // STEP 2:  get the appropriate groups
     		 foreach( $campusAssignments as $key=>$campusID )
     		 {
     		 $campusManager = new RowManager_CampusManager( $campusID );
     
     		 $campusGroupManager = new RowManager_CampusGroupManager();
     		 $campusGroupManager->setCampusID( $campusID );
     
     		 $multiTableManager = new MultiTableManager();
     		 $multiTableManager->addRowManager($campusGroupManager);
     		  
     		 $groupManager = new RowManager_GroupManager();
     		 $multiTableManager->addRowManager( $groupManager, new JoinPair( $campusGroupManager->getJoinOnGroupID(), $groupManager->getJoinOnGroupID() ) );
     
     		 $campusGroupArray = array();
     		 $this->listIterator = $multiTableManager->getListIterator();
     		 $this->listIterator->setFirst();
     		 while( $this->listIterator->moveNext() )
     		 {
     		 $group = $this->listIterator->getCurrent(new RowManager_GroupManager());
     		 $campusGroupArray[] = $group;
     		 }
     
     		 $groupCollectionArray[] = new GroupCollection( $campusManager->getShortDesc(), $campusID, $campusGroupArray );
     		 }*/
     return $this->template->set('groupCollectionArray', $groupCollectionArray);
 }