Пример #1
0
<?
$last_visit = object_get_visit($_SESSION['SessionSeminar'], "forum");
BlubberPosting::$course_hashes = ($thread['context_type'] === "course" ? $thread['Seminar_id'] : false);
$related_users = $thread['context_type'] === "private" ? $thread->getRelatedUsers() : array();
$author = $thread->getUser();
$author_name = $author->getName();
$author_url = $author->getURL();
$commentable = $GLOBALS['perm']->have_perm("autor") ? true : (bool) $commentable;
?>
<li id="posting_<?php 
echo htmlReady($thread->getId());
?>
" data-mkdate="<?php 
echo htmlReady($thread['discussion_time']);
?>
" data-discussion_time="<?php 
echo htmlReady($thread['discussion_time']);
?>
" class="thread posting<?php 
echo $last_visit < $thread['mkdate'] ? " new" : "";
?>
 <?php 
echo $thread['context_type'];
?>
" data-autor="<?php 
echo htmlReady($thread['user_id']);
?>
">
    <? $thread['discussion_time'] ?>
    <div class="hiddeninfo">
        <input type="hidden" name="context" value="<?php 
Пример #2
0
 /**
  * Displays a single thread.
  * @param string $thread_id
  */
 public function thread_action($thread_id)
 {
     $this->thread = new BlubberPosting($thread_id);
     if ($this->thread['context_type'] === "private") {
         if (!in_array($GLOBALS['user']->id, $this->thread->getRelatedUsers())) {
             throw new AccessDeniedException("Kein Zugriff auf diesen Blubb.");
         }
     } elseif ($this->thread['context_type'] === "course") {
         if (!$GLOBALS['perm']->have_studip_perm("user", $this->thread['Seminar_id'])) {
             throw new AccessDeniedException("Kein Zugriff auf diesen Blubb.");
         }
     }
     if ($this->thread['context_type'] === "course") {
         PageLayout::setTitle($GLOBALS['SessSemName']["header_line"] . " - " . $this->plugin->getDisplayTitle());
     } elseif ($this->thread['context_type'] === "public") {
         PageLayout::setTitle(get_fullname($this->thread['user_id']) . " - Blubber");
     } elseif ($this->thread['context_type'] === "private") {
         PageLayout::setTitle(_("Privater Blubber"));
     }
     if ($this->thread['context_type'] === "course") {
         Navigation::getItem("/course/blubberforum")->setImage(Icon::create('blubber', 'info'));
         Navigation::activateItem('/course/blubberforum');
     } elseif ($this->thread['context_type'] === "public") {
         if (Navigation::hasItem('/profile')) {
             Navigation::activateItem('/profile/blubber');
         }
     } else {
         if (Navigation::hasItem('/community/blubber')) {
             Navigation::activateItem('/community/blubber');
         }
     }
     $this->course_id = $_SESSION['SessionSeminar'];
     $this->single_thread = true;
     BlubberPosting::$course_hashes = $this->thread['user_id'] !== $this->thread['Seminar_id'] ? $this->thread['Seminar_id'] : false;
 }
Пример #3
0
 /**
  * Returns all comments of the blubber starting with the newest.
  * Returns an empty array if blubber_id is from a comment.
  *
  * @get /blubber/posting/:blubber_id/comments
  *
  * @param string $blubber_id  id of the thread
  *
  * @return array   an collection array('collection' => array(...), 'pagination' => array())
  */
 public function getComments($blubber_id)
 {
     $thread = new \BlubberPosting($blubber_id);
     $this->requireReadAccessTo($thread);
     \BlubberPosting::$course_hashes = $thread['context_type'] === "course" ? $thread['seminar_id'] : false;
     $comments = $thread->getChildren($this->offset, $this->limit);
     $json = array();
     foreach ($comments as $comment) {
         $url = $this->urlf('/blubber/comment/%s', array($comment->getId()));
         $json[$url] = $this->blubberPostingtoJSON($comment);
     }
     $this->etag(md5(serialize($json)));
     return $this->paginated($json, $thread->getNumberOfChildren(), array('blubber_id' => $blubber_id));
 }
Пример #4
0
 /**
  * Constructor of Plugin : adds Navigation and collects information for javascript-update.
  */
 public function __construct()
 {
     parent::__construct();
     if (UpdateInformation::isCollecting()) {
         $data = Request::getArray("page_info");
         if (stripos(Request::get("page"), "plugins.php/blubber") !== false && isset($data['Blubber'])) {
             $output = array();
             switch ($data['Blubber']['stream']) {
                 case "global":
                     $stream = BlubberStream::getGlobalStream();
                     break;
                 case "course":
                     $stream = BlubberStream::getCourseStream($data['Blubber']['context_id']);
                     break;
                 case "profile":
                     $stream = BlubberStream::getProfileStream($data['Blubber']['context_id']);
                     break;
                 case "thread":
                     $stream = BlubberStream::getThreadStream($data['Blubber']['context_id']);
                     break;
                 case "custom":
                     $stream = new BlubberStream($data['Blubber']['context_id']);
                     break;
             }
             $last_check = $data['Blubber']['last_check'] ? $data['Blubber']['last_check'] : time() - 5 * 60;
             $new_postings = $stream->fetchNewPostings($last_check);
             $factory = new Flexi_TemplateFactory($this->getPluginPath() . "/views");
             foreach ($new_postings as $new_posting) {
                 if ($new_posting['root_id'] === $new_posting['topic_id']) {
                     $thread = $new_posting;
                     $template = $factory->open("streams/thread.php");
                     $template->set_attribute('thread', $new_posting);
                 } else {
                     $thread = new BlubberPosting($new_posting['root_id']);
                     $template = $factory->open("streams/comment.php");
                     $template->set_attribute('posting', $new_posting);
                 }
                 BlubberPosting::$course_hashes = $thread['user_id'] !== $thread['Seminar_id'] ? $thread['Seminar_id'] : false;
                 $template->set_attribute("course_id", $data['Blubber']['seminar_id']);
                 $output['postings'][] = array('posting_id' => $new_posting['topic_id'], 'discussion_time' => $new_posting['discussion_time'], 'mkdate' => $new_posting['mkdate'], 'root_id' => $new_posting['root_id'], 'content' => $template->render());
             }
             UpdateInformation::setInformation("Blubber.getNewPosts", $output);
             //Events-Queue:
             $db = DBManager::get();
             $events = $db->query("SELECT event_type, item_id " . "FROM blubber_events_queue " . "WHERE mkdate >= " . $db->quote($last_check) . " " . "ORDER BY mkdate ASC " . "")->fetchAll(PDO::FETCH_ASSOC);
             UpdateInformation::setInformation("Blubber.blubberEvents", $events);
             $db->exec("DELETE FROM blubber_events_queue " . "WHERE mkdate < UNIX_TIMESTAMP() - 60 * 60 * 6 " . "");
         }
     }
     if (Navigation::hasItem("/community")) {
         $nav = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "streams/global"));
         $nav->addSubNavigation("global", new AutoNavigation(_("Globaler Stream"), PluginEngine::getURL($this, array(), "streams/global")));
         foreach (BlubberStream::findMine() as $stream) {
             $url = PluginEngine::getURL($this, array(), "streams/custom/" . $stream->getId());
             $nav->addSubNavigation($stream->getId(), new AutoNavigation($stream['name'], $url));
             if ($stream['defaultstream']) {
                 $nav->setURL($url);
             }
         }
         $nav->addSubNavigation("add", new AutoNavigation(_("Neuen Stream erstellen"), PluginEngine::getURL($this, array(), "streams/edit")));
         Navigation::insertItem("/community/blubber", $nav, "online");
         Navigation::getItem("/community")->setURL($nav->getURL());
     }
     if (Navigation::hasItem("/profile") && $this->isActivated(get_userid(Request::username('username', $GLOBALS['auth']->auth['uname'])), 'user')) {
         $nav = new AutoNavigation(_("Blubber"), PluginEngine::getURL($this, array('user_id' => get_userid(Request::get("username"))), "streams/profile"));
         Navigation::addItem("/profile/blubber", $nav);
     }
 }