Beispiel #1
0
 public function render()
 {
     $user = ORM::factory('user', $this->actor_id);
     $course = ORM::factory('course', $this->respective_id);
     if ($this->check_deleted($course)) {
         return View::factory('feed/unavaliable')->render();
     }
     $count_user = Model_Course::get_users_count($this->respective_id, 'student');
     $span = Date::fuzzy_span($this->time);
     $feed_id = $this->id;
     $comment = ORM::factory('feedcomment');
     $comment->where('feed_id', '=', $feed_id)->order_by('date', 'DESC');
     $comments = $comment->find_all();
     $curr_user = Auth::instance()->get_user();
     $role = $curr_user->role()->name;
     $url = Url::site('profile/view/id/');
     $view = View::factory('feed/' . $this->type . '_' . $this->action)->bind('user', $user)->bind('count_user', $count_user)->bind('course', $course)->bind('span', $span)->bind('role', $role)->bind('feed_id', $feed_id)->bind('comments', $comments)->bind('url', $url);
     return $view->render();
 }
Beispiel #2
0
 public function action_summary()
 {
     $id = $this->request->param('id');
     if (!$id) {
         Request::current()->redirect('course');
     }
     Session::instance()->set('course_id', $id);
     $course = ORM::factory('course', $id);
     // Todo
     $count_student = Model_Course::get_users_count($id, 'student');
     $results = Hook::instance()->trigger("course_count", $course);
     //$count_exam = Model_Exam::get_course_exams_count($id);
     $count = array('count_student' => $count_student, 'results' => $results);
     $feeds = Request::factory('feed/feeds/id/' . $id)->method(Request::GET)->execute()->body();
     $data = array();
     $data['course_id'] = $id;
     $total_feeds = Model_Feed::get_total_feeds($data);
     $view = View::factory('course/summary')->bind('course', $course)->bind('feeds', $feeds)->bind('total_feeds', $total_feeds)->bind('count', $count);
     Breadcrumbs::add(array('Courses', Url::site('course')));
     Breadcrumbs::add(array($course->name, Url::site('course/summary/id/' . $id)));
     $this->content = $view;
 }