예제 #1
0
 public function actionCourses()
 {
     $tasks = ['Добавить' => 'add', 'Изменить' => 'edit', 'Удалить' => 'del'];
     $task = $_GET['task'];
     $id = $_GET['id'];
     $view = new View();
     $view->tasks = $tasks;
     if (!isset($task)) {
     } elseif ('add' == $task) {
         if (!empty($_POST)) {
             $id = Courses::addCourses($_POST);
             header('Location: /?ctrl=Admin&act=Courses&task=edit&id=' . $id);
         }
         $courses = Courses::getCourses();
         $view->courses = $courses;
         $view->display('admin/header.php');
         $view->display('admin/courses/add.php');
         $view->display('admin/footer.php');
     } elseif ('edit' == $task && isset($id)) {
         if (!empty($_POST)) {
             Courses::updateCourse($_POST);
         }
         $course = Courses::getCourse($id);
         $courses = Courses::getCourses();
         $view->courses = $courses;
         $view->course = $course;
         $view->display('admin/header.php');
         $view->display('admin/courses/edit.php');
         $view->display('admin/footer.php');
     } elseif ('del' == $task) {
         Courses::delCourse($id);
         header('Location: /?ctrl=Admin&act=Courses');
     } else {
         $view->display('header.php');
         $view->display('404.php');
         $view->display('footer.php');
     }
 }
예제 #2
0
     } else {
         if ($testType == 'Assessment') {
             $testType = 'Assessment';
         }
     }
     $course = new Courses();
     $json = $course->checkforTestDone($userId, $courseId, $testType);
     echo $json;
 } else {
     if ($action == 'AddNewCourses') {
         $courseName = $_GET["courseName"];
         $courseNum = $_GET["courseNumber"];
         echo $courseName;
         echo $courseNum;
         $course = new Courses();
         $course->addCourses($courseName, $courseNum, 'images/courses/course-2.jpg');
     } else {
         if ($action == 'EditNewCourses') {
             $idCourses = $_GET["idCourses"];
             $courseName = $_GET["courseName"];
             $courseNum = $_GET["courseNumber"];
             echo $courseName;
             echo $courseNum;
             $course = new Courses();
             $course->updateCourses($idCourses, $courseName, $courseNum, 'images/courses/course-2.jpg');
         } else {
             if ($action == 'DeleteCourse') {
                 $idCourses = $_GET["idCourses"];
                 $course = new Courses();
                 $course->deleteCourses($idCourses);
             } else {