protected function geteditionlist() { //Course info $id_course = Get::req('id_course', DOTY_INT, 0); //Datatable info $start_index = Get::req('startIndex', DOTY_INT, 0); $results = Get::req('results', DOTY_MIXED, Get::sett('visuItem', 25)); $sort = Get::req('sort', DOTY_MIXED, 'userid'); $dir = Get::req('dir', DOTY_MIXED, 'asc'); $model = new EditionAlms($id_course); $total_edition = $model->getEditionNumber(); $array_edition = $model->loadEdition($start_index, $results, $sort, $dir); $result = array('totalRecords' => $total_edition, 'startIndex' => $start_index, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $results, 'results' => count($array_edition), 'records' => $array_edition); $this->data = $this->json->encode($result); echo $this->data; }
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; }