/**
  * function __construct
  * <pre>
  * Initialize the object.
  * </pre>
  * @param $pathModuleRoot [STRING] The path to the module's root dir.
  * @param $viewer [OBJECT] The viewer object.
  * @return [void]
  */
 function __construct($pathModuleRoot, $viewer, $staff_id, $campus_id = "", $semester_id = "")
 {
     parent::__construct();
     // initialzie the object values
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $this->permManager = new PermissionManager($this->viewer->getViewerID());
     // for looking up the person_id of this staff member
     $this->staff_id = $staff_id;
     $staffManager = new RowManager_StaffManager($this->staff_id);
     // echo 'the staff_id['.$this->staff_id.']<br/>';
     // figure out what campuses to display
     $multiTableManager = new MultiTableManager();
     $campusManager = new RowManager_CampusManager();
     $campusManager->setSortOrder('campus_desc');
     $isRT = $this->permManager->isRegional();
     if ($isRT) {
         // get all the campuses across the country
         $multiTableManager->addRowManager($campusManager);
     } else {
         // get only the campuses the staff is assigned to
         $assignmentManager = new RowManager_AssignmentsManager();
         $this->person_id = $staffManager->getPersonID();
         $assignmentManager->setPersonID($this->person_id);
         $assignmentManager->setAssignmentStatusID(CA_STAFF);
         $multiTableManager->addRowManager($assignmentManager);
         $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $assignmentManager->getJoinOnCampusID()));
     }
     $this->campusListIterator = $multiTableManager->getListIterator();
     if ($campus_id != '') {
         // echo 'campus_id is SET ['.$campus_id.']<br/>';
         $this->campus_id = $campus_id;
     } else {
         // set a default campus id
         // echo 'Choosing a default campus<br/>';
         $this->campusListIterator->setFirst();
         if ($this->campusListIterator->moveNext()) {
             $campusObject = $this->campusListIterator->getCurrent(new RowManager_CampusManager());
             $this->campus_id = $campusObject->getID();
         } else {
             die('ERROR - unable to set campus_id - page_StaffWeeklyReport');
         }
     }
     // echo 'the campus_id['.$this->campus_id.']<br/>';
     if ($semester_id != '') {
         $this->semester_id = $semester_id;
     } else {
         // set a default semester id
         $this->semester_id = 4;
         // TODO set this properly
     }
     // echo 'the semester_id['.$this->semester_id.']<br/>';
     // now initialize the labels for this page
     // start by loading the default field labels for this Module
     $languageID = $viewer->getLanguageID();
     $seriesKey = modulecim_stats::MULTILINGUAL_SERIES_KEY;
     $pageKey = page_CampusWeeklyStatsReport::MULTILINGUAL_PAGE_KEY;
     $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey);
 }
 /**
  * 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->campusaccess_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
     //
     // NOTE: Hobbe, here are the original two lines that I moved to below
     //
     // $xmlNodeName = RowManager_EventAdminCampusAssignmentManager::XML_NODE_NAME;
     // $this->template->set( 'rowManagerXMLNodeName', $xmlNodeName);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'campusaccess_id');
     // Russ' Debugging Methodoloy
     // 1. Try and create a multi-table manager that returns the
     // result set I want and put it into and array.  Then figure
     // out why that is not making it through to the template.
     //
     // Result: Hobbe, indeed you were creating the multi-table
     // manager correctly (I just renamed the one row manager),
     // otherwise your code was fine.
     //
     // 2. Ok, try and figure out why the template doesn't like
     // XML it is getting.
     //
     // a. first I check another example (FormProcessor_AddSuperAdmin)
     // of where an adminbox type template is generated.  Yes, it
     // appears we are sending the xml properly
     //
     // b. i notice the call to ->set('primaryKeyFieldName', ... )
     // in the example I'm checking, that too seems to be okay
     //
     // c. I notice the xmlNodeName parameter being set in the
     // templates, i realize that we are not setting this properly
     // and refactor the code a little to get the xmlNodeName from
     // the multitablemanager instead.
     // store data list to the template
     // NOTE: we initialize it here to make sure we capture any new data
     // from a recent processData() call.
     $campusAdminManager = new RowManager_EventAdminCampusAssignmentManager();
     //*** ADDED JOIN TO FILTER BY EVENT ***/
     $eventAdminManager = new RowManager_EventAdminAssignmentManager();
     // echo "The eventID is [".$this->event_id."]<br/>";
     $eventAdminManager->setEventID($this->event_id);
     $multiTableManager = new MultiTableManager();
     $multiTableManager->addRowManager($campusAdminManager);
     $multiTableManager->addRowManager($eventAdminManager, new JoinPair($eventAdminManager->getJoinOnEventAdminID(), $campusAdminManager->getJoinOnEventAdminID()));
     // code to check the result set in the multi-table manager
     // $i = 0;
     // $listIt = $multiTableManager->getListIterator();
     // $listIt->setFirst();
     // while( $listIt->moveNext() )
     // {
     //    echo "ith [".$i."] element";
     //    $i++;
     // }
     // end multi-table manager check
     // $this->dataList = $multiTableManager->getListIterator();
     // echo "<pre>List: ".print_r($this->dataList,true)."</pre>";
     //*** END ADD ***/
     $this->dataList = $multiTableManager->getListIterator();
     // Hobbe, I added/moved these two lines and now it works!
     // It has to do with how the template understands the
     // XML that it is passed
     $xmlNodeName = $this->dataList->getRowManagerXMLNodeName();
     $this->template->set('rowManagerXMLNodeName', $xmlNodeName);
     $this->template->setXML('dataList', $this->dataList->getXML());
     /*
      * Add any additional data required by the template here
      */
     $eventAdmin = new RowManager_EventAdminAssignmentManager();
     $eventAdmin->setEventID($this->event_id);
     $viewer = new RowManager_ViewerManager();
     $multiTableManager2 = new MultiTableManager();
     $multiTableManager2->addRowManager($eventAdmin);
     $multiTableManager2->addRowManager($viewer, new JoinPair($eventAdmin->getJoinOnViewerID(), $viewer->getJoinOnViewerID()));
     //      $multiTableManager2->constructSearchCondition( 'event_id', '=', $this->event_id, true );
     $multiTableManager2->setSortOrder('viewer_userID');
     $multiTableManager2->setLabelTemplate('viewer_userID', '[viewer_userID]');
     $listIterator = $multiTableManager2->getListIterator();
     // code to check the result set in the multi-table manager
     /*        echo "<pre>List: ".print_r($listIterator,true)."</pre>";
                    
              $i = 0;
              $listIt = $multiTableManager2->getListIterator();
              $listIt->setFirst();
              while( $listIt->moveNext() )
              {
                 echo "ith [".$i."] element";
                 $i++;
              }
      */
     // end multi-table manager check
     //        echo print_r($listIterator,true);
     /*
             $viewer = new RowManager_ViewerManager();
             $viewer->setSortOrder( 'viewer_userID' );
             $viewerList = new ListIterator($viewer);	
             $viewerArray = $viewerList->getDropListArray();
     */
     $viewerArray = $listIterator->getDropListArray();
     //$listIterator
     $this->template->set('list_eventadmin_id', $viewerArray);
     //        echo print_r($viewerArray,true);
     $campus = new RowManager_CampusManager();
     //       $campus->setEventID( $this->event_id);
     $campus->setSortOrder('campus_id');
     $campusList = new ListIterator($campus);
     $campusArray = $campusList->getDropListArray();
     $this->template->set('list_campus_id', $campusArray);
     $templateName = 'siteAdminBox.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_AddCampusAdmin.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);
     $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);
 }
Example #4
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;
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     // do the join
     // campuses
     $campusManager = new RowManager_CampusManager();
     $campusManager->setSortOrder('campus_desc');
     $multiTableManager = new MultiTableManager();
     $multiTableManager->addRowManager($campusManager);
     // prcs
     $prcManager = new RowManager_PRCManager();
     $multiTableManager->addRowManager($prcManager, new JoinPair($campusManager->getJoinOnCampusID(), $prcManager->getJoinOnCampusID()));
     // semester
     $semesterManager = new RowManager_SemesterManager();
     // TODO update the semester
     $semesterManager->setSemesterID(1);
     $multiTableManager->addRowManager($semesterManager, new JoinPair($prcManager->getJoinOnSemesterID(), $prcManager->getJoinOnSemesterID()));
     // prc method
     $prcMethodManager = new RowManager_PrcMethodManager();
     $multiTableManager->addRowManager($prcMethodManager, new JoinPair($prcManager->getJoinOnPrcMethodID(), $prcMethodManager->getJoinOnPrcMethodID()));
     // get ready to make the xml
     $xmlObject = new XMLObject();
     // HEADER
     //$reportInfoXMLObject = new XMLObject('PRC_REPORT');
     //$xmlObject->addXMLObject( $reportInfoXMLObject );
     // END HEADER
     // BODY
     $bodyXMLObject = new XMLObject('PRC_FOR_SEMESTER');
     // construct the iterator
     $list = new ListIterator($multiTableManager);
     $list->setFirst();
     while ($list->moveNext()) {
         $itemXMLObject = $list->getCurrentRowXMLObject(false, 'IndividualPRC');
         // Finally add this row into the bigger picture
         $bodyXMLObject->addXMLObject($itemXMLObject);
     }
     // multiTableManager->moveNext()
     $xmlObject->addXMLObject($bodyXMLObject);
     $xmlDoc = new DOMDocument();
     $xmlDoc->loadXML($xmlObject->getXML(false, 'PRCReport'));
     $numBytesWritten = $xmlDoc->save($this->pathModuleRoot . 'prcReport.xml');
     // echo 'Written '.$numBytesWritten.' bytes';
     // save the xml data onto the server
     // return $xmlDoc->saveXML();
     // ------- PART 2 --------
     // WEEKLY STATS
     $multiTableManager = new MultiTableManager();
     $weeklyManager = new RowManager_WeeklyReportManager();
     $multiTableManager->addRowManager($weeklyManager);
     $campusManager = new RowManager_CampusManager();
     $campusManager->setSortOrder('campus_desc');
     $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $weeklyManager->getJoinOnCampusID()));
     $weekManager = new RowManager_WeekManager();
     $multiTableManager->addRowManager($weekManager, new JoinPair($weekManager->getJoinOnWeekID(), $weeklyManager->getJoinOnWeekID()));
     $staffManager = new RowManager_StaffManager();
     $multiTableManager->addRowManager($staffManager, new JoinPair($weeklyManager->getJoinOnStaffID(), $staffManager->getJoinOnStaffID()));
     $personManager = new RowManager_PersonManager();
     $multiTableManager->addRowManager($personManager, new JoinPair($personManager->getJoinOnPersonID(), $staffManager->getJoinOnPersonID()));
     // get ready to make the xml
     $xmlObject = new XMLObject();
     // HEADER
     //$reportInfoXMLObject = new XMLObject('PRC_REPORT');
     //$xmlObject->addXMLObject( $reportInfoXMLObject );
     // END HEADER
     // BODY
     $bodyXMLObject = new XMLObject('WEEKLY_FOR_SEMESTER');
     // construct the iterator
     $list = new ListIterator($multiTableManager);
     $list->setFirst();
     while ($list->moveNext()) {
         $itemXMLObject = $list->getCurrentRowXMLObject(false, 'IndividualWeek');
         // Finally add this row into the bigger picture
         $bodyXMLObject->addXMLObject($itemXMLObject);
     }
     // multiTableManager->moveNext()
     $xmlObject->addXMLObject($bodyXMLObject);
     $xmlDoc = new DOMDocument();
     $xmlDoc->loadXML($xmlObject->getXML(false, 'Report'));
     $numBytesWritten = $xmlDoc->save($this->pathModuleRoot . 'weeklyReport.xml');
     // echo 'Written '.$numBytesWritten.' bytes';
     // save the xml data onto the server
     // return $xmlDoc->saveXML();
     // ------- PART 3 --------
     $multiTableManager = new MultiTableManager();
     $campusStatsManager = new RowManager_MoreStatsManager();
     $multiTableManager->addRowManager($campusStatsManager);
     $campusManager = new RowManager_CampusManager();
     $campusManager->setSortOrder('campus_desc');
     $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $campusStatsManager->getJoinOnCampusID()));
     $weekManager = new RowManager_WeekManager();
     $multiTableManager->addRowManager($weekManager, new JoinPair($campusStatsManager->getJoinOnWeekID(), $weekManager->getJoinOnWeekID()));
     $expTypeManager = new RowManager_ExposureTypeManager();
     $multiTableManager->addRowManager($expTypeManager, new JoinPair($campusStatsManager->getJoinOnExpTypeID(), $expTypeManager->getJoinOnExpTypeID()));
     $count = 0;
     // get ready to make the xml
     $xmlObject = new XMLObject();
     // HEADER
     //$reportInfoXMLObject = new XMLObject('PRC_REPORT');
     //$xmlObject->addXMLObject( $reportInfoXMLObject );
     // END HEADER
     // BODY
     $bodyXMLObject = new XMLObject('CAMPUS_REPORT');
     // construct the iterator
     $list = new ListIterator($multiTableManager);
     $list->setFirst();
     while ($list->moveNext()) {
         $itemXMLObject = $list->getCurrentRowXMLObject(false, 'Activity');
         $count++;
         // Finally add this row into the bigger picture
         $bodyXMLObject->addXMLObject($itemXMLObject);
     }
     // multiTableManager->moveNext()
     echo 'the count is [' . $count . ']<br/>';
     $xmlObject->addXMLObject($bodyXMLObject);
     $xmlDoc = new DOMDocument();
     $xmlDoc->loadXML($xmlObject->getXML(false, 'Report'));
     $numBytesWritten = $xmlDoc->save($this->pathModuleRoot . 'campusReport.xml');
     // echo 'Written '.$numBytesWritten.' bytes';
     // save the xml data onto the server
     // return $xmlDoc->saveXML();
     // ---------------
     // OK DONE!
     // NOTE:  this parent method prepares the $this->template with the
     // common Display data.
     $this->prepareTemplate($path);
     // uncomment this line if you are creating a template for this page
     $templateName = 'page_Reports.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 $weeklyReport_id [INTEGER] Value used to initialize the dataManager
  * @return [void]
  */
 function __construct($pathModuleRoot, $viewer, $formAction, $weeklyReport_id, $staff_id, $week_id = '', $campus_id = '')
 {
     // NOTE: be sure to call the parent constructor before trying to
     //       use the ->formXXX arrays...
     $fieldList = FormProcessor_StaffAdditionalWeeklyStats::FORM_FIELDS;
     $fieldDisplayTypes = FormProcessor_StaffAdditionalWeeklyStats::FORM_FIELD_TYPES;
     parent::__construct($formAction, $fieldList, $fieldDisplayTypes);
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $this->weeklyReport_id = $weeklyReport_id;
     $this->campus_id = $campus_id;
     $this->staff_id = $staff_id;
     if ($week_id != '') {
         // echo 'week_id is SET ['.$week_id.']<br/>';
         $this->week_id = $week_id;
     } else {
         // give a default value to the week id
         $weekManager = new RowManager_WeekManager();
         if ($weekManager->loadByDate(date('Y-m-d', time()))) {
             $this->week_id = $weekManager->getID();
         } else {
             die("ERROR - couldn't see week_id - page_StaffAdditionalWeeklyReport.php");
         }
     }
     // for looking up the person_id of this staff member
     $staffManager = new RowManager_StaffManager($this->staff_id);
     // setup the
     $assignmentManager = new RowManager_AssignmentsManager();
     $assignmentManager->setPersonID($staffManager->getPersonID());
     $assignmentManager->setAssignmentStatusID(CA_STAFF);
     $multiTableManager = new MultiTableManager();
     $multiTableManager->addRowManager($assignmentManager);
     $campusManager = new RowManager_CampusManager();
     $campusManager->setSortOrder('campus_desc');
     $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $assignmentManager->getJoinOnCampusID()));
     $this->campusListIterator = $multiTableManager->getListIterator();
     if ($campus_id != '') {
         // echo 'campus_id is SET ['.$campus_id.']<br/>';
         $this->campus_id = $campus_id;
     } else {
         // set a default campus id
         // echo 'Choosing a default campus<br/>';
         $this->campusListIterator->setFirst();
         if ($this->campusListIterator->moveNext()) {
             $campusObject = $this->campusListIterator->getCurrent(new RowManager_CampusManager());
             $this->campus_id = $campusObject->getID();
         } else {
             die('ERROR - unable to set campus_id - page_StaffWeeklyReport');
         }
     }
     // figure out the important fields for the dataManager
     $fieldsOfInterest = implode(',', $this->formFields);
     $this->dataManager = new RowManager_WeeklyReportManager($this->week_id, $this->staff_id, $this->campus_id);
     $this->dataManager->setFieldsOfInterest($fieldsOfInterest);
     $this->formValues = $this->dataManager->getArrayOfValues();
     // now initialize the labels for this page
     // start by loading the default field labels for this Module
     $languageID = $viewer->getLanguageID();
     $seriesKey = modulecim_stats::MULTILINGUAL_SERIES_KEY;
     $pageKey = modulecim_stats::MULTILINGUAL_PAGE_FIELDS;
     $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey);
     // then load the page specific labels for this page
     $pageKey = FormProcessor_StaffAdditionalWeeklyStats::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);
     $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORMERRORS);
 }
 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);
 }
 /**
  * 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);
     // temporarily reset the form values so the defaults show up properly in the jumplists
     $this->formValues['week_id'] = $this->linkValues['weekJumpLink'] . $this->week_id;
     $this->formValues['campus_id'] = $this->linkValues['campusJumpLink'] . $this->campus_id;
     // 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->morestats_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_MoreStatsManager::XML_NODE_NAME;
     $this->template->set('rowManagerXMLNodeName', $xmlNodeName);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'morestats_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_MoreStatsManager();
     // echo 'This campus ID['.$this->campus_id.']<br/>';
     $dataAccessManager->setCampusID($this->campus_id);
     $dataAccessManager->setWeekID($this->week_id);
     $dataAccessManager->setSortOrder($this->sortBy);
     //        $this->dataList = new MoreStatsList( $this->sortBy );
     $this->dataList = $dataAccessManager->getListIterator();
     $this->template->setXML('dataList', $this->dataList->getXML());
     /*
      * Add any additional data required by the template here
      */
     // week list
     $jumpLink = $this->linkValues['weekJumpLink'];
     $weekManager = new RowManager_WeekManager();
     $weekManager->setSortOrder('week_endDate');
     $weekList = new ListIterator($weekManager);
     $jumpList = $weekList->getDropListArray(null, $jumpLink);
     $this->template->set('list_week_id', $jumpList);
     // for looking up the person_id of this staff member
     $staffManager = new RowManager_StaffManager($this->staff_id);
     // campus list
     $assignmentManager = new RowManager_AssignmentsManager();
     $assignmentManager->setPersonID($staffManager->getPersonID());
     $assignmentManager->setAssignmentStatusID(CA_STAFF);
     $multiTableManager = new MultiTableManager();
     $multiTableManager->addRowManager($assignmentManager);
     $campusManager = new RowManager_CampusManager();
     $campusManager->setSortOrder('campus_desc');
     $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $assignmentManager->getJoinOnCampusID()));
     $jumpLink = $this->linkValues['campusJumpLink'];
     $campusList = $multiTableManager->getListIterator();
     $campusArray = array();
     $campusList->setFirst();
     while ($campusList->moveNext()) {
         $campusObject = $campusList->getCurrent(new RowManager_CampusManager());
         $campusArray[$jumpLink . $campusObject->getID()] = $campusObject->getLabel();
     }
     // echo '<pre>'.print_r($campusArray, true ).'</pre>';
     $this->template->set('list_campus_id', $campusArray);
     // method list
     $typeManager = new RowManager_ExposureTypeManager();
     $typeManager->setSortOrder('exposuretype_desc');
     $typeList = $typeManager->getListIterator();
     $typeArray = $typeList->getDropListArray();
     $this->template->set('list_exposuretype_id', $typeArray);
     $templateName = 'siteFormDataList.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_MoreStats.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()
 {
     $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.
  * @return [void]
  */
 function __construct($pathModuleRoot, $viewer, $eventID, $recalcStatus = FinancialTools::RECALC_NOTNEEDED, $campus_link = '')
 {
     parent::__construct();
     // initialzie the object values
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $this->event_id = $eventID;
     $this->recalcStatus = $recalcStatus;
     // get privileges for the current viewer
     $privManager = new PrivilegeManager($this->viewer->getID());
     $regSummaries = new RegSummaryTools();
     //       	$is_campus_admin = false;
     if ($privManager->isBasicAdmin($this->event_id) == true) {
         /** Set the summary data headings (used only for generating PDF) **/
         $this->summary_headings = array();
         $this->summary_headings[0] = 'Campus';
         $this->summary_headings[1] = 'Admin';
         $this->summary_headings[2] = 'Males';
         $this->summary_headings[3] = 'Females';
         $this->summary_headings[4] = 'Total';
         $this->summary_headings[5] = 'Cancellations';
         $this->summary_headings[6] = 'Completed';
         $this->summary_headings[7] = 'Incomplete';
         /** RETRIEVE CAMPUS REGISTRATION SUMMARY DATA ***/
         //TODO?: put some/all of this into a helper method
         // initialized template arrays
         $campusLevelLinks = array();
         $this->summaryTotals = array();
         $this->summaryTotals['label'] = '';
         $this->summaryTotals['blank'] = '';
         // 'Registrations' link has no need for a total...
         $this->summaryTotals['numMales'] = 0;
         $this->summaryTotals['numFemales'] = 0;
         $this->summaryTotals['campusTotal'] = 0;
         $this->summaryTotals['cancellations'] = 0;
         $this->summaryTotals['completes'] = 0;
         $this->summaryTotals['incompletes'] = 0;
         /* Get all campuses (affiliated with the admin's country) */
         // 	     		$campuses = new RowManager_CampusManager();
         // 	     		$campuses->setSortOrder('campus_desc');
         // 	     		$campusList = $campuses->getListIterator();
         // 	     		$campusArray = $campusList->getDataList();
         $country_campuses = new MultiTableManager();
         $events = new RowManager_EventManager();
         $events->setEventID($this->event_id);
         $campuses = new RowManager_CampusManager();
         $regions = new RowManager_RegionManager();
         $countries = new RowManager_CountryManager();
         $country_campuses->addRowManager($campuses);
         $country_campuses->addRowManager($regions, new JoinPair($regions->getJoinOnRegionID(), $campuses->getJoinOnRegionID()));
         $country_campuses->addRowManager($countries, new JoinPair($countries->getJoinOnCountryID(), $regions->getJoinOnCountryID()));
         $country_campuses->addRowManager($events, new JoinPair($events->getJoinOnCountryID(), $countries->getJoinOnCountryID()));
         $country_campuses->setSortOrder('campus_desc');
         $countryList = $country_campuses->getListIterator();
         $campusArray = $countryList->getDataList();
         reset($campusArray);
         // 	     		echo 'campus array = <pre>'.print_r($campusArray,true).'</pre>';
         /** JANUARY 25, 2008    (HSMIT) added $campusList to all getCampusRegistrations() calls below
                                         to match registration campuses with event-affliated country's campus list 
                                         
             ALSO: had to add somewhat redundant pre-processing to get campus list **/
         $campusList = '';
         foreach (array_keys($campusArray) as $key) {
             $record = current($campusArray);
             $campusList .= $record['campus_id'] . ',';
             // populate CSV for registrations filter
             next($campusArray);
         }
         $campusList = substr($campusList, 0, -1);
         reset($campusArray);
         // retrieve cancellations (for current event)
         $results_cancelled = array();
         $results_cancelled = $regSummaries->getCampusRegistrations($this->event_id, '', true, $campusList);
         // retrieve total registrations and total females registered (for current event)
         $results = array();
         $results_female = array();
         $results = $regSummaries->getCampusRegistrations($this->event_id, '', false, $campusList);
         $results_female = $regSummaries->getCampusRegistrations($this->event_id, 'female', false, $campusList);
         // 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, $campusList, '', RowManager_RegistrationManager::STATUS_REGISTERED);
         $results_incomplete = $regSummaries->getCampusRegistrations($this->event_id, '', false, $campusList, '', 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'] = $campus_link . $campusID;
                 // $this->linkValues[ 'CampusLink' ].$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);
         }
         $this->summary_data = $campusLevelLinks;
         /*** END CAMPUS REGISTRATION SUMMARY DATA RETRIEVAL ***/
         /**** 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);
         $this->summaryTotals['label'] = 'Total (Unique) Registrations:';
         $this->summaryTotals['blank'] = '';
         // 'Registrations' link has no need for a total...
         $this->summaryTotals['numMales'] = count($totalRegs) - count($femaleRegs);
         $this->summaryTotals['numFemales'] = count($femaleRegs);
         $this->summaryTotals['campusTotal'] = count($totalRegs);
         $this->summaryTotals['cancellations'] = count($cancelledRegs);
         $this->summaryTotals['completes'] = count($completeRegs);
         $this->summaryTotals['incompletes'] = count($incompleteRegs);
     }
     // now initialize the labels for this page
     // start by loading the default field labels for this Module
     $languageID = $viewer->getLanguageID();
     $seriesKey = modulecim_reg::MULTILINGUAL_SERIES_KEY;
     $pageKey = page_AdminEventHome::MULTILINGUAL_PAGE_KEY;
     $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey);
 }
Example #10
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 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 page labels in XML format...
     // NOTE: use this location to update any label tags ...
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     // NOTE:  this parent method prepares the $this->template with the
     // common Form data.
     $this->prepareTemplate($path);
     /*
      * Form related Template variables:
      */
     // store the button label
     $this->template->set('buttonText', $this->labels->getLabel('[Continue]'));
     // Insert the date start/end values for the following date fields:
     // example:
     //$this->template->set( 'startYear_[fieldName]', 2000);
     //$this->template->set( 'endYear_[fieldName]', 2010);
     /*
      * Add any additional data required by the template here
      */
     // semester list
     $semesterManager = new RowManager_SemesterManager();
     $semesterList = $semesterManager->getListIterator();
     $semesterArray = $semesterList->getDropListArray();
     $this->template->set('list_semester_id', $semesterArray);
     // for looking up the person_id of this staff member
     $staffManager = new RowManager_StaffManager($this->staff_id);
     // campus list
     $assignmentManager = new RowManager_AssignmentsManager();
     $assignmentManager->setPersonID($staffManager->getPersonID());
     $assignmentManager->setAssignmentStatusID(CA_STAFF);
     $multiTableManager = new MultiTableManager();
     $multiTableManager->addRowManager($assignmentManager);
     $campusManager = new RowManager_CampusManager();
     $campusManager->setSortOrder('campus_desc');
     $multiTableManager->addRowManager($campusManager, new JoinPair($campusManager->getJoinOnCampusID(), $assignmentManager->getJoinOnCampusID()));
     $campusList = $multiTableManager->getListIterator();
     $campusArray = array();
     $campusList->setFirst();
     while ($campusList->moveNext()) {
         $campusObject = $campusList->getCurrent(new RowManager_CampusManager());
         $campusArray[$campusObject->getID()] = $campusObject->getLabel();
     }
     $this->template->set('list_campus_id', $campusArray);
     // uncomment this line if you are creating a template for this page
     //$templateName = 'page_SelectPrcSemesterCampus.php';
     // otherwise use the generic admin box template
     $templateName = 'siteFormSingle.php';
     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);
 }
 /**
  * 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 = SITE_PATH_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('[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);
     // 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);
     // store the Row Manager's XML Node Name
     // $this->template->set( 'rowManagerXMLNodeName', RowManager_GroupManager::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', 'group_id');
     /*
      *  Set up any additional data transfer to the Template here...
      */
     // get a list of the different group types
     $groupType = new RowManager_GroupTypeManager();
     $groupTypeList = new ListIterator($groupType);
     $groupArray = $groupTypeList->getDropListArray();
     $this->template->set('list_groupType_id', $groupArray);
     // echo "<pre>Group:".print_r($groupArray, true)."</pre>";
     // get a list of all campus_ids
     $campus = new RowManager_CampusManager();
     $campus->setSortOrder('campus_desc');
     $campusList = new ListIterator($campus);
     $campusArray = $campusList->getDropListArray();
     //echo "<pre>Campus:".print_r($campusArray, true)."</pre>";
     $this->template->set('list_campus_id', $campusArray);
     $templateName = 'siteDataList.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_ViewGroups.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);
 }
 /**
  * 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);
 }
Example #18
0
  * country_desc [STRING]  Textual name of a country
  * country_shortDesc [STRING]  Short form of a country's name
  */
 $Country = new RowManager_CountryManager();
 $Country->dropTable();
 $Country->createTable();
 /*
  * Campus Table
  *
  * Manages the Campus Table
  *
  * campus_id [INTEGER]  The id of the campus.
  * campus_desc [STRING]  The name of the Campus.
  * campus_shortDesc [STRING]  The short name for the campus.
  */
 $Campus = new RowManager_CampusManager();
 $Campus->dropTable();
 $Campus->createTable();
 /*
  * Person Table
  *
  * Manages data associated with a person.
  *
  * person_id [INTEGER]  a person'd unique id
  * person_fname [STRING]  A person's first name
  * person_lname [STRING]  A person's last name
  * person_phone [STRING]  A person's phone number
  * person_email [STRING]  A person's email
  * person_addr [STRING]  A person's address
  * person_city [STRING]  A person's city.
  * province_id [INTEGER]  The person's province.
 /**
  * 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 __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 isCampusAdmin
  * <pre>
  * return whether viewer is a campus admin for given event and campus
  * </pre>
  * @return [boolean] 
  */
 function isCampusAdmin($eventID, $campusID)
 {
     if (isset($this->isCampusAdmin[PrivilegeManager::ALL_EVENTS]) && $this->isCampusAdmin[PrivilegeManager::ALL_EVENTS] == PrivilegeManager::ALL_CAMPUSES) {
         return true;
     }
     if (isset($eventID) && $eventID != '') {
         if (isset($this->isCampusAdmin[$eventID]) && $this->isCampusAdmin[$eventID] == PrivilegeManager::ALL_CAMPUSES) {
             return true;
         }
         if (isset($campusID) && $campusID != '') {
             if (isset($this->isCampusAdmin[$eventID])) {
                 $campuses = $this->isCampusAdmin[$eventID];
                 if ($campuses != '') {
                     $campusArray = explode('|', $campuses);
                     if (in_array($campusID, $campusArray)) {
                         return true;
                     }
                 }
             }
         }
         // if no value was found, determine if the viewer is staff on some campus
         // 		    $viewers = new RowManager_ViewerManager();
         // 		    $viewers->set($this->viewer_id);
         $access = new RowManager_AccessManager();
         $access->setViewerID($this->viewer_id);
         $person = new RowManager_PersonManager();
         $staff = new RowManager_StaffManager();
         $staff->setIsActive('1');
         $assign = new RowManager_AssignmentsManager();
         $assign->setAssignmentStatus(CA_STAFF);
         $campus = new RowManager_CampusManager();
         $campus->setCampusID($campusID);
         $multiTables = new MultiTableManager();
         $multiTables->addRowManager($access);
         $multiTables->addRowManager($person, new JoinPair($access->getJoinOnPersonID(), $person->getJoinOnPersonID()));
         $multiTables->addRowManager($staff, new JoinPair($person->getJoinOnPersonID(), $staff->getJoinOnPersonID()));
         $multiTables->addRowManager($assign, new JoinPair($assign->getJoinOnPersonID(), $person->getJoinOnPersonID()));
         $multiTables->addRowManager($campus, new JoinPair($assign->getJoinOnCampusID(), $campus->getJoinOnCampusID()));
         $campusList = $multiTables->getListIterator();
         $campusArray = $campusList->getDataList();
         // 		    echo 'campus array for user: <pre>'.print_r($campusArray, true).'</pre><br>';
         // some campus was found, so viewer is admin for this campus (for all events)
         if (isset($campusArray) && count($campusArray) > 0) {
             // store the viewer in the database as a campus id assigned to the current campus
             /*** TODO: low priority because it is an optimization ***/
             return true;
         }
     }
     return false;
 }