Exemplo n.º 1
0
 /**
  * Displays global-stream
  */
 public function global_action()
 {
     PageLayout::setTitle(_("Globaler Blubberstream"));
     Navigation::activateItem("/community/blubber");
     if (Request::get("delete_stream")) {
         $stream = new BlubberStream(Request::option("delete_stream"));
         if ($stream['user_id'] === $GLOBALS['user']->id) {
             $stream->delete();
             PageLayout::postMessage(MessageBox::success(_("Stream wurde erfolgreich gelöscht.")));
             Navigation::removeItem("/community/blubber/" . Request::option("delete_stream"));
         }
     }
     $globalstream = BlubberStream::getGlobalStream();
     $this->tags = $globalstream->fetchTags();
     if (Request::get("hash")) {
         $this->search = Request::get("hash");
         $globalstream = new BlubberStream();
         $globalstream->filter_hashtags = array(Request::get("hash"));
     }
     $this->threads = $globalstream->fetchThreads(0, $this->max_threads + 1);
     $this->more_threads = count($this->threads) > $this->max_threads;
     if ($this->more_threads) {
         $this->threads = array_slice($this->threads, 0, $this->max_threads);
     }
     $this->contact_groups = DBManager::get()->query("SELECT statusgruppen.* " . "FROM statusgruppen " . "WHERE statusgruppen.range_id = " . DBManager::get()->quote($GLOBALS['user']->id) . " " . "ORDER BY name ASC " . "")->fetchAll(PDO::FETCH_ASSOC);
     $this->favourite_tags = $globalstream->fetchTags(time() - 86400 * 30, 50);
 }
Exemplo n.º 2
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');
     			}
     		}
                      * 
                      */
 }
 /**
  * define where the plugin will be visible (toolbar and/or start page)
  *
  * @deprecated
  */
 function setDisplayType($display_type)
 {
     $changes = $this->display_type ^ $display_type;
     $this->display_type = $display_type;
     if ($this->hasNavigation()) {
         if ($changes & SYSTEM_PLUGIN_TOOLBAR) {
             if ($this->getDisplayType(SYSTEM_PLUGIN_TOOLBAR)) {
                 Navigation::addItem('/' . $this->getPluginclassname(), $this->getNavigation());
             } else {
                 Navigation::removeItem('/' . $this->getPluginclassname());
             }
         }
         if ($changes & SYSTEM_PLUGIN_STARTPAGE) {
             if ($this->getDisplayType(SYSTEM_PLUGIN_STARTPAGE)) {
                 Navigation::insertItem('/start/' . $this->getPluginclassname(), $this->getNavigation(), 'search');
             } else {
                 Navigation::removeItem('/start/' . $this->getPluginclassname());
             }
         }
     }
 }
Exemplo n.º 4
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());
 }