* 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(); /* * FormField Table * * this is a HRDB form field object * * fields_id [INTEGER] the unique id of the field * fieldtype_id [INTEGER] The field type associated with the field (i.e. "checkbox") * fields_desc [STRING] the description of the form field * staffscheduletype_id [INTEGER] id of the form that this field belongs to * fields_priority [INTEGER] the display priority of this form field * fields_reqd [BOOL] whether or not this field is a required field (for the user to fill in) * fields_invalid [STRING] an value that is invalid for this field * fields_hidden [BOOL] whether this field is hidden to the general user
/** * function processData * <pre> * Processes the data for this form. * </pre> * @return [void] */ function processData() { $activityFormInstance = new RowManager_ActivityScheduleManager(); if ($this->personal_form_id != '') { $activityFormInstance->setStaffScheduleID($this->personal_form_id); } // if this is a delete operation then if ($this->opType == 'D') { if ($this->shouldDelete) { // Delete from the activity-schedule table as well // NOTE: COULD REPLACE WITH A CASCADING FK DELETE $matchList = $activityFormInstance->getListIterator(); $matchArray = $matchList->getDataList(); reset($matchArray); foreach (array_keys($matchArray) as $key) { $row = current($matchArray); $primaryID = $row['activityschedule_id']; if ($primaryID != '') { $deleter = new RowManager_ActivityScheduleManager($primaryID); $deleter->deleteEntry(); } next($matchArray); } /** Must delete entry from matching table BEFORE deleting activity entry * so that FK constraint is not violated **/ $db_error_msg = $this->dataManager->deleteEntry(); $this->setErrorMessage($db_error_msg); } } else { // else // save the value of the Foriegn Key(s) $this->formValues['person_id'] = $this->person_id; // $this->formValues[ 'staffactivity_id' ] = $this->staffactivity_id; // $this->formValues[ 'activitytype_id' ] = $this->activitytype_id; /*[RAD_ADMINBOX_FOREIGNKEY]*/ // check to see if dates are invalid, i.e. start date < form's first valid date OR end date > form's end date if ($this->form_start_date != '' && $this->form_end_date != '') { // check to see if dates are invalid, i.e. start date > end date if (strtotime($this->formValues['staffactivity_startdate']) > strtotime($this->formValues['staffactivity_enddate'])) { $this->dateSwitchMessage = 'Start date cannot be after end date!'; } else { if (strtotime($this->formValues['staffactivity_startdate']) < strtotime($this->form_start_date) || strtotime($this->formValues['staffactivity_enddate']) > strtotime($this->form_end_date)) { $this->dateContextMessage = 'Start and end dates must fall within the following date-range (inclusive):<br>'; $this->dateContextMessage .= $this->form_date_range; } else { // Store values in dataManager object $this->dataManager->loadFromArray($this->formValues); // Interlude: create new form instance record if none exists if ($this->personal_form_id == '') { $this->scheduleFormManager->createNewEntry(); $this->personal_form_id = $this->scheduleFormManager->getID(); } // Save the values into the Table. if (!$this->dataManager->isLoaded()) { $this->dataManager->createNewEntry(); // Update the schedule-activity match table $newID = $this->dataManager->getID(); $activityFormInstance->setStaffActivityID($newID); $activityFormInstance->setStaffScheduleID($this->personal_form_id); $activityFormInstance->createNewEntry(); } else { $this->dataManager->updateDBTable(); } } } } } // end if // now Clear out dataManager & FormValues $this->dataManager->clearValues(); $this->formValues = $this->dataManager->getArrayOfValues(); // on a successful update return staffactivity_id to '' $this->staffactivity_id = ''; return $this->personal_form_id; }