本文整理汇总了PHP中Courses::getCourses方法的典型用法代码示例。如果您正苦于以下问题:PHP Courses::getCourses方法的具体用法?PHP Courses::getCourses怎么用?PHP Courses::getCourses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Courses
的用法示例。
在下文中一共展示了Courses::getCourses方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionShowAll
public function actionShowAll()
{
$auth = Auth::checkAuth();
$view = new View();
$view->auth = $auth;
if ($auth) {
$user = Auth::getUser();
$courses = Courses::getCourses();
$view->user_login = $user->user_login;
$view->user_group = $user->user_group;
$view->courses = $courses;
$view->display('header.php');
$view->display('courses/courses_list.php');
$view->display('footer.php');
} else {
header("Location: /learns/");
}
}
示例2: actionLessons
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');
}
}