/**
  * 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, $formAction, $event_id, $person_id)
 {
     parent::__construct();
     // initialzie the object values
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $this->person_id = $person_id;
     $this->event_id = $event_id;
     $this->formAction = $formAction;
     $this->displayFields = page_ConfirmCancelRegistration::DISPLAY_FIELDS;
     $this->shouldCancel = false;
     $this->wasSubmitted = false;
     // create the item Manager to display
     $regs = new RowManager_RegistrationManager();
     $regs->setPersonID($this->person_id);
     $regs->setEventID($this->event_id);
     $regList = $regs->getListIterator();
     $regArray = $regList->getDataList();
     reset($regArray);
     $record = current($regArray);
     // should be single record per person per event
     $this->reg_id = $record['registration_id'];
     // init. data manager object
     $this->itemManager = new RowManager_RegistrationManager($this->reg_id);
     // 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_ConfirmCancelRegistration::MULTILINGUAL_PAGE_KEY;
     $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey);
     // then load the page specific labels for this page
     $this->labels->loadPageLabels($pageKey);
     // add Site YES/NO labels
     $this->labels->setSeriesKey(SITE_LABEL_SERIES_SITE);
     $this->labels->loadPageLabels(SITE_LABEL_PAGE_LIST_YESNO);
 }
 protected function getRegistrationID($personID)
 {
     $regID = -1;
     if ($personID != -1) {
         // get registration ID for the rest of the reg. process
         $regs = new RowManager_RegistrationManager();
         $regs->setPersonID($this->person_id);
         $regsList = $regs->getListIterator();
         $regsArray = $regsList->getDataList();
         $statusID = 0;
         reset($regsArray);
         foreach (array_keys($regsArray) as $k) {
             $reg = current($regsArray);
             $regID = $reg['registration_id'];
             // NOTE: should only be one reg. per person per event (ENFORCE??)
             // 					$this->registration_id = $regID;
             next($regsArray);
         }
     }
     return $regID;
     // returns latest registration_id
 }
 /**
  * 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);
     // echo "<pre>".print_r($this->linkValues, true)."</pre>";
     $title = $this->labels->getLabel('[Details]');
     $columnLabel = $this->labels->getLabel('[View]');
     $link = $this->linkValues['view'];
     $fieldName = 'event_id';
     $this->addLinkColumn($title, $columnLabel, $link, $fieldName);
     $REGISTERED = 2;
     //'true';
     $INCOMPLETE = 1;
     $NOT_REGISTERED = 0;
     //'false';
     /**  determine which events the user has already registered for...  **/
     $events = new RowManager_EventManager();
     $events->setOnHomePage('1');
     $events->addSearchCondition($this->countrySearchCondition);
     //             $events->setSortOrder( $this->sortBy );	// needed to sync lists
     $regs = new RowManager_RegistrationManager();
     $regs->setPersonID($this->person_id);
     $status = new RowManager_StatusManager();
     $status->setStatusDesc(RowManager_StatusManager::REGISTERED);
     $reg_events = new MultiTableManager();
     $reg_events->addRowManager($events);
     $reg_events->addRowManager($regs, new JoinPair($events->getJoinOnEventID(), $regs->getJoinOnEventID()));
     $reg_events->addRowManager($status, new JoinPair($regs->getJoinOnStatus(), $status->getJoinOnStatusID()));
     if (!isset($this->sortBy) || $this->sortBy == '') {
         $this->sortBy = 'event_id';
     }
     $reg_events->setSortOrder($this->sortBy);
     // needed to sync lists
     //             echo "reg events sql = ".$reg_events->createSQL();
     $regs_events_list = $reg_events->getListIterator();
     $regs_events_array = $regs_events_list->getDataList();
     /** determine which events the user has PARTIALLY completed registration for ***/
     $events2 = new RowManager_EventManager();
     $events2->setOnHomePage('1');
     $events2->addSearchCondition($this->countrySearchCondition);
     //             $events->setSortOrder( $this->sortBy );	// needed to sync lists
     $regs2 = new RowManager_RegistrationManager();
     $regs2->setPersonID($this->person_id);
     $status2 = new RowManager_StatusManager();
     $status2->setStatusDesc(RowManager_StatusManager::INCOMPLETE);
     $reg_events2 = new MultiTableManager();
     $reg_events2->addRowManager($events2);
     $reg_events2->addRowManager($regs2, new JoinPair($events2->getJoinOnEventID(), $regs2->getJoinOnEventID()));
     $reg_events2->addRowManager($status2, new JoinPair($regs2->getJoinOnStatus(), $status2->getJoinOnStatusID()));
     $reg_events2->setSortOrder($this->sortBy);
     // needed to sync lists
     //             echo "reg events sql = ".$reg_events->createSQL():
     $incomplete_regs_events_list = $reg_events2->getListIterator();
     $incompete_regs_events_array = $incomplete_regs_events_list->getDataList();
     //            echo '<pre>'.print_r($incompete_regs_events_array, true).'</pre>';
     // get full event-listing for mapping isRegistered to
     $allEvents = $this->listManager->getDataList();
     //
     //           echo 'reg events = <pre>'.print_r($regs_events_array,true).'</pre><br>';
     //             echo 'all events = <pre>'.print_r($allEvents, true).'</pre><br>';
     $eventName_isReg_array = array();
     reset($regs_events_array);
     reset($incompete_regs_events_array);
     reset($allEvents);
     foreach (array_keys($allEvents) as $k) {
         $record = current($allEvents);
         $currentEvent = $record['event_id'];
         $record2 = current($regs_events_array);
         $currentRegEvent = $record2['event_id'];
         $record3 = current($incompete_regs_events_array);
         $currentIncRegEvent = $record3['event_id'];
         $eventName = $record['event_name'];
         // store event in registered array if mapping found
         if ($currentEvent == $currentRegEvent) {
             $eventName_isReg_array[$eventName] = $REGISTERED;
             next($regs_events_array);
         } else {
             if ($currentEvent == $currentIncRegEvent) {
                 $eventName_isReg_array[$eventName] = $INCOMPLETE;
                 next($incompete_regs_events_array);
             } else {
                 $eventName_isReg_array[$eventName] = $NOT_REGISTERED;
             }
         }
         next($allEvents);
     }
     //             echo "events: <PRE>".print_r($eventName_isReg_array,true)."</PRE>";
     $title = $this->labels->getLabel('[RegisterAccess]');
     $columnLabels = array();
     $columnLabels[$NOT_REGISTERED] = $this->labels->getLabel('[Register]');
     $columnLabels[$INCOMPLETE] = $this->labels->getLabel('[FinishReg]');
     $columnLabels[$REGISTERED] = $this->labels->getLabel('[EditReg]');
     // formerly [CancelReg]
     $links = array();
     $links[$NOT_REGISTERED] = $this->linkValues['register'];
     $links[$INCOMPLETE] = $this->linkValues['complete'];
     $links[$REGISTERED] = $this->linkValues['edit_reg'];
     // formerly 'cancel'
     // field column names to map to link name (i.e. filter by event to determine if link name should change based on reg status)
     $fieldNames = array();
     $fieldNames[$NOT_REGISTERED] = 'event_id';
     $fieldNames[$INCOMPLETE] = 'event_id';
     $fieldNames[$REGISTERED] = 'event_id';
     //  OLD:           $this->addLinkColumn( $title, $columnLabel, $link, $fieldName,  $useAlt, $alt_label, $link_alt, $fieldAlt);
     $this->addDynamicLinkColumn($title, $columnLabels, $links, $fieldNames);
     // link an array of filters to a particular link column
     $linkColumnFilter[$title] = $eventName_isReg_array;
     //          echo '<pre>'.print_r($linkColumnFilter, true).'</pre>';
     // 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);
     // set the filter list used to determine which events have 'register' links and which have 'cancel' links
     $this->template->set('linkColumnFilter', $linkColumnFilter);
     // store the Row Manager's XML Node Name
     $this->template->set('rowManagerXMLNodeName', RowManager_EventManager::XML_NODE_NAME);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'event_id');
     /*
      *  Set up any additional data transfer to the Template here...
      */
     $this->template->set('disableHeading', true);
     $templateName = 'siteDataList.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_HomePageEventList.php';
     return $this->template->fetch($templateName);
 }
Esempio n. 4
0
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  *
  * ON JAN 2, 2008 Russ made two changes to this page to restore the original functionality... they are documented below.
  * ON JAN 8, 2008 Hobbe added conditional statements to allow registration record searches IF viewer has Reg. Sys. Super Admin privs.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     $privManager = new PrivilegeManager($this->viewer->getID());
     if ($privManager->isSuperAdmin() == true) {
         $path = SITE_PATH_TEMPLATES;
     } else {
         // Changed by RM from using the assignment below on Jan 2, 2008.
         $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->registration_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_RegistrationManager::XML_NODE_NAME;
     $this->template->set('rowManagerXMLNodeName', $xmlNodeName);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'registration_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.
     if ($this->person_id != '') {
         $dataAccessManager = new RowManager_RegistrationManager();
         $dataAccessManager->setPersonID($this->person_id);
         $dataAccessManager->setSortOrder($this->sortBy);
         //        $this->dataList = new PriceRuleList( $this->sortBy );
         $this->dataList = $dataAccessManager->getListIterator();
         $this->template->setXML('dataList', $this->dataList->getXML());
     }
     //         else
     //         {
     // 	        $this->dataList = array();
     // // 	        $this->template->setXML( 'dataList', $this->dataList->getXML() );
     //         }
     /*
      * Add any additional data required by the template here
      */
     $person = new RowManager_PersonManager();
     $person->setLabelTemplateLastNameFirstName();
     //         $field->setPersonID( $this->person_id);
     $person->setSortOrder('person_lname, person_fname');
     $personList = new ListIterator($person);
     $personArray = $personList->getDropListArray();
     $this->template->set('list_person_id', $personArray);
     $notice = "<br><b>NOTE:</b> Duplicate names may appear if a person has multiple records.";
     $this->template->set('note_person_id', $notice);
     $event = new RowManager_EventManager();
     //         $field->setPersonID( $this->person_id);
     $eventList = new ListIterator($event);
     $eventArray = $eventList->getDropListArray();
     $this->template->set('list_event_id', $eventArray);
     $status = new RowManager_StatusManager();
     $statusList = new ListIterator($status);
     $statusArray = $statusList->getDropListArray();
     $this->template->set('list_registration_status', $statusArray);
     //
     //         $nameFields = 'person_lname,person_fname';
     //         $template = '[person_lname], [person_fname]';
     //         $this->dataManager->setLabelTemplate( $nameFields, $template );
     if ($privManager->isSuperAdmin() == true) {
         $templateName = 'siteSearchFormDataList.php';
         //'page_HrdbHome.php';
     } else {
         // Changed by RM on Jan 2, 2008 - We can't have just anybody being able to access this data.
         $templateName = 'page_HrdbHome.php';
     }
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_EditPriceRules.php';
     return $this->template->fetch($templateName);
 }