diff options
Diffstat (limited to 'public/app/controllers/cms/Course.php')
| -rw-r--r-- | public/app/controllers/cms/Course.php | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/public/app/controllers/cms/Course.php b/public/app/controllers/cms/Course.php index a1de9c1..c795ab9 100644 --- a/public/app/controllers/cms/Course.php +++ b/public/app/controllers/cms/Course.php @@ -131,7 +131,9 @@ class Course { 'categories' => $tree, 'breadcrumbs' => $breadcrumbs, 'lessons' => $lessons, - 'course_path' => $course_path + 'course_path' => $course_path, + // needed by footer + 'entity' => Cache_service::pages_list() ]); } @@ -174,6 +176,12 @@ class Course { } $course_path[] = intval($course_id); + // NOTE: CRITICAL: + // do not pass Class::method directly to the eported variables + // $entity = Cache_service::pages_list(); + + // var_dump($entity); die(); + // then Render // --- -- -- - - - Render::view('templates/lesson', [ @@ -185,7 +193,9 @@ class Course { // needed for side panel and breadcrunbs 'categories' => $tree, 'breadcrumbs' => $breadcrumbs, - 'course_path' => $course_path + 'course_path' => $course_path, + // needed by footer + 'entity' => Cache_service::pages_list() ]); } else { // user is not authorized @@ -202,7 +212,31 @@ class Course { } + /** lesson + * + * check if user is authorized to view the content; + * if so, prepare and render the lesson view + * + * @param $id : lesson id + */ + public static function page($id) + { + $id = intval($id); // lesson id + + $pages = Cache_service::pages_list(); + $page = $pages[$id]; + + // then Render + // --- -- -- - - - + Render::view('templates/page', [ + // main content + 'id' => $id, + 'page' => $page, + // needed by footer + 'entity' => $pages + ]); + } |
