本文整理汇总了PHP中Courses::findOneByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP Courses::findOneByPK方法的具体用法?PHP Courses::findOneByPK怎么用?PHP Courses::findOneByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Courses
的用法示例。
在下文中一共展示了Courses::findOneByPK方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionShow
public function actionShow()
{
$auth = Auth::checkAuth();
if ($auth) {
$user = Users::findOneByPK($auth);
$user->getProfile();
}
$course_id = $_GET['course_id'];
$view = new View();
// $view->user_login = $user->user_login;
// $view->user_group = $user->user_group;
if (isset($course_id)) {
$lessons = Lessons::findAllByColumn('parent_id', $course_id);
$course = Courses::findOneByPK($course_id);
$crumbs = Breadcrumbs::getCrumbs($course);
$view->crumbs = $crumbs;
$view->user = $user;
$view->lessons = $lessons;
$view->page_title = $course->name;
$view->display('header.php');
$view->display('lessons/list.php');
$view->display('footer.php');
} else {
throw new ControllerException('Невозможно отобразить список уроков для данного курса', '404');
}
}
示例2: actionShow
public function actionShow()
{
$id = $_GET['id'];
$auth = Auth::checkAuth();
if ($auth) {
$user = Users::findOneByPK($auth);
$user->getProfile();
}
$courses = Courses::findAllByColumn('parent_id', $id);
$view = new View();
$view->user = $user;
$view->courses = $courses;
// $view->user_login = $user->user_login;
// $view->user_group = $user->user_group;
$parent_course = Courses::findOneByPK($id);
$crumbs = Breadcrumbs::getCrumbs($parent_course);
$view->crumbs = $crumbs;
$view->page_title = $parent_course->name;
$view->display('header.php');
if (isset($id)) {
$view->display('courses/child-list.php');
} else {
$view->display('courses/list.php');
}
$view->display('footer.php');
}
示例3: actionTest
public function actionTest()
{
$course = Courses::findOneByPK(11);
$course->delete();
var_dump($course);
die;
}
示例4: actionDel
public function actionDel()
{
$id = $_GET['id'];
if (!empty($id)) {
$course = Courses::findOneByPK($id);
if ($course) {
$course->delete();
} else {
header('Location: ' . ADMIN_PATH);
}
} else {
header('Location: ' . ADMIN_PATH);
}
header('Location: ' . ADMIN_PATH . '?ctrl=courses');
}