예제 #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, $sortBy)
 {
     parent::__construct(page_AdminHome::DISPLAY_FIELDS);
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $privManager = new PrivilegeManager($this->viewer->getID());
     $dataAccessObject = new RowManager_EventManager();
     // go through events found for logged-in administrator (if lower level than super-admin)
     //         if ($privManager->isSuperAdmin()==false)	// check privilege level
     //         {
     // 	        $adminEvents = $privManager->getAdminEvents();
     // 	        if ($adminEvents != PrivilegeManager::ALL_EVENTS)
     // 	        {
     // 		        for ($i=0; $i < count($adminEvents); $i++)
     // 		        {
     // 		        		$condArray[$i] = $dataAccessObject->constructSearchCondition( 'event_id', '=', $adminEvents[$i]);
     // 		     		}
     // 	     	  		$dataAccessObject->constructSearchConditionFromArray( $condArray, 'OR', true );
     //      	  		}
     //   	  		}
     $dataAccessObject->setSortOrder($sortBy);
     //        $this->listManager = new EventList( $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_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_AdminHome::MULTILINGUAL_PAGE_KEY;
     $this->labels->loadPageLabels($pageKey);
     $this->labels->setSeriesKey(SITE_LABEL_SERIES_SITE);
     $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORM_LINKS);
 }
 /**
  * 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, $person_id, $ministry_id = '')
 {
     parent::__construct(page_HomePageEventList::DISPLAY_FIELDS);
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $this->sortBy = $sortBy;
     $this->person_id = $person_id;
     $this->ministry_id = $ministry_id;
     //        $this->managerInit = $managerInit;
     /** Disable events from being shown if registration date&time have passed **/
     // Filter for shown events that have closed registration or have already started
     // 		   $this->timeSearchCondition = '((event_regEnd < now()) or (event_startDate < now()))';
     //
     //          $events0 = new RowManager_EventManager();
     //          $events0->setOnHomePage('1');
     //          $events0->addSearchCondition($this->timeSearchCondition);
     //
     //          $disable_events_list = $events0->getListIterator();
     //          $disable_events_array = $disable_events_list->getDataList();
     //          reset($disable_events_array);
     //          foreach (array_keys($disable_events_array) as $k)	// go through all events and map user registered status
     //          {
     //             $record = current($disable_events_array);
     //             $eventID = $record['event_id'];
     //
     //      			$event_updater = new RowManager_EventManager($eventID);
     //
     //      			$updateValues = array();
     //      			$updateValues['event_onHomePage'] = '0';	// update the event row to DISABLE display
     //      			$event_updater->loadFromArray( $updateValues );
     //         		$event_updater->updateDBTable();
     //
     //             next($disable_events_array);
     //          }
     /*** Get the countries linked to the campuses that this viewer is associated with **/
     $eventFilter = new MultiTableManager();
     $assignments = new RowManager_AssignmentsManager();
     $assignments->setPersonID($this->person_id);
     $campuses = new RowManager_CampusManager();
     $regions = new RowManager_RegionManager();
     $countries = new RowManager_CountryManager();
     $eventFilter->addRowManager($countries);
     $eventFilter->addRowManager($regions, new JoinPair($countries->getJoinOnCountryID(), $regions->getJoinOnCountryID()));
     $eventFilter->addRowManager($campuses, new JoinPair($regions->getJoinOnRegionID(), $campuses->getJoinOnRegionID()));
     $eventFilter->addRowManager($assignments, new JoinPair($assignments->getJoinOnCampusID(), $campuses->getJoinOnCampusID()));
     $countryList = $eventFilter->getListIterator();
     $countryArray = $countryList->getDataList();
     $country_filter = '';
     reset($countryArray);
     foreach (array_keys($countryArray) as $k) {
         $record = current($countryArray);
         $country_filter .= $record['country_id'] . ',';
         next($countryArray);
     }
     $country_filter = substr($country_filter, 0, -1);
     $dataAccessObject = new RowManager_EventManager();
     // only display those rows that are supposed to be displayed on the home page
     $dataAccessObject->setOnHomePage(true);
     if ($this->ministry_id != '') {
         $dataAccessObject->setMinistryID($this->ministry_id);
     }
     if ($country_filter == '') {
         $country_filter = 1;
     }
     $this->countrySearchCondition = 'country_id in (' . $country_filter . ')';
     $dataAccessObject->addSearchCondition($this->countrySearchCondition);
     $dataAccessObject->setSortOrder($sortBy);
     //        $this->listManager = new EventList( $sortBy );
     $this->listManager = $dataAccessObject->getListIterator();
     $events_array = $this->listManager->getDataList();
     if (count($events_array) > 0) {
         $this->isShowingEvents = true;
     } else {
         $this->isShowingEvents = false;
     }
     // 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_HomePageEventList::MULTILINGUAL_PAGE_KEY;
     $this->labels->loadPageLabels($pageKey);
     $this->labels->setSeriesKey(SITE_LABEL_SERIES_SITE);
     $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORM_LINKS);
 }