Ejemplo n.º 1
0
     $smarty->assign("T_COURSE_LESSONS", EfrontCourse::convertLessonObjectsToArrays($courseLessons));
 } else {
     if ($_GET['op'] == 'course_order') {
         $courseLessons = $currentCourse->getCourseLessons();
         $smarty->assign('T_COURSE', $currentCourse->course);
         $smarty->assign('T_COURSE_LESSONS', EfrontCourse::convertLessonObjectsToArrays($courseLessons));
         if (isset($_GET['ajax']) && isset($_GET['order'])) {
             try {
                 $order = explode(",", $_GET['order']);
                 $previous = 0;
                 foreach ($order as $value) {
                     $result = explode("-", $value);
                     if (in_array($value, array_keys($courseLessons))) {
                         $fields = array("previous_lessons_ID" => $previous);
                         $where = "courses_ID=" . $currentCourse->course['id'] . " and lessons_ID=" . $result[0];
                         EfrontCourse::persistCourseLessons($fields, $where);
                     }
                     $previous = $result[0];
                 }
                 echo _TREESAVEDSUCCESSFULLY;
             } catch (Exception $e) {
                 header("HTTP/1.0 500");
                 echo $e->getMessage() . ' (' . $e->getCode() . ')';
             }
             exit;
         }
     } else {
         if ($_GET['op'] == 'course_scheduling') {
             $courseLessons = $currentCourse->getCourseLessons();
             $smarty->assign("T_CURRENT_COURSE", $currentCourse);
             try {