/**
  * 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);
     // 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 Form data.
     $this->prepareTemplate($path);
     /*
      * Form related Template variables:
      */
     // store the button label
     $this->template->set('buttonText', $this->labels->getLabel('[Update]'));
     // 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
      */
     // 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);
     // campus list
     $jumpLink = $this->linkValues['campusJumpLink'];
     $campusArray = array();
     $this->campusListIterator->setFirst();
     while ($this->campusListIterator->moveNext()) {
         $campusObject = $this->campusListIterator->getCurrent(new RowManager_CampusManager());
         $campusArray[$jumpLink . $campusObject->getID()] = $campusObject->getLabel();
     }
     // echo '<pre>'.print_r($campusArray, true ).'</pre>';
     $this->template->set('list_campus_id', $campusArray);
     // add the definitions at the bottom of the page
     /*$defsContent = new Template($this->pathModuleRoot.'templates/');
       $a = $defsContent->fetch( 'moreDefs.tpl.php'  );
       $this->template->set( 'footerContent', $a );*/
     // uncomment this line if you are creating a template for this page
     //$templateName = 'page_StaffAdditionalWeeklyStats.php';
     // otherwise use the generic admin box template
     $templateName = 'siteFormSingle.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;
     // The weeks
     $weekManager = new RowManager_WeekManager();
     $weekManager->setSemesterID($this->semester_id);
     $weekManager->setSortByDate();
     $staffArray = array();
     // figure out all the people we want to report on
     $isCD = $this->permManager->isCD();
     if ($isCD) {
         // get all the people from this campus who have reported stats
         $wklyReportManager = new RowManager_WeeklyReportManager();
         $wklyReportManager->setCampusID($this->campus_id);
         $anotherWeekManager = new RowManager_WeekManager();
         $anotherWeekManager->setSemesterID($this->semester_id);
         $multiTableManager = new MultiTableManager();
         $multiTableManager->addRowManager($wklyReportManager);
         $multiTableManager->addRowManager($anotherWeekManager, new JoinPair($wklyReportManager->getJoinOnWeekID(), $anotherWeekManager->getJoinOnWeekID()));
         $this->listIterator = $multiTableManager->getListIterator();
         $this->listIterator->setFirst();
         while ($this->listIterator->moveNext()) {
             $reportRow = $this->listIterator->getCurrent(new RowManager_WeeklyReportManager());
             $staffArray[] = $reportRow->getStaffID();
         }
         $staffArray = array_unique($staffArray);
         // echo '<pre>'.print_r($staffArray, true).'</pre>';
     } else {
         // just get the stats for the staff viewing the page
         $staffArray[] = $this->staff_id;
     }
     $infoArray = array();
     foreach ($staffArray as $indx => $staffID) {
         //IndSemesterInfo
         $indInfo = new IndSemesterInfo();
         $staffManager = new RowManager_StaffManager($staffID);
         $personID = $staffManager->getPersonID();
         $personManager = new RowManager_PersonManager($personID);
         $personManager->setLabelTemplateLastNameFirstName();
         $indInfo->staffName = $personManager->getLabel();
         $indInfo->staffID = $staffID;
         // calendar
         $indInfo->calendar = array();
         $currentMonth = 0;
         // actual data
         // dataArray[weekID] = arrayOfData
         $indInfo->dataArray = array();
         $weekList = new ListIterator($weekManager);
         $weekList->setFirst();
         while ($weekList->moveNext()) {
             $week = $weekList->getCurrent(new RowManager_WeekManager());
             $weekID = $week->getID();
             // setup stuff for the calendar in the report
             $endDate = $week->getEndDate();
             list($year, $month, $day) = explode('-', $endDate);
             $month = ltrim($month, "0");
             // $day = ltrim($day, "0");
             if ($currentMonth != $month) {
                 // echo 'start new array<br/>';
                 $currentMonth = $month;
             }
             $indInfo->calendar[$currentMonth][$day] = $weekID;
             // end calendar stuff
             // check if an entry exists in the table for
             $weeklyReport = new RowManager_WeeklyReportManager($weekID, $staffID, $this->campus_id);
             if ($weeklyReport->isLoaded()) {
                 // echo $week->getEndDate() . ' loaded <br/>';
                 $indInfo->dataArray[$weekID] = $weeklyReport->getArrayOfValues();
                 // echo '<pre>'.print_r( $weeklyReport->getArrayOfValues() ).'</pre>';
             } else {
                 $indInfo->dataArray[$weekID] = null;
                 // echo $week->getEndDate() . ' NOT loaded <br/>';
             }
         }
         // echo '<pre>'.print_r($calendar,true).'</pre>';
         $infoArray[] = $indInfo;
     }
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     $campusJumpLinkSelectedValue = $this->linkValues['campusJumpLink'] . $this->campus_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( 'calendar', $calendar );
     // $this->template->set( 'dataArray', $dataArray );
     $this->template->set('infoArray', $infoArray);
     $this->template->set('campusJumpLinkSelectedValue', $campusJumpLinkSelectedValue);
     $this->template->set('semesterJumpLinkSelectedValue', $semesterJumpLinkSelectedValue);
     // campus list
     $jumpLink = $this->linkValues['campusJumpLink'];
     $campusArray = array();
     $this->campusListIterator->setFirst();
     while ($this->campusListIterator->moveNext()) {
         $campusObject = $this->campusListIterator->getCurrent(new RowManager_CampusManager());
         $region_id = $campusObject->getRegionID();
         if ($region_id == 1 || $region_id == 2 || $region_id == 3) {
             $campusArray[$jumpLink . $campusObject->getID()] = $campusObject->getLabel();
         }
     }
     // echo '<pre>'.print_r($campusArray, true ).'</pre>';
     $this->template->set('list_campus_id', $campusArray);
     // semester list
     $jumpLink = $this->linkValues['semesterJumpLink'];
     $semesterArray = array();
     $semesterManager = new RowManager_SemesterManager();
     $this->semesterListIterator = $semesterManager->getListIterator();
     $this->semesterListIterator->setFirst();
     while ($this->semesterListIterator->moveNext()) {
         $semesterObject = $this->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_StaffSemesterReport.php';
     // otherwise use the generic site template
     //$templateName = '';
     return $this->template->fetch($templateName);
 }
 /** 
  * @function processData
  *
  * @abstract Provided function to allow an object to process it's data.
  *
  */
 function processData()
 {
     // if this was a form submit ...
     // NOTE: our forms should have a hidden variable named Process on them.
     if (isset($_REQUEST['Process'])) {
         // if form data is valid ...
         if ($this->pageDisplay->isDataValid()) {
             // process the data
             $this->pageDisplay->processData();
             // now switch to the proper next page ...
             switch ($this->page) {
                 case modulecim_stats::PAGE_STAFFWEEKLYREPORT:
                     $this->WEEK_ID = '';
                     $this->page = modulecim_stats::PAGE_PRC;
                     // echo '<pre>'.print_r($_REQUEST, true).'</pre>';
                     // need the semester id and campus id for the PRC page
                     if (isset($_REQUEST[modulecim_stats::CAMPUS_ID])) {
                         $this->CAMPUS_ID = $_REQUEST[modulecim_stats::CAMPUS_ID];
                     } else {
                         // figure out the campus id from a query string form value
                         $this->CAMPUS_ID = $this->getQSValueLocal(modulecim_stats::CAMPUS_ID, $_REQUEST['campus_id']);
                     }
                     // echo '$this->CAMPUS_ID['.$this->CAMPUS_ID.']<br/>';
                     // get the week_id
                     $weekID = $this->getQSValueLocal(modulecim_stats::WEEK_ID, $_REQUEST['week_id']);
                     // create a week manager
                     $weekManager = new RowManager_WeekManager($weekID);
                     $weekDate = $weekManager->getEndDate();
                     // echo '$weekDate['.$weekDate.']<br/>';
                     $semesterManager = new RowManager_SemesterManager();
                     if ($semesterManager->loadByDate($weekDate)) {
                         $this->SEMESTER_ID = $semesterManager->getID();
                     } else {
                         if ($semesterManager->checkIfFirstSemester($weekDate)) {
                             $this->SEMESTER_ID = $semesterManager->getID();
                         } else {
                             die('ERROR - could not find semester - processData - staffWeeklyReport transition');
                         }
                     }
                     $this->SEMESTER_ID = $semesterManager->getID();
                     // echo '$this->SEMESTER_ID['.$this->SEMESTER_ID.']<br/>';
                     $this->loadPRC();
                     break;
                 case modulecim_stats::PAGE_SEMESTERREPORT:
                     $this->SEMESTER_ID = '';
                     $this->page = modulecim_stats::PAGE_STATSHOME;
                     $this->loadStatsHome();
                     break;
                 case modulecim_stats::PAGE_PRCMETHOD:
                     // NOTE: after a successful submit on an AdminBox style
                     // form, set the managerInit variable back to ''
                     $this->METHOD_ID = '';
                     $this->loadPrcMethod(true);
                     break;
                 case modulecim_stats::PAGE_PRC:
                     // NOTE: after a successful submit on an AdminBox style
                     // form, set the managerInit variable back to ''
                     $this->PRC_ID = '';
                     $this->loadPRC(true);
                     break;
                 case modulecim_stats::PAGE_SELECTPRCSEMESTERCAMPUS:
                     // echo print_r($_REQUEST, true);
                     // HACK: not really sure how else to get these values
                     $this->SEMESTER_ID = $_REQUEST['semester_id'];
                     $this->CAMPUS_ID = $_REQUEST['campus_id'];
                     $this->loadPRC();
                     break;
                 case modulecim_stats::PAGE_EXPOSURETYPES:
                     // NOTE: after a successful submit on an AdminBox style
                     // form, set the managerInit variable back to ''
                     $this->EXPOSURE_ID = '';
                     $this->loadExposureTypes(true);
                     break;
                 case modulecim_stats::PAGE_MORESTATS:
                     // NOTE: after a successful submit on an AdminBox style
                     // form, set the managerInit variable back to ''
                     $this->MORESTATS_ID = '';
                     $this->loadMoreStats(true);
                     break;
                 case modulecim_stats::PAGE_STAFFADDITIONALWEEKLYSTATS:
                     $this->WEEK_ID = '';
                     $this->page = modulecim_stats::PAGE_STATSHOME;
                     $this->loadStatsHome();
                     break;
                     /*[RAD_PAGE_TRANSITION]*/
             }
         }
         // end if data valid
     }
     // end if Process
 }
 /**
  * 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;
     $exposureArray = array();
     $exposureTypeManager = new RowManager_ExposureTypeManager();
     $exIt = $exposureTypeManager->getListIterator();
     $exIt->setFirst();
     while ($exIt->moveNext()) {
         $anEx = $exIt->getCurrent(new RowManager_ExposureTypeManager());
         $typeID = $anEx->getID();
         $campusExposure = new CampusExposure();
         $campusExposure->expDesc = $anEx->getLabel();
         $arrayOfExposures = array();
         $weekManager = new RowManager_WeekManager();
         $weekManager->setSemesterID($this->semester_id);
         $moreStatsManager = new RowManager_MoreStatsManager();
         $moreStatsManager->setExposureTypeID($typeID);
         $moreStatsManager->setCampusID($this->campus_id);
         $multiTableManager = new MultiTableManager();
         $multiTableManager->addRowManager($weekManager);
         $multiTableManager->addRowManager($moreStatsManager, new JoinPair($weekManager->getJoinOnWeekID(), $moreStatsManager->getJoinOnWeekID()));
         $listIterator = $multiTableManager->getListIterator();
         $listIterator->setFirst();
         $dataArray = array();
         while ($listIterator->moveNext()) {
             $moreStatsObj = $listIterator->getCurrent(new RowManager_MoreStatsManager());
             $weekObj = $listIterator->getCurrent(new RowManager_WeekManager());
             $arrayOfExposures[] = array_merge($moreStatsObj->getArrayOfValues(), $weekObj->getArrayOfValues());
             // array( 1=>array("week_endDate"=>"23-34", "morestats_notes"=>"some notes", "morestats_exp"=>35));
         }
         $campusExposure->valuesArray = $arrayOfExposures;
         $exposureArray[] = $campusExposure;
     }
     // while
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     $campusJumpLinkSelectedValue = $this->linkValues['campusJumpLink'] . $this->campus_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('exposureArray', $exposureArray);
     $this->template->set('campusJumpLinkSelectedValue', $campusJumpLinkSelectedValue);
     $this->template->set('semesterJumpLinkSelectedValue', $semesterJumpLinkSelectedValue);
     // campus list
     $jumpLink = $this->linkValues['campusJumpLink'];
     $campusArray = array();
     $this->campusListIterator->setFirst();
     while ($this->campusListIterator->moveNext()) {
         $campusObject = $this->campusListIterator->getCurrent(new RowManager_CampusManager());
         $campusArray[$jumpLink . $campusObject->getID()] = $campusObject->getLabel();
     }
     // echo '<pre>'.print_r($campusArray, true ).'</pre>';
     $this->template->set('list_campus_id', $campusArray);
     // semester list
     $jumpLink = $this->linkValues['semesterJumpLink'];
     $semesterArray = array();
     $semesterManager = new RowManager_SemesterManager();
     $this->semesterListIterator = $semesterManager->getListIterator();
     $this->semesterListIterator->setFirst();
     while ($this->semesterListIterator->moveNext()) {
         $semesterObject = $this->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_CampusWeeklyStatsReport.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;
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     $regionJumpLinkSelectedValue = $this->linkValues['regionJumpLink'] . $this->region_id;
     $semesterJumpLinkSelectedValue = $this->linkValues['semesterJumpLink'] . $this->semester_id;
     // NOTE:  this parent method prepares the $this->template with the
     // common Display data.
     $this->prepareTemplate($path);
     $this->template->set('regionJumpLinkSelectedValue', $regionJumpLinkSelectedValue);
     $this->template->set('semesterJumpLinkSelectedValue', $semesterJumpLinkSelectedValue);
     // changed by RM on June 4, 2009 to reflect new reporting guidelines
     // $fieldsOfInterest = "weeklyReport_1on1SpConv,weeklyReport_1on1SpConvStd,weeklyReport_1on1GosPres,weeklyReport_1on1GosPresStd,weeklyReport_1on1HsPres,weeklyReport_1on1HsPresStd,weeklyReport_7upCompleted,weeklyReport_7upCompletedStd,weeklyReport_cjVideo,weeklyReport_mda,weeklyReport_otherEVMats,weeklyReport_rlk,weeklyReport_siq";
     $fieldsOfInterest = "weeklyReport_1on1SpConv,weeklyReport_1on1SpConvStd,weeklyReport_1on1GosPres,weeklyReport_1on1GosPresStd,weeklyReport_1on1HsPres";
     $fieldsArray = explode(",", $fieldsOfInterest);
     // changed by RM on June 4, 2009 to reflect new reporting guidelines, we are no longer collecting these measurements
     // $semesterReportFields = 'semesterreport_avgPrayer,semesterreport_avgWklyMtg,semesterreport_numStaffChall,semesterreport_numInternChall,semesterreport_numFrosh,semesterreport_numStaffDG,semesterreport_numInStaffDG,semesterreport_numStudentDG,semesterreport_numInStudentDG,semesterreport_numSpMultStaffDG,semesterreport_numSpMultStdDG';
     $semesterReportFields = '';
     $semesterReportFieldArray = explode(",", $semesterReportFields);
     // other 'weekly campus stats', based on exposure type
     /*
     // no longer need the exposure type fields of interest - RM June 4, 2009
             $exposureFieldsOfInterest = "";
             $exposureFieldsArray = array();
             $exposureTypePrefix = "expType";
             $isFirst = true;
             $exposureTypeManager = new RowManager_ExposureTypeManager();
             $exIt = $exposureTypeManager->getListIterator();
             $exIt->setFirst();
             while( $exIt->moveNext() )
             {
                 $anEx = $exIt->getCurrent( new RowManager_ExposureTypeManager() );
                 $typeID = $anEx->getID();
                 $fieldName = $exposureTypePrefix.$typeID;
                 $exposureFieldsArray[$typeID] = $fieldName;
                 if ( !$isFirst )
                 {
                     $exposureFieldsOfInterest .= ',';
                 }
                 $exposureFieldsOfInterest .= $fieldName;
                 $isFirst = false;
             } // while
     */
     // removed concatentation of $semesterReportFields and $exposureFieldsOfInterest - June 4, 2009 by RM
     // $fieldsOfInterest = 'prcTotal,'.$fieldsOfInterest . ',' . $semesterReportFields . ','. $exposureFieldsOfInterest;
     $fieldsOfInterest = 'prcTotal,' . $fieldsOfInterest;
     // get all the campuses for the given region
     $campusManager = new RowManager_CampusManager();
     $campusManager->setRegionID($this->region_id);
     $campusListIt = $campusManager->getListIterator();
     $campusInfoArray = array();
     $campusListIt->setFirst();
     while ($campusListIt->moveNext()) {
         $sumArray = array();
         foreach ($fieldsArray as $key => $fieldName) {
             $sumArray[$fieldName] = 0;
         }
         $campusObj = $campusListIt->getCurrent(new RowManager_CampusManager());
         $campusID = $campusObj->getID();
         $indCampusInfo = new IndCampusSemesterInfo();
         $indCampusInfo->campusID = $campusID;
         $indCampusInfo->shortName = $campusObj->getShortDesc();
         // check if an entry exists in the table for
         $weeklyReport = new RowManager_WeeklyReportManager();
         $weeklyReport->setCampusID($campusID);
         $weekManager = new RowManager_WeekManager();
         $weekManager->setSemesterID($this->semester_id);
         $multiTableManager = new MultiTableManager();
         $multiTableManager->addRowManager($weeklyReport);
         $multiTableManager->addRowManager($weekManager, new JoinPair($weeklyReport->getJoinOnWeekID(), $weekManager->getJoinOnWeekID()));
         $listIterator = $multiTableManager->getListIterator();
         $listIterator->setFirst();
         $dataArray = array();
         while ($listIterator->moveNext()) {
             $aWklyReport = $listIterator->getCurrent(new RowManager_WeeklyReportManager());
             $dataArray = $aWklyReport->getArrayOfValues();
             $this->combineValues($sumArray, $dataArray);
         }
         // $indCampusInfo->dataArray = array('weeklyReport_1on1SpConv'=>7,'weeklyReport_1on1SpConvStd'=>21);
         $indCampusInfo->dataArray = $sumArray;
         // get semster stats
         $semesterCampusReport = new RowManager_SemesterReportManager($this->semester_id, $campusID);
         $campusDataArray = $semesterCampusReport->getArrayOfValues();
         if (count($campusDataArray) <= 0) {
             // no data
             // echo 'no data<br/>';
             foreach ($semesterReportFieldArray as $key => $semFieldName) {
                 // put zeros into the array
                 $campusDataArray[$semFieldName] = 0;
             }
         }
         // echo '<pre>'.print_r($campusDataArray, true).'</pre>';
         // combine personal ministry totals array with other semester stats
         $indCampusInfo->dataArray = array_merge($indCampusInfo->dataArray, $campusDataArray);
         // add the 'campus weekly stats'
         $exposureTypeManager = new RowManager_ExposureTypeManager();
         $exIt = $exposureTypeManager->getListIterator();
         $exIt->setFirst();
         while ($exIt->moveNext()) {
             $anEx = $exIt->getCurrent(new RowManager_ExposureTypeManager());
             // echo $anEx->getLabel().'->'.$anEx->getID().'<br/>';
             $typeID = $anEx->getID();
             $sumThisType = 0;
             // get the sum of all the exposures of this type, this semester
             $moreManager = new RowManager_MoreStatsManager();
             $moreManager->setCampusID($campusID);
             $moreManager->setExposureTypeID($typeID);
             $wkManager = new RowManager_WeekManager();
             $wkManager->setSemesterID($this->semester_id);
             $multiTableManager = new MultiTableManager();
             $multiTableManager->addRowManager($moreManager);
             $multiTableManager->addRowManager($wkManager, new JoinPair($moreManager->getJoinOnWeekID(), $wkManager->getJoinOnWeekID()));
             $listIterator = $multiTableManager->getListIterator();
             $listIterator->setFirst();
             while ($listIterator->moveNext()) {
                 $moreStatsObj = $listIterator->getCurrent(new RowManager_MoreStatsManager());
                 $sumThisType += $moreStatsObj->getNumExposures();
             }
             // while
             // echo 'campusID['.$campusID.'] semesterID['.$this->semester_id.'] typeID['.$typeID.'] total['.$sumThisType.']<br/>';
             $indCampusInfo->dataArray[$exposureFieldsArray[$typeID]] = $sumThisType;
         }
         // while
         // add the number of indicated decisions
         $prcManager = new RowManager_PRCManager();
         $prcManager->setSemester($this->semester_id);
         $prcManager->setCampus($campusID);
         $prcList = $prcManager->getListIterator();
         $numPRC = $prcList->getNumRows();
         // echo $numPRC.'<br/>';
         $indCampusInfo->dataArray['prcTotal'] = $numPRC;
         $campusInfoArray[] = $indCampusInfo;
     }
     $this->template->set('campusInfoArray', $campusInfoArray);
     $this->template->set('fieldsOfInterest', $fieldsOfInterest);
     $campusSummaryJumpLink = $this->linkValues['campusSummaryJumpLink'];
     $campusSummaryJumpLink = str_replace('SSS', $this->semester_id, $campusSummaryJumpLink);
     // in case where semester was not provided (usual case)
     // look up the year associated with this semester
     $semObj = new RowManager_SemesterManager($this->semester_id);
     $year_id = $semObj->getYearID();
     $campusSummaryJumpLink = str_replace('YYY', $year_id, $campusSummaryJumpLink);
     // in case where semester was not provided (usual case)
     /*$personalMinLink = $this->linkValues['campusPersonalJumpLink'];
             $personalMinLink = str_replace( 'SSS', $this->semester_id, $personalMinLink ); // in case where semester was not provided (usual case)
             
             $campusWideLink =  $this->linkValues['campusWideJumpLink'];
             $campusWideLink =  str_replace( 'SSS', $this->semester_id, $campusWideLink ); // in case where semester was not provided (usual case)
             
             $indicatedDecLink =  $this->linkValues['indicatedDecLink'];
             $indicatedDecLink =  str_replace( 'SSS', $this->semester_id, $indicatedDecLink ); // in case where semester was not provided (usual case)
     
             $this->template->set('linksArray', array('[personalMin]'=>$personalMinLink, '[campusWideMin]'=>$campusWideLink, '[decLink]'=>$indicatedDecLink ) );*/
     $this->template->set('linksArray', array('[campusSummaryJumpLink]' => $campusSummaryJumpLink));
     // semester list
     $jumpLink = $this->linkValues['semesterJumpLink'];
     $semesterArray = array();
     $semesterManager = new RowManager_SemesterManager();
     $semesterListIterator = $semesterManager->getListIterator();
     $semesterListIterator->setFirst();
     while ($semesterListIterator->moveNext()) {
         $semesterObject = $semesterListIterator->getCurrent(new RowManager_SemesterManager());
         $semesterArray[$jumpLink . $semesterObject->getID()] = $semesterObject->getLabel();
     }
     // echo '<pre>'.print_r($campusArray, true ).'</pre>';
     $this->template->set('list_semester_id', $semesterArray);
     // region list
     $jumpLink = $this->linkValues['regionJumpLink'];
     $regionManager = new RowManager_RegionManager();
     $regionListIt = new ListIterator($regionManager);
     $regionArray = $regionListIt->getDropListArray(null, $jumpLink);
     // echo '<pre>'.print_r( $regionArray, true ).'</pre>';
     $this->template->set('list_region_id', $regionArray);
     // uncomment this line if you are creating a template for this page
     $templateName = 'page_RegionalSemesterReport.php';
     // otherwise use the generic site template
     //$templateName = '';
     return $this->template->fetch($templateName);
 }
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     //$path = $this->pathModuleRoot.'templates/';
     // Otherwise use the standard Templates for the site:
     $path = SITE_PATH_TEMPLATES;
     /*
      * store the link values
      */
     // example:
     // $this->linkValues[ 'view' ] = 'add/new/href/data/here';
     // store the link labels
     $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]');
     $this->linkLabels['del'] = $this->labels->getLabel('[Delete]');
     $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]');
     // $this->linkLabels[ 'view' ] = 'new link label here';
     /*
      * store any additional link Columns
      */
     // example:
     //$title = $this->labels->getLabel( '[title_groups]');
     //$columnLabel = $this->labels->getLabel( '[groups]');
     //$link = $this->linkValues[ 'groups' ];
     //$fieldName = 'accessgroup_id';
     //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName);
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     // 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()
 {
     // 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;
     // get a list of all the semesters associated with this year
     $semesterManager = new RowManager_SemesterManager();
     $semesterManager->setYearID($this->year_id);
     $semesterList = $semesterManager->getListIterator();
     $semesterArray = $semesterList->getDropListArray();
     // echo "<pre>".print_r( $semesterArray, true)."</pre>";
     // changed on June 4, 2009 by RM to reflect that we are now longer collecting certain fields
     // $semStatsFieldsOfInterest = "semesterreport_avgPrayer,semesterreport_avgWklyMtg,semesterreport_numStaffChall,semesterreport_numInternChall,semesterreport_numFrosh,semesterreport_numStaffDG,semesterreport_numInStaffDG,semesterreport_numStudentDG,semesterreport_numInStudentDG,semesterreport_numSpMultStaffDG,semesterreport_numSpMultStdDG";
     $semStatsFieldsOfInterest = "semesterreport_numStaffChall,semesterreport_numInternChall,semesterreport_numFrosh,semesterreport_numSpMultStaffDG,semesterreport_numSpMultStdDG";
     $semStatsFieldArray = explode(",", $semStatsFieldsOfInterest);
     // changed on June 4, 2009 by RM to reflect that we are no longer collecting certain fields
     // $perStatsFieldsOfInterest = "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";
     $perStatsFieldsOfInterest = "weeklyReport_1on1SpConv,weeklyReport_1on1SpConvStd,weeklyReport_1on1GosPres,weeklyReport_1on1GosPresStd,weeklyReport_1on1HsPres";
     $perStatsFieldArray = explode(",", $perStatsFieldsOfInterest);
     $prcTotals = array();
     $semesterStatsArray = array();
     foreach ($semesterArray as $semesterID => $desc) {
         // init the personal stats array
         foreach ($perStatsFieldArray as $key => $fieldName) {
             $personalMinStatsArray[$fieldName][$semesterID] = 0;
         }
         // GET INDICATED DECISIONS
         $prcManager = new RowManager_PRCManager();
         $prcManager->setSemester($semesterID);
         $prcManager->setCampus($this->campus_id);
         $prcList = $prcManager->getListIterator();
         $totalPRC = $prcList->getNumRows();
         $prcTotals[$semesterID] = $totalPRC;
         // GET SEMESTER STATS
         $semReportManager = new RowManager_SemesterReportManager($semesterID, $this->campus_id);
         $semReportManager->setFieldsOfInterest($semStatsFieldsOfInterest);
         $valuesArray = $semReportManager->getArrayOfValues();
         // echo "<pre>".print_r( $valuesArray, true)."</pre>";
         foreach ($semStatsFieldArray as $key => $fieldName) {
             $num = 0;
             if (isset($valuesArray[$fieldName])) {
                 $num = $valuesArray[$fieldName];
             }
             $semesterStatsArray[$fieldName][$semesterID] = $num;
         }
         // foreach semStatsFieldArray
         // GET CAMPUS TEAM EXPOSURE STATS
         $exposureTypeManager = new RowManager_ExposureTypeManager();
         $exIt = $exposureTypeManager->getListIterator();
         $exIt->setFirst();
         while ($exIt->moveNext()) {
             $anEx = $exIt->getCurrent(new RowManager_ExposureTypeManager());
             $typeID = $anEx->getID();
             $weekManager = new RowManager_WeekManager();
             $weekManager->setSemesterID($semesterID);
             $moreStatsManager = new RowManager_MoreStatsManager();
             $moreStatsManager->setExposureTypeID($typeID);
             $moreStatsManager->setCampusID($this->campus_id);
             $multiTableManager = new MultiTableManager();
             $multiTableManager->addRowManager($weekManager);
             $multiTableManager->addRowManager($moreStatsManager, new JoinPair($weekManager->getJoinOnWeekID(), $moreStatsManager->getJoinOnWeekID()));
             $listIterator = $multiTableManager->getListIterator();
             $listIterator->setFirst();
             $dataArray = array();
             $expTotal = 0;
             while ($listIterator->moveNext()) {
                 $anItem = $listIterator->getCurrent(new RowManager_MoreStatsManager());
                 $expTotal += $anItem->getNumExposures();
             }
             $campusTeamMinArray[$anEx->getLabel()][$semesterID] = $expTotal;
         }
         // all exposureTypes
         // GET PERSONAL MINISTRY STATS
         $weekManager = new RowManager_WeekManager();
         $weekManager->setSemesterID($semesterID);
         $weeklyReport = new RowManager_WeeklyReportManager();
         $weeklyReport->setCampusID($this->campus_id);
         $multiTableManager = new MultiTableManager();
         $multiTableManager->addRowManager($weekManager);
         $multiTableManager->addRowManager($weeklyReport, new JoinPair($weekManager->getJoinOnWeekID(), $weeklyReport->getJoinOnWeekID()));
         $listIterator = $multiTableManager->getListIterator();
         $listIterator->setFirst();
         $expTotal = 0;
         while ($listIterator->moveNext()) {
             $aReport = $listIterator->getCurrent(new RowManager_WeeklyReportManager());
             $dataArray = $aReport->getArrayOfValues();
             foreach ($perStatsFieldArray as $key => $fieldName) {
                 $personalMinStatsArray[$fieldName][$semesterID] += $dataArray[$fieldName];
             }
         }
     }
     // foreach semesterArray
     $prcArray = array("Indicated Decisions" => $prcTotals);
     /*
      * Update any label tags ...
      */
     // example:
     // $name = $user->getName();
     // $this->labels->setLabelTag( '[Title]', '[userName]', $name);
     $campusJumpLinkSelectedValue = $this->linkValues['campusJumpLink'] . $this->campus_id;
     $yearJumpLinkSelectedValue = $this->linkValues['yearJumpLink'] . $this->year_id;
     // NOTE:  this parent method prepares the $this->template with the
     // common Display data.
     $this->prepareTemplate($path);
     $this->template->set('semesterArray', $semesterArray);
     // the actual stats
     $this->template->set('personalMinStatsArray', $personalMinStatsArray);
     $this->template->set('prcArray', $prcArray);
     $this->template->set('campusTeamMinArray', $campusTeamMinArray);
     $this->template->set('semesterStatsArray', $semesterStatsArray);
     $this->template->set('semStatsLink', $this->linkValues['semStatsLink']);
     $this->template->set('campusTeamLink', $this->linkValues['campusTeamLink']);
     $this->template->set('indDecLink', $this->linkValues['indDecLink']);
     $this->template->set('personalMinLink', $this->linkValues['personalMinLink']);
     $this->template->set('campusJumpLinkSelectedValue', $campusJumpLinkSelectedValue);
     $this->template->set('yearJumpLinkSelectedValue', $yearJumpLinkSelectedValue);
     // campus list
     $jumpLink = $this->linkValues['campusJumpLink'];
     $campusArray = array();
     $this->campusListIterator->setFirst();
     while ($this->campusListIterator->moveNext()) {
         $campusObject = $this->campusListIterator->getCurrent(new RowManager_CampusManager());
         $region_id = $campusObject->getRegionID();
         // only include Canadian campuses
         if ($region_id == 1 || $region_id == 2 || $region_id == 3) {
             $campusArray[$jumpLink . $campusObject->getID()] = $campusObject->getLabel();
         }
     }
     // echo '<pre>'.print_r($campusArray, true ).'</pre>';
     $this->template->set('list_campus_id', $campusArray);
     // year list
     $jumpLink = $this->linkValues['yearJumpLink'];
     $yearArray = array();
     $yearManager = new RowManager_YearManager();
     $this->yearListIterator = $yearManager->getListIterator();
     $this->yearListIterator->setFirst();
     while ($this->yearListIterator->moveNext()) {
         $yearObject = $this->yearListIterator->getCurrent(new RowManager_YearManager());
         $yearArray[$jumpLink . $yearObject->getID()] = $yearObject->getLabel();
     }
     // echo '<pre>'.print_r($campusArray, true ).'</pre>';
     $this->template->set('list_year_id', $yearArray);
     // uncomment this line if you are creating a template for this page
     $templateName = 'page_CampusYearSummary.php';
     // otherwise use the generic site template
     //$templateName = '';
     return $this->template->fetch($templateName);
 }
Example #8
0
  * weeklyReport_1on1SpConv [INTEGER]  number of 1-1 spiritual conversations this week
  * weeklyReport_1on1GosPres [INTEGER]  number of 1 on 1 gospel presentations this week
  * weeklyReport_1on1HsPres [INTEGER]  number of 1 on 1 Holy Spirit presentations
  */
 $WeeklyReport = new RowManager_WeeklyReportManager();
 $WeeklyReport->dropTable();
 $WeeklyReport->createTable();
 /*
  * Week Table
  *
  * Manages information related to a week
  *
  * week_id [INTEGER]  unique id of the week
  * week_endDate [DATE]  Ending date of the week
  */
 $Week = new RowManager_WeekManager();
 $Week->dropTable();
 $Week->createTable();
 /*
  * Semester Table
  *
  * Manages information related to semesters
  *
  * semester_id [INTEGER]  unique id of a semester
  * semester_desc [STRING]  Textual description of the semester
  */
 $Semester = new RowManager_SemesterManager();
 $Semester->dropTable();
 $Semester->createTable();
 /*
  * SemesterReport Table