/** * Displays a page. */ public function index_action($id = null) { Navigation::activateItem('/course/literature/view'); PageLayout::setTitle($_SESSION['SessSemName']["header_line"] . " - " . _("Literatur")); $this->list = StudipLitList::GetFormattedListsByRange($_SESSION["SessionSeminar"], object_get_visit($_SESSION["SessionSeminar"], "literature")); $this->_range_id = $_SESSION["SessionSeminar"]; }
function dump_sem($sem_id, $print_view = false) { global $TERMIN_TYP, $SEM_TYPE, $SEM_CLASS, $_fullname_sql, $AUTO_INSERT_SEM; $Modules = new Modules; $Modules = $Modules->getLocalModules($sem_id); $query = "SELECT status, Name, Untertitel, art, VeranstaltungsNummer, ects, Beschreibung, teilnehmer, vorrausetzungen, lernorga, leistungsnachweis, Sonstiges, Institut_id, admission_turnout FROM seminare WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($sem_id)); $seminar = $statement->fetch(PDO::FETCH_ASSOC); $sem_type = $seminar['status']; $sem = Seminar::getInstance($sem_id); $dump = '<table width="100%" border="1" cellpadding="2" cellspacing="0">'; $dump .= '<tr><td colspan="2" align="left" class="table_header_bold">'; $dump .= '<h1 class="table_header_bold"> ' . htmlReady($seminar['Name'], 1, 1) . '</h1>'; $dump .= '</td></tr>' . "\n"; // Helper function that dumps into a single table row $dumpRow = function ($title, $content, $escape = false) use (&$dump) { $content = trim($content); if ($content) { if ($escape) { $content = htmlReady($content, 1, 1); } $dump .= sprintf('<tr><td width="15%%"><b>%s</b></td><td>%s</td></tr>' . "\n", htmlReady($title), $content); } }; //Grunddaten des Seminars, wie in den seminar_main $dumpRow(_('Untertitel:'), $seminar['Untertitel'], true); if ($data = $sem->getDatesExport()) { $dumpRow(_('Zeit:'), nl2br($data)); } $dumpRow(_('Semester:'), get_semester($sem_id)); $dumpRow(_('Erster Termin:'), veranstaltung_beginn($sem_id, 'export')); if ($temp = vorbesprechung($sem_id, 'export')) { $dumpRow(_('Vorbesprechung:'), htmlReady($temp)); } if ($data = $sem->getDatesTemplate('dates/seminar_export_location')) { $dumpRow(_('Ort:'), nl2br($data)); } //wer macht den Dozenten? $query = "SELECT {$_fullname_sql['full']} AS fullname FROM seminar_user LEFT JOIN auth_user_md5 USING (user_id) LEFT JOIN user_info USING (user_id) WHERE Seminar_id = ? AND status = 'dozent' ORDER BY position, Nachname"; $statement = DBManager::get()->prepare($query); $statement->execute(array($sem_id)); $teachers = $statement->fetchAll(PDO::FETCH_COLUMN); if (count($teachers) > 0) { $title = get_title_for_status('dozent', count($teachers), $sem_type); $dumpRow($title, implode('<br>', array_map('htmlReady', $teachers))); } //und wer ist Tutor? $query = "SELECT {$_fullname_sql['full']} AS fullname FROM seminar_user LEFT JOIN auth_user_md5 USING (user_id) LEFT JOIN user_info USING (user_id) WHERE Seminar_id = ? AND status = 'tutor' ORDER BY position, Nachname"; $statement = DBManager::get()->prepare($query); $statement->execute(array($sem_id)); $tutors = $statement->fetchAll(PDO::FETCH_COLUMN); if (count($tutors) > 0) { $title = get_title_for_status('tutor', count($tutors), $sem_type); $dumpRow($title, implode('<br>', array_map('htmlReady', $tutors))); } if ($seminar['status'] != '' && isset($SEM_TYPE[$seminar['status']])) { $content = $SEM_TYPE[$seminar['status']]['name']; $content .= ' ' . _('in der Kategorie') . ' '; $content .= '<b>' . $SEM_CLASS[$SEM_TYPE[$seminar['status']]['class']]['name'] . '</b>'; $dumpRow(_('Typ der Veranstaltung'), $content); } $dumpRow(_('Art der Veranstaltung:'), $seminar['art'], true); $dumpRow(_('VeranstaltungsNummer:'), htmlReady($seminar['VeranstaltungsNummer'])); $dumpRow(_('ECTS-Punkte:'), htmlReady($seminar['ects'])); $dumpRow(_('Beschreibung:'), $seminar['Beschreibung'], true); $dumpRow(_('Teilnehmende:'), $seminar['teilnehmende'], true); $dumpRow(_('Voraussetzungen:'), $seminar['vorrausetzungen'], true); $dumpRow(_('Lernorganisation:'), $seminar['lernorga'], true); $dumpRow(_('Leistungsnachweis:'), $seminar['leistungsnachweis'], true); //add the free adminstrable datafields $localEntries = DataFieldEntry::getDataFieldEntries($sem_id); foreach ($localEntries as $entry) { $dumpRow($entry->getName(), $entry->getDisplayValue()); } $dumpRow(_('Sonstiges:'), $seminar['Sonstiges'], true); // Fakultaeten... $query = "SELECT DISTINCT c.Name 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($sem_id)); $faculties = $statement->fetchAll(PDO::FETCH_COLUMN); if (count($faculties) > 0) { $dumpRow(_('Fakultät(en):'), implode('<br>', array_map('htmlReady', $faculties))); } //Studienbereiche if (isset($SEM_TYPE[$seminar['status']]) && $SEM_CLASS[$SEM_TYPE[$seminar['status']]['class']]['bereiche']) { $sem_path = get_sem_tree_path($sem_id) ?: array(); $dumpRow(_('Studienbereiche') . ':', implode('<br>', array_map('htmlReady', $sem_path))); } $iid = $seminar['Institut_id']; $query = "SELECT Name FROM Institute WHERE Institut_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($iid)); $inst_name = $statement->fetchColumn(); $dumpRow(_('Heimat-Einrichtung:'), $inst_name, true); $query = "SELECT Name FROM seminar_inst LEFT JOIN Institute USING (institut_id) WHERE seminar_id = ? AND Institute.institut_id != ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($sem_id, $iid)); $other_institutes = $statement->fetchAll(PDO::FETCH_COLUMN); if (count($other_institutes) > 0) { $title = (count($other_institutes) == 1) ? _('Beteiligte Einrichtung:') : _('Beteiligte Einrichtungen:'); $dumpRow($title, implode(', ', array_map('htmlReady', $other_institutes))); } //Teilnehmeranzahl $dumpRow(_('max. Personenanzahl:'), $seminar['admission_turnout']); //Statistikfunktionen $query = "SELECT COUNT(*) FROM seminar_user WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($sem_id)); $count = $statement->fetchColumn(); $dumpRow(_('Anzahl der angemeldeten Personen:'), $count); // number of postings for all forum-modules in this seminar $count = 0; $forum_modules = PluginEngine::getPlugins('ForumModule', $sem_id); foreach ($forum_modules as $plugin) { $count += $plugin->getNumberOfPostingsForSeminar($sem_id); } $dumpRow(_('Forenbeiträge:'), $count); if ($Modules['documents']) { //do not show hidden documents $unreadable_folders = array(); if ($print_view) { $check_user = $print_view === true ? $GLOBALS['user']->id : $print_view; if ($Modules['documents_folder_permissions'] || StudipDocumentTree::ExistsGroupFolders($sem_id)) { if (!$GLOBALS['perm']->have_studip_perm('tutor', $sem_id, $check_user)) { $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $sem_id,'entity_type' => 'sem')); $unreadable_folders = $folder_tree->getUnReadableFolders($check_user); } } } $query = "SELECT COUNT(*) FROM dokumente WHERE seminar_id = ?"; $parameters = array($sem_id); if (count($unreadable_folders) > 0) { $query .= " AND range_id NOT IN(?)"; $parameters[] = $unreadable_folders; } $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $docs = $statement->fetchColumn(); } $dumpRow(_('Dokumente:'), $docs ?: 0); $dump.= '</table>' . "\n"; // Ablaufplan if ($Modules['schedule']) { $dump.= dumpRegularDatesSchedule($sem_id); $dump.= dumpExtraDatesSchedule($sem_id); } //SCM if ($Modules['scm']) { foreach(StudipScmEntry::findByRange_id($sem_id, 'ORDER BY position ASC') as $scm) { if (!empty($scm->content)) { $dump .= '<br>'; $dump .= '<table width="100%" border="1" cellpadding="2" cellspacing="0">'; $dump .= ' <tr><td align="left" class="table_header_bold">'; $dump .= '<h2 class="table_header_bold"> ' . htmlReady($scm->tab_name) . '</h2>'; $dump .= '</td></tr>' . "\n"; $dump .= '<tr><td align="left" width="100%"><br>'. formatReady($scm->content, 1, 1) .'<br></td></tr>' . "\n"; $dump .= '</table>' . "\n"; } } } if ($Modules['literature']) { $lit = StudipLitList::GetFormattedListsByRange($sem_id, false, false); if ($lit) { $dump .= '<br>'; $dump .= '<table width="100%" border="1" cellpadding="2" cellspacing="0">'; $dump .= '<tr><td align="left" class="table_header_bold">'; $dump .= '<h2 class="table_header_bold"> ' . _('Literaturlisten') . '</h2>'; $dump .= '</td></tr>' . "\n"; $dump .= '<tr><td align="left" width="100%"><br>'. $lit .'<br></td></tr>' . "\n"; $dump .= '</table>' . "\n"; } } // Dateien anzeigen if ($Modules['documents']) { $link_text = _('Hinweis: Diese Datei wurde nicht archiviert, da sie lediglich verlinkt wurde.'); $query = "SELECT name, filename, mkdate, filesize, Nachname AS nachname, IF(url != '', CONCAT('{$link_text}', ' / ', description), description) AS description FROM dokumente LEFT JOIN auth_user_md5 USING (user_id) WHERE seminar_id = ?"; $parameters = array($sem_id); if (count($unreadable_folders) > 0) { $query .= " AND range_id NOT IN (?)"; $parameters[] = $unreadable_folders; } $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $dbresult = $statement->fetchAll(PDO::FETCH_ASSOC); if (count($dbresult) > 0) { $dump .= '<br>'; $dump .= '<table width="100%" border="1" cellpadding="2" cellspacing="0">'; $dump .= '<tr><td align="left" colspan="3" class="table_header_bold">'; $dump .= '<h2 class="table_header_bold"> ' . _('Dateien:') . '</h2>'; $dump .= '</td></tr>' . "\n"; foreach ($dbresult as $row) { $name = ($row['name'] && $row['name'] != $row['filename']) ? $row['name'] . ' (' . $row['filename'] . ')' : $row['filename']; $dump .= sprintf('<tr><td width="100%%"><b>%s</b><br>%s (%u KB)</td><td>%s</td><td>%s</td></tr>' . "\n", htmlReady($name), htmlReady($row['description']), round($row['filesize'] / 1024), htmlReady($row['nachname']), date('d.m.Y', $row['mkdate'])); } $dump .= '</table>' . "\n"; } } // Teilnehmer if ($Modules['participants'] && (Config::get()->AUTO_INSERT_SEM_PARTICIPANTS_VIEW_PERM || !in_array($sem_id, AutoInsert::getAllSeminars(true)))) { $dump .= '<br>'; // Prepare statement that obtains the number of document a specific // user has uploaded into a specific seminar $documents_params = array($sem_id, null); $query = "SELECT COUNT(*) FROM dokumente WHERE Seminar_id = ? AND user_id = ?"; if (count($unreadable_folders) > 0) { $query .= " AND range_id NOT IN (?)"; $documents_params[] = $unreadable_folders; } $documents_statement = DBManager::get()->prepare($query); // Prepare statement that obtains all participants of a specific // seminar with a specific status $ext_vis_query = get_ext_vis_query('seminar_user'); $query = "SELECT user_id, {$_fullname_sql['full']} AS fullname, {$ext_vis_query} AS user_is_visible FROM seminar_user LEFT JOIN auth_user_md5 USING (user_id) LEFT JOIN user_info USING (user_id) WHERE Seminar_id = ? AND status = ? GROUP by user_id ORDER BY Nachname, Vorname"; $user_statement = DBManager::get()->prepare($query); foreach (words('dozent tutor autor user') as $key) { // die eigentliche Teil-Tabelle $user_statement->execute(array($sem_id, $key)); $users = $user_statement->fetchAll(PDO::FETCH_ASSOC); $user_statement->closeCursor(); //haben wir in der Personengattung ueberhaupt einen Eintrag? if (count($users) > 0) { $dump .= '<table width="100%" border="1" cellpadding="2" cellspacing="0">'; $dump .= '<tr><td align="left" colspan="3" class="table_header_bold">'; $dump .= '<h2 class="table_header_bold"> ' . get_title_for_status($key, count($users), $sem_type) . '</h2>'; $dump .= '</td></tr>' . "\n"; $dump .= '<th width="30%">' . _('Name') . '</th>'; $dump .= '<th width="10%">' . _('Forenbeiträge') . '</th>'; $dump .= '<th width="10%">' . _('Dokumente') . '</th></tr>' . "\n"; foreach ($users as $user) { $documents_params[1] = $user['user_id']; $documents_statement->execute($documents_params); $count = $documents_statement->fetchColumn() ?: 0; $documents_statement->closeCursor(); // get number of postings for this user from all forum-modules $postings = 0; foreach ($forum_modules as $plugin) { $postings += $plugin->getNumberOfPostingsForUser($user['user_id'], $sem_id); } $dump .= sprintf('<tr><td>%s</td><td align="center">%u</td><td align="center">%u</td></tr>' . "\n", $user['user_is_visible'] ? htmlReady($user['fullname']) : _('(unsichtbareR NutzerIn)'), $postings, $count); } // eine Zeile zuende $dump.= '</table>' . "\n"; } } // eine Gruppe zuende } return $dump; } // end function dump_sem($sem_id)
/** * Displays print view of literature list */ public function print_view_action() { PageLayout::removeStylesheet('style.css'); PageLayout::addStylesheet('print.css'); // use special stylesheet for printing $_range_id = Request::option('_range_id'); if ($_range_id != $GLOBALS['user']->id && !$GLOBALS['perm']->have_studip_perm('user', $_range_id)) { throw new AccessDeniedException(); } $_the_tree = TreeAbstract::GetInstance("StudipLitList", $_range_id); $this->title = sprintf(_("Literatur %s"), $_the_tree->root_name); $this->list = StudipLitList::GetFormattedListsByRange($_range_id, false, false); }
/** * Entry point of the controller that displays all the information of the selected or current user * @return void */ public function index_action() { // Template Index_Box for render-partials $layout = $GLOBALS['template_factory']->open('shared/content_box'); $this->shared_box = $layout; // if he has not yet stored into user_info, he comes in with no values if ($this->current_user->mkdate === null) { $this->current_user->store(); } if (get_config('NEWS_RSS_EXPORT_ENABLE')) { $news_author_id = StudipNews::GetRssIdFromUserId($this->current_user->user_id); if ($news_author_id) { PageLayout::addHeadElement('link', array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'RSS', 'href' => 'rss.php?id=' . $news_author_id)); } } // Get Avatar $this->avatar = Avatar::getAvatar($this->current_user->user_id)->getImageTag(Avatar::NORMAL); // GetScroreList if (get_config('SCORE_ENABLE')) { if ($this->current_user->user_id === $GLOBALS['user']->id || $this->current_user->score) { $this->score = Score::GetMyScore($this->current_user); $this->score_title = Score::getTitel($this->score, $this->current_user->geschlecht); } } // Additional user information $this->public_email = get_visible_email($this->current_user->user_id); $this->motto = $this->profile->getVisibilityValue('motto'); $this->private_nr = $this->profile->getVisibilityValue('privatnr', 'private_phone'); $this->private_cell = $this->profile->getVisibilityValue('privatcell', 'private_cell'); $this->privadr = $this->profile->getVisibilityValue('privadr', 'privadr'); $this->homepage = $this->profile->getVisibilityValue('Home', 'homepage'); // skype informations if (get_config('ENABLE_SKYPE_INFO') && $this->profile->checkVisibility('skype_name')) { $this->skype_name = UserConfig::get($this->current_user->user_id)->SKYPE_NAME; $this->skype_status = UserConfig::get($this->current_user->user_id)->SKYPE_ONLINE_STATUS && $this->profile->checkVisibility('skype_online_status'); } // get generic datafield entries $this->shortDatafields = $this->profile->getShortDatafields(); $this->longDatafields = $this->profile->getLongDatafields(); // get working station of an user (institutes) $this->institutes = $this->profile->getInstitutInformations(); // get studying informations of an user if ($this->current_user->perms != 'dozent') { $study_institutes = UserModel::getUserInstitute($this->current_user->user_id, true); if (count($study_institutes) > 0 && $this->profile->checkVisibility('studying')) { $this->study_institutes = $study_institutes; } } if ($this->current_user->user_id == $this->user->user_id && $GLOBALS['has_denoted_fields']) { $this->has_denoted_fields = true; } // get kings informations if (Config::Get()->SCORE_ENABLE) { if ($this->current_user->user_id === $GLOBALS['user']->id || $this->current_user->score) { $kings = $this->profile->getKingsInformations(); if ($kings != null) { $this->kings = $kings; } } } $show_admin = $this->perm->have_perm('autor') && $this->user->user_id == $this->current_user->user_id || isDeputyEditAboutActivated() && isDeputy($this->user->user_id, $this->current_user->user_id, true); if ($this->profile->checkVisibility('news') or $show_admin === true) { $response = $this->relay('news/display/' . $this->current_user->user_id); $this->news = $response->body; } // calendar if (get_config('CALENDAR_ENABLE')) { if (!in_array($this->current_user->perms, words('admin root'))) { if ($this->profile->checkVisibility('termine')) { $response = $this->relay('calendar/contentbox/display/' . $this->current_user->user_id); $this->dates = $response->body; } } } // include and show votes and tests if (get_config('VOTE_ENABLE') && $this->profile->checkVisibility('votes')) { $response = $this->relay('questionnaire/widget/' . $this->current_user->user_id . "/user"); $this->votes = $response->body; } // Hier werden Lebenslauf, Hobbys, Publikationen und Arbeitsschwerpunkte ausgegeben: $ausgabe_felder = array('lebenslauf' => _('Lebenslauf'), 'hobby' => _('Hobbys'), 'publi' => _('Publikationen'), 'schwerp' => _('Arbeitsschwerpunkte')); $ausgabe_inhalt = array(); foreach ($ausgabe_felder as $key => $value) { if ($this->profile->checkVisibility($key)) { $ausgabe_inhalt[$value] = $this->current_user[$key]; } } $this->ausgabe_inhalt = array_filter($ausgabe_inhalt); // Anzeige der Seminare, falls User = dozent if ($this->current_user['perms'] == 'dozent') { $this->seminare = array_filter($this->profile->getDozentSeminars()); } // Hompageplugins $homepageplugins = PluginEngine::getPlugins('HomepagePlugin'); foreach ($homepageplugins as $homepageplugin) { if ($homepageplugin->isActivated($this->current_user->user_id, 'user')) { // get homepageplugin tempaltes $template = $homepageplugin->getHomepageTemplate($this->current_user->user_id); // create output of the plugins if (!empty($template)) { $render .= $template->render(null, $layout); } $layout->clear_attributes(); } } $this->hompage_plugin = $render; // show literature info if (get_config('LITERATURE_ENABLE')) { $lit_list = StudipLitList::GetFormattedListsByRange($this->current_user->user_id); if ($this->current_user->user_id == $this->user->user_id) { $this->admin_url = 'dispatch.php/literature/edit_list.php?_range_id=self'; $this->admin_title = _('Literaturlisten bearbeiten'); } if ($this->profile->checkVisibility('literature')) { $this->show_lit = true; $this->lit_list = $lit_list; } } // get categories $category = Kategorie::findByUserId($this->current_user->user_id); foreach ($category as $cat) { $head = $cat->name; $body = $cat->content; unset($vis_text); if ($this->user->user_id == $this->current_user->user_id) { $vis_text .= ' ( ' . Visibility::getStateDescription('kat_' . $cat->kategorie_id) . ' )'; } if ($this->profile->checkVisibility('kat_' . $cat->kategorie_id)) { $categories[$cat->kategorie_id]['head'] = $head; $categories[$cat->kategorie_id]['zusatz'] = $vis_text; $categories[$cat->kategorie_id]['content'] = $body; } } if (!empty($categories)) { $this->categories = array_filter($categories, function ($item) { return !empty($item['content']); }); } }