function wizardActionContent($author, $expo) { if (isset($_POST[PARAM_MAXHOURS]) && !is_null($_POST[PARAM_MAXHOURS])) { $author->updateMaxHours($expo->expoid, swwat_parse_string(html_entity_decode($_POST[PARAM_MAXHOURS]))); } $dateSpanList = $_SESSION[PARAM_DATETIME]; $locationList = $_SESSION[PARAM_LOCATION]; // Location Preference $k = 0; while (isset($_POST[PARAM_LOCATION . $k])) { $desire = parsePreferenceNumber(PARAM_LOCATION, $k); $locationDesires[$locationList[$k]] = 0 == $desire ? NULL : $desire; $locationTest[$k] = parsePreferenceNumber(PARAM_LOCATION, $k); $k += 1; } $jp = new JobPreference(); $jp->workerid = $author->workerid; $jp->expoid = $expo->expoid; $count_jobs = $jp->number_jobs; for ($k = 0; $k < $count_jobs; $k++) { $field = 'job' . ($k + 1); if (isset($locationTest[$k])) { $jp->{$field} = $locationTest[$k]; } else { $jp->{$field} = 0; } } $test = JobPreference::selectID($author->workerid, $expo->expoid); if (!is_null($test)) { $jp->update(); } else { $jp->insert(); } // Time Preference $k = 0; while (isset($_POST[PARAM_DATETIME . $k])) { $desire = parsePreferenceNumber(PARAM_DATETIME, $k); $dateSpanDesires[$dateSpanList[$k]] = 0 == $desire ? NULL : $desire; $dateSpanTest[$k] = parsePreferenceNumber(PARAM_DATETIME, $k); $k += 1; } $tp = new TimePreference(); $tp->workerid = $author->workerid; $tp->expoid = $expo->expoid; $count_shifts = $tp->number_shifts; for ($k = 0; $k < $count_shifts; $k++) { $field = 'shift' . ($k + 1); if (isset($dateSpanTest[$k])) { $tp->{$field} = $dateSpanTest[$k]; } else { $tp->{$field} = 0; } } $test = TimePreference::selectID($author->workerid, $expo->expoid); if (!is_null($test)) { $tp->update(); } else { $tp->insert(); } //exit; $gp = GrossPreference::updateHelper_Location_DateSpan($expo->expoid, $author->workerid, $locationDesires, $dateSpanDesires); }
function welcomeActionContent($author, $expo) { // Time Preferences $i = 0; while (isset($_POST[PARAM_DAY . $i])) { $days[$i] = parsePreferenceString(PARAM_DAY, $i); $tprefs[$i] = parsePreferenceString(PARAM_TPREFS, $i); $i++; } $tp = new NewTimePreference(); $tp->workerid = $author->workerid; $tp->expoid = $expo->expoid; for ($i = 0; $i < count($days); $i++) { $tp->day = $days[$i]; $hcodes = str_split($tprefs[$i]); for ($j = 0; $j < count($hcodes); $j++) { $hdesire = 0; if ($hcodes[$j] == 2) { $hdesire = 100; } $hour = "hour" . ($j + 1); $tp->{$hour} = $hdesire; } $test = NewTimePreference::selectID($author->workerid, $expo->expoid, $days[$i]); if (count($test) != 0) { $tp->update(); } else { $tp->insert(); } } // Location Preferences $i = 0; while (isset($_POST[PARAM_LOCATION . $i])) { $locations[$i] = parsePreferenceString(PARAM_LOCATION, $i); $lpref[$i] = parsePreferenceNumber(PARAM_LPREFS, $i); $i++; } $jp = new JobPreference(); $jp->workerid = $author->workerid; $jp->expoid = $expo->expoid; $count_jobs = $jp->number_jobs; for ($i = 0; $i < $count_jobs; $i++) { $field = 'job' . ($i + 1); if (isset($lpref[$i])) { $jp->{$field} = $lpref[$i] * 10; } else { $jp->{$field} = 0; } } $test = JobPreference::selectID($author->workerid, $expo->expoid); if (count($test) != 0) { $jp->update(); } else { $jp->insert(); } if (isset($_POST[PARAM_MAXHOURS]) && !is_null($_POST[PARAM_MAXHOURS])) { $author->updateMaxHours($expo->expoid, swwat_parse_string(html_entity_decode($_POST[PARAM_MAXHOURS]))); } setShiftPreferences($author->workerid, $expo->expoid, $locations); return; }