* activitytype_id [INTEGER]  The activity's type (i.e. "vacation")
  */
 $StaffActivity = new RowManager_StaffActivityManager();
 $StaffActivity->dropTable();
 $StaffActivity->createTable();
 /*
  * StaffScheduleType Table
  *
  * The HRDB schedule/form type.
  *
  * staffscheduletype_id [INTEGER]  Unique ID for this form/schedule type
  * staffscheduletype_desc [STRING]  Description of the staff form/schedule type.
  * staffscheduletype_startdate [DATE]  The min. start date for the schedule/form context
  * staffscheduletype_enddate [DATE]  The max ending date for the schedule/form.
  */
 $StaffScheduleType = new RowManager_StaffScheduleTypeManager();
 $StaffScheduleType->dropTable();
 $StaffScheduleType->createTable();
 /*
  * StaffSchedule Table
  *
  * A particular staff person's schedule
  *
  * staffschedule_id [INTEGER]  Unique id of the person's schedule
  * person_id [INTEGER]  The id of the person associated with this schedule
  * staffscheduletype_id [INTEGER]  the id of the form associated with this personal schedule
  * staffschedule_approved [BOOL]  boolean indicating director's approval
  * staffschedule_approvedby [INTEGER]  the person_id of the director approving the schedule
  * staffschedule_lastmodifiedbydirector [DATE]  the timestamp of the last change *made by a director*
  * staffschedule_approvalnotes [STRING]  notes made by the director regarding approval
  */
 /**
  * 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
     $title = $this->labels->getLabel('[Access]');
     $columnLabel = $this->labels->getLabel('[View]');
     $link = $this->linkValues['view'];
     $fieldName = 'staffschedule_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', MultiTableManager::XML_NODE_NAME);
     //RowManager_StaffScheduleManager
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'staffschedule_id');
     // Get the real form name and add to page as sub-heading
     $form_name = '';
     if ($this->formtype_id != '') {
         $formContext = new RowManager_StaffScheduleTypeManager($this->formtype_id);
         $form_name = $formContext->getFormName();
     }
     $this->template->set('subheading', $form_name);
     /*
      *  Set up any additional data transfer to the Template here...
      */
     //TODO: replace this with a reference to a multi_lingual label constant array...
     $boolArray = array();
     $boolArray['0'] = 'no';
     $boolArray['1'] = 'yes';
     $this->template->set('list_staffschedule_approved', $boolArray);
     $personManager = new RowManager_PersonManager();
     $personManager->setSortOrder('person_lname');
     $personManager->setLabelTemplateLastNameFirstName();
     $personList = $personManager->getListIterator();
     $personArray = $personList->getDropListArray();
     $this->template->set('list_person_id', $personArray);
     $templateName = 'siteDataList.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_FormApprovalListing.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()
 {
     // Make a new Template object
     //$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]' );
     if (!isset($this->linkLabels['cont'])) {
         $this->linkLabels['cont'] = $this->labels->getLabel('[Back]');
         // [Continue]
     }
     // $this->linkLabels[ 'view' ] = 'new link label here';
     $this->prepareTemplate($path);
     // Set form approval status message
     // 		$form_approved = "Approval Pending";
     // 		if ($this->is_form_approved == true)
     // 		{
     // 			$form_approved = "Form Approved";
     // 		}
     // 		$this->template->set('form_approval_msg', $form_approved );
     //
     // Display message if form has just been submitted
     if ($this->form_submitted == true) {
         $statusMessage = 'Form information successfully submitted.';
         $this->template->set('form_status_msg', $statusMessage);
         $this->form_submitted = false;
     }
     // Set the sub-page objects
     $this->template->set('basicStaffForm', $this->generateTopForm());
     if ($this->has_activity_form == true) {
         $this->template->set('scheduledActivityForm', $this->generateBottomForm());
     }
     // Set approval form information
     $is_approved = '';
     $approved_by = '';
     $last_change = '';
     $approval_array = $this->listManager->getDataList();
     reset($approval_array);
     foreach (array_keys($approval_array) as $k) {
         $record = current($approval_array);
         $approved = $record['staffschedule_approved'];
         if ($approved == '1') {
             $is_approved = 'CHECKED';
         }
         $approved_by = $record['staffschedule_approvedby'];
         $last_change = $record['staffschedule_lastmodifiedbydirector'];
         $approval_notes = $record['staffschedule_approvalnotes'];
         next($approval_array);
     }
     $personManager = new RowManager_PersonManager($approved_by);
     $personManager->setSortOrder('person_lname');
     $personManager->setLabelTemplateLastNameFirstName();
     $approved_by = $personManager->getPersonFirstName() . ' ' . $personManager->getPersonLastName();
     //         $personList = $personManager->getListIterator( );
     //         $personArray = $personList->getDropListArray( );
     //         $this->template->set( 'list_approved_by', $personArray );
     $this->template->set('approvalFormAction', $this->formAction);
     $this->template->set('is_approved', $is_approved);
     $this->template->set('approvalButtonText', 'Approve/Disapprove');
     $this->template->set('approval_notes', $approval_notes);
     $this->template->set('director_field', 'Last Change By');
     $this->template->set('approved_by', $approved_by);
     $this->template->set('time_field', 'Last Change At');
     if ($last_change != '') {
         $date_regex = '/[2-9]([0-9]{3})\\-[0-9]{1,2}\\-[0-9]{1,2}/';
         if (preg_match($date_regex, $last_change) >= 1) {
             $time = strtotime($last_change);
             $last_change = strftime("%d %b %Y  %H:%M:%S", $time);
         }
     }
     $this->template->set('last_change', $last_change);
     // 			$this->template->set('last_change', $last_change);
     // 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);
     // 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', 'person_id');
     // 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);
     // Get the real form name
     $form_name = '';
     if ($this->form_id != '') {
         $formContext = new RowManager_StaffScheduleTypeManager($this->form_id);
         $form_name = $formContext->getFormName();
     }
     // Get the person's name
     $person_name = '';
     if ($this->person_id != '') {
         $personInfo = new RowManager_PersonManager($this->person_id);
         $person_name = $personInfo->getPersonFirstName() . ' ' . $personInfo->getPersonLastName();
     }
     //      	  $form_notice = 'Please note that the "Update" button only updates the top form.<br>The bottom form is updated via its own buttons/links.';
     $this->template->set('heading', $form_name);
     $this->template->set('subheading', $person_name);
     //         $this->template->set( 'formsNotice', $form_notice);
     $templateName = 'page_ApproveStaffSchedule.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 this module's root directory
  * @param $viewer [OBJECT] The viewer object.
  * @param $formAction [STRING] The action on a form submit
  * @param $sortBy [STRING] Field data to sort listManager by.
  * @param $staffactivity_id [STRING] The init data for the dataManager obj
  * @param $person_id [INTEGER] The foreign key data for the data Manager
  * @param $activitytype_id [INTEGER] The foreign key data for the data Manager
  * @return [void]
  */
 function __construct($pathModuleRoot, $viewer, $formAction, $sortBy, $staffactivity_id, $person_id = '', $form_id = '', $personal_form_id = '', $activitytype_id = '', $disableHeading = true, $showContactField = false, $activityTypesFilter = array(), $disableForm = false)
 {
     // NOTE: be sure to call the parent constructor before trying to
     //       use the ->formXXX arrays...
     if ($showContactField == true) {
         $FORM_FIELDS = 'staffactivity_startdate|T|,staffactivity_enddate|T|,staffactivity_contactPhone|T|,activitytype_id|N|,person_id|T|<skip>,form_name|T|<skip>';
         $FORM_FIELD_TYPES = 'datebox,datebox,textbox,droplist,-,hidden';
         $DISPLAY_FIELDS = 'staffactivity_startdate,staffactivity_enddate,staffactivity_contactPhone,activitytype_id';
     } else {
         $FORM_FIELDS = 'staffactivity_startdate|T|,staffactivity_enddate|T|,activitytype_id|N|,person_id|T|<skip>,form_name|T|<skip>';
         $FORM_FIELD_TYPES = 'datebox,datebox,droplist,-,hidden';
         $DISPLAY_FIELDS = 'staffactivity_startdate,staffactivity_enddate,activitytype_id';
     }
     $fieldList = $FORM_FIELDS;
     //FormProcessor_EditStaffActivity::FORM_FIELDS;
     $fieldTypes = $FORM_FIELD_TYPES;
     //FormProcessor_EditStaffActivity::FORM_FIELD_TYPES;
     $displayFields = $DISPLAY_FIELDS;
     //FormProcessor_EditStaffActivity::DISPLAY_FIELDS;
     parent::__construct($viewer, $formAction, $sortBy, $fieldList, $fieldTypes, $displayFields);
     $this->pathModuleRoot = $pathModuleRoot;
     $this->sortBy = $sortBy;
     if ($sortBy == '') {
         $this->sortBy = 'staffactivity_startdate';
     }
     $this->disableForm = $disableForm;
     //         $this->showOnlyVacation = $showOnlyVacation;		// TODO??: replace with activitytype_id = 1
     $this->activityTypesFilter = $activityTypesFilter;
     $this->staffactivity_id = $staffactivity_id;
     $this->person_id = $person_id;
     $this->form_id = $form_id;
     $this->personal_form_id = $personal_form_id;
     // Get person and form type IDs from form instance ID, if applicable
     if ($this->personal_form_id != '') {
         $formInstance = new RowManager_StaffScheduleManager($this->personal_form_id);
         $this->person_id = $formInstance->getPersonID();
         $this->form_id = $formInstance->getFormID();
         // 	        echo 'person_id = '.$this->person_id.'  and   form type id = '.$this->form_id;
     }
     // Set the form instance ID based on other IDs
     if ($this->person_id != '' && $this->form_id != '' && $this->personal_form_id == '') {
         $this->personal_form_id = $personal_form_id;
         $this->scheduleFormManager = new RowManager_StaffScheduleManager();
         $this->scheduleFormManager->setPersonID($this->person_id);
         $this->scheduleFormManager->setFormID($this->form_id);
         $formList = $this->scheduleFormManager->getListIterator();
         $formArray = $formList->getDataList();
         if (count($formArray) > 0) {
             $row = current($formArray);
             // pick first record for grabbing form ID
             $this->personal_form_id = $row['staffschedule_id'];
         }
     }
     $this->activitytype_id = $activitytype_id;
     $this->disableHeading = $disableHeading;
     // figure out the important fields for the dataManager
     $fieldsOfInterest = implode(',', $this->formFields);
     $this->dataManager = new RowManager_StaffActivityManager($this->staffactivity_id);
     //         $this->dataManager->setStaffActivityID($staffactivity_id);
     $this->dataManager->setPersonID($this->person_id);
     if (count($this->activityTypesFilter) > 0) {
         $activityTypesList = implode(',', $this->activityTypesFilter);
         if ($activityTypesList != '') {
             $this->dataManager->addSearchCondition('activitytype_id in (' . $activityTypesList . ')');
         }
     }
     if (!isset($this->form_start_date)) {
         $this->form_start_date = '';
     }
     if (!isset($this->form_start_date)) {
         $this->form_end_date = '';
     }
     if ($form_id != '') {
         $scheduleType = new RowManager_StaffScheduleTypeManager($this->form_id);
         $this->form_start_date = $scheduleType->getStartDate();
         //         		$this->dataManager->addSearchCondition( 'staffactivity_startdate >= '.$form_start_date );
         $this->dataManager->constructSearchCondition('staffactivity_startdate', '>=', $this->form_start_date, true);
         $this->form_end_date = $scheduleType->getEndDate();
         //         		$this->dataManager->addSearchCondition( 'staffactivity_enddate <= '.$form_end_date );
         $this->dataManager->constructSearchCondition('staffactivity_enddate', '<=', $this->form_end_date, true);
         $transformedStartDate = $this->getEasyDate($this->form_start_date);
         $transformedEndDate = $this->getEasyDate($this->form_end_date);
         $this->form_date_range = $transformedStartDate . ' - ' . $transformedEndDate;
     }
     $this->dataManager->setSortOrder($this->sortBy);
     // does nothing, see manager called in getHTML()...
     //      	  $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_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_EditStaffActivity::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 __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, $basicFormAction, $activityFormAction, $sortBy, $person_id, $staffscheduletype_id, $staffschedule_id = '', $fieldvalues_id = '', $fields_id = '', $activity_id = '', $showHidden = true)
 {
     $fieldList = FormProcessor_EditStaffScheduleForm::FORM_FIELDS;
     $fieldTypes = FormProcessor_EditStaffScheduleForm::FORM_FIELD_TYPES;
     $displayFields = FormProcessor_EditStaffScheduleForm::DISPLAY_FIELDS;
     parent::__construct($formAction, $fieldList, $displayFields);
     // initialize the object values
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $this->sortBy = $sortBy;
     $this->formAction = $formAction;
     $this->basic_formAction = $basicFormAction;
     $this->activity_formAction = $activityFormAction;
     //         $this->has_activity_form = $hasActivityForm;
     $this->form_id = $staffscheduletype_id;
     $this->personal_form_id = $staffschedule_id;
     $this->field_id = $fields_id;
     if ($fieldvalues_id != '') {
         $this->fieldvalues_id = $fieldvalues_id;
     }
     if ($activity_id != '') {
         $this->staffactivity_id = $activity_id;
     }
     // just let these be empty if they are passed as empty
     $this->person_id = $person_id;
     $this->has_activity_form = true;
     // set default, could be changed if form info exists
     $this->has_activity_contact_nums = false;
     // set default, could be changed if form info exists
     $this->activity_types_filter = array();
     $this->show_hidden_fields = $showHidden;
     $this->form_submitted = false;
     //          // Get the real form name
     //         $this->hrdbFormTitle = '';
     //         if ($this->form_id != '')
     //         {
     // 	        $formContext = new RowManager_StaffScheduleTypeManager($this->form_id);
     //
     //      	  }
     // Get form type context information
     $formType = new RowManager_StaffScheduleTypeManager($this->form_id);
     $this->hrdbFormTitle = $formType->getFormName();
     $formTypeList = $formType->getListIterator();
     $formTypeArray = $formTypeList->getDataList();
     if (count($formTypeArray) > 0) {
         $row = current($formTypeArray);
         // pick first record for grabbing form context data
         // Determine if form should have associated activities
         $has_activities = $row['staffscheduletype_has_activities'];
         if ($has_activities == '0') {
             $this->has_activity_form = false;
         }
         // Determine if form activities require contact phone #s
         $has_activity_phone_nums = $row['staffscheduletype_has_activity_phone'];
         if ($has_activity_phone_nums == '1') {
             $this->has_activity_contact_nums = true;
         }
         // Determine if activities form must be filtered by 1 or more activity types
         $filters_result = $row['staffscheduletype_activity_types'];
         if ($filters_result != '') {
             $this->activity_types_filter = explode(',', $filters_result);
         }
     }
     // Ensure that a form instance is created for the staff person
     $scheduleFormManager = new RowManager_StaffScheduleManager();
     $scheduleFormManager->setPersonID($this->person_id);
     $scheduleFormManager->setFormID($this->form_id);
     $formList = $scheduleFormManager->getListIterator();
     $formArray = $formList->getDataList();
     $this->is_form_approved = false;
     if (count($formArray) > 0) {
         $row = current($formArray);
         // pick first record for grabbing approval data
         $approved = $row['staffschedule_approved'];
         if ($approved == '1') {
             $this->is_form_approved = true;
         }
         $this->approval_notes = $row['staffschedule_approvalnotes'];
     }
     // create references to sub-page objects
     $disableHeading = true;
     $this->basic_form = new FormProcessor_EditBasicStaffForm($this->pathModuleRoot, $this->viewer, $this->basic_formAction, $this->person_id, $this->form_id, $this->fieldvalues_id, $this->field_id, $disableHeading, $this->show_hidden_fields);
     //  $this->sortBy,
     if ($this->has_activity_form == true) {
         $incContactNums = $this->has_activity_contact_nums;
         // 	        $incContactNums = false;
         // 	        $onlyShowVacationType = false;
         //
         // 	        /** HACK: to be replaced with a more generic approach tied in with Edit Form Fields **/
         // 			  if ($this->form_id ==  '1')  // summer schedule form requires contact # for each activity
         // 			  {
         // 				  $incContactNums = true;
         // 			  }
         // 			  else if ($this->form_id == '2')
         // 			  {
         // 				  $onlyShowVacationType = true;
         // 			  }
         $this->optional_sheduled_activity_form = new FormProcessor_EditStaffActivity($this->pathModuleRoot, $this->viewer, $this->activity_formAction, $this->sortBy, $this->staffactivity_id, $this->person_id, $this->form_id, $this->personal_form_id, '', true, $incContactNums, $this->activity_types_filter);
         //, $activitytype_id=''
         $this->optional_sheduled_activity_form->setFormName('scheduledActivityForm');
     }
     // 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 = FormProcessor_EditStaffScheduleForm::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()
 {
     // Make a new Template object
     //$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]' );
     if (!isset($this->linkLabels['cont'])) {
         $this->linkLabels['cont'] = $this->labels->getLabel('[Back]');
     }
     // $this->linkLabels[ 'view' ] = 'new link label here';
     // NOTE:  this parent method prepares the $this->template with the
     // common Form data.
     $this->prepareTemplate($path);
     // Display message if form has just been submitted
     if ($this->form_submitted == true) {
         $statusMessage = 'Form information successfully submitted.';
         $this->template->set('form_status_msg', $statusMessage);
         $this->form_submitted = false;
     }
     // Set the sub-page objects
     $this->template->set('instrForm', $this->generateTopForm());
     $this->template->set('editFieldsForm', $this->generateBottomForm());
     // 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);
     // 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', 'person_id');
     // 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);
     // Get the real form name
     $form_name = '';
     if ($this->form_id != '') {
         $formContext = new RowManager_StaffScheduleTypeManager($this->form_id);
         $form_name = $formContext->getFormName();
     }
     $form_notice = 'Please note that the "Update" button only updates the top form.<br>The bottom form is updated via its own buttons/links.';
     $this->template->set('subheading', $form_name);
     $this->template->set('formsNotice', $form_notice);
     $templateName = 'page_EditHrdbForm.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 this module's root directory
  * @param $viewer [OBJECT] The viewer object.
  * @param $formAction [STRING] The action on a form submit
  * @param $fieldvalues_id [INTEGER] Value used to initialize the dataManager
  * @param $fields_id [INTEGER] The foreign key data for the data Manager
  * @return [void]
  */
 function __construct($pathModuleRoot, $viewer, $formAction, $person_id = '', $staffscheduletype_id = '', $fieldvalues_id = '', $fields_id = '', $disableHeading = false, $showHidden = true, $staffschedule_id = '', $disableForm = false)
 {
     $this->disable_heading = $disableHeading;
     $this->disable_form = $disableForm;
     $this->show_hidden = $showHidden;
     // set to FALSE when in sign-up process
     // NOTE: be sure to call the parent constructor before trying to
     //       use the ->formXXX arrays...
     // store field values in field list; NOTE: probably don't need this now that we are generating custom labels...
     $fieldList = $this->getFieldList($person_id, $staffscheduletype_id);
     //FormProcessor_EditStaffScheduleForm::FORM_FIELDS; ;
     // 		  $this->total_nonrepeatable_fields = count(explode(',', $fieldList)) - 1;   // subtract 1 because of special hidden field
     // 		  $footerFieldList = $this->getFooterFieldList($person_id, $staffscheduletype_id);
     // store field display types
     $fieldTypes = $this->getFormFieldTypes($person_id, $staffscheduletype_id);
     //FormProcessor_EditStaffScheduleForm::FORM_FIELD_TYPES;
     $footerFieldTypes = $this->getFooterFormFieldTypes($person_id, $staffscheduletype_id);
     $displayFields = $this->getDisplayFields($person_id, $staffscheduletype_id);
     //FormProcessor_EditStaffScheduleForm::DISPLAY_FIELDS;
     //parent::__construct( $formAction, $fieldList, $fieldDisplayTypes  );
     parent::__construct($formAction, $fieldList, $fieldTypes);
     //$viewer,  $sortBy, $displayFields, $footerFieldList, $footerFieldTypes
     $this->pathModuleRoot = $pathModuleRoot;
     //         $this->sortBy = $sortBy;
     $this->viewer = $viewer;
     $this->formFieldToValueIDmapper = array();
     // mapping is setup later in getFieldValuesArray()
     $this->formFieldToFieldIDmapper = array();
     // mapping is setup later in getFieldsArray()
     $this->formLabels = array();
     $this->formLabels = $this->getFieldLabels($person_id, $staffscheduletype_id);
     $this->listLabels = $this->getListLabels($person_id, $staffscheduletype_id);
     $this->fieldvalues_id = $fieldvalues_id;
     $this->fields_id = $fields_id;
     $this->person_id = $person_id;
     $this->staffscheduletype_id = $staffscheduletype_id;
     $this->staffschedule_id = $staffschedule_id;
     // Get person and form type IDs from form instance ID, if applicable
     if ($this->staffschedule_id != '') {
         $formInstance = new RowManager_StaffScheduleManager($this->staffschedule_id);
         $this->person_id = $formInstance->getPersonID();
         $this->staffscheduletype_id = $formInstance->getFormID();
         // 	        echo 'person_id = '.$this->person_id.'  and   form type id = '.$this->staffscheduletype_id;
     }
     // Get the real form name
     if ($this->staffscheduletype_id != '') {
         $formContext = new RowManager_StaffScheduleTypeManager($this->staffscheduletype_id);
         $this->form_name = $formContext->getFormName();
     } else {
         $this->form_name = '';
     }
     //        echo "PersonID = ".$person_id;
     // 		 echo "EventID = ".$event_id;
     // 			echo "Registration ID = ".$registration_id;
     // figure out the important fields for the dataManager
     //      $fieldsOfInterest = implode(',', $this->formFields);
     $this->dataManager = new RowManager_FormFieldValueManager($fieldvalues_id);
     //        $this->dataManager->setFieldsOfInterest( $fieldsOfInterest );
     $mainFormValues = $this->getFieldValuesArray($this->person_id, $this->staffscheduletype_id);
     //$this->dataManager->getArrayOfValues();
     // 		  $footerFormValues = $this->getFooterFieldValuesArray( $person_id, $staffscheduletype_id); //$this->dataManager->getArrayOfValues();
     $this->formValues = $mainFormValues;
     //array_merge($mainFormValues, $footerFormValues);
     //  		  echo 'initial db form values = <pre>'.print_r($this->formValues,true).'</pre>';
     // if the database contains no values then flag for new record creation (assumes not all values can be empty strings)
     if (count($this->formValues) == 0) {
         $this->isNewRecordCreator = true;
         // NEVER SET!!
     } else {
         $this->isNewRecordCreator = false;
     }
     // 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_EditStaffScheduleForm::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);
 }