예제 #1
0
 $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
  */
 $StaffSchedule = new RowManager_StaffScheduleManager();
 $StaffSchedule->dropTable();
 $StaffSchedule->createTable();
 /*
  * ActivitySchedule Table
  *
  * object linking an activity to some schedule; allows an activity to be associated with more than one schedule/form
  *
  * activityschedule_id [INTEGER]  unique id of the object
  * staffactivity_id [INTEGER]  the id of the staff activity
  * staffschedule_id [INTEGER]  id of the schedule/form to associated with the activity
  */
 $ActivitySchedule = new RowManager_ActivityScheduleManager();
 $ActivitySchedule->dropTable();
 $ActivitySchedule->createTable();
 /*
 /**
  * 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, $staffscheduletype_id)
 {
     parent::__construct(page_FormApprovalListing::DISPLAY_FIELDS);
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     $this->formtype_id = $staffscheduletype_id;
     $this->sortBy = $sortBy;
     if ($this->sortBy == '') {
         $this->sortBy = 'staffschedule_approved,person_lname,person_fname';
     } else {
         if ($this->sortBy == 'person_id') {
             $this->sortBy = 'person_lname,person_fname';
         }
     }
     // Now load the access Priviledge manager of this viewer
     $this->adminManager = new RowManager_AdminManager();
     // Get the person ID
     $accessManager = new RowManager_AccessManager();
     $accessManager->loadByViewerID($this->viewer->getViewerID());
     $personID = $accessManager->getPersonID();
     // Get the permissions the person has.
     $this->adminManager->loadByPersonID($personID);
     // Super-admin
     if ($this->adminManager->hasSitePriv()) {
         $dataAccessObject = new MultiTableManager();
         $schedules = new RowManager_StaffScheduleManager();
         $schedules->setFormID($this->formtype_id);
         $persons = new RowManager_PersonManager();
         $dataAccessObject->addRowManager($schedules);
         $dataAccessObject->addRowManager($persons, new JoinPair($schedules->getJoinOnPersonID(), $persons->getJoinOnPersonID()));
         $dataAccessObject->setSortOrder($this->sortBy);
         //        $this->listManager = new StaffScheduleList( $sortBy );
         $this->listManager = $dataAccessObject->getListIterator();
     } else {
         if ($this->adminManager->isStaff($viewer->getID())) {
             $director_id = $this->getStaffIDfromViewerID();
             $staffManager = new RowManager_StaffDirectorManager();
             $staffManager->setDirectorID($director_id);
             /* Retrieve all directors under the current director */
             $hierarchy_result = $staffManager->getDirectorHierarchy($director_id);
             $hierarchy_result->setFirst();
             $hierarchy_array = array();
             $directed_staff = '';
             while ($hierarchy_result->moveNext()) {
                 $staff_ids = $hierarchy_result->getCurrentRow();
                 // 	           echo 'array = <pre>'.print_r($hierarchy_array,true).'</pre>';
                 for ($lvl = 1; $lvl <= MAX_DIRECTOR_LEVELS; $lvl++) {
                     $staff_id = $staff_ids['staff_lvl' . $lvl];
                     if ($staff_id != null) {
                         $directed_staff .= $staff_id . ',';
                     }
                 }
             }
             if ($directed_staff != '') {
                 $directed_staff = substr($directed_staff, 0, -1);
             } else {
                 $directed_staff = page_FormApprovalListing::NO_SUPERVISEES;
             }
             // 	        // Filter approval records by those staff persons found in the list of staff under the direction of the current viewer
             $schedules = new RowManager_StaffScheduleManager();
             $schedules->setFormID($this->formtype_id);
             $person_info = new RowManager_PersonManager();
             $staff = new RowManager_StaffManager();
             $dataAccessObject = new MultiTableManager();
             $dataAccessObject->addRowManager($staff);
             $dataAccessObject->addRowManager($person_info, new JoinPair($staff->getJoinOnPersonID(), $person_info->getJoinOnPersonID()));
             $dataAccessObject->addRowManager($schedules, new JoinPair($person_info->getJoinOnPersonID(), $schedules->getJoinOnPersonID()));
             $dataAccessObject->addSearchCondition('staff_id in (' . $directed_staff . ')');
             $dataAccessObject->setSortOrder($this->sortBy);
             $this->listManager = $dataAccessObject->getListIterator();
         } else {
             $dataAccessObject = new MultiTableManager();
             $schedules = new RowManager_StaffScheduleManager();
             $schedules->setFormID(page_FormApprovalListing::UNAUTHORIZED_DIRECTOR);
             $dataAccessObject->addRowManager($schedules);
             $dataAccessObject->setSortOrder($this->sortBy);
             //        $this->listManager = new StaffScheduleList( $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_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 = page_FormApprovalListing::MULTILINGUAL_PAGE_KEY;
     $this->labels->loadPageLabels($pageKey);
     $this->labels->setSeriesKey(SITE_LABEL_SERIES_SITE);
     $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORM_LINKS);
 }
 /**
  * function processData
  * <pre>
  * Processes the data for this form. Because this page is made up of 
  * sub-pages we just need to figure out the appropriate processData() call
  * on a sub-page.
  * </pre>
  * Precondition: sub-page objects must be initialized
  * @return [void]
  */
 function processData()
 {
     if ($this->active_subPage == null) {
         // save the value of the Primary Key(s)
         $this->formValues['staffschedule_id'] = $this->personal_form_id;
         $this->formValues['staffschedule_approvedby'] = $this->getPersonIDfromViewerID();
         $this->formValues['staffschedule_approvalnotes'] = trim($this->formValues['staffschedule_approvalnotes']);
         /*[RAD_ADMINBOX_FOREIGNKEY]*/
         // Only set the "last modified" time if approval is changed
         if ($this->formValues['staffschedule_approved'] == 'on') {
             $this->formValues['staffschedule_approved'] = 1;
             if ($this->is_form_approved == false) {
                 $this->formValues['staffschedule_lastmodifiedbydirector'] = strftime("%Y-%m-%d %H:%M:%S", time());
                 // == CURRENT_TIME
                 $this->is_form_approved = true;
             }
         } else {
             $this->formValues['staffschedule_approved'] = 0;
             if ($this->is_form_approved == true) {
                 $this->formValues['staffschedule_lastmodifiedbydirector'] = strftime("%Y-%m-%d %H:%M:%S", time());
                 // == CURRENT_TIME
                 $this->is_form_approved = false;
             }
         }
         // 		     echo 'form values = <pre>'.print_r($this->formValues,true).'</pre>';
         $form_instance = new RowManager_StaffScheduleManager($this->personal_form_id);
         //        $registration->setSortOrder( $sortBy );
         // 	        $form_instance->setFormID($this->form_id);
         // 	        $form_instance->setPersonID($this->person_id);
         $form_instance->loadFromArray($this->formValues);
         $form_instance->updateDBTable();
     } else {
         $this->active_subPage->processData();
     }
 }
 /**
  * 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 processData
  * <pre>
  * Processes the data for this form. Because this page is made up of 
  * sub-pages we just need to figure out the appropriate processData() call
  * on a sub-page.
  * </pre>
  * Precondition: sub-page objects must be initialized
  * @return [void]
  */
 function processData()
 {
     $personal_form_id = $this->active_subPage->processData();
     if ($personal_form_id != '') {
         $this->personal_form_id = $personal_form_id;
         //NOTE: may replace a non-empty value..
     }
     // Flag the requirement for the director to be notified of this change
     $scheduleFormManager = new RowManager_StaffScheduleManager($this->personal_form_id);
     $scheduleFormManager->setToNotify(true);
     $scheduleFormManager->updateDBTable();
     // Compose Notification E-mail
     //  		$message = $this->composeNotificationMessage();
     //   		$this->sendEmailToDirector();
 }
예제 #6
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.
  * @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);
 }
 /**
  * function processData
  * <pre>
  * Processes the data for this form.
  * </pre>
  * @return [void]
  */
 function processData()
 {
     // save the value of the Foriegn Key(s)
     //            $this->formValues[ 'fieldvalues_id' ] = $this->fieldvalues_id;
     //            $this->formValues[ 'registration_id' ] = $this->registration_id;
     /*[RAD_ADMINBOX_FOREIGNKEY]*/
     $formValues = array();
     $fieldValues = array();
     // get field value records
     //			$fieldValues = $this->getFieldValuesArray( $this->registration_id, $this->person_id, $this->event_id, true );
     $fieldValues = $this->formValues;
     //  			echo "field values:<br><pre>".print_r($fieldValues,true)."</pre>";
     //  			echo 'field to value id mapper:<br><pre>'.print_r($this->formFieldToValueIDmapper,true).'</pre>';
     $fields = new RowManager_FormFieldManager();
     $fields->setFormID($this->staffscheduletype_id);
     $fieldsList = $fields->getListIterator();
     $fieldsArray = $fieldsList->getDataList();
     $all_field_ids = array_keys($fieldsArray);
     $field_ids_list = array();
     // use to store field ids that already have values
     $idx = 0;
     reset($fieldValues);
     $keys = array_keys($fieldValues);
     // get field value ids, since array indexed using them
     foreach ($keys as $formLabel) {
         $fieldValueID = -1;
         if (isset($this->formFieldToValueIDmapper[$formLabel])) {
             // get fieldvalues_id mapped to formlabel
             $fieldValueID = $this->formFieldToValueIDmapper[$formLabel];
             $formValues['fieldvalues_id'] = $fieldValueID;
             $formValues['fieldvalues_value'] = $fieldValues[$formLabel];
             $formValues['person_id'] = $this->person_id;
             $formValues['fieldvalues_modTime'] = strftime("%Y-%m-%d %H:%M:%S", time());
             // == CURRENT_TIME
             // 					echo "FORM values:<br><pre>".print_r($formValues,true)."</pre>";
             $this->dataManager = new RowManager_FormFieldValueManager($fieldValueID);
             //$fieldValueIDs[$idx]
             $fieldsOfInterest = FormProcessor_EditStaffScheduleForm::FORM_FIELDS;
             $this->dataManager->setFieldsOfInterest($fieldsOfInterest);
             $this->dataManager->loadFromArray($formValues);
             // load field value into appropriate row in DB
             // 				  echo 'field value id = '.$fieldValueID.' for '.$fieldValues[$formLabel].'<BR>';
             // standard code for adding/updating but nested to accomodate updating multiple fieldvalues rows
             if (!$this->dataManager->isLoaded()) {
                 $this->dataManager->createNewEntry();
                 //echo "ADDED";
             } else {
                 $this->dataManager->updateDBTable();
                 //echo "UPDATED";
             }
         } else {
             if ($this->isNewRecordCreator == true) {
                 // 				   echo "field mapper = <pre>".print_r($this->formFieldToValueIDmapper,true)."</pre>";
                 // must ensure that a fieldID exists
                 if (isset($this->formFieldToFieldIDmapper[$formLabel])) {
                     // get fields_id mapped to formlabel
                     $fieldID = $this->formFieldToFieldIDmapper[$formLabel];
                     $field_ids_list[$idx++] = $fieldID;
                     $formValues['fields_id'] = $fieldID;
                     $formValues['fieldvalues_value'] = $fieldValues[$formLabel];
                     $formValues['person_id'] = $this->person_id;
                     $formValues['fieldvalues_modTime'] = strftime("%Y-%m-%d %H:%M:%S", time());
                     // == CURRENT_TIME
                     //						echo "ADD FORM values:<br><pre>".print_r($formValues,true)."</pre>";
                     $this->dataManager = new RowManager_FormFieldValueManager();
                     //$fieldValueIDs[$idx]
                     //			        $fieldsOfInterest = FormProcessor_EditStaffScheduleForm::FORM_FIELDS;
                     //		           $this->dataManager->setFieldsOfInterest( $fieldsOfInterest );
                     $this->dataManager->loadFromArray($formValues);
                     // load field value into appropriate row in DB
                     //				  echo 'field value id = '.$fieldValueID.' for '.$fieldValues[$formLabel].'<BR>';
                     // standard code for adding/updating but nested to accomodate updating multiple fieldvalues rows
                     if (!$this->dataManager->isLoaded()) {
                         $this->dataManager->createNewEntry();
                         // 			            echo "ADDED";
                     } else {
                         $this->dataManager->updateDBTable();
                         // 			            echo "UPDATED";
                     }
                 }
             }
         }
     }
     /*** Add empty field values for event fields not shown to the user (i.e. hidden fields) **/
     /** NOTE: only required for first time registration field values are stored **/
     if ($this->isNewRecordCreator == true) {
         // Find which ids in the set of all fields do NOT appear the set of fields with values
         $missing_values = array_diff($all_field_ids, $field_ids_list);
         // 		  echo 'missing fields = <pre>'.print_r($missing_values,true).'</pre>';
         reset($missing_values);
         $newValues = array();
         foreach (array_keys($missing_values) as $key) {
             $fieldID = current($missing_values);
             $newValues['fields_id'] = $fieldID;
             $newValues['fieldvalues_value'] = '';
             $newValues['person_id'] = $this->person_id;
             $formValues['fieldvalues_modTime'] = strftime("%Y-%m-%d %H:%M:%S", time());
             // == CURRENT_TIME
             $this->dataManager = new RowManager_FormFieldValueManager();
             //$fieldValueIDs[$idx]
             $this->dataManager->loadFromArray($newValues);
             // load field value into appropriate row in DB
             //				  echo 'field value id = '.$fieldValueID.' for '.$fieldValues[$formLabel].'<BR>';
             // standard code for adding/updating but nested to accomodate updating multiple fieldvalues rows
             if (!$this->dataManager->isLoaded()) {
                 $this->dataManager->createNewEntry();
                 // 			            echo "ADDED";
             } else {
                 $this->dataManager->updateDBTable();
                 // 			            echo "UPDATED";
             }
             next($missing_values);
         }
     }
     // Ensure that a form instance is created for the staff person
     $scheduleFormManager = new RowManager_StaffScheduleManager();
     $scheduleFormManager->setPersonID($this->person_id);
     $scheduleFormManager->setFormID($this->staffscheduletype_id);
     $formList = $scheduleFormManager->getListIterator();
     $formArray = $formList->getDataList();
     $personal_form_id = '';
     if (count($formArray) > 0) {
         $row = current($formArray);
         // pick first record for grabbing form ID
         $personal_form_id = $row['staffschedule_id'];
     }
     // Create new form instance record if none exists
     if ($personal_form_id == '') {
         $scheduleFormManager->createNewEntry();
         $personal_form_id = $scheduleFormManager->getID();
     }
     return $personal_form_id;
 }