//This is an ajax controller for the faculty backend $object = new FacultyBackend($dbo); //this is for the autocompleter and fetches the searched courses and course codes //it is very specific to the UI of the backend and the plugin being used for selecting courses if (isset($_POST['str'])) { $searchString = strtoupper($_POST['str']); $strlen = strlen($searchString); if ($strlen >= 1) { if ($strlen < COURSE_CODE_PREFIX_ABBREVIATION_LENGTH) { // $result = $object -> getDepCodes($searchString); if ($_POST['undergradLevel'] === '1' && $_POST['gradLevel'] === '1') { $result = $object->getDepCodes($searchString); } elseif ($_POST['gradLevel'] === '1') { $result = $object->getGradDepCodes($searchString); } elseif ($_POST['undergradLevel'] === '1') { $result = $object->getUndergradDepCodes($searchString); } foreach ($result as $row) { $bucketList .= "<option value='" . $row['depcode'] . "'>" . $row['depcode'] . "</option>"; } } else { if ($strlen < COURSE_CODE_PREFIX_ABBREVIATION_LENGTH + COURSE_CODE_COURSE_NUMBER_LENGTH) { if ($strlen === COURSE_CODE_PREFIX_ABBREVIATION_LENGTH) { $bucketList .= "<option value='{$searchString}'>{$searchString}</option>"; // $result = $object -> getCourseCodes($searchString); } if ($_POST['undergradLevel'] === '1' && $_POST['gradLevel'] === '1') { $result = $object->getCourseCodes($searchString); } elseif ($_POST['gradLevel'] === '1') { $result = $object->getGradCourseCodes($searchString); } elseif ($_POST['undergradLevel'] === '1') {