protected function presence() { //Course info $id_course = Get::req('id_course', DOTY_INT, 0); $id_date = Get::req('id_date', DOTY_INT, 0); $model = new ClassroomAlms($id_course, $id_date); if (isset($_POST['save'])) { if ($model->savePresence()) { Util::jump_to('index.php?r=' . $this->base_link_classroom . '/classroom&id_course=' . $model->getIdCourse() . '&result=ok'); } else { Util::jump_to('index.php?r=' . $this->base_link_classroom . '/classroom&id_course=' . $model->getIdCourse() . '&result=err_pres'); } } elseif (isset($_POST['undo'])) { Util::jump_to('index.php?r=' . $this->base_link_classroom . '/classroom&id_course=' . $model->getIdCourse()); } $cmodel = new CourseAlms(); $course_info = $cmodel->getInfo($id_course, FALSE, $id_date); $course_name = ($course_info['code'] !== '' ? '[' . $course_info['code'] . '] ' : '') . $course_info['name']; $this->render('presence', array('model' => $model, 'base_link_course' => $this->base_link_course, 'base_link_classroom' => $this->base_link_classroom, 'course_name' => $course_name)); }
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; }