public function actionShowLesson() { $auth = Auth::checkAuth(); $view = new View(); $view->auth = $auth; if (!isset($_GET['id'])) { header("Location: /learns/"); } if ($auth) { $user = Auth::getUser(); $id = $_GET['id']; $lesson = Lessons::getLesson($id); $course = Courses::getCourse($lesson->course_id); $lesson_prew = Lessons::getLessonByNumber($lesson->lesson_number - 1, $lesson->course_id); $lesson_next = Lessons::getLessonByNumber($lesson->lesson_number + 1, $lesson->course_id); $view->user_login = $user->user_login; $view->user_group = $user->user_group; $view->lesson = $lesson; $view->course = $course; $view->lesson_prew = $lesson_prew; $view->lesson_next = $lesson_next; $view->display('header.php'); $view->display('lessons/lesson_view.php'); $view->display('footer.php'); } else { header("Location: /learns/"); } }
public function actionShow() { $view = new View(); $lessons = Lessons::findAll(); $view->lessons = $lessons; $view->display('admin/header.php'); $view->display('admin/lessons/list.php'); $view->display('admin/footer.php'); }
function draw() { global $display; $keyword = Url::get('keyword'); if (!$keyword) { $keyword = Url::get('keyword_mobile'); } $order_str = ''; $where_class = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%" AND is_active = 1 '; $where_subject = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%" '; $where_lesson = ' WHERE `name` LIKE "%' . addslashes($keyword) . '%" '; $per_page = 21; $list_class = Classes::get_collection(' LIMIT 0, ' . $per_page, $where_class, $order_str); $list_subject = Subjects::get_collection(' LIMIT 0, ' . $per_page, $where_subject, $order_str); $list_lesson = Lessons::get_collection(' LIMIT 0, ' . $per_page, $where_lesson, $order_str); $current_url = strtok($_SERVER['REQUEST_URI'], '&'); if (count($list_class) == $per_page) { $is_next_class = 1; array_pop($list_class); } else { $is_next_class = 0; } if (count($list_subject) == $per_page) { $is_next_subject = 1; array_pop($list_subject); } else { $is_next_subject = 0; } if (count($list_lesson) == $per_page) { $is_next_lesson = 1; array_pop($list_lesson); } else { $is_next_lesson = 0; } $display->add('current_url', $current_url); $display->add('is_next_class', $is_next_class); $display->add('is_next_subject', $is_next_subject); $display->add('is_next_lesson', $is_next_lesson); $display->add('list_class', $list_class); $display->add('list_subject', $list_subject); $display->add('list_lesson', $list_lesson); $display->add('keyword_view', htmlspecialchars($keyword)); $display->add('keyword', $keyword); $display->add('keyword_mobile', $keyword); // Output $display->output("list"); }
public function actionLessons() { $tasks = ['Добавить' => 'show', 'Добавить' => 'add', 'Изменить' => 'edit', 'Удалить' => 'del']; $task = $_GET['task']; $id = $_GET['id']; $view = new View(); $view->tasks = $tasks; if (!isset($task)) { $lessons = Lessons::getLessons($id); $view->lessons = $lessons; $view->display('admin/header.php'); $view->display('admin/lessons/list.php'); $view->display('admin/footer.php'); } elseif ('add' == $task) { if (!empty($_POST)) { $id = Lessons::addLesson($_POST); header('Location: /?ctrl=Admin&act=Lessons&task=edit&id=' . $id); } $courses = Courses::getCourses(); $view->courses = $courses; $view->display('admin/header.php'); $view->display('admin/lessons/add.php'); $view->display('admin/footer.php'); } elseif ('edit' == $task && isset($id)) { if (!empty($_POST)) { Lessons::updateLesson($_POST); } $lesson = Lessons::getLesson($id); $courses = Courses::getCourses(); $view->lesson = $lesson; $view->courses = $courses; $view->display('admin/header.php'); $view->display('admin/lessons/edit.php'); $view->display('admin/footer.php'); } elseif ('del' == $task) { Courses::delCourse($id); header('Location: /?ctrl=Admin&act=Lessons'); } else { $view->display('header.php'); $view->display('404.php'); $view->display('footer.php'); } }
function change_item() { $filter_type = Url::get('filter_type'); if ($filter_type == 1) { $result = Lessons::get_collection_with_join(null); } if ($filter_type == 0) { $result = Classes::get_collection_with_join(null); } $html = ""; if ($result) { foreach ($result as $row) { if ($row['name'] != '' && $row['subject_type'] == 1) { $html .= '<option value="' . $row['id'] . '">' . $row['id'] . '. ' . $row['name'] . '</option>'; } } } echo $html; exit; }
public function actionLesson() { $auth = Auth::checkAuth(); if ($auth) { $user = Users::findOneByPK($auth); $user->getProfile(); } $lesson_id = $_GET['lesson_id']; $view = new View(); // $view->user_login = $user->user_login; // $view->user_group = $user->user_group; if (isset($lesson_id)) { $lesson = Lessons::findOneByPK($lesson_id); $crumbs = Breadcrumbs::getCrumbs($lesson); $view->page_title = $lesson->name; $view->crumbs = $crumbs; $view->user = $user; $view->display('header.php'); $view->display('lessons/lesson.php'); $view->display('footer.php'); } else { throw new ControllerException('Сожалеем, такого урока не существует', '404'); } }
<?php class Lessons { public function __construct() { require 'idiorm.php'; ORM::configure('mysql:host=localhost;dbname=etutor'); ORM::configure('username', 'root'); ORM::configure('password', 'pass'); } public function data() { $id = $_GET['id']; $name = ORM::for_table('name')->raw_query("SELECT * FROM course x INNER JOIN lessons y on x.id = y.c_id WHERE y.c_id = " . $id)->find_many(); foreach ($name as $names) { $nam['lesson'][] = array('cname' => $names->cname, 'clesson' => $names->lesson_name, 'id' => $names->id, 'thum' => $names->c_thumb, 'nov' => $names->c_nv, 'clevel' => $names->c_level, 'cid' => $names->c_id, 'vpath' => $names->l_vpath, "dur" => $names->l_dur); } echo json_encode($nam); } } $serv = new Lessons(); $serv->data();
public function listLessonAction() { $this->view->disable(); $lessons = Lessons::getList(); echo json_encode(array("data" => $lessons->toArray())); }
function draw() { $user_ids = Url::get('id'); global $display; // $this->beginForm(false, 'post', false, Url::build_current(array('cmd' => 'history_lesson'))); $filter_id = intval(trim(Url::get('filter_id'))); $sid = intval(trim(Url::get('subject'))); $display->add('from_time', Url::get('from_time')); $display->add('to_time', Url::get('to_time')); $display->add('subject', $sid); $list_subject = Subjects::get_collection(null); if (!empty($sid)) { $list_lesson = Lessons::get_collection(null, ' subject = ' . $sid); } else { $list_lesson = Lessons::get_collection(null); } $display->add('list_subject', $list_subject); $display->add('list_lesson', $list_lesson); $cond = array(); if (!empty($filter_id)) { $cond[] = 'id LIKE "%' . $filter_id . '%"'; $display->add('filter_id', $filter_id); } $from_time = 0; $to_time = 0; if (Url::get('from_time')) { $date_arr = explode('/', Url::get('from_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $from_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 0); } } if (Url::get('to_time')) { $date_arr = explode('/', Url::get('to_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $to_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 1); } } if ($from_time) { $cond[] = ' `time` >= ' . $from_time; } if ($to_time) { $cond[] = ' `time` <= ' . $to_time; } $cond[] = 'uid = ' . $user_ids; $cond[] = 'type_id = 1'; $str_lesson = ''; foreach ($list_lesson as $lesson) { $str_lesson .= $str_lesson == '' ? $lesson['id'] : ', ' . $lesson['id']; } $cond[] = ' object_id IN (' . $str_lesson . ') '; $item_per_page = 50; $cond = EClassApi::analyze_conditions($cond); $list_user_log = array(); $paging = ''; $total_row = Logs::count_all($cond); if ($total_row) { require_once ROOT_PATH . 'core/ECPagging.php'; $limit = ''; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $list_user_log = Logs::get_collection($limit, $cond, 'ORDER BY id DESC'); } $error_message = $this->getErrorMessage('admin/category/error'); $display->add('error_message', $error_message); $display->add('paging', $paging); $display->add('user_ids', $user_ids); $display->add('list_user_log', $list_user_log); $display->add('is_admin', User::is_admin()); $display->output('history'); // $this->endForm(); }
/** * @return \yii\db\ActiveQuery */ public function getLessons() { return $this->hasMany(Lessons::className(), ['id_discipline' => 'discipline_distribution_id']); }
function draw() { global $display; // $this->beginForm(false, 'post', false, Url::build_current(array('cmd' => 'list_log'))); $filter_id = intval(trim(Url::get('filter_id'))); $filter_type = intval(trim(Url::get('filter_type'))); $type_id = intval(trim(Url::get('type_id'))); $cid = intval(trim(Url::get('cid'))); $display->add('cid', $cid); $display->add('type_id', $type_id); $display->add('from_time', Url::get('from_time')); $display->add('to_time', Url::get('to_time')); $cond = array(); if (!empty($filter_id)) { $cond[] = 'a.id LIKE "' . $filter_id . '"'; $display->add('filter_id', $filter_id); } if (!empty($filter_type)) { switch ($filter_type) { case 1: $cond[] = ' type_id = ' . $filter_type; break; case 2: $cond[] = ' type_id = ' . $filter_type; break; case 0: $cond[] = ' type_id = ' . $filter_type; break; default: // $cond[] = ' type_id = 0'; break; } $display->add('filter_type', $filter_type); } else { $cond[] = ' type_id = 0'; $display->add('filter_type', 0); } if (!empty($type_id) && $type_id != 0) { $cond[] = 'object_id = ' . $type_id; if (!empty($cid)) { $cond[] = ' (CONCAT(",", class_id, ",") LIKE "%,' . $cid . ',%") '; } } $from_time = 0; $to_time = 0; if (Url::get('from_time')) { $date_arr = explode('/', Url::get('from_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $from_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 0); } } if (Url::get('to_time')) { $date_arr = explode('/', Url::get('to_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $to_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 1); } } if ($from_time) { $cond[] = ' `time` >= ' . $from_time; } if ($to_time) { $cond[] = ' `time` <= ' . $to_time; } $item_per_page = 50; $cond = EClassApi::analyze_conditions($cond); $list_log = array(); $paging = ''; $total_row = Logs::count_all($cond); if ($total_row) { require_once ROOT_PATH . 'core/ECPagging.php'; $limit = ''; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $list_log = Logs::get_collection($limit, $cond, ' ORDER BY id DESC'); } $list_class = Classes::get_collection_with_join(null); $list_lesson = Lessons::get_collection_with_join(null); $list_exam = Exam::get_collection(null); $error_message = $this->getErrorMessage('admin/log/error'); $display->add('error_message', $error_message); $display->add('paging', $paging); $display->add('list_log', $list_log); $display->add('list_class', $list_class); $display->add('list_lesson', $list_lesson); $display->add('list_exam', $list_exam); $display->add('is_admin', User::is_admin()); $display->output('ListLog'); // $this->endForm(); }
public function show_content() { header('Content-Type: text/html; charset=utf-8'); global $display; $path_id = Url::get('path_id'); $current_part = Lessons::get_item($path_id); $html = ""; $html .= $current_part['content']; echo $html; exit; }
function show_more_history_student() { header('Content-Type: text/html; charset=utf-8'); global $display; $id_view = intval(Url::get('id_view', 0)); $anchor_index = intval(Url::get('anchor_index_h', 0)); if ($id_view) { $history_student = Classes::get_list_teacher_log(' LIMIT ' . $anchor_index * 6 . ', 7', ' WHERE uid = ' . $id_view, 'ORDER BY id DESC'); } else { $history_student = Classes::get_list_teacher_log(' LIMIT ' . $anchor_index * 6 . ', 7', ' WHERE uid = ' . $_SESSION['user_id'], 'ORDER BY id DESC'); } $list_teacher = Teachers::get_collection(null); $list_lesson = Lessons::get_collection_with_join(null); if (count($history_student) == 7) { $is_next_h = 1; array_pop($history_student); } else { $is_next_h = 0; } if (empty($history_student)) { exit; } $display->add('history_student', $history_student); $display->add('list_teacher', $list_teacher); $display->add('list_lesson', $list_lesson); $display->add('anchor_index', $anchor_index); $display->add('is_next_h', $is_next_h); $display->output('Personal/ajax/ShowMoreHistory'); exit; }