Esempio n. 1
0
 public function testURL()
 {
     $navigation = new Navigation('test', 'foo.php');
     $this->assertEquals($navigation->getURL(), 'foo.php');
     $navigation->setURL('bar.php', array('fuzz' => 'yes'));
     $this->assertEquals('bar.php?fuzz=yes', $navigation->getURL());
     $this->assertTrue($navigation->isEnabled());
     $navigation->setEnabled(false);
     $this->assertFalse($navigation->isEnabled());
     $this->assertFalse($navigation->isVisible(true));
     $this->assertTrue($navigation->isVisible());
     $navigation->setURL(NULL);
     $this->assertFalse($navigation->isVisible());
 }
Esempio n. 2
0
 public function __construct()
 {
     parent::__construct();
     if ($GLOBALS['perm']->have_perm("root")) {
         $processes = FleximportProcess::findBySQL("1=1 ORDER BY name ASC");
         $navigation = new Navigation($this->getDisplayName());
         $navigation->setURL(PluginEngine::getURL($this, array(), 'import/overview' . (count($processes) ? "/" . $processes[0]['process_id'] : "")));
         Navigation::addItem('/start/fleximport', $navigation);
         Navigation::addItem('/fleximport', $navigation);
         if (count($processes)) {
             foreach ($processes as $process) {
                 $navigation = new Navigation($process['name'], PluginEngine::getURL($this, array(), 'import/overview/' . $process->getId()));
                 Navigation::addItem('/fleximport/process_' . $process->getId(), $navigation);
             }
         } else {
             $navigation = new Navigation(_("Import"), PluginEngine::getURL($this, array(), 'import/overview'));
             Navigation::addItem('/fleximport/overview', $navigation);
         }
         $navigation = new Navigation(_("Konfiguration"), PluginEngine::getURL($this, array(), 'config/overview'));
         Navigation::addItem('/fleximport/config', $navigation);
         if (FleximportConfig::get("DISPLAY_AT_HEADER")) {
             if (is_numeric(FleximportConfig::get("DISPLAY_AT_HEADER"))) {
                 Navigation::getItem('/fleximport')->setImage(version_compare($GLOBALS['SOFTWARE_VERSION'], "3.4", ">=") ? Icon::create("install", "navigation") : Assets::image_path("icons/lightblue/install.svg"));
             } else {
                 Navigation::getItem('/fleximport')->setImage(version_compare($GLOBALS['SOFTWARE_VERSION'], "3.4", ">=") ? Icon::create(FleximportConfig::get("DISPLAY_AT_HEADER"), "navigation") : FleximportConfig::get("DISPLAY_AT_HEADER"));
             }
         }
     }
 }
Esempio 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;
}
Esempio n. 4
0
 /**
  * Constructor of Plugin : adds Navigation and collects information for javascript-update.
  */
 public function __construct()
 {
     parent::__construct();
     if (UpdateInformation::isCollecting()) {
         $data = Request::getArray("page_info");
         if (stripos(Request::get("page"), "plugins.php/blubber") !== false && isset($data['Blubber'])) {
             $output = array();
             switch ($data['Blubber']['stream']) {
                 case "global":
                     $stream = BlubberStream::getGlobalStream();
                     break;
                 case "course":
                     $stream = BlubberStream::getCourseStream($data['Blubber']['context_id']);
                     break;
                 case "profile":
                     $stream = BlubberStream::getProfileStream($data['Blubber']['context_id']);
                     break;
                 case "thread":
                     $stream = BlubberStream::getThreadStream($data['Blubber']['context_id']);
                     break;
                 case "custom":
                     $stream = new BlubberStream($data['Blubber']['context_id']);
                     break;
             }
             $last_check = $data['Blubber']['last_check'] ? $data['Blubber']['last_check'] : time() - 5 * 60;
             $new_postings = $stream->fetchNewPostings($last_check);
             $factory = new Flexi_TemplateFactory($this->getPluginPath() . "/views");
             foreach ($new_postings as $new_posting) {
                 if ($new_posting['root_id'] === $new_posting['topic_id']) {
                     $thread = $new_posting;
                     $template = $factory->open("streams/thread.php");
                     $template->set_attribute('thread', $new_posting);
                 } else {
                     $thread = new BlubberPosting($new_posting['root_id']);
                     $template = $factory->open("streams/comment.php");
                     $template->set_attribute('posting', $new_posting);
                 }
                 BlubberPosting::$course_hashes = $thread['user_id'] !== $thread['Seminar_id'] ? $thread['Seminar_id'] : false;
                 $template->set_attribute("course_id", $data['Blubber']['seminar_id']);
                 $output['postings'][] = array('posting_id' => $new_posting['topic_id'], 'discussion_time' => $new_posting['discussion_time'], 'mkdate' => $new_posting['mkdate'], 'root_id' => $new_posting['root_id'], 'content' => $template->render());
             }
             UpdateInformation::setInformation("Blubber.getNewPosts", $output);
             //Events-Queue:
             $db = DBManager::get();
             $events = $db->query("SELECT event_type, item_id " . "FROM blubber_events_queue " . "WHERE mkdate >= " . $db->quote($last_check) . " " . "ORDER BY mkdate ASC " . "")->fetchAll(PDO::FETCH_ASSOC);
             UpdateInformation::setInformation("Blubber.blubberEvents", $events);
             $db->exec("DELETE FROM blubber_events_queue " . "WHERE mkdate < UNIX_TIMESTAMP() - 60 * 60 * 6 " . "");
         }
     }
     if (Navigation::hasItem("/community")) {
         $nav = new Navigation($this->getDisplayTitle(), PluginEngine::getURL($this, array(), "streams/global"));
         $nav->addSubNavigation("global", new AutoNavigation(_("Globaler Stream"), PluginEngine::getURL($this, array(), "streams/global")));
         foreach (BlubberStream::findMine() as $stream) {
             $url = PluginEngine::getURL($this, array(), "streams/custom/" . $stream->getId());
             $nav->addSubNavigation($stream->getId(), new AutoNavigation($stream['name'], $url));
             if ($stream['defaultstream']) {
                 $nav->setURL($url);
             }
         }
         $nav->addSubNavigation("add", new AutoNavigation(_("Neuen Stream erstellen"), PluginEngine::getURL($this, array(), "streams/edit")));
         Navigation::insertItem("/community/blubber", $nav, "online");
         Navigation::getItem("/community")->setURL($nav->getURL());
     }
     if (Navigation::hasItem("/profile") && $this->isActivated(get_userid(Request::username('username', $GLOBALS['auth']->auth['uname'])), 'user')) {
         $nav = new AutoNavigation(_("Blubber"), PluginEngine::getURL($this, array('user_id' => get_userid(Request::get("username"))), "streams/profile"));
         Navigation::addItem("/profile/blubber", $nav);
     }
 }
Esempio n. 5
0
 /**
  * Check for new entries in wiki
  * @param $my_obj
  * @param $user_id
  * @param $modules
  */
 public static function checkWiki(&$my_obj, $user_id, $object_id)
 {
     if ($my_obj["modules"]["wiki"]) {
         $sql = "SELECT COUNT(DISTINCT keyword) as count_d,\n                COUNT(IF((chdate > IFNULL(ouv.visitdate, :threshold) AND wiki.user_id !=:user_id), keyword, NULL)) AS neue,\n                MAX(IF((chdate > IFNULL(ouv.visitdate, :threshold) AND wiki.user_id !=:user_id), chdate, 0)) AS last_modified,\n              COUNT(keyword) as count\n            FROM\n              wiki\n            LEFT JOIN\n              object_user_visits ouv ON(ouv . object_id = wiki . range_id AND ouv . user_id = :user_id and ouv . type = 'wiki')\n            WHERE\n              wiki . range_id = :course_id\n            GROUP BY\n              wiki.range_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 (!is_null($result['last_modified']) && (int) $result['last_modified'] != 0) {
                 if ($my_obj['last_modified'] < $result['last_modified']) {
                     $my_obj['last_modified'] = $result['last_modified'];
                 }
             }
             $nav = new Navigation('wiki');
             if ((int) $result['neue']) {
                 $nav->setURL('wiki.php?view=listnew');
                 $nav->setImage(Icon::create('wiki+new', 'attention', ["title" => sprintf('%s %s, %s %s', $result['count_d'], _('WikiSeite(n)'), $result['neue'], _('Änderungen'))]));
                 $nav->setBadgeNumber($result['neue']);
             } elseif ((int) $result['count']) {
                 $nav->setURL('wiki.php');
                 $nav->setImage(Icon::create('wiki', 'inactive', ["title" => sprintf('%s %s', $result['count_d'], _('WikiSeite(n)'))]));
             }
             return $nav;
         }
     }
     return null;
 }
Esempio n. 6
0
 /**
  * Initialize the subnavigation of this item. This method
  * is called once before the first item is added or removed.
  */
 public function initSubNavigation()
 {
     global $SessionSeminar, $SessSemName, $archive_kill, $perm;
     parent::initSubNavigation();
     if ($SessSemName['class'] == 'inst') {
         if (isset($_SESSION['links_admin_data']['referred_from']) && $_SESSION['links_admin_data']['referred_from'] == 'inst') {
             $back_jump = _('zurück zur ausgewählten Einrichtung');
         } else {
             $back_jump = _('zur ausgewählten Einrichtung');
         }
     } else {
         if ($SessSemName['class'] == 'sem') {
             if (isset($_SESSION['links_admin_data']['referred_from']) && $_SESSION['links_admin_data']['referred_from'] == 'sem' && !$archive_kill && !(isset($_SESSION['links_admin_data']['assi']) && $_SESSION['links_admin_data']['assi'])) {
                 $back_jump = _('zurück zur ausgewählten Veranstaltung');
             } else {
                 if (isset($_SESSION['links_admin_data']['referred_from']) && $_SESSION['links_admin_data']['referred_from'] == 'assi' && !$archive_kill) {
                     $back_jump = _('zur neu angelegten Veranstaltung');
                 } else {
                     if (!(isset($_SESSION['links_admin_data']['assi']) && $_SESSION['links_admin_data']['assi'])) {
                         $back_jump = _('zur ausgewählten Veranstaltung');
                     }
                 }
             }
         }
     }
     $sem_create_perm = in_array(Config::get()->SEM_CREATE_PERM, array('root', 'admin', 'dozent')) ? Config::get()->SEM_CREATE_PERM : 'dozent';
     // global config / user administration
     if (!Config::get()->RESTRICTED_USER_MANAGEMENT || $perm->have_perm('root')) {
         $navigation = new Navigation(_('Benutzer'));
         $navigation->setURL('dispatch.php/admin/user/');
         $navigation->addSubNavigation('index', new Navigation(_('Benutzer'), 'dispatch.php/admin/user'));
         if ($perm->have_perm('root')) {
             $navigation->addSubNavigation('user_domains', new Navigation(_('Nutzerdomänen'), 'dispatch.php/admin/domain'));
         }
         $this->addSubNavigation('user', $navigation);
     }
     // institute administration
     $navigation = new Navigation(_('Einrichtungen'));
     $navigation->setURL('dispatch.php/institute/basicdata/index?cid=');
     $navigation->addSubNavigation('details', new Navigation(_('Grunddaten'), 'dispatch.php/institute/basicdata/index'));
     $navigation->addSubNavigation('faculty', new Navigation(_('Mitarbeiter'), 'dispatch.php/institute/members?admin_view=1'));
     $navigation->addSubNavigation('groups', new Navigation(_('Funktionen / Gruppen'), 'dispatch.php/admin/statusgroups?type=inst'));
     if (Config::get()->VOTE_ENABLE) {
         $navigation->addSubNavigation('vote', new Navigation(_('Umfragen und Tests'), 'admin_vote.php?view=vote_inst'));
         $navigation->addSubNavigation('evaluation', new Navigation(_('Evaluationen'), 'admin_evaluation.php?view=eval_inst'));
     }
     $navigation->addSubNavigation('modules', new Navigation(_('Inhaltselemente'), 'dispatch.php/course/plus/index'));
     if (Config::get()->EXTERN_ENABLE) {
         $navigation->addSubNavigation('external', new Navigation(_('Externe Seiten'), 'admin_extern.php?view=extern_inst'));
     }
     if ($perm->have_perm("root") || $perm->is_fak_admin() && Config::get()->INST_FAK_ADMIN_PERMS != 'none') {
         $navigation->addSubNavigation('create', new Navigation(_('Neue Einrichtung anlegen'), 'dispatch.php/institute/basicdata/index?cid=&i_view=new'));
     }
     $this->addSubNavigation('institute', $navigation);
     $navigation = new Navigation(_('Standort'));
     if ($perm->have_perm(Config::get()->RANGE_TREE_ADMIN_PERM ? Config::get()->RANGE_TREE_ADMIN_PERM : 'admin')) {
         $navigation->addSubNavigation('range_tree', new Navigation(_('Einrichtungshierarchie'), 'admin_range_tree.php'));
     }
     if ($perm->have_perm(Config::get()->SEM_TREE_ADMIN_PERM ? Config::get()->SEM_TREE_ADMIN_PERM : 'admin') && $perm->is_fak_admin()) {
         $navigation->addSubNavigation('sem_tree', new Navigation(_('Veranstaltungshierarchie'), 'admin_sem_tree.php'));
     }
     if ($perm->have_perm(Config::get()->LOCK_RULE_ADMIN_PERM ? Config::get()->LOCK_RULE_ADMIN_PERM : 'admin')) {
         $navigation->addSubNavigation('lock_rules', new Navigation(_('Sperrebenen'), 'dispatch.php/admin/lockrules'));
     }
     if ($perm->have_perm('root')) {
         $navigation->addSubNavigation('auto_insert', new Navigation(_('Automatisiertes Eintragen'), 'dispatch.php/admin/autoinsert'));
         if (Config::get()->SEMESTER_ADMINISTRATION_ENABLE) {
             $navigation->addSubNavigation('semester', new Navigation(_('Semester'), 'dispatch.php/admin/semester'));
             $navigation->addSubNavigation('holidays', new Navigation(_('Ferien'), 'dispatch.php/admin/holidays'));
         }
         if (Config::get()->EXTERN_ENABLE) {
             $navigation->addSubNavigation('external', new Navigation(_('Externe Seiten'), 'admin_extern.php?list=TRUE&view=extern_global'));
         }
         $navigation->addSubNavigation('studycourse', new Navigation(_('Studiengänge'), 'dispatch.php/admin/studycourse/profession'));
         $navigation->addSubNavigation('sem_classes', new Navigation(_('Veranstaltungskategorien'), 'dispatch.php/admin/sem_classes/overview'));
     }
     $this->addSubNavigation('locations', $navigation);
     // global config / user administration
     $navigation = new Navigation(_('System'));
     if ($perm->have_perm('root')) {
         $navigation->addSubNavigation('plugins', new Navigation(_('Plugins'), 'dispatch.php/admin/plugin'));
         $navigation->addSubNavigation('roles', new Navigation(_('Rollen'), 'dispatch.php/admin/role'));
         $navigation->addSubNavigation('datafields', new Navigation(_('Datenfelder'), 'dispatch.php/admin/datafields'));
         $navigation->addSubNavigation('configuration', new Navigation(_('Konfiguration'), 'dispatch.php/admin/configuration/configuration'));
         if (Config::get()->BANNER_ADS_ENABLE) {
             $navigation->addSubNavigation('banner', new Navigation(_('Werbebanner'), 'dispatch.php/admin/banner'));
         }
         $navigation->addSubNavigation('coursewizardsteps', new Navigation(_('Anlegeassistent'), 'dispatch.php/admin/coursewizardsteps'));
         $navigation->addSubNavigation('studygroup', new Navigation(_('Studiengruppen'), 'dispatch.php/course/studygroup/globalmodules'));
         if (Config::get()->SMILEYADMIN_ENABLE) {
             $navigation->addSubNavigation('smileys', new Navigation(_('Smileys'), 'dispatch.php/admin/smileys'));
         }
         if (Config::get()->TOURS_ENABLE) {
             $navigation->addSubNavigation('tour', new Navigation(_('Touren'), 'dispatch.php/tour/admin_overview'));
         }
         $navigation->addSubNavigation('help_content', new Navigation(_('Hilfe-Texte'), 'dispatch.php/help_content/admin_overview'));
         if (Config::get()->ELEARNING_INTERFACE_ENABLE) {
             $navigation->addSubNavigation('elearning', new Navigation(_('Lernmodule'), 'admin_elearning_interface.php'));
         }
         if (Config::get()->WEBSERVICES_ENABLE) {
             $navigation->addSubNavigation('webservice_access', new Navigation(_('Webservices'), 'dispatch.php/admin/webservice_access'));
         }
         if (Config::get()->CRONJOBS_ENABLE) {
             $navigation->addSubNavigation('cronjobs', new Navigation(_('Cronjobs'), 'dispatch.php/admin/cronjobs/schedules'));
         }
         if (Config::get()->PERSONALDOCUMENT_ENABLE) {
             $navigation->addSubNavigation('document_area', new Navigation(_('Pers. Dateibereich'), 'dispatch.php/document/administration'));
         }
         $navigation->addSubNavigation('admissionrules', new Navigation(_('Anmelderegeln'), 'dispatch.php/admission/ruleadministration'));
         $navigation->addSubNavigation('api', new Navigation(_('API'), 'dispatch.php/admin/api'));
     }
     if ($perm->have_perm(Config::get()->AUX_RULE_ADMIN_PERM ? Config::get()->AUX_RULE_ADMIN_PERM : 'admin')) {
         $navigation->addSubNavigation('specification', new Navigation(_('Zusatzangaben'), 'dispatch.php/admin/specification'));
     }
     $this->addSubNavigation('config', $navigation);
     // log view
     if ($perm->have_perm('root') && Config::get()->LOG_ENABLE) {
         $navigation = new Navigation(_('Log'));
         $navigation->addSubNavigation('show', new Navigation(_('Log'), 'dispatch.php/event_log/show'));
         $navigation->addSubNavigation('admin', new Navigation(_('Einstellungen'), 'dispatch.php/event_log/admin'));
         $this->addSubNavigation('log', $navigation);
     }
     // link to course
     if ($SessSemName['class'] == 'inst') {
         $navigation = new Navigation($back_jump, 'dispatch.php/institute/overview?auswahl=' . $SessSemName[1]);
         $this->addSubNavigation('back_jump', $navigation);
     } else {
         if ($SessSemName['class'] == 'sem' && !$archive_kill && !(isset($_SESSION['links_admin_data']['assi']) && $_SESSION['links_admin_data']['assi'])) {
             $navigation = new Navigation($back_jump, 'seminar_main.php?auswahl=' . $SessSemName[1]);
             $this->addSubNavigation('back_jump', $navigation);
         }
     }
     // admin plugins
     $navigation = new Navigation(_('Admin-Plugins'));
     $this->addSubNavigation('plugins', $navigation);
 }