コード例 #1
0
ファイル: StreamAvatar.class.php プロジェクト: ratbird/hope
 /**
  * Return the default title of the avatar.
  * @return string the default title
  */
 function getDefaultTitle()
 {
     require_once dirname(__FILE__) . '/BlubberStream.class.php';
     return BlubberStream::find($this->user_id)->name;
 }
コード例 #2
0
ファイル: streams.php プロジェクト: ratbird/hope
 public function get_streams_threadnumber_action()
 {
     $stream = new BlubberStream();
     //Pool-rules
     $stream['pool_courses'] = Request::get("pool_courses_check") ? in_array("all", Request::getArray("pool_courses")) ? array("all") : Request::getArray("pool_courses") : null;
     $stream['pool_groups'] = Request::get("pool_groups_check") ? in_array("all", Request::getArray("pool_groups")) ? array("all") : Request::getArray("pool_groups") : null;
     $stream['pool_hashtags'] = Request::get("pool_hashtags_check") ? preg_split("/\\s+/", Request::get("pool_hashtags"), null, PREG_SPLIT_NO_EMPTY) : null;
     if (is_array($stream['pool_hashtags'])) {
         $stream['pool_hashtags'] = array_map(function ($tag) {
             while ($tag[0] === "#") {
                 $tag = substr($tag, 1);
             }
             return $tag;
         }, $stream['pool_hashtags']);
     }
     //Filter-rules
     $stream['filter_type'] = Request::get("filter_type_check") ? Request::getArray("filter_type") : null;
     $stream['filter_courses'] = Request::get("filter_courses_check") ? in_array("all", Request::getArray("filter_courses")) ? array("all") : Request::getArray("filter_courses") : null;
     $stream['filter_groups'] = Request::get("filter_groups_check") ? in_array("all", Request::getArray("filter_groups")) ? array("all") : Request::getArray("filter_groups") : null;
     $stream['filter_hashtags'] = Request::get("filter_hashtags_check") ? preg_split("/\\s+/", Request::get("filter_hashtags"), null, PREG_SPLIT_NO_EMPTY) : null;
     if (is_array($stream['filter_hashtags'])) {
         $stream['filter_hashtags'] = array_map(function ($tag) {
             while ($tag[0] === "#") {
                 $tag = substr($tag, 1);
             }
             return $tag;
         }, $stream['filter_hashtags']);
     }
     $stream['filter_nohashtags'] = Request::get("filter_nohashtags_check") ? preg_split("/\\s+/", Request::get("filter_nohashtags"), null, PREG_SPLIT_NO_EMPTY) : null;
     if (is_array($stream['filter_nohashtags'])) {
         $stream['filter_nohashtags'] = array_map(function ($tag) {
             while ($tag[0] === "#") {
                 $tag = substr($tag, 1);
             }
             return $tag;
         }, $stream['filter_nohashtags']);
     }
     $this->render_text($stream->fetchNumberOfThreads());
 }
コード例 #3
0
ファイル: Blubber.php プロジェクト: ratbird/hope
 /**
  * Returns the rest resource of the stream regarding a stream a context-id and the parameters
  * stream-time, limit and offset (all in $this).
  *
  * @param BlubberStream $stream : the stream
  * @param $parameter : an array of context-parameter i.e. array('user_id' => $user_id)
  *
  * @return Array('collection' => array(...), 'pagination' => array())
  */
 private function getStreamBlubberRestResource($stream, $parameter)
 {
     $total = $stream->fetchNumberOfThreads();
     $threads = $stream->fetchThreads((int) $this->offset, (int) $this->limit ?: null, $this->stream_time ?: null);
     $json = array();
     foreach ($threads as $thread) {
         $url = $this->urlf('/blubber/posting/%s', array($thread->getId()));
         $json[$url] = $this->blubberPostingtoJSON($thread);
     }
     $this->etag(md5(serialize($json)));
     return $this->paginated($json, $total, $parameter);
 }
コード例 #4
0
ファイル: Blubber.class.php プロジェクト: ratbird/hope
 /**
  * Needed function to return notification-objects.
  * @param string $course_id
  * @param int $since
  * @param string $user_id
  * @return array of type ContentElement
  */
 public function getNotificationObjects($course_id, $since, $user_id)
 {
     $blubber = BlubberStream::getCourseStream($course_id)->fetchNewPostings($since);
     $contents = array();
     foreach ($blubber as $blubb) {
         $contents[] = new ContentElement($blubb['name'], $blubb['name'], $blubb['description'], $blubb['user_id'], get_fullname($blubb['user_id']), PluginEngine::getURL($this, array(), 'streams/thread/' . $blubb['root_id']), $blubb['mkdate']);
     }
     return $contents;
 }