Ejemplo n.º 1
0
 public function run()
 {
     Major::create(['name' => '材料成型及控制工程', 'academy_id' => 1]);
     Major::create(['name' => '材料科学与工程', 'academy_id' => 1]);
     Major::create(['name' => '电气工程及其自动化', 'academy_id' => 1]);
     Major::create(['name' => '自动化', 'academy_id' => 1]);
     Major::create(['name' => '材料化学', 'academy_id' => 1]);
     Major::create(['name' => '过程装备与控制工程', 'academy_id' => 1]);
     Major::create(['name' => '化学工程与工艺', 'academy_id' => 1]);
     Major::create(['name' => '应用化学', 'academy_id' => 1]);
     Major::create(['name' => '安全工程', 'academy_id' => 1]);
     Major::create(['name' => '环境工程', 'academy_id' => 1]);
     Major::create(['name' => '人文地理与城乡规划', 'academy_id' => 1]);
     Major::create(['name' => '机械设计制造及其自动化', 'academy_id' => 1]);
     Major::create(['name' => '计算机科学与技术', 'academy_id' => 1]);
     Major::create(['name' => '软件工程', 'academy_id' => 1]);
     Major::create(['name' => '网络工程', 'academy_id' => 1]);
     Major::create(['name' => '建筑学', 'academy_id' => 1]);
     Major::create(['name' => '财务管理', 'academy_id' => 1]);
     Major::create(['name' => '国际经济与贸易', 'academy_id' => 1]);
     Major::create(['name' => '金融工程', 'academy_id' => 1]);
     Major::create(['name' => '汉语言文学', 'academy_id' => 1]);
     Major::create(['name' => '生物工程', 'academy_id' => 1]);
     Major::create(['name' => '生物技术', 'academy_id' => 1]);
     Major::create(['name' => '食品科学与工程', 'academy_id' => 1]);
     Major::create(['name' => '土木工程', 'academy_id' => 1]);
     Major::create(['name' => '工程管理', 'academy_id' => 1]);
     Major::create(['name' => '日语', 'academy_id' => 1]);
     Major::create(['name' => '商务英语', 'academy_id' => 1]);
     Major::create(['name' => '英语', 'academy_id' => 1]);
     Major::create(['name' => '物流管理', 'academy_id' => 1]);
     Major::create(['name' => '电子信息工程', 'academy_id' => 1]);
     Major::create(['name' => '电子科学与技术', 'academy_id' => 1]);
     Major::create(['name' => '通信工程', 'academy_id' => 1]);
     Major::create(['name' => '微电子科学与工程', 'academy_id' => 1]);
     Major::create(['name' => '信息管理与信息系统', 'academy_id' => 1]);
     Major::create(['name' => '行政管理', 'academy_id' => 1]);
     Major::create(['name' => '包装工程', 'academy_id' => 1]);
     Major::create(['name' => '工业设计', 'academy_id' => 1]);
     Major::create(['name' => '音乐学', 'academy_id' => 1]);
     Major::create(['name' => '产品设计', 'academy_id' => 1]);
 }
Ejemplo n.º 2
0
                $updateDone = true;
                Major::updateCode($majorId, $newMajorCode);
            }
            if (!$updateDone) {
                throw new Exception("No new data inputted. Process aborted.");
            }
            //
            header('Location: ' . BASE_URL . 'academia/majors/success');
        } else {
            throw new Exception("Either you're trying to hack this app or something wrong went. In either case the\n            developers were just notified about this.");
        }
    } else {
        if (isBtnSavePrsd()) {
            $newMajorCode = trim($_POST['major_code']);
            $newMajorName = trim($_POST['major_name']);
            Major::create($newMajorCode, $newMajorName);
            header('Location: ' . BASE_URL . 'academia/majors/success');
            exit;
        } else {
            if (isBtnDeletePrsd()) {
                Major::delete($_POST['delMajorIdModal']);
                header('Location: ' . BASE_URL . 'academia/majors/success');
                exit;
            }
        }
    }
} catch (Exception $e) {
    $errors[] = $e->getMessage();
}
/**
 * http://stackoverflow.com/a/4128377/2790481
Ejemplo n.º 3
0
    exit;
}
$pageTitle = "Academia - Students";
$section = "academia";
try {
    $students = StudentFetcher::retrieveAll();
    $majors = MajorFetcher::retrieveMajors();
    $appointments = AppointmentFetcher::retrievePendingForAllStudents();
    if (isBtnAddStudentPrsd()) {
        $majorId = !empty($_POST['userMajorId']) ? $_POST['userMajorId'] : null;
        Student::create($_POST['firstName'], $_POST['lastName'], $_POST['email'], $_POST['studentId'], $_POST['mobileNum'], $majorId, $_POST['ciInput'], $_POST['creditsInput']);
        header('Location: ' . BASE_URL . "academia/students/success");
        exit;
    } else {
        if (isBtnAddMajorPrsd()) {
            Major::create($_POST['majorCode'], $_POST['majorName']);
            header('Location: ' . BASE_URL . "academia/students/success");
        } else {
            if (isBtnUpdatePrsd()) {
                if (!isset($_POST['idUpdate']) || ($oldStudentData = getStudent($_POST['idUpdate'], $students)) === false) {
                    throw new Exception("Data tempering detected. Process stopped.");
                } else {
                    $id = $oldStudentData[StudentFetcher::DB_COLUMN_ID];
                    $newFirstName = $_POST['newFirstName'];
                    $newLastName = $_POST['newLastName'];
                    $newEmail = $_POST['newEmail'];
                    $newStudentId = $_POST['newStudentId'];
                    $newMobileNum = $_POST['newMobileNum'];
                    $newMajorId = $_POST['newStudentMajorId'];
                    $newCI = isset($_POST['newCI']) ? $_POST['newCI'] : null;
                    $newCreditsNum = $_POST['newCreditsNum'];