示例#1
0
 function getTabNavigation($course_id)
 {
     $object_type = get_object_type($course_id, array('sem', 'inst'));
     if ($object_type === 'sem') {
         $course = Course::find($course_id);
         $sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$course->status]['class']] ?: SemClass::getDefaultSemClass();
     } else {
         $institute = Institute::find($course_id);
         $sem_class = SemClass::getDefaultInstituteClass($institute->type);
     }
     $navigation = new Navigation(_('Übersicht'));
     $navigation->setImage(Icon::create('seminar', 'info_alt'));
     $navigation->setActiveImage(Icon::create('seminar', 'info'));
     if ($object_type !== 'sem') {
         $navigation->addSubNavigation('info', new Navigation(_('Kurzinfo'), 'dispatch.php/institute/overview'));
         $navigation->addSubNavigation('courses', new Navigation(_('Veranstaltungen'), 'show_bereich.php?level=s&id=' . $course_id));
         $navigation->addSubNavigation('schedule', new Navigation(_('Veranstaltungs-Stundenplan'), 'dispatch.php/calendar/instschedule?cid=' . $course_id));
         if ($GLOBALS['perm']->have_studip_perm('admin', $course_id)) {
             $navigation->addSubNavigation('admin', new Navigation(_('Administration der Einrichtung'), 'dispatch.php/institute/basicdata/index?new_inst=TRUE'));
         }
     } else {
         $navigation->addSubNavigation('info', new Navigation(_('Kurzinfo'), 'dispatch.php/course/overview'));
         if (!$sem_class['studygroup_mode']) {
             $navigation->addSubNavigation('details', new Navigation(_('Details'), 'dispatch.php/course/details/'));
         }
         if (!$course->admission_binding && in_array($GLOBALS['perm']->get_studip_perm($course_id), array('user', 'autor'))) {
             $navigation->addSubNavigation('leave', new Navigation(_('Austragen aus der Veranstaltung'), 'dispatch.php/my_courses/decline/' . $course_id . '?cmd=suppose_to_kill'));
         }
     }
     return array('main' => $navigation);
 }
 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
 function getTabNavigation($course_id)
 {
     if (TRUE) {
         $temp = ScmTabEntry::findByRange_id($course_id, 'ORDER BY position ASC');
         if ($temp) {
             $scms = SimpleORMapCollection::createFromArray($temp);
             $navigation = new Navigation($scms->first()->tab_name ?: _('Informationen'));
             $navigation->setImage('icons/16/white/infopage.png');
             $navigation->setActiveImage('icons/16/black/infopage.png');
             foreach ($scms as $scm) {
                 $scm_link = PluginEngine::getLink($this, array(), 'show/' . $scm->id);
                 $nav = new Navigation($scm['tab_name'], $scm_link);
                 $nav->setImage('icons/16/white/infopage.png');
                 $nav->setActiveImage('icons/16/black/infopage.png');
                 Navigation::addItem('course/scmTabs' . $scm->id, $nav);
             }
             return null;
             //array('scm' => $navigation);
         } else {
             $scm = new ScmTabEntry($id);
             $scm->tab_name = 'Infoseite';
             $scm->user_id = $GLOBALS['user']->id;
             $scm->range_id = $GLOBALS['SessSemName'][1];
             $scm->store();
             $scm_link = PluginEngine::getLink($this, array(), 'show/' . $scm->id);
             $nav = new Navigation($scm->tab_name, $scm_link);
             $nav->setImage('icons/16/white/infopage.png');
             $nav->setActiveImage('icons/16/black/infopage.png');
             Navigation::addItem('course/scmTabs' . $scm->id, $nav);
             return null;
         }
     } else {
         return null;
     }
 }
示例#4
0
 function getPortalTemplate()
 {
     $dispatcher = new StudipDispatcher();
     $controller = new NewsController($dispatcher);
     $response = $controller->relay('news/display/studip');
     $template = $GLOBALS['template_factory']->open('shared/string');
     $template->content = $response->body;
     if (StudipNews::CountUnread() > 0) {
         $navigation = new Navigation('', PluginEngine::getLink($this, array(), 'read_all'));
         $navigation->setImage(Icon::create('refresh', 'clickable', ["title" => _('Alle als gelesen markieren')]));
         $icons[] = $navigation;
     }
     if (get_config('NEWS_RSS_EXPORT_ENABLE')) {
         if ($rss_id = StudipNews::GetRssIdFromRangeId('studip')) {
             $navigation = new Navigation('', 'rss.php', array('id' => $rss_id));
             $navigation->setImage(Icon::create('rss', 'clickable', ["title" => _('RSS-Feed')]));
             $icons[] = $navigation;
         }
     }
     if ($GLOBALS['perm']->have_perm('root')) {
         $navigation = new Navigation('', 'dispatch.php/news/edit_news/new/studip');
         $navigation->setImage(Icon::create('add', 'clickable', ["title" => _('Ankündigungen bearbeiten')]), ["rel" => 'get_dialog']);
         $icons[] = $navigation;
         if (get_config('NEWS_RSS_EXPORT_ENABLE')) {
             $navigation = new Navigation('', 'dispatch.php/news/rss_config/studip');
             $navigation->setImage(Icon::create('rss+add', 'clickable', ["title" => _('RSS-Feed konfigurieren')]), ["data-dialog" => 'size=auto']);
             $icons[] = $navigation;
         }
     }
     $template->icons = $icons;
     return $template;
 }
 public function __construct()
 {
     parent::__construct();
     if ($GLOBALS['perm']->have_perm("autor")) {
         $topicon = new Navigation(_("Lernmaterialien"), PluginEngine::getURL($this, array(), "market/overview"));
         $topicon->setImage(Icon::create('service', 'navigation'));
         Navigation::addItem("/lernmarktplatz", $topicon);
         Navigation::addItem("/lernmarktplatz/overview", new Navigation(_("Lernmarktplatz"), PluginEngine::getURL($this, array(), "market/overview")));
         Navigation::addItem("/lernmarktplatz/mymaterial", new Navigation(_("Meine Materialien"), PluginEngine::getURL($this, array(), "mymaterial/overview")));
     }
     if ($GLOBALS['perm']->have_perm("root")) {
         $tab = new Navigation(_("Lernmarktplatz"), PluginEngine::getURL($this, array(), "admin/hosts"));
         Navigation::addItem("/admin/config/lernmarktplatz", $tab);
     }
     if (UpdateInformation::isCollecting() && stripos(Request::get("page"), "plugins.php/lernmarktplatz/market/discussion/") !== false) {
         $data = Request::getArray("page_info");
         $last_update = Request::get("server_timestamp", time() - 30);
         $review_id = $data['Lernmarktplatz']['review_id'];
         $output = array('comments' => array());
         $comments = LernmarktplatzComment::findBySQL("review_id = :review_id AND mkdate >= :last_update ORDER BY mkdate ASC", array('last_update' => $last_update, 'review_id' => $review_id));
         $tf = new Flexi_TemplateFactory(__DIR__ . "/views");
         foreach ($comments as $comment) {
             $template = $tf->open("market/_comment.php");
             $template->set_attribute('comment', $comment);
             $output['comments'][] = array('comment_id' => $comment->getId(), 'html' => $template->render());
         }
         UpdateInformation::setInformation("Lernmarktplatz.update", $output);
     }
 }
 function getTabNavigation($course_id)
 {
     $navigation = new Navigation(_('Teilnehmende'), "dispatch.php/course/studygroup/members/" . $course_id);
     $navigation->setImage(Icon::create('persons', 'info_alt'));
     $navigation->setActiveImage(Icon::create('persons', 'info'));
     return array('members' => $navigation);
 }
 public function __construct()
 {
     parent::__construct();
     $nav = new Navigation(_("Downloads"), PluginEngine::getURL($this, array(), "downloadarea/overview"));
     $nav->setImage(Icon::create("download", "navigation"));
     Navigation::addItem("/downloader", $nav);
 }
示例#8
0
 function getTabNavigation($course_id)
 {
     $navigation = new Navigation(_('Dateien'));
     $navigation->setImage(Icon::create('files', 'info_alt'));
     $navigation->setActiveImage(Icon::create('files', 'info'));
     $navigation->addSubNavigation('tree', new Navigation(_('Ordneransicht'), "folder.php?cmd=tree"));
     $navigation->addSubNavigation('all', new Navigation(_('Alle Dateien'), "folder.php?cmd=all"));
     return array('files' => $navigation);
 }
示例#9
0
 public function testActiveImage()
 {
     $foo = Icon::create('foo', 'clickable');
     $bar = Icon::create('bar', 'clickable');
     $navigation = new Navigation('test', 'foo.php');
     $navigation->setImage($foo);
     $navigation->setActiveImage($bar);
     $this->assertEquals($foo, $navigation->getImage());
     $navigation->setActive(true);
     $this->assertEquals($bar, $navigation->getImage());
 }
示例#10
0
 function getTabNavigation($course_id)
 {
     if (get_config('CALENDAR_GROUP_ENABLE')) {
         $navigation = new Navigation(_('Kalender'), 'dispatch.php/calendar/single/');
         $navigation->setImage(Icon::create('schedule', 'info_alt'));
         $navigation->setActiveImage(Icon::create('schedule', 'info'));
         return array('calendar' => $navigation);
     } else {
         return null;
     }
 }
示例#11
0
 public function getPortalTemplate()
 {
     $dispatcher = new StudipDispatcher();
     $controller = new Calendar_ContentboxController($dispatcher);
     $response = $controller->relay('calendar/contentbox/display/' . $GLOBALS['user']->id);
     $template = $GLOBALS['template_factory']->open('shared/string');
     $template->content = $response->body;
     $navigation = new Navigation('', 'dispatch.php/calendar/single/week');
     $navigation->setImage(Icon::create('add', 'clickable', ["title" => _('Neuen Termin anlegen')]));
     $template->icons = array($navigation);
     return $template;
 }
示例#12
0
 public function getPortalTemplate()
 {
     PageLayout::addScript($this->getPluginUrl() . '/js/QuickSelection.js');
     $names = WidgetHelper::getWidgetUserConfig($GLOBALS['user']->id, 'QUICK_SELECTION');
     $template_factory = new Flexi_TemplateFactory(__DIR__ . '/templates');
     $template = $template_factory->open('list');
     $template->navigation = $this->getFilteredNavigation($names);
     $navigation = new Navigation('', PluginEngine::getLink($this, array(), 'configuration'));
     $navigation->setImage(Icon::create('edit', 'clickable', ["title" => _('Konfigurieren')]), array('data-dialog' => 'size=auto'));
     $template->icons = array($navigation);
     return $template;
 }
示例#13
0
 function getIconNavigation($course_id, $last_visit, $user_id = null)
 {
     if (!$this->isActivated($course_id)) {
         return;
     }
     $this->setupAutoload();
     if ($GLOBALS['perm']->have_studip_perm('user', $course_id)) {
         $num_entries = ForumVisit::getCount($course_id, ForumVisit::getVisit($course_id));
         $text = ForumHelpers::getVisitText($num_entries, $course_id);
     } else {
         $num_entries = 0;
         $text = 'Forum';
     }
     $navigation = new Navigation('forum', PluginEngine::getURL($this, array(), 'index/enter_seminar'));
     $navigation->setBadgeNumber($num_entries);
     if ($num_entries > 0) {
         $navigation->setImage(Icon::create('forum+new', 'attention', ["title" => $text]));
     } else {
         $navigation->setImage(Icon::create('forum', 'inactive', ["title" => $text]));
     }
     return $navigation;
 }
示例#14
0
 function getTabNavigation($course_id)
 {
     if (get_config('WIKI_ENABLE')) {
         $navigation = new Navigation(_('Wiki'));
         $navigation->setImage(Icon::create('wiki', 'info_alt'));
         $navigation->setActiveImage(Icon::create('wiki', 'info'));
         $navigation->addSubNavigation('show', new Navigation(_('WikiWikiWeb'), 'wiki.php?view=show'));
         $navigation->addSubNavigation('listnew', new Navigation(_('Neue Seiten'), 'wiki.php?view=listnew'));
         $navigation->addSubNavigation('listall', new Navigation(_('Alle Seiten'), 'wiki.php?view=listall'));
         return array('wiki' => $navigation);
     } else {
         return null;
     }
 }
示例#15
0
 function getTabNavigation($course_id)
 {
     // cmd und open_close_id mit durchziehen, damit geöffnete Termine geöffnet bleiben
     $req = Request::getInstance();
     $openItem = '';
     if (isset($req['cmd']) && isset($req['open_close_id'])) {
         $openItem = '&cmd=' . $req['cmd'] . '&open_close_id=' . $req['open_close_id'];
     }
     $navigation = new Navigation(_('Ablaufplan'));
     $navigation->setImage(Icon::create('schedule', 'info_alt'));
     $navigation->setActiveImage(Icon::create('schedule', 'info'));
     $navigation->addSubNavigation('dates', new Navigation(_('Termine'), "dispatch.php/course/dates"));
     $navigation->addSubNavigation('topics', new Navigation(_('Themen'), "dispatch.php/course/topics"));
     return array('schedule' => $navigation);
 }
示例#16
0
 public function getPortalTemplate()
 {
     // include and show votes and tests
     if (get_config('VOTE_ENABLE')) {
         $controller = new PluginController(new StudipDispatcher());
         $response = $controller->relay('questionnaire/widget/start')->body;
         $template = $GLOBALS['template_factory']->open('shared/string');
         $template->content = $response;
         if ($GLOBALS['perm']->have_perm('root')) {
             $navigation = new Navigation('', 'admin_vote.php', array('page' => 'overview', 'showrangeID' => 'studip'));
             $navigation->setImage(Icon::create('admin', 'clickable', ["title" => _('Umfragen bearbeiten')]));
             $template->icons = array($navigation);
         }
         return $template;
     }
 }
示例#17
0
 function getTabNavigation($course_id)
 {
     if (get_config('RESOURCES_ENABLE') && checkAvailableResources($course_id)) {
         $navigation = new Navigation(_('Ressourcen'), 'resources.php?view=openobject_main&view_mode=oobj');
         $navigation->setImage(Icon::create('resources', 'info_alt'));
         $navigation->setActiveImage(Icon::create('resources', 'info'));
         $navigation->addSubNavigation('overview', new Navigation(_('Übersicht'), 'resources.php?view=openobject_main'));
         $navigation->addSubNavigation('group_schedule', new Navigation(_('Übersicht Belegung'), 'resources.php?view=openobject_group_schedule'));
         $navigation->addSubNavigation('view_details', new Navigation(_('Details'), 'resources.php?view=openobject_details'));
         $navigation->addSubNavigation('view_schedule', new Navigation(_('Belegung'), 'resources.php?view=openobject_schedule'));
         $navigation->addSubNavigation('edit_assign', new Navigation(_('Belegungen bearbeiten'), 'resources.php?view=openobject_assign'));
         return array('resources' => $navigation);
     } else {
         return null;
     }
 }
示例#18
0
 function getTabNavigation($course_id)
 {
     #$navigation = new AutoNavigation(_('Teilnehmende'));
     $navigation = new Navigation(_('Teilnehmende'));
     $navigation->setImage(Icon::create('persons', 'info_alt'));
     $navigation->setActiveImage(Icon::create('persons', 'info'));
     $navigation->addSubNavigation('view', new Navigation(_('Teilnehmende'), 'dispatch.php/course/members'));
     if (Course::find($course_id)->aux_lock_rule) {
         $navigation->addSubNavigation('additional', new Navigation(_('Zusatzangaben'), 'dispatch.php/course/members/additional'));
     }
     $navigation->addSubNavigation('view_groups', new Navigation(_('Funktionen / Gruppen'), 'statusgruppen.php?view=statusgruppe_sem'));
     if ($GLOBALS['perm']->have_studip_perm('tutor', $course_id) && !LockRules::check($course_id, 'groups')) {
         $navigation->addSubNavigation('edit_groups', new Navigation(_('Funktionen / Gruppen verwalten'), 'admin_statusgruppe.php?new_sem=TRUE&range_id=' . $course_id));
     }
     return array('members' => $navigation);
 }
示例#19
0
 function getTabNavigation($course_id)
 {
     if (get_config('LITERATURE_ENABLE')) {
         $object_type = get_object_type($course_id);
         $navigation = new Navigation(_('Literatur'));
         $navigation->setImage(Icon::create('literature', 'info_alt'));
         $navigation->setActiveImage(Icon::create('literature', 'info'));
         $navigation->addSubNavigation('view', new Navigation(_('Literatur'), "dispatch.php/course/literature?view=literatur_" . $object_type));
         if ($GLOBALS['perm']->have_studip_perm('tutor', $course_id)) {
             $navigation->addSubNavigation('edit', new Navigation(_('Literatur bearbeiten'), 'dispatch.php/literature/edit_list?view=literatur_' . $object_type . '&new_' . $object_type . '=TRUE&_range_id=' . $course_id));
             $navigation->addSubNavigation('search', new Navigation(_('Literatur suchen'), 'dispatch.php/literature/search?return_range=' . $course_id));
         }
         return array('literature' => $navigation);
     } else {
         return null;
     }
 }
示例#20
0
 function getTabNavigation($course_id)
 {
     if (get_config('SCM_ENABLE')) {
         $temp = StudipScmEntry::findByRange_id($course_id, 'ORDER BY position ASC');
         $scms = SimpleORMapCollection::createFromArray($temp);
         $navigation = new Navigation($scms->first()->tab_name ?: _('Informationen'));
         $navigation->setImage(Icon::create('infopage', 'info_alt'));
         $navigation->setActiveImage(Icon::create('infopage', 'info'));
         foreach ($scms as $scm) {
             $scm_link = 'dispatch.php/course/scm/' . $scm->id;
             $nav = new Navigation($scm['tab_name'], $scm_link);
             $navigation->addSubNavigation($scm->id, $nav);
         }
         return array('scm' => $navigation);
     } else {
         return null;
     }
 }
示例#21
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);
 }
 function getTabNavigation($course_id)
 {
     if (get_config('ELEARNING_INTERFACE_ENABLE')) {
         $navigation = new Navigation(_('Lernmodule'));
         $navigation->setImage(Icon::create('learnmodule', 'info_alt'));
         $navigation->setActiveImage(Icon::create('learnmodule', 'info'));
         if (ObjectConnections::isConnected($course_id)) {
             $elearning_nav = new Navigation(_('Lernmodule dieser Veranstaltung'), 'dispatch.php/course/elearning/show?seminar_id=' . $course_id);
             if ($sem_class == 'inst') {
                 $elearning_nav->setTitle(_('Lernmodule dieser Einrichtung'));
             }
             $navigation->addSubNavigation('show', $elearning_nav);
         }
         if ($GLOBALS['perm']->have_studip_perm('tutor', $_SESSION['SessionSeminar'])) {
             $navigation->addSubNavigation('edit', new Navigation(_('Lernmodule hinzufügen / entfernen'), 'dispatch.php/course/elearning/edit?seminar_id=' . $course_id));
         }
         return array('elearning' => $navigation);
     } else {
         return null;
     }
 }
示例#23
0
 function getTabNavigation($course_id)
 {
     if ($GLOBALS['perm']->have_studip_perm('dozent', $course_id)) {
         $navigation = new Navigation(_('Verwaltung'));
         $navigation->setImage(Icon::create('admin', 'info_alt'));
         $navigation->setActiveImage(Icon::create('admin', 'info'));
         $navigation->addSubNavigation('main', new Navigation(_('Verwaltung'), 'dispatch.php/course/studygroup/edit/' . $course_id));
         $navigation->addSubNavigation('avatar', new Navigation(_('Infobild'), 'dispatch.php/course/avatar/update/' . $course_id));
         if (!$GLOBALS['perm']->have_perm('admin')) {
             if (get_config('VOTE_ENABLE')) {
                 $item = new Navigation(_('Umfragen und Tests'), 'admin_vote.php?view=vote_sem');
                 $item->setDescription(_('Erstellen und bearbeiten Sie einfache Umfragen und Tests.'));
                 $navigation->addSubNavigation('vote', $item);
                 $item = new Navigation(_('Evaluationen'), 'admin_evaluation.php?view=eval_sem');
                 $item->setDescription(_('Richten Sie fragebogenbasierte Umfragen und Lehrevaluationen ein.'));
                 $navigation->addSubNavigation('evaluation', $item);
             }
         }
         return array('admin' => $navigation);
     } else {
         return array();
     }
 }
示例#24
0
/**
 *
 * @param unknown_type $my_obj
 * @param unknown_type $user_id
 * @param unknown_type $modules
 */
function get_my_obj_values(&$my_obj, $user_id, $modules = NULL)
{
    $threshold = ($config = Config::get()->NEW_INDICATOR_THRESHOLD) ? strtotime("-{$config} days 0:00:00") : 0;
    $db2 = new DB_seminar();
    $db2->query("CREATE TEMPORARY TABLE IF NOT EXISTS myobj_" . $user_id . " ( object_id char(32) NOT NULL, PRIMARY KEY (object_id)) ENGINE = MEMORY");
    $db2->query("REPLACE INTO  myobj_" . $user_id . " (object_id) VALUES ('" . join("'),('", array_keys($my_obj)) . "')");
    //dokumente
    $unreadable_folders = array();
    if (!$GLOBALS['perm']->have_perm('admin')) {
        foreach (array_keys($my_obj) as $obj_id) {
            if ($my_obj[$obj_id]['modules']['documents_folder_permissions'] || $my_obj[$obj_id]['obj_type'] == 'sem' && StudipDocumentTree::ExistsGroupFolders($obj_id)) {
                $must_have_perm = $my_obj[$obj_id]['obj_type'] == 'sem' ? 'tutor' : 'autor';
                if ($GLOBALS['perm']->permissions[$my_obj[$obj_id]['status']] < $GLOBALS['perm']->permissions[$must_have_perm]) {
                    $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $obj_id, 'entity_type' => $my_obj[$obj_id]['obj_type']));
                    $unreadable_folders = array_merge((array) $unreadable_folders, (array) $folder_tree->getUnReadableFolders($user_id));
                }
            }
        }
    }
    $db2->query(get_obj_clause('dokumente a', 'Seminar_id', 'dokument_id', "(chdate > IFNULL(b.visitdate, {$threshold}) AND a.user_id !='{$user_id}')", 'documents', false, count($unreadable_folders) ? "AND a.range_id NOT IN('" . join("','", $unreadable_folders) . "')" : "", false, $user_id));
    while ($db2->next_record()) {
        $object_id = $db2->f('object_id');
        if ($my_obj[$object_id]["modules"]["documents"]) {
            $my_obj[$object_id]["neuedokumente"] = $db2->f("neue");
            $my_obj[$object_id]["dokumente"] = $db2->f("count");
            if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
                $my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
            }
            $nav = new Navigation('files');
            if ($db2->f('neue')) {
                $nav->setURL('folder.php?cmd=all');
                $nav->setImage(Icon::create('files+new', 'attention', ["title" => sprintf(_('%s Dokumente, %s neue'), $db2->f('count'), $db2->f('neue'))]));
                $nav->setBadgeNumber($db2->f('neue'));
            } else {
                if ($db2->f('count')) {
                    $nav->setURL('folder.php?cmd=tree');
                    $nav->setImage(Icon::create('files', 'inactive', ["title" => sprintf(_('%s Dokumente'), $db2->f('count'))]));
                }
            }
            $my_obj[$object_id]['files'] = $nav;
        }
    }
    //Ankündigungen
    $db2->query(get_obj_clause('news_range a {ON_CLAUSE} LEFT JOIN news nw ON(a.news_id=nw.news_id AND UNIX_TIMESTAMP() BETWEEN date AND (date+expire))', 'range_id', 'nw.news_id', "(chdate > IFNULL(b.visitdate, {$threshold}) AND nw.user_id !='{$user_id}')", 'news', false, false, 'a.news_id', $user_id));
    while ($db2->next_record()) {
        $object_id = $db2->f('object_id');
        $my_obj[$object_id]["neuenews"] = $db2->f("neue");
        $my_obj[$object_id]["news"] = $db2->f("count");
        if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
            $my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
        }
        $nav = new Navigation('news', '');
        if ($db2->f('neue')) {
            $nav->setURL('?new_news=true');
            $nav->setImage(Icon::create('news+new', 'attention', ["title" => sprintf(_('%s Ankündigungen, %s neue'), $db2->f('count'), $db2->f('neue'))]));
            $nav->setBadgeNumber($db2->f('neue'));
        } else {
            if ($db2->f('count')) {
                $nav->setImage(Icon::create('news', 'inactive', ["title" => sprintf(_('%s Ankündigungen'), $db2->f('count'))]));
            }
        }
        $my_obj[$object_id]['news'] = $nav;
    }
    // scm?
    $db2->query(get_obj_clause('scm a', 'range_id', "IF(content !='',1,0)", "(chdate > IFNULL(b.visitdate, {$threshold}) AND a.user_id !='{$user_id}')", "scm", 'tab_name', false, false, $user_id));
    while ($db2->next_record()) {
        $object_id = $db2->f('object_id');
        if ($my_obj[$object_id]["modules"]["scm"]) {
            $my_obj[$object_id]["neuscmcontent"] = $db2->f("neue");
            $my_obj[$object_id]["scmcontent"] = $db2->f("count");
            $my_obj[$object_id]["scmtabname"] = $db2->f("tab_name");
            if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
                $my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
            }
            $nav = new Navigation('scm', 'dispatch.php/course/scm');
            if ($db2->f('count')) {
                if ($db2->f('neue')) {
                    $image = Icon::create('infopage+new', 'new');
                    $nav->setBadgeNumber($db2->f('neue'));
                    if ($db2->f('count') == 1) {
                        $title = $db2->f('tab_name') . _(' (geändert)');
                    } else {
                        $title = sprintf(_('%s Einträge, %s neue'), $db2->f('count'), $db2->f('neue'));
                    }
                } else {
                    $image = Icon::create('infopage', 'inactive');
                    if ($db2->f('count') == 1) {
                        $title = $db2->f('tab_name');
                    } else {
                        $title = sprintf(_('%s Einträge'), $db2->f('count'));
                    }
                }
                $nav->setImage($image, array('title' => $title));
            }
            $my_obj[$object_id]['scm'] = $nav;
        }
    }
    //Termine?
    $db2->query(get_obj_clause('ex_termine a', 'range_id', 'termin_id', "(chdate > IFNULL(b.visitdate, {$threshold}) AND autor_id !='{$user_id}')", 'schedule', false, " AND a.content <> '' ", false, $user_id));
    while ($db2->next_record()) {
        $object_id = $db2->f('object_id');
        if ($my_obj[$object_id]["modules"]["schedule"]) {
            $my_obj[$object_id]["neueausfalltermine"] = $db2->f("neue");
            $my_obj[$object_id]["ausfalltermine"] = $db2->f("count");
            if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
                $my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
            }
        }
    }
    $db2->query(get_obj_clause('termine a', 'range_id', 'termin_id', "(chdate > IFNULL(b.visitdate, {$threshold}) AND autor_id !='{$user_id}')", 'schedule', false, false, false, $user_id));
    while ($db2->next_record()) {
        $object_id = $db2->f('object_id');
        if ($my_obj[$object_id]["modules"]["schedule"]) {
            $my_obj[$object_id]["neuetermine"] = $db2->f("neue");
            $my_obj[$object_id]["termine"] = $db2->f("count");
            if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
                $my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
            }
            $nav = new Navigation('schedule', 'dispatch.php/course/dates');
            $neue = $my_obj[$object_id]["neuetermine"] + $my_obj[$object_id]["neueausfalltermine"];
            $count = $my_obj[$object_id]["termine"] + $my_obj[$object_id]["ausfalltermine"];
            if ($neue) {
                $nav->setImage(Icon::create('schedule+new', 'attention', ["title" => sprintf(_('%s Termine, %s neue'), $count, $neue)]));
                $nav->setBadgeNumber($neue);
            } else {
                if ($count) {
                    $nav->setImage(Icon::create('schedule', 'inactive', ["title" => sprintf(_('%s Termine'), $count)]));
                }
            }
            $my_obj[$object_id]['schedule'] = $nav;
        }
    }
    //Wiki-Eintraege?
    if (get_config('WIKI_ENABLE')) {
        $db2->query(get_obj_clause('wiki a', 'range_id', 'keyword', "(chdate > IFNULL(b.visitdate, {$threshold}) AND a.user_id !='{$user_id}')", 'wiki', "COUNT(DISTINCT keyword) as count_d", false, false, $user_id));
        while ($db2->next_record()) {
            $object_id = $db2->f('object_id');
            if ($my_obj[$object_id]["modules"]["wiki"]) {
                $my_obj[$object_id]["neuewikiseiten"] = $db2->f("neue");
                $my_obj[$object_id]["wikiseiten"] = $db2->f("count_d");
                if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
                    $my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
                }
                $nav = new Navigation('wiki');
                if ($db2->f('neue')) {
                    $nav->setURL('wiki.php?view=listnew');
                    $nav->setImage(Icon::create('wiki+new', 'attention', ["title" => sprintf(_('%s WikiSeiten, %s Änderungen'), $db2->f('count_d'), $db2->f('neue'))]));
                    $nav->setBadgeNumber($db2->f('neue'));
                } else {
                    if ($db2->f('count')) {
                        $nav->setURL('wiki.php');
                        $nav->setImage(Icon::create('wiki', 'inactive', ["title" => sprintf(_('%s WikiSeiten'), $db2->f('count_d'))]));
                    }
                }
                $my_obj[$object_id]['wiki'] = $nav;
            }
        }
    }
    //Lernmodule?
    if (get_config('ELEARNING_INTERFACE_ENABLE')) {
        $db2->query(get_obj_clause('object_contentmodules a', 'object_id', 'module_id', "(chdate > IFNULL(b.visitdate, {$threshold}) AND a.module_type != 'crs')", 'elearning_interface', false, " AND a.module_type != 'crs'", false, $user_id));
        //      $db2->query(get_obj_clause('object_contentmodules a','object_id','module_id',"(chdate > IFNULL(b.visitdate, $threshold))", 'elearning_interface'));
        while ($db2->next_record()) {
            $object_id = $db2->f('object_id');
            if ($my_obj[$object_id]["modules"]["elearning_interface"]) {
                $my_obj[$object_id]["neuecontentmodule"] = $db2->f("neue");
                $my_obj[$object_id]["contentmodule"] = $db2->f("count");
                if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
                    $my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
                }
                $nav = new Navigation('elearning', 'elearning_interface.php?view=show');
                if ($db2->f('neue')) {
                    $nav->setImage(Icon::create('learnmodule+new', 'attention', ["title" => sprintf(_('%s Lernmodule, %s neue'), $db2->f('count'), $db2->f('neue'))]));
                    $nav->setBadgeNumber($db2->f('neue'));
                } else {
                    if ($db2->f('count')) {
                        $nav->setImage(Icon::create('learnmodule', 'inactive', ["title" => sprintf(_('%s Lernmodule'), $db2->f('count'))]));
                    }
                }
                $my_obj[$object_id]['elearning'] = $nav;
            }
        }
    }
    //Umfragen
    if (get_config('VOTE_ENABLE')) {
        $db2->query(get_obj_clause('vote a', 'range_id', 'vote_id', "(chdate > IFNULL(b.visitdate, {$threshold}) AND a.author_id !='{$user_id}' AND a.state != 'stopvis')", 'vote', false, " AND a.state IN('active','stopvis')", 'vote_id', $user_id));
        while ($db2->next_record()) {
            $object_id = $db2->f('object_id');
            $my_obj[$object_id]["neuevotes"] = $db2->f("neue");
            $my_obj[$object_id]["votes"] = $db2->f("count");
            if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
                $my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
            }
        }
        $db2->query(get_obj_clause('eval_range a {ON_CLAUSE} INNER JOIN eval d ON ( a.eval_id = d.eval_id AND d.startdate < UNIX_TIMESTAMP( ) AND (d.stopdate > UNIX_TIMESTAMP( ) OR d.startdate + d.timespan > UNIX_TIMESTAMP( ) OR (d.stopdate IS NULL AND d.timespan IS NULL)))', 'range_id', 'a.eval_id', "(chdate > IFNULL(b.visitdate, {$threshold}) AND d.author_id !='{$user_id}' )", 'eval', false, false, 'a.eval_id', $user_id));
        while ($db2->next_record()) {
            $object_id = $db2->f('object_id');
            $my_obj[$object_id]["neuevotes"] += $db2->f("neue");
            $my_obj[$object_id]["votes"] += $db2->f("count");
            if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
                $my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
            }
        }
        foreach (array_keys($my_obj) as $object_id) {
            $nav = new Navigation('vote', '#vote');
            if ($my_obj[$object_id]['neuevotes']) {
                $nav->setImage(Icon::create('vote+new', 'attention', ["title" => sprintf(_('%s Umfrage(n), %s neue'), $my_obj[$object_id]['votes'], $my_obj[$object_id]['neuevotes'])]));
                $nav->setBadgeNumber($my_obj[$object_id]['neuevotes']);
            } else {
                if ($my_obj[$object_id]['votes']) {
                    $nav->setImage(Icon::create('vote', 'inactive', ["title" => sprintf(_('%s Umfrage(n)'), $my_obj[$object_id]['votes'])]));
                }
            }
            $my_obj[$object_id]['vote'] = $nav;
        }
    }
    //Literaturlisten
    if (get_config('LITERATURE_ENABLE')) {
        $db2->query(get_obj_clause('lit_list a', 'range_id', 'list_id', "(chdate > IFNULL(b.visitdate, {$threshold}) AND a.user_id !='{$user_id}')", 'literature', false, " AND a.visibility=1", false, $user_id));
        while ($db2->next_record()) {
            $object_id = $db2->f('object_id');
            if ($my_obj[$object_id]["modules"]["literature"]) {
                $my_obj[$object_id]["neuelitlist"] = $db2->f("neue");
                $my_obj[$object_id]["litlist"] = $db2->f("count");
                if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
                    $my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
                }
                $nav = new Navigation('literature', 'dispatch.php/course/literature');
                if ($db2->f('neue')) {
                    $nav->setImage(Icon::create('literature+new', 'attention', ["title" => sprintf(_('%s Literaturlisten, %s neue'), $db2->f('count'), $db2->f('neue'))]));
                    $nav->setBadgeNumber($db2->f('neue'));
                } else {
                    if ($db2->f('count')) {
                        $nav->setImage(Icon::create('literature', 'inactive', ["title" => sprintf(_('%s Literaturlisten'), $db2->f('count'))]));
                    }
                }
                $my_obj[$object_id]['literature'] = $nav;
            }
        }
    }
    // TeilnehmerInnen
    if ($GLOBALS['perm']->have_perm('tutor')) {
        //vorläufige Teilnahme
        $db2->query(get_obj_clause('admission_seminar_user a', 'seminar_id', 'a.user_id', "(mkdate > IFNULL(b.visitdate, {$threshold}) AND a.user_id !='{$user_id}')", 'participants', false, " AND a.status='accepted' ", false, $user_id, 'mkdate'));
        while ($db2->next_record()) {
            $object_id = $db2->f('object_id');
            if ($my_obj[$object_id]["modules"]["participants"]) {
                if ($GLOBALS['perm']->have_perm('admin', $user_id) || in_array($my_obj[$object_id]['status'], words('dozent tutor'))) {
                    $my_obj[$object_id]["new_accepted_participants"] = $db2->f("neue");
                    $my_obj[$object_id]["count_accepted_participants"] = $db2->f("count");
                    if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
                        $my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
                    }
                }
            }
        }
        $db2->query(get_obj_clause('seminar_user a', 'seminar_id', 'a.user_id', "(mkdate > IFNULL(b.visitdate, {$threshold}) AND a.user_id !='{$user_id}')", 'participants', false, false, false, $user_id, 'mkdate'));
        $all_auto_inserts = AutoInsert::getAllSeminars(true);
        $auto_insert_perm = Config::get()->AUTO_INSERT_SEM_PARTICIPANTS_VIEW_PERM;
        while ($db2->next_record()) {
            $object_id = $db2->f('object_id');
            // show the participants-icon only if the module is activated and it is not an auto-insert-sem
            if ($my_obj[$object_id]["modules"]["participants"]) {
                if (in_array($object_id, $all_auto_inserts)) {
                    if ($GLOBALS['perm']->have_perm('admin', $user_id) && !$GLOBALS['perm']->have_perm($auto_insert_perm, $user_id)) {
                        continue;
                    } else {
                        if ($GLOBALS['perm']->permissions[$auto_insert_perm] > $GLOBALS['perm']->permissions[$my_obj[$object_id]['status']]) {
                            continue;
                        }
                    }
                }
                $my_obj[$object_id]["newparticipants"] = $db2->f("neue");
                $my_obj[$object_id]["countparticipants"] = $db2->f("count");
                if ($GLOBALS['perm']->have_perm('admin', $user_id) || in_array($my_obj[$object_id]['status'], words('dozent tutor'))) {
                    if ($my_obj[$object_id]['last_modified'] < $db2->f('last_modified')) {
                        $my_obj[$object_id]['last_modified'] = $db2->f('last_modified');
                    }
                }
                if (SeminarCategories::GetByTypeId($my_obj[$object_id]['sem_status'])->studygroup_mode) {
                    $nav = new Navigation('participants', 'dispatch.php/course/studygroup/members/' . $object_id);
                } else {
                    $nav = new Navigation('participants', 'dispatch.php/course/members/index');
                }
                $neue = $my_obj[$object_id]["newparticipants"] + $my_obj[$object_id]["new_accepted_participants"];
                $count = $my_obj[$object_id]["countparticipants"] + $my_obj[$object_id]["count_accepted_participants"];
                if ($neue && ($GLOBALS['perm']->have_perm('admin', $user_id) || in_array($my_obj[$object_id]['status'], words('dozent tutor')))) {
                    $nav->setImage(Icon::create('persons+new', 'attention', ["title" => sprintf(_('%s Teilnehmende, %s neue'), $count, $neue)]));
                    $nav->setBadgeNumber($neue);
                } else {
                    if ($count) {
                        $nav->setImage(Icon::create('persons', 'inactive', ["title" => sprintf(_('%s Teilnehmende'), $count)]));
                    }
                }
                $my_obj[$object_id]['participants'] = $nav;
            }
        }
    } else {
        // show only the participants-icon, no colouring!
        foreach ($my_obj as $object_id => $data) {
            $all_auto_inserts = AutoInsert::getAllSeminars(true);
            $auto_insert_perm = Config::get()->AUTO_INSERT_SEM_PARTICIPANTS_VIEW_PERM;
            if (in_array($object_id, $all_auto_inserts)) {
                if ($GLOBALS['perm']->have_perm('admin', $user_id) && !$GLOBALS['perm']->have_perm($auto_insert_perm, $user_id)) {
                    continue;
                } else {
                    if ($GLOBALS['perm']->permissions[$auto_insert_perm] > $GLOBALS['perm']->permissions[$my_obj[$object_id]['status']]) {
                        continue;
                    }
                }
            }
            if ($my_obj[$object_id]["modules"]["participants"]) {
                if (SeminarCategories::GetByTypeId($my_obj[$object_id]['sem_status'])->studygroup_mode) {
                    $nav = new Navigation('participants', 'dispatch.php/course/studygroup/members/' . $object_id);
                } else {
                    $nav = new Navigation('participants', 'dispatch.php/course/members/index');
                }
                $nav->setImage(Icon::create('persons', 'inactive', ["title" => _('Teilnehmende')]));
                $my_obj[$object_id]['participants'] = $nav;
            }
        }
    }
    $db2->query("DROP TABLE IF EXISTS myobj_" . $user_id);
    return;
}
示例#25
0
文件: my_realm.php 项目: ratbird/hope
 public static function checkParticipants(&$my_obj, $user_id, $object_id, $is_admission)
 {
     if ($my_obj["modules"]["participants"]) {
         if (SeminarCategories::GetByTypeId($my_obj['status'])->studygroup_mode) {
             $nav = new Navigation('participants', 'dispatch.php/course/studygroup/members/' . $object_id);
         } else {
             $nav = new Navigation('participants', 'dispatch.php/course/members/index');
         }
         if ($GLOBALS['perm']->have_perm('admin', $user_id) || in_array($my_obj['user_status'], words('dozent tutor'))) {
             $count = 0;
             $neue = 0;
             $all_auto_inserts = AutoInsert::getAllSeminars(true);
             $auto_insert_perm = Config::get()->AUTO_INSERT_SEM_PARTICIPANTS_VIEW_PERM;
             $sql = "SELECT\n                        COUNT(a.user_id) as count,\n                        COUNT(IF((mkdate > IFNULL(b.visitdate, :threshold) AND a.user_id !=:user_id), a.user_id, NULL)) AS neue,\n                        MAX(IF((mkdate > IFNULL(b.visitdate, :threshold) AND a.user_id != :user_id), mkdate, 0)) AS last_modified\n                    FROM admission_seminar_user a\n                    LEFT JOIN object_user_visits b ON (b.object_id = a.seminar_id AND b.user_id = :user_id AND b.type ='participants')\n                    WHERE a.seminar_id = :course_id";
             $statement = DBManager::get()->prepare($sql);
             $statement->bindValue(':user_id', $user_id);
             $statement->bindValue(':course_id', $object_id);
             $statement->bindValue(':threshold', ($threshold = Config::get()->NEW_INDICATOR_THRESHOLD) ? strtotime("-{$threshold} days 0:00:00") : 0);
             $statement->execute();
             $result = $statement->fetch(PDO::FETCH_ASSOC);
             if (!empty($result)) {
                 if ($GLOBALS['perm']->have_perm('admin', $user_id) || in_array($my_obj['user_status'], words('dozent tutor'))) {
                     $count = $result['count'];
                     $neue = $result['neue'];
                     if ($my_obj['last_modified'] < $result['last_modified']) {
                         $my_obj['last_modified'] = $result['last_modified'];
                     }
                 }
             }
             $sql = "SELECT\n                    COUNT(a . user_id) as count,\n                    COUNT(IF((mkdate > IFNULL(b.visitdate, :threshold) AND a.user_id !=:user_id), a.user_id, NULL)) AS neue,\n                    MAX(IF ((mkdate > IFNULL(b.visitdate, :threshold) AND a.user_id != :user_id), mkdate, 0)) AS last_modified\n                    FROM seminar_user a\n                    LEFT JOIN object_user_visits b ON(b . object_id = a . seminar_id AND b . user_id = :user_id AND b . type = 'participants')\n                    WHERE seminar_id = :course_id";
             $statement = DBManager::get()->prepare($sql);
             $statement->bindValue(':user_id', $user_id);
             $statement->bindValue(':course_id', $object_id);
             $statement->bindValue(':threshold', ($threshold = Config::get()->NEW_INDICATOR_THRESHOLD) ? strtotime("-{$threshold} days 0:00:00") : 0);
             $statement->execute();
             $result = $statement->fetch(PDO::FETCH_ASSOC);
             if (!empty($result)) {
                 // show the participants-icon only if the module is activated and it is not an auto-insert-sem
                 if (in_array($object_id, $all_auto_inserts)) {
                     if ($GLOBALS['perm']->have_perm('admin', $user_id) && !$GLOBALS['perm']->have_perm($auto_insert_perm, $user_id)) {
                         return null;
                     } else {
                         if ($GLOBALS['perm']->permissions[$auto_insert_perm] > $GLOBALS['perm']->permissions[$my_obj['user_status']]) {
                             return null;
                         }
                     }
                 }
                 $count += $result['count'];
                 $neue += $result['neue'];
                 if ($GLOBALS['perm']->have_perm('admin', $user_id) || in_array($my_obj['user_status'], words('dozent tutor'))) {
                     if ($my_obj['last_modified'] < $result['last_modified']) {
                         $my_obj['last_modified'] = $result['last_modified'];
                     }
                 }
             }
             if ($neue) {
                 $nav->setImage(Icon::create('persons+new', 'attention', ["title" => sprintf('%s %s, %s %s', $count, _('Teilnehmende'), $neue, _('neue'))]));
                 $nav->setBadgeNumber($neue);
             } else {
                 if ($count) {
                     $nav->setImage(Icon::create('persons', 'inactive', ["title" => sprintf('%s %s', $count, _('Teilnehmende'))]));
                 }
             }
         } else {
             $nav->setImage(Icon::create('persons', 'inactive', ["title" => _('Teilnehmende')]));
         }
         return $nav;
     }
     return null;
 }
示例#26
0
 /**
  * Adds all navigation entries for each passed seminar.
  *
  * @param array $seminars List of seminars
  * @return array Extended list of seminars
  */
 protected function get_seminar_navigations($seminars)
 {
     if (empty($seminars)) {
         return array();
     }
     foreach ($seminars as $id => $seminar) {
         $seminar['navigations'] = array();
         foreach (words('forum files news scm schedule wiki vote literature') as $key) {
             $seminar['navigations'][$key] = false;
         }
         $seminars[$id] = $seminar;
     }
     $seminar_ids = array_keys($seminars);
     // Documents
     $query = "SELECT seminar_id, COUNT(*) AS count\n                  FROM dokumente\n                  WHERE seminar_id IN (?)\n                  GROUP BY seminar_id";
     $statement = DBManager::get()->prepare($query);
     $statement->execute(array($seminar_ids));
     while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
         $nav = new Navigation('files', 'folder.php?cmd=tree');
         $nav->setImage(Icon::create('files', 'inactive', ["title" => sprintf(_('%s Dokumente'), $row['count'])]));
         $seminars[$row['seminar_id']]['navigations']['files'] = $nav;
     }
     // News
     $query = "SELECT range_id, COUNT(*) AS count\n                  FROM news_range\n                  LEFT JOIN news USING (news_id)\n                  WHERE range_id IN (?)\n                  GROUP BY range_id\n                  HAVING count > 0";
     $statement = DBManager::get()->prepare($query);
     $statement->execute(array($seminar_ids));
     while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
         $nav = new Navigation('news', '');
         $nav->setImage(Icon::create('news', 'inactive', ["title" => sprintf(_('%s Ankündigungen'), $row['count'])]));
         $seminars[$row['range_id']]['navigations']['news'] = $nav;
     }
     // Information
     $query = "SELECT range_id, COUNT(*) AS count\n                  FROM scm\n                  WHERE range_id IN (?)\n                  GROUP BY range_id";
     $statement = DBManager::get()->prepare($query);
     $statement->execute(array($seminar_ids));
     while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
         $nav = new Navigation('scm', 'dispatch.php/course/scm');
         $nav->setImage(Icon::create('infopage', 'inactive', ["title" => sprintf(_('%s Einträge'), $row['count'])]));
         $seminars[$row['range_id']]['navigations']['scm'] = $nav;
     }
     // Literature
     $query = "SELECT range_id, COUNT(list_id) AS count\n                  FROM lit_list\n                  WHERE range_id IN (?) AND visibility = 1\n                  GROUP BY range_id";
     $statement = DBManager::get()->prepare($query);
     $statement->execute(array($seminar_ids));
     while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
         $nav = new Navigation('literature', 'dispatch.php/course/literatur');
         $nav->setImage(Icon::create('literature', 'inactive', ["title" => sprintf(_('%s Literaturlisten'), $row['count'])]));
         $seminars[$row['range_id']]['navigations']['literature'] = $nav;
     }
     // Appointments
     $query = "SELECT range_id, COUNT(*) AS count\n                  FROM termine\n                  WHERE range_id IN (?)\n                  GROUP BY range_id";
     $statement = DBManager::get()->prepare($query);
     $statement->execute(array($seminar_ids));
     while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
         $nav = new Navigation('schedule', 'dispatch.php/course/dates');
         $nav->setImage(Icon::create('schedule', 'inactive', ["title" => sprintf(_('%s Termine'), $row['count'])]));
         $seminars[$row['range_id']]['navigations']['schedule'] = $nav;
     }
     // Wiki
     if (Config::get()->WIKI_ENABLE) {
         $query = "SELECT range_id, COUNT(DISTINCT keyword) AS count\n                      FROM wiki\n                      WHERE range_id IN (?)\n                      GROUP BY range_id";
         $statement = DBManager::get()->prepare($query);
         $statement->execute(array($seminar_ids));
         while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
             $nav = new Navigation('wiki', 'wiki.php');
             $nav->setImage(Icon::create('wiki', 'inactive', ["title" => sprintf(_('%s WikiSeiten'), $row['count'])]));
             $seminars[$row['range_id']]['navigations']['wiki'] = $nav;
         }
     }
     // Votes
     if (Config::get()->VOTE_ENABLE) {
         $query = "SELECT questionnaire_assignments.range_id, COUNT(DISTINCT questionnaires.questionnaire_id) AS count\n                      FROM questionnaires\n                          INNER JOIN questionnaire_assignments ON (questionnaire_assignments.questionnaire_id = questionnaires.questionnaire_id)\n                      WHERE questionnaires.visible = '1'\n                          AND questionnaire_assignments.range_id IN (?)\n                      GROUP BY questionnaire_assignments.range_id ";
         $statement = DBManager::get()->prepare($query);
         $statement->execute(array($seminar_ids));
         while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
             $nav = new Navigation('vote', '#vote');
             $nav->setImage(Icon::create('vote', 'inactive', ["title" => sprintf(_('%s Umfrage(n)'), $row['count'])]));
             $seminars[$row['range_id']]['navigations']['vote'] = $nav;
         }
     }
     return $seminars;
 }
示例#27
0
 function getTabNavigation($course_id)
 {
     $sem_create_perm = in_array(get_config('SEM_CREATE_PERM'), array('root', 'admin', 'dozent')) ? get_config('SEM_CREATE_PERM') : 'dozent';
     if ($GLOBALS['perm']->have_studip_perm('tutor', $course_id)) {
         $navigation = new Navigation(_('Verwaltung'));
         $navigation->setImage(Icon::create('admin', 'info_alt'));
         $navigation->setActiveImage(Icon::create('admin', 'info'));
         $main = new Navigation(_('Verwaltung'), 'dispatch.php/course/management');
         $navigation->addSubNavigation('main', $main);
         if ($GLOBALS['SessSemName']['class'] !== "inst") {
             $item = new Navigation(_('Grunddaten'), 'dispatch.php/course/basicdata/view/' . $course_id);
             $item->setImage(Icon::create('edit', 'clickable'));
             $item->setDescription(_('Bearbeiten der Grundeinstellungen dieser Veranstaltung.'));
             $navigation->addSubNavigation('details', $item);
             $item = new Navigation(_('Infobild'), 'dispatch.php/course/avatar/update/' . $course_id);
             $item->setImage(Icon::create('file-pic', 'clickable'));
             $item->setDescription(_('Infobild dieser Veranstaltung bearbeiten oder löschen.'));
             $navigation->addSubNavigation('avatar', $item);
             $item = new Navigation(_('Studienbereiche'), 'dispatch.php/course/study_areas/show/' . $course_id);
             $item->setImage(Icon::create('module', 'clickable'));
             $item->setDescription(_('Zuordnung dieser Veranstaltung zu Studienbereichen für die Darstellung im Verzeichnis aller Veranstaltungen.'));
             $navigation->addSubNavigation('study_areas', $item);
             $item = new Navigation(_('Zeiten/Räume'), 'dispatch.php/course/timesrooms');
             $item->setImage(Icon::create('date', 'clickable'));
             $item->setDescription(_('Regelmäßige Veranstaltungszeiten, Einzeltermine und Ortsangaben ändern.'));
             $navigation->addSubNavigation('dates', $item);
             if (get_config('RESOURCES_ENABLE') && get_config('RESOURCES_ALLOW_ROOM_REQUESTS')) {
                 $item = new Navigation(_('Raumanfragen'), 'dispatch.php/course/room_requests/index/' . $course_id);
                 $item->setImage(Icon::create('resources', 'clickable'));
                 $item->setDescription(_('Raumanfragen zu Veranstaltungszeiten verwalten.'));
                 $navigation->addSubNavigation('room_requests', $item);
             }
             $item = new Navigation(_('Zugangsberechtigungen'), 'dispatch.php/course/admission');
             $item->setImage(Icon::create('lock-locked', 'clickable'));
             $item->setDescription(_('Zugangsbeschränkungen, Anmeldeverfahren oder einen Passwortschutz für diese Veranstaltung einrichten.'));
             $navigation->addSubNavigation('admission', $item);
             $item = new AutoNavigation(_('Zusatzangaben'), 'dispatch.php/admin/additional');
             $item->setImage(Icon::create('add', 'clickable'));
             $item->setDescription(_('Vorlagen zur Erhebung weiterer Angaben von Teilnehmenden auswählen.'));
             $navigation->addSubNavigation('additional_data', $item);
             if ($GLOBALS['perm']->have_perm($sem_create_perm)) {
                 if (!LockRules::check($course_id, 'seminar_copy')) {
                     $item = new Navigation(_('Veranstaltung kopieren'), 'dispatch.php/course/wizard/copy/' . $course_id);
                     $item->setImage(Icon::create('seminar+add', 'clickable'));
                     $main->addSubNavigation('copy', $item);
                 }
                 if (get_config('ALLOW_DOZENT_ARCHIV') || $GLOBALS['perm']->have_perm('admin')) {
                     $item = new Navigation(_('Veranstaltung archivieren'), 'archiv_assi.php');
                     $item->setImage(Icon::create('seminar+remove', 'clickable'));
                     $main->addSubNavigation('archive', $item);
                 }
                 if ((get_config('ALLOW_DOZENT_VISIBILITY') || $GLOBALS['perm']->have_perm('admin')) && !LockRules::Check($course_id, 'seminar_visibility')) {
                     $is_visible = Course::findCurrent()->visible;
                     $item = new Navigation(_('Sichtbarkeit ändern') . ' (' . ($is_visible ? _('sichtbar') : _('unsichtbar')) . ')', 'dispatch.php/course/management/change_visibility');
                     $item->setImage(Icon::create('visibility-' . ($is_visible ? 'visible' : 'invisible'), 'clickable'));
                     $main->addSubNavigation('visibility', $item);
                 }
                 if ($GLOBALS['perm']->have_perm('admin')) {
                     $is_locked = Course::findCurrent()->lock_rule;
                     $item = new Navigation(_('Sperrebene ändern') . ' (' . ($is_locked ? _('gesperrt') : _('nicht gesperrt')) . ')', 'dispatch.php/course/management/lock');
                     $item->setImage(Icon::create('lock-' . ($is_locked ? 'locked' : 'unlocked'), 'clickable'), ['data-dialog' => 'size=auto']);
                     $main->addSubNavigation('lock', $item);
                 }
             }
             // show entry for simulated participant view
             if (in_array($GLOBALS['perm']->get_studip_perm($course_id), words('tutor dozent'))) {
                 $item = new Navigation('Studierendenansicht simulieren', 'dispatch.php/course/change_view?cid=' . Request::option('cid'));
                 $item->setDescription(_('Hier können Sie sich die Veranstaltung aus der Sicht von Studierenden sehen.'));
                 $item->setImage(Icon::create('visibility-invisible', 'clickable'));
                 $main->addSubNavigation('change_view', $item);
             }
         }
         // endif modules only seminars
         if ($GLOBALS['perm']->have_studip_perm('tutor', $course_id)) {
             if (get_config('VOTE_ENABLE')) {
                 $item = new Navigation(_('Umfragen und Tests'), 'admin_vote.php?view=vote_sem');
                 $item->setImage(Icon::create('vote', 'clickable'));
                 $item->setDescription(_('Erstellen und bearbeiten von einfachen Umfragen und Tests.'));
                 $navigation->addSubNavigation('vote', $item);
                 $item = new Navigation(_('Evaluationen'), 'admin_evaluation.php?view=eval_sem');
                 $item->setImage(Icon::create('evaluation', 'clickable'));
                 $item->setDescription(_('Richten Sie fragebogenbasierte Umfragen und Lehrevaluationen ein.'));
                 $navigation->addSubNavigation('evaluation', $item);
             }
         }
         return array('admin' => $navigation);
     } else {
         return array();
     }
 }
示例#28
0
 /**
  * Initialize the subnavigation of this item. This method
  * is called once before the first item is added or removed.
  */
 public function initSubNavigation()
 {
     global $SEM_CLASS, $SEM_TYPE;
     global $SessSemName, $user;
     parent::initSubNavigation();
     // list of used modules
     $Modules = new Modules();
     $modules = $Modules->getLocalModules($SessSemName[1], $SessSemName['class'], false, $SessSemName['art_num']);
     if ($SessSemName['class'] === 'sem') {
         $sem_class = $SEM_CLASS[$SEM_TYPE[$SessSemName['art_num']]['class']] ?: SemClass::getDefaultSemClass();
     } else {
         $sem_class = SemClass::getDefaultInstituteClass($SessSemName['art_num']);
     }
     // general information
     if (($modules['overview'] || $sem_class->isSlotMandatory("overview")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("overview"))) {
         foreach ($sem_class->getNavigationForSlot("overview") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // admin area
     if (($modules['admin'] || $sem_class->isSlotMandatory("admin")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("admin"))) {
         foreach ($sem_class->getNavigationForSlot("admin") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // forum
     if (($modules['forum'] || $sem_class->isSlotMandatory("forum")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("forum"))) {
         foreach ($sem_class->getNavigationForSlot("forum") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // participants
     if ($user->id != 'nobody') {
         if ($modules['personal']) {
             $navigation = new Navigation(_('Personal'));
             $navigation->setImage(Icon::create('persons', 'info_alt'));
             $navigation->setActiveImage(Icon::create('persons', 'info'));
             $navigation->addSubNavigation('view', new Navigation(_('MitarbeiterInnen'), 'dispatch.php/institute/members'));
             if ($GLOBALS['perm']->have_studip_perm('tutor', $_SESSION['SessionSeminar']) && $GLOBALS['perm']->have_perm('admin')) {
                 $navigation->addSubNavigation('edit_groups', new Navigation(_('Funktionen / Gruppen verwalten'), 'dispatch.php/admin/statusgroups'));
             }
             $this->addSubNavigation('faculty', $navigation);
         }
         if (($modules['participants'] || $sem_class->isSlotMandatory("participants")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("participants"))) {
             foreach ($sem_class->getNavigationForSlot("participants") as $nav_name => $navigation) {
                 if ($nav_name && is_a($navigation, "Navigation")) {
                     $this->addSubNavigation($nav_name, $navigation);
                 }
             }
         }
     }
     // files
     if (($modules['documents'] || $sem_class->isSlotMandatory("documents")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("documents"))) {
         foreach ($sem_class->getNavigationForSlot("documents") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // schedule
     if (($modules['schedule'] || $sem_class->isSlotMandatory("schedule")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("schedule"))) {
         foreach ($sem_class->getNavigationForSlot("schedule") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // information page
     if (($modules['scm'] || $sem_class->isSlotMandatory("scm")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("scm"))) {
         foreach ($sem_class->getNavigationForSlot("scm") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // literature
     if (($modules['literature'] || $sem_class->isSlotMandatory("literature")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("literature"))) {
         foreach ($sem_class->getNavigationForSlot("literature") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // wiki
     if (($modules['wiki'] || $sem_class->isSlotMandatory("wiki")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("wiki"))) {
         foreach ($sem_class->getNavigationForSlot("wiki") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // resources
     if (($modules['resources'] || $sem_class->isSlotMandatory("resources")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("resources"))) {
         foreach ($sem_class->getNavigationForSlot("resources") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // calendar
     if (($modules['calendar'] || $sem_class->isSlotMandatory("calendar")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("calendar"))) {
         foreach ($sem_class->getNavigationForSlot("calendar") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     // content modules
     if (($modules['elearning_interface'] || $sem_class->isSlotMandatory("elearning_interface")) && $sem_class->isModuleAllowed($sem_class->getSlotModule("elearning_interface"))) {
         foreach ($sem_class->getNavigationForSlot("elearning_interface") as $nav_name => $navigation) {
             if ($nav_name && is_a($navigation, "Navigation")) {
                 $this->addSubNavigation($nav_name, $navigation);
             }
         }
     }
     //plugins
     $standard_plugins = PluginManager::getInstance()->getPlugins("StandardPlugin", $_SESSION['SessionSeminar']);
     foreach ($standard_plugins as $plugin) {
         if (!$sem_class->isSlotModule(get_class($plugin))) {
             foreach ($sem_class->getNavigationForSlot(get_class($plugin)) as $nav_name => $navigation) {
                 if ($nav_name && is_a($navigation, "Navigation")) {
                     $this->addSubNavigation($nav_name, $navigation);
                 }
             }
         }
     }
 }
示例#29
0
 /**
  * Initialize the subnavigation of this item. This method
  * is called once before the first item is added or removed.
  */
 public function initSubNavigation()
 {
     global $perm, $user;
     parent::initSubNavigation();
     // top navigation (toolbar)
     $this->addSubNavigation('start', new StartNavigation());
     // if the user is not logged in, he will see the free courses, otherwise
     // the my courses page will be shown.
     if (is_object($user) && $user->id != 'nobody' || get_config('ENABLE_FREE_ACCESS')) {
         $this->addSubNavigation('browse', new BrowseNavigation());
     }
     // if a course is selected, the navigation for it will be loaded, but
     // it will not be shown in the main toolbar
     if ($_SESSION['SessionSeminar']) {
         $this->addSubNavigation('course', new CourseNavigation());
     }
     if (is_object($user) && $user->id != 'nobody') {
         // internal message system
         $this->addSubNavigation('messaging', new MessagingNavigation());
         // community page
         $this->addSubNavigation('community', new CommunityNavigation());
         // user profile page
         $this->addSubNavigation('profile', new ProfileNavigation());
         // calendar and schedule page
         $this->addSubNavigation('calendar', new CalendarNavigation());
         // search page
         $this->addSubNavigation('search', new SearchNavigation());
     }
     // tools page
     if (is_object($user) && $perm->have_perm('autor')) {
         $this->addSubNavigation('tools', new ToolsNavigation());
     }
     // admin page
     if (is_object($user) && $perm->have_perm('admin')) {
         $this->addSubNavigation('admin', new AdminNavigation());
     }
     // resource managment, if it is enabled
     if (get_config('RESOURCES_ENABLE')) {
         //TODO: suboptimal, es sollte eine ResourcesNavigation geben
         $navigation = new Navigation(_('Ressourcen'), 'resources.php', array('view' => 'resources'));
         if (is_object($user) && $perm->have_perm('admin')) {
             $navigation->setImage(Icon::create('resources', 'navigation', ["title" => _('Zur Ressourcenverwaltung')]));
         }
         $this->addSubNavigation('resources', $navigation);
     }
     // quick links
     $links = new Navigation('Links');
     // login / logout
     if (is_object($user) && $user->id != 'nobody') {
         $links->addSubNavigation('logout', new Navigation(_('Logout'), 'logout.php'));
     } else {
         if (in_array('CAS', $GLOBALS['STUDIP_AUTH_PLUGIN'])) {
             $links->addSubNavigation('login_cas', new Navigation(_('Login CAS'), Request::url(), array('again' => 'yes', 'sso' => 'cas')));
         }
         if (in_array('Shib', $GLOBALS['STUDIP_AUTH_PLUGIN'])) {
             $links->addSubNavigation('login_shib', new Navigation(_('Login Shibboleth'), Request::url(), array('again' => 'yes', 'sso' => 'shib')));
         }
         $links->addSubNavigation('login', new Navigation(_('Login'), Request::url(), array('again' => 'yes')));
     }
     $this->addSubNavigation('links', $links);
     // footer links
     $this->addSubNavigation('footer', new FooterNavigation(_('Footer')));
     // login page
     $this->addSubNavigation('login', new LoginNavigation(_('Login')));
 }