public function __construct()
 {
     parent::__construct();
     if (false) {
         //Suche ersetzen
         if (Navigation::hasItem("/search")) {
             $nav = Navigation::getItem("/search");
             $nav->setURL(PluginEngine::getURL($this, array(), "search"));
             foreach ($nav->getSubNavigation() as $name => $nav_object) {
                 $nav->removeSubNavigation($name);
             }
             $tab = new AutoNavigation(_("Suche"), PluginEngine::getURL($this, array(), "search"));
             $nav->addSubNavigation('search', $tab);
         }
     } else {
         //Suche erweitern
         if (Navigation::hasItem("/search")) {
             $nav = Navigation::getItem("/search");
             $nav->setURL(PluginEngine::getURL($this, array(), "search"));
             $tab = new AutoNavigation(_("Suche"), PluginEngine::getURL($this, array(), "search"));
             $nav->addSubNavigation('search', $tab);
         }
     }
     //Observer definieren:
     NotificationCenter::addObserver($this, "show_user_avatar", "WillDisplaySearchResultItem");
     NotificationCenter::addObserver($this, "show_seminar_avatar", "WillDisplaySearchResultItem");
     NotificationCenter::addObserver($this, "show_document_avatar", "WillDisplaySearchResultItem");
     NotificationCenter::addObserver($this, "add_calculator", "LastAlteringOfSearchResults");
     NotificationCenter::addObserver($this, "filter_study_areas", "GlobalSearchFilter");
 }
 /**
  * @deprecated
  */
 function setNavigation(StudipPluginNavigation $navigation)
 {
     parent::setNavigation($navigation);
     if (Navigation::hasItem('/admin/plugins')) {
         Navigation::addItem('/admin/plugins/' . $this->getPluginclassname(), $navigation);
     }
 }
Exemplo n.º 3
0
 function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (Navigation::hasItem("/tools/questionnaire")) {
         Navigation::activateItem("/tools/questionnaire");
     }
     Sidebar::Get()->setImage(Assets::image_path("sidebar/evaluation-sidebar.png"));
     PageLayout::setTitle(_("Fragebögen"));
     class_exists("Test");
     //trigger autoloading
 }
 /**
  * Sets the navigation of this plugin.
  *
  * @deprecated
  */
 function setNavigation(StudipPluginNavigation $navigation)
 {
     parent::setNavigation($navigation);
     // prepend copy of navigation to its sub navigation
     $item_names = array_keys($navigation->getSubNavigation());
     $navigation_copy = clone $navigation;
     $navigation_copy->clearSubmenu();
     $navigation_copy->freezeActivation();
     $navigation->insertSubNavigation('self', $navigation_copy, $item_names[0]);
     $navigation->setTitle($this->getDisplayTitle());
     // Check activation for user and display if appropriate.
     if (Navigation::hasItem('/profile') && is_object($this->getRequestedUser()) && $GLOBALS['perm']->have_profile_perm('user', $this->getRequestedUser()->getUserid()) && PluginManager::getInstance()->isPluginActivatedForUser($this->getPluginId(), $this->getRequestedUser()->getUserid())) {
         Navigation::addItem('/profile/' . $this->getPluginclassname(), $navigation);
     }
 }
Exemplo n.º 5
0
 private function setupNavigation()
 {
     global $perm;
     $cid = $this->getContext();
     if (Request::isXhr() || Navigation::hasItem('/course/cliqr') || !$this->isActivated($cid) || !$perm->have_studip_perm("tutor", $cid)) {
         return;
     }
     # /course/cliqr -> plugins.php/cliqrplugin/questions
     $url = PluginEngine::getURL('cliqrplugin', compact('cid'), 'questions', true);
     $navigation = new Navigation(_('Cliqr'), $url);
     $navigation->setImage(Assets::image_path('icons/16/white/test.png'));
     $navigation->setActiveImage(Assets::image_path('icons/16/black/test.png'));
     # /course/cliqr/index -> plugins.php/cliqrplugin/questions#index
     $navigation->addSubNavigation("index", new Navigation(_("Fragen"), $url . '#index'));
     # /course/cliqr/new -> plugins.php/cliqrplugin/questions#new
     $navigation->addSubNavigation("new", new Navigation(_("Frage erstellen"), $url . '#new'));
     # /course/cliqr/help -> plugins.php/cliqrplugin/help
     $url = PluginEngine::getURL('cliqrplugin', compact('cid'), 'help', true);
     $navigation->addSubNavigation("help", new Navigation(_("Methodische Informationen"), $url));
     Navigation::addItem('/course/cliqr', $navigation);
 }
Exemplo n.º 6
0
 /**
  * @var Container
  */
 public function __construct()
 {
     parent::__construct();
     global $perm;
     $this->course = Course::findCurrent();
     $this->course_id = $this->course->id;
     $this->course = Course::findCurrent();
     if ($this->course) {
         $this->setupStudIPNavigation();
         if (Navigation::hasItem('/course/admin') && $perm->have_studip_perm('dozent', $this->course_id)) {
             $url = PluginEngine::getURL($this);
             $scormItem = new Navigation(_('Inhaltselemente bearbeiten'), $url);
             Navigation::addItem('/course/admin/seminar_tabs', $scormItem);
         } else {
             if (Navigation::hasItem('/admin/course/details')) {
                 $url = PluginEngine::getURL($this);
                 $scormItem = new Navigation(_('Inhaltselemente bearbeiten'), $url);
                 Navigation::addItem('/admin/course/seminar_tabs', $scormItem);
             }
         }
     }
 }
Exemplo n.º 7
0
 /**
  * Common actions before any other action
  *
  * @param String $action Action to be executed
  * @param Array $args Arguments passed to the action
  * @throws Trails_Exception when either no course was found or the user
  *                          may not access this area
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Try to find a valid course
     if (Course::findCurrent()) {
         $course_id = Course::findCurrent()->id;
     } else {
         throw new Trails_Exception(404, _('Es wurde keine Veranstaltung ausgewählt!'));
     }
     if (!$GLOBALS['perm']->have_studip_perm('tutor', $course_id)) {
         throw new Trails_Exception(400);
     }
     // Get seminar instance
     $this->course = Seminar::getInstance($course_id);
     if (Navigation::hasItem('course/admin/dates')) {
         Navigation::activateItem('course/admin/dates');
     }
     $this->show = array('regular' => true, 'irregular' => true, 'roomRequest' => true);
     PageLayout::setHelpKeyword('Basis.Veranstaltungen');
     PageLayout::addSqueezePackage('raumzeit');
     $title = _('Verwaltung von Zeiten und Räumen');
     $title = $this->course->getFullname() . ' - ' . $title;
     PageLayout::setTitle($title);
     $_SESSION['raumzeitFilter'] = Request::get('newFilter');
     // bind linkParams for chosen semester and opened dates
     URLHelper::bindLinkParam('raumzeitFilter', $_SESSION['raumzeitFilter']);
     $this->checkFilter();
     $this->selection = $this->getSemestersForCourse($this->course, $_SESSION['raumzeitFilter']);
     if (!Request::isXhr()) {
         $this->setSidebar();
     } elseif (Request::isXhr() && $this->flash['update-times']) {
         $semester_id = $GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE;
         if ($semester_id === 'all') {
             $semester_id = '';
         }
         $this->response->add_header('X-Raumzeit-Update-Times', json_encode(studip_utf8encode(array('course_id' => $this->course->id, 'html' => Seminar::GetInstance($this->course->id)->getDatesHTML(array('semester_id' => $semester_id, 'show_room' => true)) ?: _('nicht angegeben')))));
     }
 }
Exemplo n.º 8
0
 public function before_filter(&$action, &$args)
 {
     $this->set_layout($GLOBALS['template_factory']->open('layouts/base_without_infobox'));
     $this->course = Course::findCurrent();
     if (!$this->course) {
         throw new CheckObjectException(_('Sie haben kein Objekt gewählt.'));
     } else {
         if (Navigation::hasItem('/course/admin')) {
             Navigation::activateItem('/course/admin/seminar_tabs');
         } else {
             if (Navigation::hasItem('/admin/course/seminar_tabs')) {
                 Navigation::activateItem('/admin/course/seminar_tabs');
             }
         }
         $this->ignore_tabs = array('modules', 'mini_course');
         $this->ignore_visibility_tabs = array('admin', 'main');
         $this->course_id = $this->course->id;
         $this->sem = Seminar::getInstance($this->course_id);
         $sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$this->sem->status]['class']];
         $sem_class || ($sem_class = SemClass::getDefaultSemClass());
         $this->studygroup_mode = $SEM_CLASS[$SEM_TYPE[$this->sem->status]["class"]]["studygroup_mode"];
     }
 }
Exemplo n.º 9
0
echo Assets::url('sounds/blubb.ogg');
?>
" type="audio/ogg">
                    <source src="<?php 
echo Assets::url('sounds/blubb.mp3');
?>
" type="audio/mpeg">
                </audio>
                <? endif ?>
            </li>
            <? endif ?>
            <? if (isset($search_semester_nr)) : ?>
            <li>
                        </li>
            <? endif ?>
            <? if (Navigation::hasItem('/links')) : ?>
            <? foreach (Navigation::getItem('/links') as $nav) : ?>
                <? if ($nav->isVisible()) : ?>
                    <li <? if ($nav->isActive()) echo 'class="active"'; ?>>
                    <a
                    <? if (is_internal_url($url = $nav->getURL())) : ?>
                        href="<?php 
echo URLHelper::getLink($url, $link_params);
?>
"
                    <? else : ?>
                        href="<?php 
echo htmlReady($url);
?>
" target="_blank"
                    <? endif ?>
Exemplo n.º 10
0
    object_set_visit($course_id, "sem");
}
// gibt es eine Anweisung zur Umleitung?
if (Request::get('redirect_to')) {
    $query_parts = explode('&', stristr(urldecode($_SERVER['QUERY_STRING']), 'redirect_to'));
    list(, $where_to) = explode('=', array_shift($query_parts));
    $new_query = $where_to . '?' . join('&', $query_parts);
    $new_query = preg_replace('/[^:0-9a-z+_\\-.#?&=\\/]/i', '', $new_query);
    header('Location: ' . URLHelper::getURL($new_query, array('cid' => $course_id)));
    die;
}
$sem_class = Seminar::getInstance($course_id)->getSemClass();
if ($sem_class->getSlotModule("overview")) {
    foreach ($sem_class->getNavigationForSlot("overview") as $nav) {
        header('Location: ' . URLHelper::getURL($nav->getURL()));
        die;
    }
} else {
    $Modules = new Modules();
    $course_modules = $Modules->getLocalModules($course_id);
    if (!$course_modules['overview'] && !$sem_class->isSlotMandatory("overview")) {
        //Keine Übersichtsseite. Anstatt eines Fehler wird der Nutzer zum ersten
        //Reiter der Veranstaltung weiter geleitet.
        if (Navigation::hasItem("/course")) {
            foreach (Navigation::getItem("/course")->getSubNavigation() as $navigation) {
                header('Location: ' . URLHelper::getURL($navigation->getURL()));
                die;
            }
        }
    }
}
Exemplo n.º 11
0
 /**
  * Returns the base navigation object (not its path) for the tabs.
  * May return NULL if tab display is disabled.
  */
 public static function getTabNavigation()
 {
     if (self::$tab_navigation === false) {
         self::$tab_navigation = Navigation::hasItem('/') ? Navigation::getItem('/')->activeSubNavigation() : null;
     }
     return self::$tab_navigation;
 }
Exemplo n.º 12
0
 * "Ich will unsichtbar sein" angezeigt.
 *
 * Bei Nutzung dieser Funktion unbedingt die Texte unter locale/de/LC_HELP/visibility_decision.php bzw.
 * locale/en/LC_HELP/visibility_decision.php an die lokalen Verhältnisse anpassen!
 */
if ($GLOBALS['USER_VISIBILITY_CHECK'] && is_object($GLOBALS['user']) && $GLOBALS['user']->id != 'nobody') {
    require_once 'lib/user_visible.inc.php';
    first_decision($GLOBALS['user']->id);
}
if (PageLayout::isHeaderEnabled()) {
    $header_template = $GLOBALS['template_factory']->open('header');
    $header_template->current_page = PageLayout::getTitle();
    $header_template->link_params = array_fill_keys(array_keys(URLHelper::getLinkParams()), NULL);
    if (is_object($GLOBALS['user']) && $GLOBALS['user']->id != 'nobody') {
        // only mark course if user is logged in and free access enabled
        if (get_config('ENABLE_FREE_ACCESS') && Navigation::hasItem('/course') && Navigation::getItem('/course')->isActive()) {
            // indicate to the template that this course is publicly visible
            // need to handle institutes separately (always visible)
            if ($GLOBALS['SessSemName']['class'] == 'inst') {
                $header_template->public_hint = _('öffentliche Einrichtung');
            } else {
                if (Course::findCurrent()->lesezugriff == 0) {
                    $header_template->public_hint = _('öffentliche Veranstaltung');
                }
            }
        }
        if ($GLOBALS['user']->cfg->getValue('ACCESSKEY_ENABLE')) {
            $header_template->accesskey_enabled = true;
        }
        // fetch semester for quick search box in the link bar
        $semester_data = SemesterData::GetSemesterArray();
Exemplo n.º 13
0
 public function testNavigationTree()
 {
     $navigation = new Navigation('test');
     $nav1 = new Navigation('foo', NULL);
     $nav2 = new Navigation('bar', 'bar.php');
     $nav3 = new Navigation('baz', 'baz.php');
     $nav4 = new Navigation('egg', 'egg.php');
     $this->assertFalse(Navigation::hasItem('/test/a2'));
     Navigation::addItem('/test', $navigation);
     Navigation::addItem('/test/a1', $nav1);
     Navigation::addItem('/test/a2', $nav2);
     Navigation::addItem('/test/a3', $nav3);
     Navigation::addItem('/test/a2/b1', $nav4);
     $this->assertTrue(Navigation::hasItem('/test/a2'));
     $this->assertFalse(Navigation::getItem('/test')->isActive());
     $this->assertEquals('bar.php', Navigation::getItem('/test')->getURL());
     $this->assertEquals(array('a1' => $nav1, 'a2' => $nav2, 'a3' => $nav3), Navigation::getItem('/test')->getSubNavigation());
     Navigation::activateItem('/test/a2/b1');
     $this->assertTrue(Navigation::getItem('/test')->isActive());
     $this->assertTrue(Navigation::getItem('/test/a2')->isActive());
     $this->assertTrue(Navigation::getItem('/test/a2/b1')->isActive());
     Navigation::removeItem('/test/a3');
     Navigation::insertItem('/test/a3', $nav3, 'a2');
     Navigation::removeItem('/test/a1');
     Navigation::insertItem('/test/a2/a1', $nav1, '');
     $this->assertEquals('baz.php', Navigation::getItem('/test')->getURL());
     $this->assertEquals(array('a3' => $nav3, 'a2' => $nav2), Navigation::getItem('/test')->getSubNavigation());
     $this->assertEquals(array('b1' => $nav4, 'a1' => $nav1), Navigation::getItem('/test/a2')->getSubNavigation());
 }
Exemplo n.º 14
0
">
<input type="hidden" id="user_id" value="<?php 
echo htmlReady($GLOBALS['user']->id);
?>
">
<input type="hidden" id="stream_time" value="<?php 
echo time();
?>
">
<input type="hidden" id="browser_start_time" value="">
<input type="hidden" id="orderby" value="mkdate">
<div id="editing_question" style="display: none;"><?php 
echo _("Wollen Sie den Beitrag wirklich bearbeiten?");
?>
</div>
<? if (Navigation::hasItem("/community/blubber")) : ?>
<p>
    <? switch ($thread['context_type']) {
        case "course":
            $overview_url = URLHelper::getURL("plugins.php/blubber/streams/forum", array('cid' => $thread['Seminar_id']));
            break;
        case "public":
            $overview_url = URLHelper::getURL("plugins.php/blubber/streams/profile", array('user_id' => $thread['user_id'], 'extern' => $thread['external_contact'] ? $thread['external_contact'] : null));
            break;
        default:
            $overview_url = URLHelper::getURL("plugins.php/blubber/streams/global");
    } ?>
    <a href="<?php 
echo URLHelper::getLink($overview_url);
?>
">
Exemplo n.º 15
0
include 'lib/seminar_open.php'; // initialise Stud.IP-Session


// -- here you have to put initialisations for the current page

if (get_config('RESOURCES_ENABLE')) {
    include_once($GLOBALS['RELATIVE_PATH_RESOURCES'] . "/lib/DeleteResourcesUser.class.php");
}

if ($perm->have_perm('admin')) {
    if (Navigation::hasItem('/browse/my_courses/list')) {
        Navigation::activateItem('/browse/my_courses/list');
    }
} else {
    if (Navigation::hasItem('/course/admin/main/archive')) {
        Navigation::activateItem('/course/admin/main/archive');
    }
}

PageLayout::setTitle(_("Archivieren von Veranstaltungen"));

//Change header_line if open object
if ($SessSemName[1]) {
    PageLayout::setTitle(getHeaderLine($SessSemName[1]) . " - " . PageLayout::getTitle());
}
// single delete (a Veranstaltung is open)
if ($SessSemName[1]) {
    $archiv_sem[] = "_id_" . $SessSemName[1];
    $archiv_sem[] = "on";
}
Exemplo n.º 16
0
<body id="<?php 
echo $body_id ? $body_id : PageLayout::getBodyElementId();
?>
">
<div id="layout_wrapper">
    <? SkipLinks::insertContainer() ?>
    <? SkipLinks::addIndex(_("Hauptinhalt"), 'layout_content', 100, true) ?>
    <?php 
echo PageLayout::getBodyElements();
?>

    <? include 'lib/include/header.php' ?>

    <div id="layout_page">
        <? if (PageLayout::isHeaderEnabled() && is_object($GLOBALS['user']) && $GLOBALS['user']->id != 'nobody' && Navigation::hasItem('/course') && Navigation::getItem('/course')->isActive() && $_SESSION['seminar_change_view_'.$GLOBALS['SessionSeminar']]) : ?>
            <?php 
echo $this->render_partial('change_view', array('changed_status' => $_SESSION['seminar_change_view_' . $GLOBALS['SessionSeminar']]));
?>
        <? endif ?>

        <? if (PageLayout::isHeaderEnabled() && isset($navigation)) : ?>
            <?php 
echo $this->render_partial('tabs', compact("navigation"));
?>
        <? endif ?>

        <?php 
echo Helpbar::get()->render();
?>
        <div id="layout_container">
Exemplo n.º 17
0
// This also binds the global $_SESSION['SessionSeminar']
// variable to the URL parameter 'cid' for all generated links.
if (isset($course_id)) {
    selectSem($course_id) || selectInst($course_id);
    unset($course_id);
}
if (Request::get("sober") && ($GLOBALS['user']->id === "nobody" || $GLOBALS['perm']->have_perm("root"))) {
    //deactivate non-core-plugins:
    URLHelper::bindLinkParam("sober", $sober);
    PluginManager::$sober = true;
}
// load the default set of plugins
PluginEngine::loadPlugins();
// add navigation item: add modules
if ((Navigation::hasItem('/course/admin') || $GLOBALS['perm']->have_perm('admin')) && ($perm->have_studip_perm('tutor', $SessSemName[1]) && $SessSemName['class'] == 'sem') && ($SessSemName['class'] != 'sem' || !$GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$SessSemName['art_num']]['class']]['studygroup_mode'])) {
    $plus_nav = new Navigation(_('Mehr …'), 'dispatch.php/course/plus/index');
    $plus_nav->setDescription(_("Mehr Stud.IP-Funktionen für Ihre Veranstaltung"));
    Navigation::addItem('/course/modules', $plus_nav);
}
// add navigation item for profile: add modules
if (Navigation::hasItem('/profile/edit')) {
    $plus_nav = new Navigation(_('Mehr …'), 'dispatch.php/profilemodules/index');
    $plus_nav->setDescription(_("Mehr Stud.IP-Funktionen für Ihr Profil"));
    Navigation::addItem('/profile/modules', $plus_nav);
}
if ($user_did_login) {
    NotificationCenter::postNotification('UserDidLogin', $user->id);
}
if ($seminar_open_redirected) {
    startpage_redirect(UserConfig::get($user->id)->PERSONAL_STARTPAGE);
}
Exemplo n.º 18
0
 public function __construct()
 {
     global $perm;
     parent::__construct();
     if (UpdateInformation::isCollecting()) {
         $data = Request::getArray("page_info");
         if (stripos(Request::get("page"), "plugins.php/blubber") !== false) {
             $output = array();
             $context_id = $data['Blubber']['context_id'];
             $stream = $data['Blubber']['stream'];
             $last_check = $data['Blubber']['last_check'] ? $data['Blubber']['last_check'] : time() - 5 * 60;
             $parameter = array('since' => $last_check);
             if ($stream === "thread") {
                 $parameter['thread'] = $context_id;
             }
             if ($stream === "course") {
                 $parameter['seminar_id'] = $context_id;
             }
             if ($stream === "profile") {
                 $parameter['user_id'] = $context_id;
             }
             if ($data['Blubber']['search']) {
                 $parameter['search'] = $data['Blubber']['search'];
             }
             $new_postings = ForumPosting::getPostings($parameter);
             $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("forum/thread.php");
                     $template->set_attribute('thread', $new_posting);
                 } else {
                     $thread = new ForumPosting($new_posting['root_id']);
                     $template = $factory->open("forum/comment.php");
                     $template->set_attribute('posting', $new_posting);
                 }
                 ForumPosting::$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'], '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("/course") && $this->isActivated() && version_compare($GLOBALS['SOFTWARE_VERSION'], "2.4") <= 0) {
         $tab = new AutoNavigation($this->getDisplayTitle(), PluginEngine::getLink($this, array(), "forum/forum"));
         $tab->setImage($this->getPluginURL() . "/assets/images/blubber_white.png");
         Navigation::addItem("/course/blubberforum", $tab);
     }
     if (Navigation::hasItem("/community")) {
         $nav = new AutoNavigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "forum/globalstream"));
         Navigation::insertItem("/community/blubber", $nav, "online");
         Navigation::getItem("/community")->setURL(PluginEngine::getURL($this, array(), "forum/globalstream"));
     }
     if (Navigation::hasItem("/profile")) {
         $nav = new AutoNavigation(_("Blubber"), PluginEngine::getURL($this, array('user_id' => get_userid(Request::get("username"))), "forum/profile"));
         Navigation::addItem("/profile/blubber", $nav);
     }
 }
Exemplo n.º 19
0
 public function discussion_action($review_id)
 {
     if (Navigation::hasItem("/lernmarktplatz/overview")) {
         Navigation::activateItem("/lernmarktplatz/overview");
     }
     $this->review = new LernmarktplatzReview($review_id);
     if (Request::isPost() && Request::get("comment")) {
         $comment = new LernmarktplatzComment();
         $comment['review_id'] = $review_id;
         $comment['comment'] = Request::get("comment");
         $comment['user_id'] = $GLOBALS['user']->id;
         $comment->store();
     }
 }
Exemplo n.º 20
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);
     }
 }
Exemplo n.º 21
0
 public function __construct()
 {
     parent::__construct();
     // instantiate patching template factory
     $GLOBALS['template_factory'] = new VHS\PatchTemplateFactory($GLOBALS['template_factory'], realpath($this->getPluginPath() . '/templates'));
     global $perm;
     $username = Request::get('username', $auth->auth['uname']);
     PageLayout::addStylesheet($this->getPluginUrl() . '/css/startseite.css');
     PageLayout::addStylesheet($this->getPluginUrl() . '/css/courseware.css');
     //falls Mooc.IP aktiviert ist, Icon aus der Kopfzeile ausblenden
     if (Navigation::hasItem('/mooc')) {
         Navigation::removeItem('/mooc');
     }
     if (!$perm->have_perm('admin') && $perm->get_perm() != 'nobody') {
         if (Navigation::hasItem('/search')) {
             Navigation::removeItem('/search');
         }
         if (Navigation::hasItem('/tools')) {
             if (!$perm->have_perm('dozent')) {
                 if (Navigation::hasItem('/tools/elearning')) {
                     Navigation::removeItem('/tools/elearning');
                 }
                 if (Navigation::hasItem('/tools/evaluation')) {
                     Navigation::removeItem('/tools/evaluation');
                 }
             }
         }
         /**		
         			if (Navigation::hasItem('/course/main/courses')){
         			//	Navigation::removeItem('/course/main/courses');
         			}
         			
         			if (Navigation::hasItem('/course/main/schedule')){
         			//	Navigation::removeItem('/course/main/schedule');
         			}
         		**/
         if (Navigation::hasItem('/tools')) {
             Navigation::getItem('/tools')->setImage(NULL);
         }
         if (Navigation::hasItem('/tools/rss')) {
             Navigation::removeItem('/tools/rss');
         }
         if (Navigation::hasItem('/tools/literature')) {
             Navigation::removeItem('/tools/literature');
         }
         if (Navigation::hasItem('/profile/edit/study_data')) {
             Navigation::removeItem('/profile/edit/study_data');
         }
         if (Navigation::hasItem('/start/search')) {
             Navigation::removeItem('/start/search');
         }
         if (Navigation::hasItem('/browse')) {
             $stmt = DBManager::get()->prepare("SELECT su.seminar_id FROM seminar_user su\n\t\t\t\t\tWHERE su.user_id = ?");
             $stmt->execute(array($GLOBALS['user']->id));
             $count = $stmt->rowCount();
             if ($count == 1) {
                 $result = $stmt->fetch();
                 Navigation::getItem('/browse')->setURL("/seminar_main.php?auswahl=" . $result['seminar_id']);
                 Navigation::getItem('/browse')->setTitle("Mein Kurs");
             }
             if ($count == 0 && !$perm->have_perm('tutor')) {
                 Navigation::removeItem('/browse');
             }
         }
         if (Navigation::hasItem('/course')) {
             $stmt = DBManager::get()->prepare("SELECT su.seminar_id FROM seminar_user su\n\t\t\t\t\tWHERE su.user_id = ?");
             $stmt->execute(array($GLOBALS['user']->id));
             $count = $stmt->rowCount();
             if ($count == 1) {
                 $result = $stmt->fetch();
                 Navigation::getItem('/course')->setURL("/seminar_main.php?auswahl=" . $result['seminar_id']);
                 Navigation::getItem('/course')->setTitle("Mein Kurs");
             }
         }
         if (Navigation::hasItem('/start/my_courses')) {
             if (Navigation::hasItem('/start/my_courses/browse')) {
                 Navigation::removeItem('/start/my_courses/browse');
             }
             if (Navigation::hasItem('/start/my_courses/new_studygroup')) {
                 Navigation::removeItem('/start/my_courses/new_studygroup');
             }
             if (Navigation::hasItem('/start/tools')) {
                 Navigation::removeItem('/start/tools');
             }
             $stmt = DBManager::get()->prepare("SELECT su.seminar_id FROM seminar_user su\n\t\t\t\t\tWHERE su.user_id = ?");
             $stmt->execute(array($GLOBALS['user']->id));
             $count = $stmt->rowCount();
             if ($count == 1) {
                 $result = $stmt->fetch();
                 Navigation::getItem('/start/my_courses')->setURL("/seminar_main.php?auswahl=" . $result['seminar_id']);
                 Navigation::getItem('/start/my_courses')->setTitle("Mein Kurs");
             }
             if ($count == 0) {
                 Navigation::removeItem('/start/my_courses');
             }
             if ($count > 1) {
                 Navigation::getItem('/start/my_courses')->setTitle("Kurse");
             }
         }
         if (Navigation::hasItem('/start/community/browse')) {
             Navigation::removeItem('/start/community/browse');
         }
         if (Navigation::hasItem('/start/community/score')) {
             Navigation::removeItem('/start/community/score');
         }
     }
     //Aus irgendeinem Grund wird das hier immer aufgerufen und oben geht er auch bei 'nobody' in die if-Schleife
     /**if ($my_about->auth_user['perms'] == 'nobody'){
     			if (Navigation::hasItem('/course/main/courses')){
     				Navigation::removeItem('/course/main/courses');
     			}
     			
     			if (Navigation::hasItem('/course/main/schedule')){
     				Navigation::removeItem('/course/main/schedule');
     			}
     		}
                      * 
                      */
 }
Exemplo n.º 22
0
    <? if (Studip\ENV === 'development'): ?>
        [
            <?php 
echo sprintf('%u db queries', DBManager::get()->query_count);
?>
            /
            <?php 
echo relsize(memory_get_peak_usage(true), false);
?>
 mem
        ]
    <? endif; ?>
    </div>
<? endif; ?>

<? if (Navigation::hasItem('/footer')) : ?>
    <ul>
    <? foreach (Navigation::getItem('/footer') as $nav): ?>
        <? if ($nav->isVisible()): ?>
            <li>
            <a
            <? if (is_internal_url($url = $nav->getURL())) : ?>
                href="<?php 
echo URLHelper::getLink($url, $header_template->link_params);
?>
"
            <? else: ?>
                href="<?php 
echo htmlReady($url);
?>
" target="_blank"
Exemplo n.º 23
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;
 }