本文整理汇总了PHP中Courses::getCourse方法的典型用法代码示例。如果您正苦于以下问题:PHP Courses::getCourse方法的具体用法?PHP Courses::getCourse怎么用?PHP Courses::getCourse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Courses
的用法示例。
在下文中一共展示了Courses::getCourse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionShowLesson
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/");
}
}
示例2: actionCourses
public function actionCourses()
{
$tasks = ['Добавить' => 'add', 'Изменить' => 'edit', 'Удалить' => 'del'];
$task = $_GET['task'];
$id = $_GET['id'];
$view = new View();
$view->tasks = $tasks;
if (!isset($task)) {
} elseif ('add' == $task) {
if (!empty($_POST)) {
$id = Courses::addCourses($_POST);
header('Location: /?ctrl=Admin&act=Courses&task=edit&id=' . $id);
}
$courses = Courses::getCourses();
$view->courses = $courses;
$view->display('admin/header.php');
$view->display('admin/courses/add.php');
$view->display('admin/footer.php');
} elseif ('edit' == $task && isset($id)) {
if (!empty($_POST)) {
Courses::updateCourse($_POST);
}
$course = Courses::getCourse($id);
$courses = Courses::getCourses();
$view->courses = $courses;
$view->course = $course;
$view->display('admin/header.php');
$view->display('admin/courses/edit.php');
$view->display('admin/footer.php');
} elseif ('del' == $task) {
Courses::delCourse($id);
header('Location: /?ctrl=Admin&act=Courses');
} else {
$view->display('header.php');
$view->display('404.php');
$view->display('footer.php');
}
}