-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathIndex.php
More file actions
29 lines (22 loc) · 818 Bytes
/
Copy pathIndex.php
File metadata and controls
29 lines (22 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Courses_Index extends Controller_Base_preDispatch
{
public function action_show()
{
$courseId = $this->request->param('id') ?: $this->request->query('id');
$isAlias = $this->request->query('id');
$course = Model_Courses::get($courseId);
if ($course->id == 0) {
throw new HTTP_Exception_404();
}
if (!empty($courseId)) {
if ($course->uri && !$isAlias) {
$this->redirect($course->uri);
}
}
$this->view["course"] = $course;
$this->title = $course->title;
$this->description = $course->description;
$this->template->content = View::factory('templates/courses/course', $this->view);
}
}