Ejemplo n.º 1
0
 /**
  * Check for changes in folders for a course
  * @param      $my_obj
  * @param      $user_id
  * @param null $modules
  */
 public static function checkDocuments(&$my_obj, $user_id, $object_id)
 {
     if ($my_obj["modules"]["documents"]) {
         if (!$GLOBALS['perm']->have_perm('admin')) {
             if ($my_obj['modules']['documents_folder_permissions'] || $my_obj['obj_type'] == 'sem' && StudipDocumentTree::ExistsGroupFolders($object_id)) {
                 $must_have_perm = $my_obj['obj_type'] == 'sem' ? 'tutor' : 'autor';
                 if ($GLOBALS['perm']->permissions[$my_obj['user_status']] < $GLOBALS['perm']->permissions[$must_have_perm]) {
                     $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $object_id, 'entity_type' => $my_obj['obj_type']));
                     $unreadable_folders = (array) $folder_tree->getUnReadableFolders($user_id);
                 }
             }
         }
         $result = self::getDocumentsVisitDate($object_id, $user_id, $unreadable_folders);
         if (!is_null($result['last_modified'])) {
             if ($my_obj['last_modified'] < $result['last_modified']) {
                 $my_obj['last_modified'] = $result['last_modified'];
             }
             $nav = new Navigation('files');
             if ($result['neue']) {
                 $nav->setURL(sprintf('folder.php?cmd=all'));
                 $nav->setImage(Icon::create('files+new', 'attention', ["title" => sprintf('%s %s, %s %s', $result['count'], _('Dokument(e)'), $result['neue'], _('neue'))]));
                 $nav->setBadgeNumber($result['neue']);
             } else {
                 $nav->setURL('folder.php?cmd=tree');
                 $nav->setImage(Icon::create('files', 'inactive', ["title" => sprintf('%s %s', $result['count'], _('Dokument(e)'))]));
             }
             return $nav;
         }
     }
     return null;
 }
Ejemplo n.º 2
0
function in_archiv ($sem_id)
{
    global $SEM_CLASS,$SEM_TYPE, $ARCHIV_PATH, $TMP_PATH, $ZIP_PATH, $ZIP_OPTIONS, $_fullname_sql;

    NotificationCenter::postNotification('CourseWillArchive', $sem_id);

    //Besorgen der Grunddaten des Seminars
    $query = "SELECT Seminar_id, Name, Untertitel, Beschreibung,
                     start_time, Institut_id, status
              FROM seminare
              WHERE Seminar_id = ?";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($sem_id));
    $row = $statement->fetch(PDO::FETCH_ASSOC);

    $seminar_id     = $row['Seminar_id'];
    $name           = $row['Name'];
    $untertitel     = $row['Untertitel'];
    $beschreibung   = $row['Beschreibung'];
    $start_time     = $row['start_time'];
    $heimat_inst_id = $row['Institut_id'];

    //Besorgen von einzelnen Daten zu dem Seminar
    $semester = new SemesterData;
    $all_semester = $semester->getAllSemesterData();
    foreach ($all_semester as $sem) {
        if (($start_time >= $sem['beginn']) && ($start_time <= $sem['ende'])) {
            $semester_tmp = $sem['name'];
        }
    }

    //Studienbereiche
    if ($SEM_CLASS[$SEM_TYPE[$row['status']]['class']]['bereiche']) {
        $sem_path = get_sem_tree_path($seminar_id);
        if (is_array($sem_path)) {
            $studienbereiche = join(', ', $sem_path);
        }
    }

    // das Heimatinstitut als erstes
    $query = "SELECT Name FROM Institute WHERE Institut_id = ?";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($heimat_inst_id));
    $institute = $statement->fetchColumn();

    // jetzt den Rest
    $query = "SELECT Name
              FROM Institute
              LEFT JOIN seminar_inst USING (institut_id)
              WHERE seminar_id = ? AND Institute.Institut_id != ?";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($seminar_id, $heimat_inst_id));
    while ($temp = $statement->fetchColumn()) {
        $institute .= ', ' . $temp;
    }

    $query = "SELECT GROUP_CONCAT({$_fullname_sql['full']} SEPARATOR ', ')
              FROM seminar_user
              LEFT JOIN auth_user_md5 USING (user_id)
              LEFT JOIN user_info USING (user_id)
              WHERE seminar_id = ? AND seminar_user.status = 'dozent'";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($seminar_id));
    $dozenten = $statement->fetchColumn();

    $query = "SELECT fakultaets_id
              FROM seminare
              LEFT JOIN Institute USING (Institut_id)
              WHERE Seminar_id = ?";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($seminar_id));
    $fakultaet_id = $statement->fetchColumn();

    $query = "SELECT GROUP_CONCAT(DISTINCT c.Name SEPARATOR ' | ')
              FROM seminar_inst AS a
              LEFT JOIN Institute AS b USING (Institut_id)
              LEFT JOIN Institute AS c ON (c.Institut_id = b.fakultaets_id)
              WHERE a.seminar_id = ?";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($seminar_id));
    $fakultaet = $statement->fetchColumn();

    setTempLanguage();  // use $DEFAULT_LANGUAGE for archiv-dumps

    //Dump holen
    $dump = dump_sem($sem_id, 'nobody');

    //Forumdump holen
    foreach (PluginEngine::getPlugins('ForumModule', $sem_id) as $plugin) {
        $forumdump .= $plugin->getDump($sem_id);
    }

    // Wikidump holen
    $wikidump = getAllWikiPages($sem_id, $name, FALSE);

    restoreLanguage();

    //OK, naechster Schritt: Kopieren der Personendaten aus seminar_user in archiv_user
    $query = "INSERT INTO archiv_user (seminar_id, user_id, status)
              SELECT Seminar_id, user_id, status FROM seminar_user WHERE Seminar_id = ?";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($seminar_id));

    // Eventuelle Vertretungen in der Veranstaltung haben weiterhin Zugriff mit Dozentenrechten
    if (get_config('DEPUTIES_ENABLE')) {
        $deputies = getDeputies($seminar_id);
        // Eintragen ins Archiv mit Zugriffsberechtigung "dozent"
        $query = "INSERT IGNORE INTO archiv_user SET seminar_id = ?, user_id = ?, status = 'dozent'";
        $statement = DBManager::get()->prepare($query);
        foreach ($deputies as $deputy) {
            $statement->execute(array($seminar_id, $deputy['user_id']));
        }
    }

    $Modules = new Modules;
    $Modules = $Modules->getLocalModules($sem_id);
    $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $sem_id,'entity_type' => 'sem'));

    if ($Modules['documents_folder_permissions'] || StudipDocumentTree::ExistsGroupFolders($sem_id)) {
        $unreadable_folders = $folder_tree->getUnReadableFolders('nobody');
    }

    $query = "SELECT COUNT(dokument_id) FROM dokumente WHERE seminar_id = ? AND url = ''";
    $statement = DBManager::get()->prepare($query);
    $statement->execute(array($seminar_id));
    $count = $statement->fetchColumn();
    if ($count) {
        $hash_secret = "frauen";
        $archiv_file_id = md5(uniqid($hash_secret,1));

        //temporaeres Verzeichnis anlegen
        $tmp_full_path = "$TMP_PATH/$archiv_file_id";
        mkdir($tmp_full_path, 0700);

        if($folder_tree->getNumKids('root')) {
            $list = $folder_tree->getKids('root');
        }
        if (is_array($list) && count($list) > 0) {
            $query = "SELECT folder_id, name
                      FROM folder WHERE range_id IN (?)
                      ORDER BY name";
            $statement = DBManager::get()->prepare($query);
            $statement->execute(array($list));

            $folder = 0;
            while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
                $folder += 1;
                $temp_folder = $tmp_full_path . "/[$folder]_" . prepareFilename($row['name'], FALSE);
                mkdir($temp_folder, 0700);
                createTempFolder($row['folder_id'], $temp_folder, $seminar_id, 'nobody');
            }

            //zip all the stuff
            $archiv_full_path = "$ARCHIV_PATH/$archiv_file_id";
            create_zip_from_directory($tmp_full_path, $tmp_full_path);
            @rename($tmp_full_path . '.zip', $archiv_full_path);
        }
        rmdirr($tmp_full_path);

        if (is_array($unreadable_folders)) {
            $query = "SELECT dokument_id FROM dokumente WHERE seminar_id = ? AND url = '' AND range_id IN (?)";
            $statement = DBManager::get()->prepare($query);
            $statement->execute(array($seminar_id, $unreadable_folders));
            $archiv_protected_file_id = createSelectedZip($statement->fetchAll(PDO::FETCH_COLUMN), false, false);
            @rename("$TMP_PATH/$archiv_protected_file_id", "$ARCHIV_PATH/$archiv_protected_file_id");
        }
    } else {
        $archiv_file_id = '';
    }

    //Reinschreiben von diversem Klumpatsch in die Datenbank
    $query = "INSERT INTO archiv
                (seminar_id, name, untertitel, beschreibung, start_time,
                 semester, heimat_inst_id, institute, dozenten, fakultaet,
                 dump, archiv_file_id,archiv_protected_file_id, forumdump, wikidump, studienbereiche,
                 mkdate)
              VALUES
                (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, UNIX_TIMESTAMP())";
    $statement = DBManager::get()->prepare($query);
    $success = $statement->execute(array(
        $seminar_id,
        $name ?: '',
        $untertitel ?: '',
        $beschreibung ?: '',
        $start_time,
        $semester_tmp ?: '',
        $heimat_inst_id,
        $institute ?: '',
        $dozenten ?: '',
        $fakultaet ?: '',
        $dump ?: '',
        $archiv_file_id ?: '',
        $archiv_protected_file_id ?: '',
        $forumdump ?: '',
        $wikidump ?: '',
        $studienbereiche ?: '',
    ));
    if ($success) {
        NotificationCenter::postNotification('CourseDidArchive', $seminar_id);
    }
}
Ejemplo n.º 3
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;
}