protected function subject() { global $db; $params = array(); if ($this->method == "GET") { if (sizeof($this->args) == 2) { if ($this->args[0] == "data") { $main_arg = $this->args[1]; if (is_numeric($main_arg)) { $params["sid"] = $main_arg; return get_subject_data($db, $params); } else { return "The id you passed in is not a number!"; } } else { $this->args[0] == "id" ? $type = "id" : ($type = "name"); $main_arg = $this->args[1]; if ($type == "id") { $params["sid"] = $main_arg; } else { if ($type == "name") { $params["sname"] = $main_arg; } else { return "The type of parameter you are passing in is not valid!"; } } return get_subjects($db, $params); } } else { return "The number of parameters is not correct!"; } } else { return "This only accepts GET requests!"; } }
<?php ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(-1); error_reporting(E_ALL ^ E_NOTICE); require 'vendor/autoload.php'; include 'inc/config.php'; include ROOT_PATH . '/inc/header.php'; $ini = parse_ini_file('../config/admin.ini', true); global $db; $subjects_list = []; $subject = $_GET['subject']; connect_to_sql(); $subject_data_all = get_subject_data(); $classes = filter_classes($subject_data_all); ?> <html> <body> <div id="app" class="container"> <h1 class="text-center"><?php echo $subject; ?> </h1> <choose-class :classes="classes" :selected_class.sync="selectedClass"></choose-class> <choose-week :week.sync="week" v-show="selectedClass"></choose-week> <render-data :week="week" v-show="week" :subjectdata.sync="classData"></render-data> </div> </body>