public function getFollowedSlides() { $this->initConnection(); $res = array(); $res_array = $this->dbQuery('SELECT * FROM subscription WHERE item_type="slide" AND user_id=:id', array('id' => $this->id)); foreach ($res_array as $row) { $slide = new Slide(); $slide->slide_id = $row['item_id']; $slide->createFromIDLite($slide->getLastRevisionID()); $title = $slide->getTitle(); $slide->title = $slide->shortenTitle($title); $res[] = $slide; } return $res; }
public function getCreateQuestionRevision($user_id = false, $start, $end, $keywords = '') { if ($user_id) { $user = new User(); $user->id = $user_id; $user->getUsername(); $this->initConnection(); $activities = array(); $result = array(); if (strlen($keywords)) { $result = $this->dbQuery('SELECT * FROM questions WHERE user_id=:user_id AND based_on IS NOT NULL AND MATCH (question) AGAINST (\'' . $keywords . '*\' IN BOOLEAN MODE)', array('user_id' => $user_id)); } else { $result = $this->dbQuery('SELECT * FROM questions WHERE user_id=:user_id AND based_on IS NOT NULL AND timestamp >= "' . $start . '" AND timestamp < "' . $end . '"', array('user_id' => $user_id)); } if (count($result)) { foreach ($result as $row) { $question = new Question(); $question->question = $row['question']; $text = new Slide(); $text->slide_id = $row['item_id']; $text->createFromIDLite($text->getLastRevisionID()); $text->title = $text->getTitle(); if ($text->title == "") { $text->title = "Untitled"; } $activity = new Activity($row['timestamp'], $user, 'created_question', $question, $text); $activities[] = $activity; } } if (count($activities)) { foreach ($activities as $activity) { $this->activities[] = $activity; } } } }