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");
 }
Пример #2
0
 public function __construct()
 {
     parent::__construct();
     $top = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array('view' => 'tiles'), "presenting/overview"));
     $top->setImage(Icon::create($this->getPluginURL() . "/assets/topicon.svg"));
     $overview = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "presenting/overview"));
     $top->addSubNavigation("presenting", $overview);
     $overview->addSubNavigation("overview", new AutoNavigation(_('Übersicht'), PluginEngine::getURL($this, array(), "presenting/overview")));
     $overview->addSubNavigation("all", new AutoNavigation(_('Alle Plugins'), PluginEngine::getURL($this, array(), "presenting/all")));
     $overview->addSubNavigation("tools", new AutoNavigation(_('Tools'), PluginEngine::getURL($this, array(), "tools/sidebar_graphics_generator")));
     if ($GLOBALS['perm']->have_perm("autor")) {
         $top->addSubNavigation("myplugins", new Navigation(_("Meine Plugins"), PluginEngine::getURL($this, array(), "myplugins/overview")));
     }
     if ($GLOBALS['perm']->have_perm("user")) {
         $last_visit = UserConfig::get($GLOBALS['user']->id)->getValue("last_pluginmarket_visit");
         if ($last_visit) {
             $badge_number = MarketPlugin::countBySql("publiclyvisible = 1 AND approved = 1 AND published > ?", array($last_visit));
             if ($badge_number > 0) {
                 $top->setBadgeNumber($badge_number);
             }
         }
     }
     if ($GLOBALS['perm']->have_perm("root")) {
         $approving = new Navigation(_("Qualitätssicherung"), PluginEngine::getURL($this, array(), "approving/overview"));
         $top->addSubNavigation("approving", $approving);
     }
     Navigation::addItem("/pluginmarket", $top);
     $loginlink = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "presenting/overview"));
     $loginlink->setDescription(_("Laden Sie hier Plugins für Ihr Stud.IP herunter"));
     Navigation::addItem("/login/pluginmarket", $loginlink);
     NotificationCenter::addObserver($this, "triggerFollowingStudips", "PluginReleaseDidUpdateCode");
 }
Пример #3
0
 /**
  * returns matching "old-style" DataFieldEntry object
  *
  * @return DataFieldEntry
  */
 public function getTypedDatafield()
 {
     $range_id = $this->sec_range_id ? array($this->range_id, $this->sec_range_id) : $this->range_id;
     $df = DataFieldEntry::createDataFieldEntry($this->datafield, $range_id, $this->getValue('content'));
     $self = $this;
     $observer = function ($event, $object, $user_data) use($self) {
         if ($user_data['changed']) {
             $self->restore();
         }
     };
     NotificationCenter::addObserver($observer, '__invoke', 'DatafieldDidUpdate', $df);
     return $df;
 }
Пример #4
0
<?php

/**
 * ForumIssue.php - Manage issues linked to postings
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of
 * the License, or (at your option) any later version.
 *
 * @author      Till Glöggler <*****@*****.**>
 * @license     http://www.gnu.org/licenses/gpl-3.0.html GPL version 3
 * @category    Stud.IP
 */
NotificationCenter::addObserver('ForumIssue', 'unlinkIssue', 'ForumBeforeDelete');
class ForumIssue
{
    /**
     * Get the id of the topic linked to the issue denoted by the passed id.
     * 
     * @param string $issue_id
     * @return string  the id of the linked topic
     */
    static function getThreadIdForIssue($issue_id)
    {
        $stmt = DBManager::get()->prepare("SELECT topic_id FROM forum_entries_issues\n            WHERE issue_id = ?");
        $stmt->execute(array($issue_id));
        return $stmt->fetchColumn();
    }
    /**
     * Create/Update the linked posting for the passed issue_id
Пример #5
0
 function assertMatchingNotification($matcher, $subject)
 {
     // register observer
     $observer = $this->getMock("Observer");
     NotificationCenter::addObserver($observer, 'update', 'SomeNotification', $matcher);
     // expect notication
     $observer->expects($this->once())->method('update')->with('SomeNotification', $subject);
     // fire!
     NotificationCenter::postNotification('SomeNotification', $subject);
     // remove observer
     NotificationCenter::removeObserver($observer);
 }
Пример #6
0
 function observeNotifications()
 {
     \NotificationCenter::addObserver($this, 'onQuestionStarted', 'QuestionDidStart');
     \NotificationCenter::addObserver($this, 'onQuestionStopped', 'QuestionDidStop');
 }
Пример #7
0
 * Forum.class.php - Forum
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * @author      Till Glöggler <*****@*****.**>
 * @copyright   2011 ELAN e.V. <http://www.elan-ev.de>
 * @license     http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
 * @category    Stud.IP
 */
require_once 'app/models/smiley.php';
require_once 'controllers/forum_controller.php';
// Notifications
NotificationCenter::addObserver('CoreForum', 'overviewDidClear', "OverviewDidClear");
class CoreForum extends StudipPlugin implements ForumModule
{
    /**
     * This method dispatches all actions.
     *
     * @param string $unconsumed_path  part of the dispatch path that was not consumed
     */
    public function perform($unconsumed_path)
    {
        $this->setupAutoload();
        // Add JS and StyleSheet to header
        PageLayout::addScript($this->getPluginURL() . '/javascript/forum.js');
        PageLayout::addStylesheet($this->getPluginURL() . '/stylesheets/forum.css');
        parent::perform($unconsumed_path);
    }
Пример #8
0
 public function testNotificationOnActivation()
 {
     $navigation = new Navigation('test');
     Navigation::addItem('/test', $navigation);
     $observer = $this->getMock("NotificationObserver");
     $observer->expects($this->once())->method('update')->with($this->equalTo('NavigationDidActivateItem'), $this->equalTo('/test'));
     NotificationCenter::addObserver($observer, 'update', 'NavigationDidActivateItem', '/test');
     Navigation::activateItem('/test');
 }