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"); }
public function testBadgeNumber() { $navigation = new Navigation('badge-test'); $this->assertFalse($navigation->hasBadgeNumber()); $this->assertEquals(0, $navigation->getBadgeNumber()); $navigation->setBadgeNumber(23); $this->assertTrue($navigation->hasBadgeNumber()); $this->assertEquals(23, $navigation->getBadgeNumber()); }
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; }
/** * * @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; }
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; }