Ejemplo n.º 1
0
 public function getEditionTableContent($courses)
 {
     $res = array();
     foreach ($courses as $id_course) {
         if ($this->controlCoursesWithEdition(array($id_course))) {
             $query = "SELECT code, name, course_type" . " FROM %lms_course" . " WHERE idCourse = " . (int) $id_course;
             list($code, $name, $course_type) = sql_fetch_row(sql_query($query));
             if ($course_type !== 'classroom') {
                 require_once _lms_ . '/admin/models/EditionAlms.php';
                 $edition_model = new EditionAlms($id_course);
                 $edition = $edition_model->loadEdition(false, false, 'date_begin', 'desc');
             } else {
                 require_once _lms_ . '/admin/models/ClassroomAlms.php';
                 $classroom_model = new ClassroomAlms($id_course);
                 $edition = $classroom_model->loadCourseEdition(false, false, 'date_begin', 'desc');
             }
             $all_value = array();
             foreach ($edition as $edition_info) {
                 $all_value[isset($edition_info['id_date']) ? $edition_info['id_date'] : $edition_info['id_edition']] = $edition_info['code'] . ' - ' . $edition_info['name'] . ' (' . (isset($edition_info['id_date']) ? $edition_info['date_begin'] : Format::date($edition_info['date_begin'], 'date')) . ' - ' . (isset($edition_info['id_date']) ? $edition_info['date_end'] : Format::date($edition_info['date_end'], 'date')) . ')';
             }
             $res[] = array($code, $name, Form::getInputDropdown('dropdown', 'edition_' . $id_course, 'edition_' . $id_course, $all_value, false, ''));
         }
     }
     return $res;
 }
Ejemplo n.º 2
0
 public function del()
 {
     if (!$this->permissions['del']) {
         $output = array('success' => false, 'message' => $this->_getMessage('no permission'));
         echo $this->json->encode($output);
         return;
     }
     if (Get::cfg('demo_mode')) {
         die('Cannot del course during demo mode.');
     }
     //Course info
     $id_course = Get::req('id_course', DOTY_INT, 0);
     $id_edition = Get::req('id_edition', DOTY_INT, 0);
     $model = new EditionAlms($id_course, $id_edition);
     $res = array('success' => $model->delEdition());
     $this->data = $this->json->encode($res);
     echo $this->data;
 }