/** * 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"]; }
$query = "SELECT seminar_id FROM archiv WHERE archiv_protected_file_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($file_id)); $archiv_seminar_id = $statement->fetchColumn(); if ($archiv_seminar_id) { $no_access = !in_array(archiv_check_perm($archiv_seminar_id), words('tutor dozent admin')); } } } //download bibliography if ($type == 5) { $range_id = Request::option('range_id'); $list_id = Request::option('list_id'); if ($range_id == $user->id || $perm->have_studip_perm('tutor', $range_id)) { $no_access = false; $the_data = StudipLitList::GetTabbedList($range_id, $list_id); } } //download ad hoc created files, always allowed if (in_array($type, array(2, 3, 4))) { $no_access = false; } //if download not allowed throw exception to terminate script if ($no_access) { // redirect to login page if user is not logged in $auth->login_if($auth->auth['uid'] == 'nobody'); throw new AccessDeniedException(_("Sie haben keine Zugriffsberechtigung für diesen Download!")); } switch ($type) { //We want to download from the archive (this mode performs perm checks) case 1:
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)
/** * Deletes the current seminar * * @return void returns success-message if seminar could be deleted * otherwise an error-message */ public function delete() { $s_id = $this->id; // Delete that Seminar. // Alle Benutzer aus dem Seminar rauswerfen. $query = "DELETE FROM seminar_user WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if (($db_ar = $statement->rowCount()) > 0) { $this->createMessage(sprintf(_("%s Teilnehmende und Lehrende archiviert."), $db_ar)); } // Alle Benutzer aus Wartelisten rauswerfen $query = "DELETE FROM admission_seminar_user WHERE seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); // Alle beteiligten Institute rauswerfen $query = "DELETE FROM seminar_inst WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if (($db_ar = $statement->rowCount()) > 0) { $this->createMessage(sprintf(_("%s Zuordnungen zu Einrichtungen archiviert."), $db_ar)); } // user aus den Statusgruppen rauswerfen $count = DeleteAllStatusgruppen($s_id); if ($count > 0) { $this->createMessage(_("Einträge aus Funktionen / Gruppen gelöscht.")); } // Alle Eintraege aus dem Vorlesungsverzeichnis rauswerfen $db_ar = StudipSemTree::DeleteSemEntries(null, $s_id); if ($db_ar > 0) { $this->createMessage(sprintf(_("%s Zuordnungen zu Bereichen archiviert."), $db_ar)); } // Alle Termine mit allem was dranhaengt zu diesem Seminar loeschen. if (($db_ar = SingleDateDB::deleteAllDates($s_id)) > 0) { $this->createMessage(sprintf(_("%s Veranstaltungstermine archiviert."), $db_ar)); } //Themen IssueDB::deleteAllIssues($s_id); //Cycles SeminarCycleDate::deleteBySQL('seminar_id = ' . DBManager::get()->quote($s_id)); // Alle weiteren Postings zu diesem Seminar in den Forums-Modulen löschen foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { $plugin->deleteContents($s_id); // delete content irrespective of plugin-activation in the seminar if ($plugin->isActivated($s_id)) { // only show a message, if the plugin is activated, to not confuse the user $this->createMessage(sprintf(_('Einträge in %s archiviert.'), $plugin->getPluginName())); } } // Alle Dokumente zu diesem Seminar loeschen. if (($db_ar = delete_all_documents($s_id)) > 0) { $this->createMessage(sprintf(_("%s Dokumente und Ordner archiviert."), $db_ar)); } // Freie Seite zu diesem Seminar löschen $query = "DELETE FROM scm WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if (($db_ar = $statement->rowCount()) > 0) { $this->createMessage(_("Freie Seite der Veranstaltung archiviert.")); } // delete literatur $del_lit = StudipLitList::DeleteListsByRange($s_id); if ($del_lit) { $this->createMessage(sprintf(_("%s Literaturlisten archiviert."),$del_lit['list'])); } // Alle News-Verweise auf dieses Seminar löschen if ( ($db_ar = StudipNews::DeleteNewsRanges($s_id)) ) { $this->createMessage(sprintf(_("%s Ankündigungen gelöscht."), $db_ar)); } //delete entry in news_rss_range StudipNews::UnsetRssId($s_id); //kill the datafields DataFieldEntry::removeAll($s_id); //kill all wiki-pages $query = "DELETE FROM wiki WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if (($db_wiki = $statement->rowCount()) > 0) { $this->createMessage(sprintf(_("%s Wiki-Seiten archiviert."), $db_wiki)); } $query = "DELETE FROM wiki_links WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); $query = "DELETE FROM wiki_locks WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); // kill all the ressources that are assigned to the Veranstaltung (and all the linked or subordinated stuff!) if (Config::get()->RESOURCES_ENABLE) { $killAssign = new DeleteResourcesUser($s_id); $killAssign->delete(); if ($rr = RoomRequest::existsByCourse($s_id)) { RoomRequest::find($rr)->delete(); } } // kill virtual seminar-entries in calendar $query = "DELETE FROM schedule_seminare WHERE seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); if(get_config('ELEARNING_INTERFACE_ENABLE')){ global $connected_cms; $del_cms = 0; $cms_types = ObjectConnections::GetConnectedSystems($s_id); if(count($cms_types)){ foreach($cms_types as $system){ ELearningUtils::loadClass($system); $del_cms += $connected_cms[$system]->deleteConnectedModules($s_id); } $this->createMessage(sprintf(_("%s Verknüpfungen zu externen Systemen gelöscht."), $del_cms )); } } //kill the object_user_vists for this seminar object_kill_visits(null, $s_id); // Logging... $query = "SELECT CONCAT(seminare.VeranstaltungsNummer, ' ', seminare.name, '(', semester_data.name, ')') FROM seminare LEFT JOIN semester_data ON (seminare.start_time = semester_data.beginn) WHERE seminare.Seminar_id='$s_id'"; $statement = DBManager::get()->prepare($query); $statement->execute(array($s_id)); $semlogname = $statement->fetchColumn() ?: sprintf('unknown sem_id: %s', $s_id); StudipLog::log("SEM_ARCHIVE",$s_id,NULL,$semlogname); // ...logged // delete deputies if necessary deleteAllDeputies($s_id); UserDomain::removeUserDomainsForSeminar($s_id); AutoInsert::deleteSeminar($s_id); //Anmeldeset Zordnung entfernen $cs = $this->getCourseSet(); if ($cs) { CourseSet::removeCourseFromSet($cs->getId(), $this->getId()); $cs->load(); if (!count($cs->getCourses()) && $cs->isGlobal() && $cs->getUserid() != '') { $cs->delete(); } } AdmissionPriority::unsetAllPrioritiesForCourse($this->getId()); // und das Seminar loeschen. $this->course->delete(); $this->restore(); return true; }
function setFormObject() { $form_fields = array(); $form_name = $this->form_name; if ($this->isNewEntry()) { $this->fields['default_lit_list'] = array('caption' => _("Eintrag in diese Literaturliste"), 'info' => _("Wählen Sie hier eine persönliche Literaturliste aus, in die der neue Eintrag aufgenommen werden soll."), 'len' => 255, 'type' => 'select', 'options' => array_merge(array('---'), (array) StudipLitList::GetListsByRange($GLOBALS['user']->id, 'form_options'))); } foreach ($this->fields as $field_name => $field_detail) { if ($field_detail['caption']) { if ($field_detail['select_list']) { $form_fields[$field_name . "_select"] = array('type' => 'select', 'options' => $field_detail['select_list']); $form_fields[$field_name . "_text"] = array('type' => 'text'); $form_fields[$field_name] = array('type' => 'combo', 'text' => $field_name . "_text", 'select' => $field_name . "_select", 'separator' => ' '); } else { $form_fields[$field_name]['type'] = $field_detail['type']; if ($field_detail['type'] == 'text' && $field_detail['len'] > 100) { $form_fields[$field_name]['type'] = 'textarea'; } if ($field_detail['type'] == 'select') { $form_fields[$field_name]['options'] = $field_detail['options']; } } $form_fields[$field_name]['caption'] = $field_detail['caption']; $form_fields[$field_name]['info'] = $field_detail['info']; $form_fields[$field_name]['default_value'] = $field_detail['value']; } } $form_fields['catalog_id'] = array('type' => 'hidden', 'default_value' => $this->fields['catalog_id']['value']); $form_buttons = array('send' => array('type' => 'accept', 'caption' => _('speichern'), 'info' => _("Änderungen speichern")), 'reset' => array('caption' => _('zurücksetzen'), 'info' => _("Änderungen zurücksetzen")), 'delete' => array('caption' => _('löschen'), 'info' => _("Eintrag löschen"))); if (!is_object($this->form_obj)) { $this->form_obj = new StudipForm($form_fields, $form_buttons, $form_name); } else { $this->form_obj->form_fields = $form_fields; } if ($this->form_obj->getFormFieldValue("catalog_id") != $this->getValue("catalog_id")) { $this->form_obj->doFormReset(); } return true; }
/** * Deletes an institute * @param String $i_id Institute id */ public function delete_action($i_id) { CSRFProtection::verifyUnsafeRequest(); // Missing parameter if (!Request::get('i_kill')) { return $this->redirect('institute/basicdata/index/' . $i_id); } // Invalid ticket if (!check_ticket(Request::option('studipticket'))) { PageLayout::postMessage(MessageBox::error(_('Ihr Ticket ist abgelaufen. Versuchen Sie die letzte Aktion erneut.'))); return $this->redirect('institute/basicdata/index/' . $i_id); } // User may not delete this institue if (!$GLOBALS['perm']->have_perm('root') && !($GLOBALS['perm']->is_fak_admin() && get_config('INST_FAK_ADMIN_PERMS') === 'all')) { PageLayout::postMessage(MessageBox::error(_('Sie haben nicht die Berechtigung Fakultäten zu löschen!'))); return $this->redirect('institute/basicdata/index/' . $i_id); } $institute = Institute::find($i_id); if ($institute === null) { throw new Exception('Invalid institute id'); } // Institut in use? if (count($institute->home_courses)) { PageLayout::postMessage(MessageBox::error(_('Diese Einrichtung kann nicht gelöscht werden, da noch Veranstaltungen an dieser Einrichtung existieren!'))); return $this->redirect('institute/basicdata/index/' . $i_id); } // Institute has sub institutes? if (count($institute->sub_institutes)) { PageLayout::postMessage(MessageBox::error(_('Diese Einrichtung kann nicht gelöscht werden, da sie den Status Fakultät hat und noch andere Einrichtungen zugeordnet sind!'))); return $this->redirect('institute/basicdata/index/' . $i_id); } // Is the user allowed to delete faculties? if ($institute->is_fak && !$GLOBALS['perm']->have_perm('root')) { PageLayout::postMessage(MessageBox::error(_('Sie haben nicht die Berechtigung Fakultäten zu löschen!'))); return $this->redirect('institute/basicdata/index/' . $i_id); } // Save users, name and number of courses $user_ids = $institute->members->pluck('user_id'); $i_name = $institute->name; $i_courses = count($institute->courses); // Delete that institute if (!$institute->delete()) { PageLayout::postMessage(MessageBox::error(_('Die Einrichtung konnte nicht gelöscht werden.'))); } else { $details = array(); // logging - put institute's name in info - it's no longer derivable from id afterwards log_event('INST_DEL', $i_id, NULL, $i_name); // set a suitable default institute for each user foreach ($user_ids as $user_id) { log_event('INST_USER_DEL', $i_id, $user_id); checkExternDefaultForUser($user_id); } if (count($user_ids)) { $details[] = sprintf(_('%u Mitarbeiter gelöscht.'), count($user_ids)); } // Report number of formerly associated courses if ($i_courses) { $details[] = sprintf(_('%u Beteiligungen an Veranstaltungen gelöscht'), $i_courses); } // delete literatur $del_lit = StudipLitList::DeleteListsByRange($i_id); if ($del_lit) { $details[] = sprintf(_('%u Literaturlisten gelöscht.'), $del_lit['list']); } // delete news-links StudipNews::DeleteNewsRanges($i_id); //delete entry in news_rss_range StudipNews::UnsetRssId($i_id); //updating range_tree $query = "UPDATE range_tree SET name = ?, studip_object = '', studip_object_id = '' WHERE studip_object_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array(_('(in Stud.IP gelöscht)'), $i_id)); if (($db_ar = $statement->rowCount()) > 0) { $details[] = sprintf(_('%u Bereiche im Einrichtungsbaum angepasst.'), $db_ar); } // Statusgruppen entfernen if ($db_ar = DeleteAllStatusgruppen($i_id) > 0) { $details[] = sprintf(_('%s Funktionen/Gruppen gelöscht.'), $db_ar); } //kill the datafields DataFieldEntry::removeAll($i_id); //kill all wiki-pages $removed_wiki_pages = 0; foreach (array('', '_links', '_locks') as $area) { $query = "DELETE FROM wiki{$area} WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($i_id)); $removed_wiki_pages += $statement->rowCount(); } if ($removed_wiki_pages > 0) { $details[] = sprintf(_('%u Wikiseiten gelöscht.')); } // kill all the ressources that are assigned to the Veranstaltung (and all the linked or subordinated stuff!) if (get_config('RESOURCES_ENABLE')) { $killAssign = new DeleteResourcesUser($i_id); $killAssign->delete(); } // delete all configuration files for the "extern modules" if (get_config('EXTERN_ENABLE')) { $counts = ExternConfig::DeleteAllConfigurations($i_id); if ($counts) { $details[] = sprintf(_('%u Konfigurationsdateien für externe Seiten gelöscht.'), $counts); } } // delete all contents in forum-modules foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { $plugin->deleteContents($i_id); // delete content irrespective of plugin-activation in the seminar if ($plugin->isActivated($i_id)) { // only show a message, if the plugin is activated, to not confuse the user $details[] = sprintf(_('Einträge in %s gelöscht.'), $plugin->getPluginName()); } } // Delete assigned documents $db_ar = delete_all_documents($i_id); if ($db_ar > 0) { $details[] = sprintf(_('%u Dokumente gelöscht.'), $db_ar); } //kill the object_user_vists for this institut object_kill_visits(null, $i_id); // Report success with details $message = sprintf(_('Die Einrichtung "%s" wurde gelöscht!'), $i_name); PageLayout::postMessage(MessageBox::success($message, $details)); } $this->redirect('institute/basicdata/index?cid='); }
/** * Builds an array containing all available elements that are part of a * user's homepage together with their visibility. It isn't sufficient to * just load the visibility settings from database, because if the user * has added some data (e.g. CV) but not yet assigned a special visibility * to that field, it wouldn't show up. * * @return array An array containing all available homepage elements * together with their visibility settings in the form * $name => $visibility. */ public function get_homepage_elements() { global $NOT_HIDEABLE_FIELDS; $query = "SELECT user_info.*, auth_user_md5.*\n FROM auth_user_md5\n LEFT JOIN user_info USING (user_id)\n WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->auth_user['user_id'])); $my_data = $statement->fetch(PDO::FETCH_ASSOC); $homepage_visibility = get_local_visibility_by_id($this->auth_user['user_id'], 'homepage'); if (is_array(json_decode($homepage_visibility, true))) { $homepage_visibility = json_decode($homepage_visibility, true); } else { $homepage_visibility = array(); } // News $news = StudipNews::GetNewsByRange($this->auth_user['user_id'], true); // Non-private dates. if (Config::get()->CALENDAR_ENABLE) { $dates = CalendarEvent::countBySql('range_id = ?', array($this->auth_user['user_id'])); } // Votes if (Config::get()->VOTE_ENABLE) { //$voteDB = new VoteDB(); $activeVotes = Questionnaire::countBySQL("user_id = ? AND visible = '1'", array($this->auth_user['user_id'])); $stoppedVotes = Questionnaire::countBySQL("user_id = ? AND visible = '0'", array($this->auth_user['user_id'])); } // Evaluations $evalDB = new EvaluationDB(); $activeEvals = $evalDB->getEvaluationIDs($this->auth_user['user_id'], EVAL_STATE_ACTIVE); // Literature $lit_list = StudipLitList::GetListsByRange($this->auth_user['user_id']); // Free datafields $data_fields = DataFieldEntry::getDataFieldEntries($this->auth_user['user_id'], 'user'); // Homepage plugins //$homepageplugins = PluginEngine::getPlugins('HomepagePlugin'); // Deactivate plugin visibility settings because they aren't working now. $homepageplugins = array(); $user_domains = count(UserDomain::getUserDomains()); // Now join all available elements with visibility settings. $homepage_elements = array(); if (Avatar::getAvatar($this->auth_user['user_id'])->is_customized() && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['picture']) { $homepage_elements["picture"] = array("name" => _("Eigenes Bild"), "visibility" => $homepage_visibility["picture"] ?: get_default_homepage_visibility($this->auth_user['user_id']), "extern" => true, 'category' => 'Allgemeine Daten'); } if ($my_data["motto"] && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['motto']) { $homepage_elements["motto"] = array("name" => _("Motto"), "visibility" => $homepage_visibility["motto"] ?: get_default_homepage_visibility($this->auth_user['user_id']), 'category' => 'Private Daten'); } if (Config::get()->ENABLE_SKYPE_INFO) { if ($GLOBALS['user']->cfg->getValue('SKYPE_NAME') && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['skype_name']) { $homepage_elements["skype_name"] = array("name" => _("Skype Name"), "visibility" => $homepage_visibility["skype_name"] ?: get_default_homepage_visibility($this->auth_user['user_id']), 'category' => 'Private Daten'); if ($GLOBALS['user']->cfg->getValue('SKYPE_ONLINE_STATUS')) { $homepage_elements["skype_online_status"] = array("name" => _("Skype Online Status"), "visibility" => $homepage_visibility["skype_online_status"] ?: get_default_homepage_visibility($this->auth_user['user_id']), 'category' => 'Private Daten'); } } } if ($my_data["privatnr"] && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['Private Daten_phone']) { $homepage_elements["private_phone"] = array("name" => _("Private Telefonnummer"), "visibility" => $homepage_visibility["private_phone"] ?: get_default_homepage_visibility($this->auth_user['user_id']), 'category' => 'Private Daten'); } if ($my_data["privatcell"] && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['private_cell']) { $homepage_elements["private_cell"] = array("name" => _("Private Handynummer"), "visibility" => $homepage_visibility["private_cell"] ?: get_default_homepage_visibility($this->auth_user['user_id']), 'category' => 'Private Daten'); } if ($my_data["privadr"] && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['privadr']) { $homepage_elements["privadr"] = array("name" => _("Private Adresse"), "visibility" => $homepage_visibility["privadr"] ?: get_default_homepage_visibility($this->auth_user['user_id']), 'category' => 'Private Daten'); } if ($my_data["Home"] && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['homepage']) { $homepage_elements["homepage"] = array("name" => _("Homepage-Adresse"), "visibility" => $homepage_visibility["homepage"] ?: get_default_homepage_visibility($this->auth_user['user_id']), "extern" => true, 'category' => 'Private Daten'); } if ($news && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['news']) { $homepage_elements["news"] = array("name" => _("Ankündigungen"), "visibility" => $homepage_visibility["news"] ?: get_default_homepage_visibility($this->auth_user['user_id']), "extern" => true, 'category' => 'Allgemeine Daten'); } if (Config::get()->CALENDAR_ENABLE && $dates && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['dates']) { $homepage_elements["termine"] = array("name" => _("Termine"), "visibility" => $homepage_visibility["termine"] ?: get_default_homepage_visibility($this->auth_user['user_id']), "extern" => true, 'category' => 'Allgemeine Daten'); } if (Config::get()->VOTE_ENABLE && ($activeVotes || $stoppedVotes || $activeEvals) && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['votes']) { $homepage_elements["votes"] = array("name" => _("Fragebögen"), "visibility" => $homepage_visibility["votes"] ?: get_default_homepage_visibility($this->auth_user['user_id']), 'category' => 'Allgemeine Daten'); } $query = "SELECT 1\n FROM user_inst\n LEFT JOIN Institute USING (Institut_id)\n WHERE user_id = ? AND inst_perms = 'user'"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->auth_user['user_id'])); if ($statement->fetchColumn() && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['studying']) { $homepage_elements["studying"] = array("name" => _("Wo ich studiere"), "visibility" => $homepage_visibility["studying"] ?: get_default_homepage_visibility($this->auth_user['user_id']), 'category' => 'Studien-/Einrichtungsdaten'); } if ($lit_list && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['literature']) { $homepage_elements["literature"] = array("name" => _("Literaturlisten"), "visibility" => $homepage_visibility["literature"] ?: get_default_homepage_visibility($this->auth_user['user_id']), 'category' => 'Allgemeine Daten'); } if ($my_data["lebenslauf"] && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['lebenslauf']) { $homepage_elements["lebenslauf"] = array("name" => _("Lebenslauf"), "visibility" => $homepage_visibility["lebenslauf"] ?: get_default_homepage_visibility($this->auth_user['user_id']), "extern" => true, 'category' => 'Private Daten'); } if ($my_data["hobby"] && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['hobby']) { $homepage_elements["hobby"] = array("name" => _("Hobbies"), "visibility" => $homepage_visibility["hobby"] ?: get_default_homepage_visibility($this->auth_user['user_id']), 'category' => 'Private Daten'); } if ($my_data["publi"] && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['publi']) { $homepage_elements["publi"] = array("name" => _("Publikationen"), "visibility" => $homepage_visibility["publi"] ?: get_default_homepage_visibility($this->auth_user['user_id']), "extern" => true, 'category' => 'Private Daten'); } if ($my_data["schwerp"] && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']]['schwerp']) { $homepage_elements["schwerp"] = array("name" => _("Arbeitsschwerpunkte"), "visibility" => $homepage_visibility["schwerp"] ?: get_default_homepage_visibility($this->auth_user['user_id']), "extern" => true, 'category' => 'Private Daten'); } if ($data_fields) { foreach ($data_fields as $key => $field) { if ($field->getValue() && $field->isEditable($this->auth_user['perms']) && !$NOT_HIDEABLE_FIELDS[$this->auth_user['perms']][$key]) { $homepage_elements[$key] = array('name' => $field->getName(), 'visibility' => $homepage_visibility[$key] ?: get_default_homepage_visibility($this->auth_user['user_id']), 'extern' => true, 'category' => 'Zusätzliche Datenfelder'); } } } $query = "SELECT kategorie_id, name\n FROM kategorien\n WHERE range_id = ?\n ORDER BY priority"; $statement = DBManager::get()->prepare($query); $statement->execute(array($this->auth_user['user_id'])); while ($category = $statement->fetch(PDO::FETCH_ASSOC)) { $homepage_elements["kat_" . $category["kategorie_id"]] = array("name" => $category["name"], "visibility" => $homepage_visibility["kat_" . $category["kategorie_id"]] ?: get_default_homepage_visibility($this->auth_user['user_id']), "extern" => true, 'category' => 'Eigene Kategorien'); } if ($homepageplugins) { foreach ($homepageplugins as $plugin) { $homepage_elements['plugin_' . $plugin->getPluginId()] = array("name" => $plugin->getPluginName(), "visibility" => $homepage_visibility["plugin_" . $plugin->getPluginId()] ?: get_default_homepage_visibility($this->auth_user['user_id']), 'category' => 'Plugins'); } } return $homepage_elements; }
/** * 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']); }); } }