/**
  * 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 __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_ApproveStaffSchedule::FORM_FIELDS;
     $fieldTypes = FormProcessor_ApproveStaffSchedule::FORM_FIELD_TYPES;
     $displayFields = FormProcessor_ApproveStaffSchedule::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 form type context information
     $formType = new RowManager_StaffScheduleTypeManager($this->form_id);
     $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);
         }
     }
     // 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->staffscheduletype_id = $formInstance->getFormID();
         // 	        echo 'person_id = '.$this->person_id.'  and   form type id = '.$this->staffscheduletype_id;
     }
     // Setup data-manager tied to staff schedule table (i.e. for approval)
     $form_instance = new RowManager_StaffScheduleManager($staffschedule_id);
     //        $registration->setSortOrder( $sortBy );
     $form_instance->setFormID($this->form_id);
     $form_instance->setPersonID($this->person_id);
     //     $multiTableManager2->setLabelTemplate('viewer_userID', '[viewer_userID]');
     $this->listManager = $form_instance->getListIterator();
     //         $formInstanceArray = $this->listManager->getDataList();
     //         echo "<pre>".print_r($this->listManager,true)."</pre>";
     //        echo "<pre>".print_r($formInstanceArray,true)."</pre>";
     // create references to sub-page objects
     $disableHeading = true;
     $disableForm = 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->personal_form_id, $disableForm);
     //  $this->sortBy,
     if ($this->has_activity_form == true) {
         $incContactNums = $this->has_activity_contact_nums;
         $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, $disableForm);
         //, $activitytype_id=''
     }
     // 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;
         }
     }
     // 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_ApproveStaffSchedule::MULTILINGUAL_PAGE_KEY;
     $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey);
 }
 /**
  * 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, $instrFormAction, $editFieldsFormAction, $sortBy, $staffscheduletype_id, $fields_id = '')
 {
     $fieldList = FormProcessor_EditHrdbForm::FORM_FIELDS;
     $fieldTypes = FormProcessor_EditHrdbForm::FORM_FIELD_TYPES;
     $displayFields = FormProcessor_EditHrdbForm::DISPLAY_FIELDS;
     parent::__construct($formAction, $fieldList, $displayFields);
     // initialize the object values
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $this->sortBy = $sortBy;
     $this->formAction = $formAction;
     $this->editfields_formAction = $editFieldsFormAction;
     $this->instructions_formAction = $instrFormAction;
     //         $this->has_activity_form = $hasActivityForm;
     $this->form_id = $staffscheduletype_id;
     $this->field_id = $fields_id;
     // just let these be empty if they are passed as empty
     //         $this->person_id = $person_id;
     $this->form_submitted = false;
     // figure out the important fields for the dataManager
     $fieldsOfInterest = implode(',', $this->formFields);
     $this->dataManager = new RowManager_FormFieldManager($fields_id);
     $this->dataManager->setFieldsOfInterest($fieldsOfInterest);
     $this->formValues = $this->dataManager->getArrayOfValues();
     // Get form type context information
     $formType = new RowManager_StaffScheduleTypeManager($this->form_id);
     $formTypeList = $formType->getListIterator();
     $formTypeArray = $formTypeList->getDataList();
     // 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();
     // create references to sub-page objects
     $disableHeading = true;
     $this->instructions_form = new FormProcessor_EditStaffFormInstructions($this->pathModuleRoot, $this->viewer, $this->instructions_formAction, $this->form_id, $disableHeading);
     $this->editfields_form = new FormProcessor_EditFormFields($this->pathModuleRoot, $this->viewer, $this->editfields_formAction, $this->sortBy, $this->field_id, $this->form_id, $disableHeading);
     // 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_EditHrdbForm::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);
 }