Example #1
0
<?php

namespace Ventus\FacultyBackend;

require '../includes/php/bootstrap.php';
$SESSION = new \Zend_Session_Namespace('internal', true);
//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);
Example #2
0
namespace Ventus\FacultyBackend;

//============================================================================================
// Session, configuration file, localization constructor
//============================================================================================
require '../includes/php/bootstrap.php';
$SESSION = new \Zend_Session_Namespace('internal', true);
if (!isset($SESSION->lang)) {
    $SESSION->lang = DEFAULT_LANGUAGE;
}
\Locale::setDefault($SESSION->lang);
$l10n->setLanguage($SESSION->lang);
//============================================================================================
// Model
//============================================================================================
$object = new FacultyBackend($dbo);
//============================================================================================
// Load the page requested by the user
//============================================================================================
if (!isset($_GET['page'])) {
    $render = true;
    $users = $object->getUsers();
    $viewFile = 'views/index.php';
    $l10n->addResource(__DIR__ . '/l10n/index.json');
} elseif ($_GET['page'] === 'writeuser') {
    if (!isset($_POST['undergradLevel']) && !isset($_POST['gradLevel'])) {
        // if user does not select undergrad and grad level
        $_POST['undergrad_level'] = 1;
        $_POST['grad_level'] = 1;
    } else {
        $_POST['undergrad_level'] = !isset($_POST['undergradLevel']) ? 0 : $_POST['undergradLevel'];