コード例 #1
0
 /**
  * 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, $registrant_formAction, $sortBy, $event_id, $campus_id = "", $isInRegProcess = 'FALSE', $reg_id = '')
 {
     // 	     $fieldList = page_EditCampusRegistrations::FORM_FIELDS;
     //        $fieldTypes = page_EditCampusRegistrations::FORM_FIELD_TYPES;
     $displayFields = page_EditCampusRegistrations::DISPLAY_FIELDS;
     parent::__construct($displayFields);
     //$formAction,  $fieldList,
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $this->registrant_formAction = $registrant_formAction;
     $this->sortBy = $sortBy;
     $this->event_id = $event_id;
     $this->campus_id = $campus_id;
     $this->is_in_reg_process = $isInRegProcess;
     $this->reg_id = $reg_id;
     //        $this->managerInit = $managerInit;
     //        $dataAccessObject = new RowManager_RegistrationManager();
     //        $dataAccessObject->setSortOrder( $sortBy );
     //        $this->listManager = new RegistrationList( $sortBy );
     //        $this->listManager = $dataAccessObject->getListIterator();
     $registration = new RowManager_RegistrationManager();
     $registration->setSortOrder($sortBy);
     $registration->setEventID($this->event_id);
     $person = new RowManager_PersonManager();
     $assignment = new RowManager_AssignmentsManager();
     // assigns campus to person
     $campus = new RowManager_CampusManager();
     //   $campus->setCampusID($this->campus_id);
     $cash_trans = new RowManager_CashTransactionManager();
     $cc_trans = new RowManager_CreditCardTransactionManager();
     $status = new RowManager_StatusManager();
     // join 6 tables together:
     //cim_reg_registration, cim_hrdb_person, cim_hrdb_assignment, cim_hrdb_campus,
     //cim_reg_cashtransaction, and cim_reg_cctransaction  (and cim_reg_status)
     $campusRegs = new MultiTableManager();
     /*        $campusRegs->addRowManager( $registration, new JoinPair( $person->getJoinOnPersonID(), $registration->getJoinOnPersonID()));        
             $campusRegs->addRowManager( $person, new JoinPair( $assignment->getJoinOnPersonID(), $person->getJoinOnPersonID() ) );
             $campusRegs->addRowManager( $assignment, new JoinPair( $campus->getJoinOnCampusID(), $assignment->getJoinOnCampusID() ) );
             $campusRegs->addRowManager( $cash_trans, new JoinPair( $registration->getJoinOnRegID(), $cash_trans->getJoinOnRegID() ) );
     /*        $campusRegs->addRowManager( $cc_trans, new JoinPair( $registration->getJoinOnRegID(), $cc_trans->getJoinOnRegID() ) );
     */
     /**/
     $campusRegs->addRowManager($campus);
     $campusRegs->addRowManager($assignment, new JoinPair($campus->getJoinOnCampusID(), $assignment->getJoinOnCampusID(), JOIN_TYPE_LEFT));
     $campusRegs->addRowManager($person, new JoinPair($assignment->getJoinOnPersonID(), $person->getJoinOnPersonID(), JOIN_TYPE_LEFT));
     $campusRegs->addRowManager($registration, new JoinPair($person->getJoinOnPersonID(), $registration->getJoinOnPersonID(), JOIN_TYPE_LEFT));
     $campusRegs->addRowManager($cash_trans, new JoinPair($registration->getJoinOnRegID(), $cash_trans->getJoinOnRegID(), JOIN_TYPE_LEFT));
     $campusRegs->addRowManager($cc_trans, new JoinPair($registration->getJoinOnRegID(), $cc_trans->getJoinOnRegID(), JOIN_TYPE_LEFT));
     $campusRegs->addRowManager($status, new JoinPair($registration->getJoinOnStatus(), $status->getJoinOnStatusID(), JOIN_TYPE_LEFT));
     if ($this->campus_id != '') {
         $campusRegs->constructSearchCondition('campus_id', '=', $this->campus_id, true);
     }
     // (below) ensures no duplicate entries appear in case of multiple payments
     // TODO: figure out which record is displayed....
     $campusRegs->setGroupBy('registration_id');
     //         $campusRegs->setSortOrder( $sortBy );
     $campusRegs->setPrimaryKeyField('registration_id');
     if ($sortBy == 'registration_balance') {
         $campusRegs->addSortField($sortBy, 'DESC');
         // sort balances from greatest to least
     } else {
         $campusRegs->addSortField($sortBy);
         // sort field from least to greatest value
     }
     //     $multiTableManager2->setLabelTemplate('viewer_userID', '[viewer_userID]');
     $this->listManager = $campusRegs->getListIterator();
     $regsArray = $this->listManager->getDataList();
     //          echo "<pre>".print_r($this->listManager,true)."</pre>";
     //         echo "<pre>".print_r($regsArray,true)."</pre>";
     // cycle through registrations and store balance owing for each
     $this->owingArray = array();
     $priceGetter = new FinancialTools();
     $results = array();
     $temp = array();
     reset($regsArray);
     foreach (array_keys($regsArray) as $k) {
         $reg = current($regsArray);
         //				echo 'regID = '.$reg['registration_id'];
         $reg_id = $reg['registration_id'];
         $param = null;
         $array = array();
         $owed = $reg['registration_balance'];
         // $priceGetter->simpleCalcBalanceOwing($reg_id, $this->event_id, $this->campus_id);
         $this->owingArray[$reg_id] = $owed;
         next($regsArray);
     }
     //			echo "<pre>".print_r($this->owingArray,true)."</pre>";
     // create references to sub-page object: registrant drop-down list
     //			$this->registrants_dropList = new FormProcessor_EditCampusRegistrations_OffflineRegBox( $this->pathModuleRoot, $this->viewer, $formAction);
     // 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 = modulecim_reg::MULTILINGUAL_PAGE_FIELDS;
     $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey);
     // then load the page specific labels for this page
     $pageKey = page_EditCampusRegistrations::MULTILINGUAL_PAGE_KEY;
     $this->labels->loadPageLabels($pageKey);
     $this->labels->setSeriesKey(SITE_LABEL_SERIES_SITE);
     $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORM_LINKS);
 }