Ejemplo n.º 1
0
 /**
  * Method to get multiple feeds
  */
 public function action_feeds()
 {
     $data = array();
     if ($this->request->param('start')) {
         $data['offset'] = $this->request->param('start');
     }
     $course_id = $this->request->param('id');
     if ($course_id) {
         $data['course_id'] = $course_id;
     }
     $result = Model_Feed::get_feeds($data);
     $feeds = array();
     foreach ($result as $feed) {
         $feeds[$feed->id] = Feed::factory($feed->type, $feed->id)->render();
     }
     $view = View::factory('feed/feeds')->bind('feeds', $feeds);
     $this->content = $view;
 }
Ejemplo n.º 2
0
 function action_feed()
 {
     $authentification = new Authentification();
     $auth_opt = $authentification->get_auth_opt();
     $model = new Model_Feed();
     if (isset($_GET['delete'])) {
         $model->delete_post($_GET['delete']);
     }
     if (isset($_GET['like_post_id'])) {
         $model->like_post($_GET['like_post_id'], $_SESSION['user_id']);
     }
     if (isset($_GET['recieve_comment'])) {
         $model->add_comment($_GET['recieve_comment']);
     }
     if ($_GET['recieve_post'] == 1) {
         if (isset($_FILES['userfile']['tmp_name'])) {
             $destination = 'images/' . $_FILES['userfile']['name'];
             move_uploaded_file($_FILES['userfile']['tmp_name'], $destination);
         }
         $model->add_post($destination);
     }
     $data = $model->get_posts($_SESSION['user_id']);
     $this->view->generate('view_feed.php', 'view_skeleton.php', $data, $auth_opt);
 }
Ejemplo n.º 3
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;
 }