/** * This function is called before any output is generated or any other * actions are performed. Initializations happen here. * * @param $action Name of the action to perform * @param $args Arguments for the given action */ public function before_filter(&$action, &$args) { parent::before_filter($action, $args); $this->modules = array(); // Set Navigation PageLayout::setHelpKeyword("Basis.ProfileModules"); PageLayout::setTitle(_("Mehr Funktionen")); PageLayout::addSqueezePackage('lightbox'); Navigation::activateItem('/profile/modules'); // Get current user. $this->username = Request::username('username', $GLOBALS['user']->username); $this->user_id = get_userid($this->username); $this->plugins = array(); $blubber = PluginEngine::getPlugin('Blubber'); // Add blubber to plugin list so status can be updated. if ($blubber) { $this->plugins[] = $blubber; } // Get homepage plugins from database. $this->plugins = array_merge($this->plugins, PluginEngine::getPlugins('HomepagePlugin')); // Show info message if user is not on his own profile if ($this->user_id != $GLOBALS['user']->id) { $current_user = User::find($this->user_id); $message = sprintf(_('Daten von: %s %s (%s), Status: %s'), htmlReady($current_user->Vorname), htmlReady($current_user->Nachname), htmlReady($current_user->username), htmlReady($current_user->perms)); PageLayout::postMessage(MessageBox::info($message)); } $this->setupSidebar(); }
/** * Loads all possible standard plugins for the given seminars and adds * a navigation entry for each one. * * @param array $seminars List of seminars * @return array Extended list of seminars */ protected function get_plugin_navigations($seminars) { foreach ($seminars as $id => $seminar) { foreach (PluginEngine::getPlugins('StandardPlugin', $id) as $plugin) { $seminars[$id]['navigations'][] = $plugin->getIconNavigation($id, time(), $GLOBALS['user']->id); } } return $seminars; }
* * L O G I N - P A G E ( N O B O D Y - U S E R ) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ PageLayout::setHelpKeyword("Basis.Startseite"); // set keyword for new help PageLayout::setTitle(_("Startseite")); Navigation::activateItem('/start'); PageLayout::setTabNavigation(NULL); // disable display of tabs // Start of Output include 'lib/include/html_head.inc.php'; // Output of html head include 'lib/include/header.php'; $index_nobody_template = $GLOBALS['template_factory']->open('index_nobody'); $index_nobody_template->set_attributes(array('num_active_courses' => count_table_rows('seminare'), 'num_registered_users' => count_table_rows('auth_user_md5'), 'num_online_users' => get_users_online_count(10))); if (Request::get('logout')) { $index_nobody_template->set_attribute('logout', true); } echo '<div><div class="index_container">'; echo $index_nobody_template->render(); $layout = $GLOBALS['template_factory']->open('shared/index_box'); // Prüfen, ob PortalPlugins vorhanden sind. $portalplugins = PluginEngine::getPlugins('PortalPlugin'); foreach ($portalplugins as $portalplugin) { $template = $portalplugin->getPortalTemplate(); if ($template) { echo $template->render(NULL, $layout); $layout->clear_attributes(); } } page_close(); include 'lib/include/html_end.inc.php';
protected function getToplistEntries($sem_status) { $sql_where_query_seminare = " WHERE 1 "; $parameters = array(); if (!$GLOBALS['perm']->have_perm(get_config('SEM_VISIBILITY_PERM'))) { $sql_where_query_seminare .= " AND seminare.visible = 1 "; } if ($_SESSION['sem_portal']['bereich'] != 'all' && count($sem_status)) { $sql_where_query_seminare .= " AND seminare.status IN (?) "; $parameters[] = $sem_status; } switch ($_SESSION['sem_portal']["toplist"]) { case 4: default: $query = "SELECT seminar_id, name, mkdate AS count\n FROM seminare\n {$sql_where_query_seminare}\n ORDER BY mkdate DESC\n LIMIT 5"; $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $top_list = $statement->fetchAll(PDO::FETCH_ASSOC); //$toplist = $this->getToplist(_('neueste Veranstaltungen'), $query, 'date', $parameters); break; case 1: $query = "SELECT seminare.seminar_id, seminare.name, COUNT(seminare.seminar_id) AS count\n FROM seminare\n LEFT JOIN seminar_user USING (seminar_id)\n {$sql_where_query_seminare}\n GROUP BY seminare.seminar_id\n ORDER BY count DESC\n LIMIT 5"; $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $top_list = $statement->fetchAll(PDO::FETCH_ASSOC); //$toplist = $this->getToplist(_('Teilnehmeranzahl'), $query, 'count', $parameters); break; case 2: $query = "SELECT dokumente.seminar_id, seminare.name, COUNT(dokumente.seminar_id) AS count\n FROM seminare\n INNER JOIN dokumente USING (seminar_id)\n {$sql_where_query_seminare}\n GROUP BY dokumente.seminar_id\n ORDER BY count DESC\n LIMIT 5"; $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $top_list = $statement->fetchAll(PDO::FETCH_ASSOC); //$toplist = $this->getToplist(_('die meisten Materialien'), $query, 'count', $parameters); break; case 3: $cache = StudipCacheFactory::getCache(); $hash = '/sem_portal/most_active'; $top_list = unserialize($cache->read($hash)); if (!$top_list) { // get TopTen of seminars from all ForumModules and add up the // count for seminars with more than one active ForumModule // to get a combined toplist $seminars = array(); foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { $new_seminars = $plugin->getTopTenSeminars(); foreach ($new_seminars as $sem) { if (!isset($seminars[$sem['seminar_id']])) { $seminars[$sem['seminar_id']] = $sem; $seminars[$sem['seminar_id']]['name'] = $seminars[$sem['seminar_id']]['display']; } else { $seminars[$sem['seminar_id']]['count'] += $sem['count']; } } } // sort the seminars by the number of combined postings usort($seminars, function ($a, $b) { if ($a['count'] == $b['count']) { return 0; } return $a['count'] > $b['count'] ? -1 : 1; }); $top_list = $seminars; // use only the first five seminars $top_list = array_slice($top_list, 0, 5); $cache->write($hash, serialize($top_list), 5 * 60); } break; } return $top_list; }
private static function forum_kings() { $kings = array(); // sum up postings for all users from all ForumModules available foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { $table = $plugin->getEntryTableInfo(); $query = "SELECT user_id AS id, COUNT(*) AS num FROM " . $table['table'] . " GROUP BY user_id"; $new_kings = self::select_kings($query); foreach ($new_kings as $user_id => $num) { if (!isset($kings[$user_id])) { $kings[$user_id] = $num; } else { $kings[$user_id] += $num; } } } return $kings; }
/** * 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']); }); } }
/** * getAvailableWidgets - fetches all widgets that are not already in use. * * @param string $user_id the user to check * * @return array All available widgets. */ static function getAvailableWidgets($user_id = null) { $all_widgets = PluginEngine::getPlugins('PortalPlugin'); $used_widgets = is_null($user_id) ? array() : DBManager::get()->fetchFirst("SELECT `pluginid` FROM `widget_user` WHERE `range_id`=? ORDER BY `pluginid`", array($user_id)); $available = array(); foreach ($all_widgets as $widget) { if (!in_array($widget->getPluginId(), $used_widgets)) { $available[$widget->getPluginId()] = $widget; } } return $available; }
function getPluginNavigationForSeminar($seminar_id, $visitdate) { static $plugin_navigation; if (!$plugin_navigation[$seminar_id]) { $plugin_navigation[$seminar_id] = array(); $plugins = PluginEngine::getPlugins('StandardPlugin', $seminar_id); foreach ($plugins as $plugin) { $nav = $plugin->getIconNavigation($seminar_id, $visitdate, $GLOBALS['user']->id); if ($nav instanceof Navigation) { $plugin_navigation[$seminar_id][get_class($plugin)] = $nav; } } } return $plugin_navigation[$seminar_id]; }
/** * 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='); }
function indicator($key) { $cache = StudipCacheFactory::getCache(); if ($found_in_cache = $cache->read(__METHOD__ . $key)) { return $found_in_cache; } $template = $this->template_factory->open('indicator'); $indicator['seminar_all'] = array("count" => array('count_table_rows', 'seminare'), "title" => _("Aktive Veranstaltungen"), "detail" => _("alle Veranstaltungen, die nicht archiviert wurden")); $indicator['seminar_archived'] = array("count" => array('count_table_rows', 'archiv'), "title" => _("Archivierte Veranstaltungen"), "detail" => _("alle Veranstaltungen, die archiviert wurden")); $indicator['institute_secondlevel_all'] = array("query" => "SELECT COUNT(*) FROM Institute WHERE Institut_id != fakultaets_id", "title" => _("beteiligte Einrichtungen"), "detail" => _("alle Einrichtungen außer den Fakultäten")); $indicator['institute_firstlevel_all'] = array("query" => "SELECT COUNT(*) FROM Institute WHERE Institut_id = fakultaets_id", "title" => _("beteiligte Fakultäten"), "detail" => _("alle Fakultäten")); $indicator['user_admin'] = array("query" => "SELECT COUNT(*) FROM auth_user_md5 WHERE perms='admin'", "title" => _("registrierte Administratoren"), "detail" => ""); $indicator['user_dozent'] = array("query" => "SELECT COUNT(*) FROM auth_user_md5 WHERE perms='dozent'", "title" => _("registrierte Dozenten"), "detail" => ""); $indicator['user_tutor'] = array("query" => "SELECT COUNT(*) FROM auth_user_md5 WHERE perms='tutor'", "title" => _("registrierte Tutoren"), "detail" => ""); $indicator['user_autor'] = array("query" => "SELECT COUNT(*) FROM auth_user_md5 WHERE perms='autor'", "title" => _("registrierte Autoren"), "detail" => ""); $indicator['document'] = array("query" => "SELECT COUNT(*) FROM dokumente WHERE url = ''", "title" => _("Dokumente"), "detail" => ""); $indicator['link'] = array("query" => "SELECT COUNT(*) FROM dokumente WHERE url != ''", "title" => _("verlinkte Dateien"), "detail" => ""); $indicator['litlist'] = array("count" => array('count_table_rows', 'lit_list'), "title" => _("Literaturlisten"), "detail" => "", "constraint" => get_config('LITERATURE_ENABLE')); $indicator['termin'] = array("count" => array('count_table_rows', 'termine'), "title" => _("Termine"), "detail" => ""); $indicator['news'] = array("count" => array('count_table_rows', 'news'), "title" => _("Ankündigungen"), "detail" => ""); $indicator['vote'] = array("count" => array('count_table_rows', 'questionnaires'), "title" => _("Fragebögen"), "detail" => "", "constraint" => get_config('VOTE_ENABLE')); $indicator['evaluation'] = array("count" => array('count_table_rows', 'eval'), "title" => _("Evaluationen"), "detail" => "", "constraint" => get_config('VOTE_ENABLE')); $indicator['wiki_pages'] = array("query" => "SELECT COUNT(DISTINCT keyword) AS count FROM wiki", "title" => _("Wiki-Seiten"), "detail" => "", "constraint" => get_config('WIKI_ENABLE')); $indicator['resource'] = array("count" => array('count_table_rows', 'resources_objects'), "title" => _("Ressourcen-Objekte"), "detail" => _("von Stud.IP verwaltete Ressourcen wie Räume oder Geräte"), "constraint" => Config::get()->RESOURCES_ENABLE); if ($key == 'posting') { $count = 0; // sum up number of postings for all availabe ForumModules foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { $count += $plugin->getNumberOfPostings(); } $template->title = _('Forenbeiträge'); $template->detail = _('Anzahl Beiträge aller verwendeten Foren'); $template->count = $count; } else { // iterate over the other indicators if (in_array($key, array_keys($indicator))) { if (!isset($indicator[$key]['constraint']) || $indicator[$key]['constraint']) { if ($indicator[$key]['query']) { $result = $this->db->query($indicator[$key]['query']); $rows = $result->fetch(PDO::FETCH_NUM); $template->count = $rows[0]; } else { $template->count = call_user_func($indicator[$key]['count'][0], $indicator[$key]['count'][1]); } $template->title = $indicator[$key]['title']; if ($indicator[$key]['detail']) { $template->detail = $indicator[$key]['detail']; } } else { return ""; } } else { return ""; } } $ret = $template->render(); $cache->write(__METHOD__ . $key, $ret); return $ret; }
function setForum($newForumValue) { // only do something, if we enable the link to a thread in a forum if ($newForumValue) { // find the ForumModule which takes the role of the CoreForum in the current Seminar $sem = Seminar::getInstance($this->seminar_id); $forum_slot = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$sem->status]['class']]->getSlotModule('forum'); foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { if (get_class($plugin) == $forum_slot) { // only link if there is none yet if (!$plugin->getLinkToThread($this->issue_id)) { $plugin->setThreadForIssue($this->issue_id, $this->title, $this->description); $this->messages[] = sprintf(_("Ordner im Forum für das Thema \"%s\" angelegt."), $this->toString()); } } } } }
function getAllNotifications($user_id = NULL) { if (is_null($user_id)) { $user_id = $GLOBALS['user']->id; } $my_sem = array(); $query = "SELECT s.Seminar_id, s.Name, s.chdate, s.start_time, s.modules, s.status as sem_status, su.status,s.admission_prelim, su.notification, IFNULL(visitdate, :threshold) AS visitdate " . "FROM seminar_user su " . "LEFT JOIN seminare s USING (Seminar_id) " . "LEFT JOIN object_user_visits ouv ON (ouv.object_id = su.Seminar_id AND ouv.user_id = :user_id AND ouv.type = 'sem') " . "WHERE su.user_id = :user_id AND su.status != 'user' AND su.notification <> 0"; if (get_config('DEPUTIES_ENABLE')) { $query .= " UNION SELECT s.Seminar_id, CONCAT(s.Name, ' [Vertretung]') as Name, s.chdate, s.start_time, s.modules, s.status as sem_status, 'dozent' as status, s.admission_prelim, d.notification, IFNULL(visitdate, :threshold) AS visitdate " . "FROM deputies d " . "LEFT JOIN seminare s ON (d.range_id = s.Seminar_id) " . "LEFT JOIN object_user_visits ouv ON (ouv.object_id = d.range_id AND ouv.user_id = :user_id AND ouv.type = 'sem') " . "WHERE d.user_id = :user_id AND d.notification <> 0"; } $statement = DBManager::get()->prepare($query); $statement->bindValue(':user_id', $user_id); $statement->bindValue(':threshold', ($threshold = Config::get()->NEW_INDICATOR_THRESHOLD) ? strtotime("-{$threshold} days 0:00:00") : 0); $statement->execute(); while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $seminar_id = $row['Seminar_id']; $modules = $this->getLocalModules($seminar_id, 'sem', $row['modules'], $row['sem_status']); $modulesInt = array_sum($modules); //korrigiert wg. SemClass::isSlotMandatory() Kram $my_sem[$seminar_id] = array('name' => $row['Name'], 'chdate' => $row['chdate'], 'start_time' => $row['start_time'], 'modules' => $modules, 'modulesInt' => $modulesInt, 'visitdate' => $row['visitdate'], 'obj_type' => 'sem', 'notification' => $row['notification'], 'sem_status' => $row['sem_status'], 'status' => $row['status'], 'prelim' => $row['admission_prelim']); unset($seminar_id); unset($modules); unset($modulesInt); } $m_enabled_modules = $this->getGlobalEnabledNotificationModules('sem'); $m_extended = 0; foreach ($this->registered_notification_modules as $m_data) { $m_extended += pow(2, $m_data['id']); } get_my_obj_values($my_sem, $user_id); $news = array(); foreach ($my_sem as $seminar_id => $s_data) { $m_notification = $s_data['modulesInt'] + $m_extended & $s_data['notification']; $n_data = array(); foreach ($m_enabled_modules as $m_name => $m_data) { if ($this->isBit($m_notification, $m_data['id'])) { if ($m_name != 'plugins') { $data = $this->getModuleText($m_name, $seminar_id, $s_data, 'sem'); if ($data) { $n_data[] = $data; } } else { $sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$s_data['sem_status']]["class"]]; if (is_object($sem_class)) { foreach (PluginEngine::getPlugins('StandardPlugin', $seminar_id) as $plugin) { if (!$sem_class->isSlotModule($plugin)) { $data = $this->getPluginText($plugin, $seminar_id, $s_data, 'plugins'); if ($data) { $n_data[] = $data; } } } } } } } if (count($n_data)) { $news[$s_data['name']] = $n_data; } } if (count($news)) { $template = $GLOBALS['template_factory']->open('mail/notification_html'); $template->set_attribute('lang', getUserLanguagePath($user_id)); $template->set_attribute('news', $news); $template_text = $GLOBALS['template_factory']->open('mail/notification_text'); $template_text->set_attribute('news', $news); return array('text' => $template_text->render(), 'html' => $template->render()); } else { return FALSE; } }
private static function sendMessage($message, $stat, $value, $sampleRate) { // cannot proceed without loaded PluginEngine if (!class_exists('PluginEngine')) { return; } if ($sampleRate < 1) { $rand = mt_rand() / mt_getrandmax(); if ($rand > $sampleRate) { return; } } // cache the activated MetricsPlugins if (!self::$metricPlugins) { self::$metricPlugins = \PluginEngine::getPlugins('MetricsPlugin'); } // call every MetricPlugin foreach (self::$metricPlugins as $plugin) { call_user_func_array(array($plugin, $message), array($stat, $value, $sampleRate)); } }
function toStringStudipInfo ($preview) { if ($preview) { $studip_info = $this->elements["StudipInfo"]->toString(array("content" => $this->config->getValue("StudipInfo", "homeinst") . " ")); $studip_info .= sprintf("<a href=\"\"%s>%s</a><br>\n", $this->config->getAttributes("LinkInternSimple", "a"), _("Heimatinstitut")); $studip_info .= $this->elements["StudipInfo"]->toString(array("content" => $this->config->getValue("StudipInfo", "involvedinst") . " ")); $studip_info .= str_repeat(_("Beteiligte Institute") . " ", 5) . "<br>\n"; $studip_info .= $this->elements["StudipInfo"]->toString(array("content" => $this->config->getValue("StudipInfo", "countuser") . " ")); $studip_info .= "23<br>\n"; $studip_info .= $this->elements["StudipInfo"]->toString(array("content" => $this->config->getValue("StudipInfo", "countpostings") . " ")); $studip_info .= "42<br>\n"; $studip_info .= $this->elements["StudipInfo"]->toString(array("content" => $this->config->getValue("StudipInfo", "countdocuments") . " ")); $studip_info .= "7<br>\n"; } else { $query="SELECT i.Institut_id, i.Name, i.url FROM seminare LEFT JOIN Institute i USING(institut_id) WHERE Seminar_id = ?"; $parameters = array($this->seminar_id); $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $res = $statement->fetch(PDO::FETCH_ASSOC); $own_inst = $res['Institut_id']; $studip_info = $this->elements["StudipInfo"]->toString(array("content" => $this->config->getValue("StudipInfo", "homeinst") . " ")); if ($res['url']) { $link_inst = htmlReady($res['url']); if (!preg_match('{^https?://.+$}', $link_inst)) $link_inst = "http://$link_inst"; $studip_info .= sprintf("<a href=\"%s\"%s target=\"_blank\">%s</a>", $link_inst, $this->config->getAttributes("LinkInternSimple", "a"), htmlReady($res['Name'])); }else $studip_info .= htmlReady($res['Name']); $studip_info .= "<br>\n"; $query = "SELECT Name, url FROM seminar_inst LEFT JOIN Institute i USING(institut_id) WHERE seminar_id = ? AND i.institut_id!='$own_inst'"; $parameters = array($this->seminar_id); $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $involved_insts = NULL; foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $res) { if ($res['url']) { $link_inst = htmlReady($res['url']); if (!preg_match('{^https?://.+$}', $link_inst)) $link_inst = "http://$link_inst"; $involved_insts[] = sprintf("<a href=\"%s\"%s target=\"_blank\">%s</a>", $link_inst, $this->config->getAttributes("LinkInternSimple", "a"), htmlReady($res['Name'])); } else $involved_insts[] = $res['Name']; } if ($involved_insts) { $involved_insts = implode(", ", $involved_insts); $studip_info .= $this->elements["StudipInfo"]->toString(array("content" => $this->config->getValue("StudipInfo", "involvedinst") . " ")); $studip_info .= $involved_insts . "<br>\n"; } $query = "SELECT count(*) as count_user FROM seminar_user WHERE Seminar_id = ?"; $parameters = array($this->seminar_id); $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $res = $statement->fetch(PDO::FETCH_ASSOC); if ($res['count_user']) { $studip_info .= $this->elements["StudipInfo"]->toString(array("content" => $this->config->getValue("StudipInfo", "countuser") . " ")); $studip_info .= $res['count_user'] . "<br>\n"; } // get postings for all ForumModules foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { $postings += $plugin->getNumberOfPostingsForSeminar($this->seminar_id); } if ($postings) { $studip_info .= $this->elements["StudipInfo"]->toString(array("content" => $this->config->getValue("StudipInfo", "countpostings") . " ")); $studip_info .= $postings . "<br>\n"; } $query = "SELECT count(*) as count_documents FROM dokumente WHERE seminar_id = ?"; $parameters = array($this->seminar_id); $statement = DBManager::get()->prepare($query); $statement->execute($parameters); $res = $statement->fetch(PDO::FETCH_ASSOC); if ($res['count_documents']) { $studip_info .= $this->elements["StudipInfo"]->toString(array("content" => $this->config->getValue("StudipInfo", "countdocuments") . " ")); $studip_info .= $res['count_documents'] . "\n"; } } return $this->elements["Content"]->toString(array("content" => $studip_info)); }
/** * This function reset all visits on every available modules * @param $object * @param $object_id * @param $user_id * @return bool */ public static function setObjectVisits(&$object, $object_id, $user_id, $timestamp = null) { // load plugins, so they have a chance to register themselves as observers PluginEngine::getPlugins('StandardPlugin'); $query = "INSERT INTO object_user_visits\n (object_id, user_id, type, visitdate, last_visitdate)\n (\n SELECT news_id, :user_id, 'news', :timestamp, 0\n FROM news_range\n WHERE range_id = :id\n ) UNION (\n SELECT vote_id, :user_id, 'vote', :timestamp, 0\n FROM vote\n WHERE range_id = :id\n ) UNION (\n SELECT eval_id, :user_id, 'eval', :timestamp, 0\n FROM eval_range\n WHERE range_id = :id\n )\n ON DUPLICATE KEY UPDATE last_visitdate = IFNULL(visitdate, 0), visitdate = :timestamp"; $statement = DBManager::get()->prepare($query); $statement->bindValue(':user_id', $user_id); $statement->bindValue(':timestamp', $timestamp ?: time()); // Update all activated modules foreach (words('forum documents schedule participants literature wiki scm elearning_interface') as $type) { if ($object['modules'][$type]) { object_set_visit($object_id, $type); } } // Update news, votes and evaluations $statement->bindValue('id', $object_id); $statement->execute(); // Update object itself object_set_visit($object_id, $object['obj_type']); return true; }
$ank = key($_SESSION['_user_activities']['open']); // Define structure of displayed information $queries[] = array('desc' => _('Eingetragen in Veranstaltungen (dozent / tutor / autor / user)'), 'query' => "SELECT CONCAT_WS(' / ', SUM(status = 'dozent'), SUM(status = 'tutor'),\n SUM(status = 'autor'), SUM(status = 'user'))\n FROM seminar_user\n WHERE user_id = ?\n GROUP BY user_id", 'details' => "details=seminar"); $queries[] = array('desc' => _('Eingetragen in geschlossenen Veranstaltungen (dozent / tutor / autor / user)'), 'query' => "SELECT CONCAT_WS(' / ', SUM(su.status = 'dozent'), SUM(su.status = 'tutor'),\n SUM(su.status = 'autor'), SUM(su.status = 'user'))\n FROM seminar_user AS su\n INNER JOIN seminar_courseset sc USING (seminar_id)\n INNER JOIN courseset_rule cr ON cr.set_id=sc.set_id AND cr.type='ParticipantRestrictedAdmission'\n WHERE user_id = ?\n GROUP BY user_id", 'details' => "details=seminar_closed"); $queries[] = array('desc' => _("Eingetragen in Wartelisten (wartend / vorläufig akzeptiert)"), 'query' => "SELECT CONCAT_WS(' / ', SUM(status = 'awaiting'), SUM(status = 'accepted'))\n FROM admission_seminar_user\n WHERE user_id = ?\n GROUP BY user_id", 'details' => "details=seminar_wait"); $queries[] = array('desc' => _("Eingetragen in Anmeldelisten"), 'query' => "SELECT COUNT(*)\n FROM priorities\n WHERE user_id = ?\n GROUP BY user_id", 'details' => "details=seminar_claiming"); $queries[] = array('desc' => _("Eingetragen in Einrichtungen (admin / dozent / tutor / autor)"), 'query' => "SELECT CONCAT_WS(' / ', SUM(inst_perms = 'admin'), SUM(inst_perms = 'dozent'),\n SUM(inst_perms = 'tutor'), SUM(inst_perms = 'autor'))\n FROM user_inst\n WHERE user_id = ?\n GROUP BY user_id"); $queries[] = array('desc' => _("Anzahl der Ankündigungen"), 'query' => "SELECT COUNT(*) FROM news WHERE user_id = ? GROUP BY user_id"); $queries[] = array('desc' => _("Anzahl der Wikiseiten"), 'query' => "SELECT COUNT(*) FROM wiki WHERE user_id = ? GROUP BY user_id"); $queries[] = array('desc' => _("Anzahl der Umfragen"), 'query' => "SELECT COUNT(*) FROM vote WHERE author_id = ? GROUP BY author_id"); $queries[] = array('desc' => _("Anzahl der Evaluationen"), 'query' => "SELECT COUNT(*) FROM eval WHERE author_id = ? GROUP BY author_id"); $queries[] = array('desc' => _("Anzahl der Literatureinträge"), 'query' => "SELECT COUNT(*) FROM lit_catalog WHERE user_id = ? GROUP BY user_id"); $queries[] = array('desc' => _("Anzahl der Ressourcenobjekte"), 'query' => "SELECT COUNT(*) FROM resources_objects WHERE owner_id = ? GROUP BY owner_id"); $queries[] = array('desc' => _("Anzahl der Dateien (hochgeladen / verlinkt)"), 'query' => "SELECT CONCAT_WS(' / ', COUNT(*) - COUNT(NULLIF(url,'')), COUNT(NULLIF(url,'')))\n FROM dokumente\n WHERE user_id = ?\n GROUP BY user_id", 'details' => "details=files"); $queries[] = array('desc' => _("Gesamtgröße der hochgeladenen Dateien (MB)"), 'query' => "SELECT FORMAT(SUM(filesize)/1024/1024,2)\n FROM dokumente\n WHERE user_id = ? AND (url IS NULL OR url = '')\n GROUP BY user_id", 'details' => "details=files"); foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { $table = $plugin->getEntryTableInfo(); $queries[] = array('desc' => $plugin->getPluginName() . ' - ' . _("Anzahl der Postings"), 'query' => 'SELECT COUNT(*) FROM `' . $table['table'] . '` WHERE `' . $table['user_id'] . '` = ? GROUP BY `' . $table['user_id'] . '`'); } // Evaluate queries foreach ($queries as $index => $query) { $statement = DBManager::get()->prepare($query['query']); $statement->execute(array($user_id)); $queries[$index]['value'] = $statement->fetchColumn() ?: 0; } // Create details if neccessary $details = false; if ($_SESSION['_user_activities']['details'] == 'files') { $files = array();
/** * Merge an user ($old_id) to another user ($new_id). This is a part of the * old numit-plugin. * * @param string $old_user * @param string $new_user * @param boolean $identity merge identity (if true) * * @return array() messages to display after migration */ public static function convert($old_id, $new_id, $identity = false) { NotificationCenter::postNotification('UserWillMigrate', $old_id, $new_id); $messages = array(); //Identitätsrelevante Daten migrieren if ($identity) { // Veranstaltungseintragungen self::removeDoubles('seminar_user', 'Seminar_id', $new_id, $old_id); $query = "UPDATE IGNORE seminar_user SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); self::removeDoubles('admission_seminar_user', 'seminar_id', $new_id, $old_id); $query = "UPDATE IGNORE admission_seminar_user SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Persönliche Infos $query = "DELETE FROM user_info WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id)); $query = "UPDATE IGNORE user_info SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Studiengänge self::removeDoubles('user_studiengang', 'studiengang_id', $new_id, $old_id); $query = "UPDATE IGNORE user_studiengang SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Eigene Kategorien $query = "UPDATE IGNORE kategorien SET range_id = ? WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Institute self::removeDoubles('user_inst', 'Institut_id', $new_id, $old_id); $query = "UPDATE IGNORE user_inst SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Generische Datenfelder zusammenführen (bestehende Einträge des // "neuen" Nutzers werden dabei nicht überschrieben) $old_user = User::find($old_id); $query = "INSERT INTO datafields_entries\n (datafield_id, range_id, sec_range_id, content, mkdate, chdate)\n VALUES (:datafield_id, :range_id, :sec_range_id, :content,\n UNIX_TIMESTAMP(), UNIX_TIMESTAMP())\n ON DUPLICATE KEY\n UPDATE content = IF(content IN ('', 'default_value'), VALUES(content), content),\n chdate = UNIX_TIMESTAMP()"; $statement = DBManager::get()->prepare($query); $statement->bindValue(':range_id', $new_id); $old_user->datafields->each(function ($field) use($new_id, $statement) { $statement->bindValue(':datafield_id', $field->datafield_id); $statement->bindValue(':sec_range_id', $field->sec_range_id); $statement->bindValue(':content', $field->content); $statement->execute(); }); # Datenfelder des alten Nutzers leeren $old_user->datafields = array(); $old_user->store(); //Buddys $query = "UPDATE IGNORE contact SET owner_id = ? WHERE owner_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Avatar $old_avatar = Avatar::getAvatar($old_id); $new_avatar = Avatar::getAvatar($new_id); if ($old_avatar->is_customized()) { if (!$new_avatar->is_customized()) { $avatar_file = $old_avatar->getFilename(AVATAR::ORIGINAL); if (!file_exists($avatar_file)) { $avatar_file = $old_avatar->getFilename(AVATAR::NORMAL); } $new_avatar->createFrom($avatar_file); } $old_avatar->reset(); } $messages[] = _('Identitätsrelevante Daten wurden migriert.'); } // Restliche Daten übertragen // ForumsModule migrieren foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { $plugin->migrateUser($old_id, $new_id); } // Dateieintragungen und Ordner // TODO (mlunzena) should post a notification $query = "UPDATE IGNORE dokumente SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE folder SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); //Kalender $query = "UPDATE IGNORE calendar_event SET range_id = ? WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE calendar_user SET owner_id = ? WHERE owner_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE calendar_user SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE event_data SET author_id = ? WHERE author_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE event_data SET editor_id = ? WHERE editor_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); //Archiv self::removeDoubles('archiv_user', 'seminar_id', $new_id, $old_id); $query = "UPDATE IGNORE archiv_user SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Evaluationen $query = "UPDATE IGNORE eval SET author_id = ? WHERE author_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); self::removeDoubles('eval_user', 'eval_id', $new_id, $old_id); $query = "UPDATE IGNORE eval_user SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE evalanswer_user SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Kategorien $query = "UPDATE IGNORE kategorien SET range_id = ? WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Literatur $query = "UPDATE IGNORE lit_catalog SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE lit_list SET range_id = ? WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Nachrichten (Interne) $query = "UPDATE IGNORE message SET autor_id = ? WHERE autor_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); self::removeDoubles('message_user', 'message_id', $new_id, $old_id); $query = "UPDATE IGNORE message_user SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // News $query = "UPDATE IGNORE news SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE news_range SET range_id = ? WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Informationsseiten $query = "UPDATE IGNORE scm SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Statusgruppeneinträge self::removeDoubles('statusgruppe_user', 'statusgruppe_id', $new_id, $old_id); $query = "UPDATE IGNORE statusgruppe_user SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); // Termine $query = "UPDATE IGNORE termine SET autor_id = ? WHERE autor_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); //Votings $query = "UPDATE IGNORE vote SET author_id = ? WHERE author_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE vote SET range_id = ? WHERE range_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); self::removeDoubles('vote_user', 'vote_id', $new_id, $old_id); $query = "UPDATE IGNORE vote_user SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); self::removeDoubles('voteanswers_user', 'answer_id', $new_id, $old_id); $query = "UPDATE IGNORE voteanswers_user SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); //Wiki $query = "UPDATE IGNORE wiki SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE wiki_locks SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); //Adressbucheinträge $query = "UPDATE IGNORE contact SET owner_id = ? WHERE owner_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); //Blubber $query = "UPDATE IGNORE blubber SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE blubber_follower SET studip_user_id = ? WHERE studip_user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE blubber_mentions SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE blubber_reshares SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); $query = "UPDATE IGNORE blubber_streams SET user_id = ? WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($new_id, $old_id)); NotificationCenter::postNotification('UserDidMigrate', $old_id, $new_id); $messages[] = _('Dateien, Termine, Adressbuch, Nachrichten und weitere Daten wurden migriert.'); return $messages; }
/** * Searches the database for occurences of smileys and returns a list * of how often each smiley was used. * If smiley favorites are activated, the list will include the number * how often a smiley was favored. * * @return Array Associative array with smiley name as key and according * usage numbers as value */ static function getUsage() { // Tabellen, die nach Smileys durchsucht werden sollen // Format: array( array (Tabelle, Feld), array (Tabelle, Feld), ... ) $table_data = array(array('datafields_entries', 'content'), array('kategorien', 'content'), array('message', 'message'), array('news', 'body'), array('scm', 'content'), array('user_info', 'hobby'), array('user_info', 'lebenslauf'), array('user_info', 'publi'), array('user_info', 'schwerp'), array('wiki', 'body'), array('forum_entries', 'content')); // add tables from ForumModules to count for foreach (PluginEngine::getPlugins('ForumModule') as $plugin) { $table = $plugin->getEntryTableInfo(); $table_data[] = array($table['table'], $table['content']); } // search in all tables $usage = array(); foreach ($table_data as $table) { // only fetch entries which have some content, otherwise the while-loop will fail $query = "SELECT ? AS txt FROM ? WHERE LENGTH(?) > 0"; // $table1, $table0 if ($table[0] == 'wiki') { // only the actual wiki page ... $sqltxt = "SELECT MAX(CONCAT(LPAD(version, 5, '0'),' ', ?)) AS txt FROM ? GROUP BY range_id, keyword"; } $statement = DBManager::get()->prepare($query); $statement->bindParam(1, $table[1], StudipPDO::PARAM_COLUMN); $statement->bindParam(2, $table[0], StudipPDO::PARAM_COLUMN); $statement->bindParam(3, $table[1], StudipPDO::PARAM_COLUMN); $statement->execute(array()); // and all entrys while ($txt = $statement->fetchColumn()) { // extract all smileys if (preg_match_all('/' . SmileyFormat::REGEXP . '/', $txt, $matches)) { for ($k = 0; $k < count($matches[2]); $k++) { $name = $matches[2][$k]; if (!isset($usage[$name])) { $usage[$name] = array('count' => 0, 'short_count' => 0, 'favorites' => 0); } $usage[$name]['count'] += 1; } } // and now the short-notation foreach (self::getShort() as $code => $name) { $regexp = '/(\\>|^|\\s)' . preg_quote($code) . '(?=$|\\<|\\s)/'; if ($count = preg_match_all($regexp, $txt, $matches)) { if (!isset($usage[$name])) { $usage[$name] = array('count' => 0, 'short_count' => 0, 'favorites' => 0); } $usage[$name]['short_count'] += $count; } } } } // favorites if (SmileyFavorites::isEnabled()) { $favorite_usage = SmileyFavorites::getUsage(); foreach ($favorite_usage as $name => $count) { if (!isset($usage[$name])) { $usage[$name] = array('count' => 0, 'short_count' => 0, 'favorites' => 0); } $usage[$name]['favorites'] = $count; } } return $usage; }
echo '<b>'._('Beschreibung:').' </b><br>'. formatLinks($sem->description) .'<br><br>'; echo '<b>'._('Moderiert von:') .'</b> '; $all_mods = $sem->getMembers('dozent') + $sem->getMembers('tutor'); $mods = array(); foreach($all_mods as $mod) { $mods[] = '<a href="'.URLHelper::getLink("dispatch.php/profile?username="******">'.htmlready($mod['fullname']).'</a>'; } echo implode(', ', $mods); echo '<br><br>'; } ?> <?php // Anzeige von News echo $news; // Anzeige von Terminen echo $dates; // Anzeige von Umfragen echo $votes; // display plugins $plugins = PluginEngine::getPlugins('StandardPlugin', $course_id); $layout = $GLOBALS['template_factory']->open('shared/index_box'); foreach ($plugins as $plugin) { $template = $plugin->getInfoTemplate($course_id); if ($template) { echo $template->render(NULL, $layout); $layout->clear_attributes(); } } $sidebar = Sidebar::get(); $sidebar->setImage('sidebar/seminar-sidebar.png');
private function getContent ($args = NULL, $raw = FALSE) { $instituts_id = $this->config->range_id; $username = $args['username']; $sem_id = $args['seminar_id']; if (!$nameformat = $this->config->getValue('Main', 'nameformat')) { $nameformat = 'full'; } $row = false; $global_view = false; $dbv = new DbView(); if (in_array(get_object_type($this->config->range_id), array('fak', 'global'))) { $global_view = true; $selected_item_ids = $this->config->getValue('SelectInstitutes', 'institutesselected'); // at least one institute has to be selected in the configuration if (!is_array($selected_item_ids)) { return array(); } // is user lecturer ? if ($this->config->getValue('Main', 'onlylecturers')) { $current_semester = get_sem_num(time()); $stm = DBManager::get()->prepare(sprintf( "SELECT aum.user_id " . "FROM auth_user_md5 aum " . "LEFT JOIN seminar_user su USING(user_id) " . "LEFT JOIN seminare s USING (seminar_id) " . "LEFT JOIN user_inst ui ON aum.user_id = ui.user_id " . "WHERE aum.username = ? " . "AND su.status = 'dozent' " . "AND s.visible = 1 " . "AND ((%s) = %s OR ((%s) <= %s AND ((%s) >= %s OR (%s) = -1))) " . "AND ui.Institut_id IN ('%s') " . "AND ui.inst_perms = 'dozent' " . "AND ui.externdefault = 1 " . "AND %s", $dbv->sem_number_sql, $current_semester, $dbv->sem_number_sql, $current_semester, $dbv->sem_number_end_sql, $current_semester, $dbv->sem_number_end_sql, implode("','", $selected_item_ids), get_ext_vis_query())); $stm->execute(array($username)); // user is not a lecturer if (!$row = $stm->fetch()) { return array(); } } else { // have user the status dozent at an institute in the list of accepted institutes $stm = DBManager::get()->prepare(sprintf( "SELECT aum.user_id " . "FROM auth_user_md5 aum " . "LEFT JOIN user_inst ui USING(user_id) " . "WHERE aum.username = ? " . "AND ui.Institut_id IN ('%s') " . "AND ui.externdefault = 1 " . "AND %s", implode("','", $selected_item_ids), get_ext_vis_query())); $stm->execute(array($username)); // user is not dozent at an institute that is in the list of accepted institutes if (!$row = $stm->fetch()) { return array(); } } } $row = false; // Mitarbeiter/in am Institut $stm_inst = DBManager::get()->prepare( "SELECT i.Institut_id " . "FROM Institute i " . "LEFT JOIN user_inst ui USING(Institut_id) " . "LEFT JOIN auth_user_md5 aum USING(user_id) " . "WHERE i.Institut_id = ? " . "AND aum.username = ? AND ui.inst_perms IN ('autor','tutor','dozent') AND " . get_ext_vis_query()); $stm_inst->execute(array($instituts_id, $username)); // Mitarbeiter/in am Heimatinstitut des Seminars if (!$row = $stm_inst->fetch(PDO::FETCH_ASSOC) && $sem_id) { $stm_inst = DBManager::get()->prepare( "SELECT s.Institut_id " . "FROM seminare s " . "LEFT JOIN user_inst ui USING(Institut_id) " . "LEFT JOIN auth_user_md5 aum USING(user_id) " . "WHERE s.Seminar_id = ? " . "AND aum.username = ? AND ui.inst_perms = 'dozent' AND " . get_ext_vis_query()); $stm_inst->execute(array($sem_id, $username)); if ($row = $stm_inst->fetch(PDO::FETCH_ASSOC)) { $instituts_id = $row['Institut_id']; } } // an beteiligtem Institut Dozent(in) if (!$row && $sem_id) { $stm_inst = DBManager::get()->prepare( "SELECT si.institut_id " . "FROM seminare s " . "LEFT JOIN seminar_inst si ON(s.Seminar_id = si.seminar_id) " . "LEFT JOIN user_inst ui ON(si.institut_id = ui.Institut_id) " . "LEFT JOIN auth_user_md5 aum USING(user_id) " . "WHERE s.Seminar_id = ? " . "AND si.institut_id != ? AND ui.inst_perms = 'dozent' AND aum.username = ? AND " . get_ext_vis_query()); $stm_inst->execute(array($sem_id, $intituts_id, $username)); if ($row = $stm_inst->fetch(PDO::FETCH_ASSOC)) { $instituts_id = $row['institut_id']; } } // ist zwar global Dozent, aber an keinem Institut eingetragen if (!$row && $sem_id) { $stm = DBManager::get()->prepare(sprintf( "SELECT aum.*, %s AS fullname " . "FROM auth_user_md5 aum " . "LEFT JOIN user_info USING(user_id) " . "LEFT JOIN seminar_user su " . "WHERE username = ? " . "AND perms = 'dozent' AND su.seminar_id = ? AND su.status = 'dozent' AND %s" , $GLOBALS['_fullname_sql'][$nameformat], get_ext_vis_query())); $stm->execute(array($username, $sem_id)); $row = $stm->fetch(PDO::FETCH_ASSOC); } elseif ($global_view || $this->config->getValue('Main', 'defaultaddr')) { $stm = DBManager::get()->prepare(sprintf( "SELECT i.Institut_id, i.Name, i.Strasse, i.Plz, i.url, ui.*, aum.*, " . "%s AS fullname, uin.user_id, uin.lebenslauf, uin.publi, uin.schwerp, " . "uin.Home, uin.title_front, uin.title_rear " . "FROM Institute i " . "LEFT JOIN user_inst ui USING(Institut_id) " . "LEFT JOIN auth_user_md5 aum USING(user_id) " . "LEFT JOIN user_info uin USING (user_id) " . "WHERE ui.inst_perms IN ('autor','tutor','dozent') " . "AND aum.username = ? AND ui.externdefault = 1 AND %s" , $GLOBALS['_fullname_sql'][$nameformat], get_ext_vis_query())); $stm->execute(array($username)); $row = $stm->fetch(PDO::FETCH_ASSOC); if (!$row) { $stm = DBManager::get()->prepare(sprintf( "SELECT i.Institut_id, i.Name, i.Strasse, i.Plz, i.url, ui.*, aum.*, " . "%s AS fullname, uin.user_id, uin.lebenslauf, uin.publi, uin.schwerp, " . "uin.Home, uin.title_front, uin.title_rear " . "FROM Institute i " . "LEFT JOIN user_inst ui USING(Institut_id) " . "LEFT JOIN auth_user_md5 aum USING(user_id) " . "LEFT JOIN user_info uin USING (user_id) " . "WHERE ui.inst_perms IN ('autor','tutor','dozent') " . "AND aum.username = ? AND i.Institut_id = ? AND %s" , $GLOBALS['_fullname_sql'][$nameformat], get_ext_vis_query())); $stm->execute(array($username, $instituts_id)); $row = $stm->fetch(PDO::FETCH_ASSOC); } } else { $stm = DBManager::get()->prepare(sprintf( "SELECT i.Institut_id, i.Name, i.Strasse, i.Plz, i.url, ui.*, aum.*, " . "%s AS fullname, uin.user_id, uin.lebenslauf, uin.publi, uin.schwerp, " . "uin.Home, uin.title_front, uin.title_rear " . "FROM Institute i " . "LEFT JOIN user_inst ui USING(Institut_id) " . "LEFT JOIN auth_user_md5 aum USING(user_id) " . "LEFT JOIN user_info uin USING (user_id) " . "WHERE ui.inst_perms IN ('autor','tutor','dozent') " . "AND aum.username = ? AND i.Institut_id = ? AND %s" , $GLOBALS['_fullname_sql'][$nameformat], get_ext_vis_query())); $stm->execute(array($username, $instituts_id)); $row = $stm->fetch(PDO::FETCH_ASSOC); } // the user with the given username does not fulfill the conditions above if (!$row) { return array(); } // Alle Einrichtungen hohlen $stm = DBManager::get()->prepare(sprintf( "SELECT i.Institut_id, i.Name, i.Strasse, i.Plz, i.url, ui.*, aum.*, " . "%s AS fullname, uin.user_id, uin.lebenslauf, uin.publi, uin.schwerp, " . "uin.Home, uin.title_front, uin.title_rear " . "FROM Institute i " . "LEFT JOIN user_inst ui USING(Institut_id) " . "LEFT JOIN auth_user_md5 aum USING(user_id) " . "LEFT JOIN user_info uin USING (user_id) " . "WHERE ui.inst_perms IN ('autor','tutor','dozent') " . "AND aum.username = ?" , $GLOBALS['_fullname_sql'][$nameformat])); $stm->execute(array($username)); $allRows = $stm->fetchAll(); $this->user_id = $row['user_id']; $this->user_perm = $visibilities['perms']; $content['__GLOBAL__']['STUDIP-EDIT-HREF'] = "{$GLOBALS['ABSOLUTE_URI_STUDIP']}dispatch.php/settings/account?username=$username&login=yes"; $content['PERSONDETAILS']['FULLNAME'] = ExternModule::ExtHtmlReady($row['fullname']); $content['PERSONDETAILS']['LASTNAME'] = ExternModule::ExtHtmlReady($row['Nachname']); $content['PERSONDETAILS']['FIRSTNAME'] = ExternModule::ExtHtmlReady($row['Vorname']); $content['PERSONDETAILS']['TITLEFRONT'] = ExternModule::ExtHtmlReady($row['title_front']); $content['PERSONDETAILS']['TITLEREAR'] = ExternModule::ExtHtmlReady($row['title_rear']); if ($statusgroups = Statusgruppen::getUserRoles($instituts_id, $this->user_id)) { $content['PERSONDETAILS']['STATUSGROUPS'] = ExternModule::ExtHtmlReady(join(', ', array_values($statusgroups))); } $content['PERSONDETAILS']['USERNAME'] = $row['username']; $content['PERSONDETAILS']['IMAGE-HREF'] = Avatar::getAvatar($this->user_id)->getURL(Avatar::NORMAL); $gruppen = GetRoleNames(GetAllStatusgruppen($this->config->range_id, $row['user_id'])); for ($i = 0; $i < sizeof($gruppen); $i++) { $content['PERSONDETAILS']['GROUPS'][$i]['GROUP'] = ExternModule::ExtHtmlReady($gruppen[$i]); } $content['PERSONDETAILS']['INST-NAME'] = ExternModule::ExtHtmlReady($row['Name']); $content['PERSONDETAILS']['INST-HREF'] = ExternModule::ExtHtmlReady(trim($row['url'])); $content['PERSONDETAILS']['STREET'] = ExternModule::ExtHtmlReady($row['Strasse']); $content['PERSONDETAILS']['ZIPCODE'] = ExternModule::ExtHtmlReady($row['Plz']); $email = get_visible_email($this->user_id); $content['PERSONDETAILS']['EMAIL'] = ExternModule::ExtHtmlReady($email); $content['PERSONDETAILS']['EMAIL-LOCAL'] = array_shift(explode('@', $content['PERSONDETAILS']['EMAIL'])); $content['PERSONDETAILS']['EMAIL-DOMAIN'] = array_pop(explode('@', $content['PERSONDETAILS']['EMAIL'])); $content['PERSONDETAILS']['ROOM'] = ExternModule::ExtHtmlReady($row['raum']); $content['PERSONDETAILS']['PHONE'] = ExternModule::ExtHtmlReady($row['Telefon']); $content['PERSONDETAILS']['FAX'] = ExternModule::ExtHtmlReady($row['Fax']); if (Visibility::verify('homepage', $this->user_id)) { $content['PERSONDETAILS']['HOMEPAGE-HREF'] = ExternModule::ExtHtmlReady(trim($row['Home'])); } $content['PERSONDETAILS']['OFFICE-HOURS'] = ExternModule::ExtHtmlReady($row['sprechzeiten']); $j = 0; foreach($allRows as $curRow) { $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-NAME'] = ExternModule::ExtHtmlReady($curRow['Name']); $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-HREF'] = ExternModule::ExtHtmlReady(trim($curRow['url'])); $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-STREET'] = ExternModule::ExtHtmlReady($curRow['Strasse']); $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-ZIPCODE'] = ExternModule::ExtHtmlReady($curRow['Plz']); $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-EMAIL'] = ExternModule::ExtHtmlReady($curRow['Email']); $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-EMAIL-LOCAL'] = array_shift(explode('@', $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-EMAIL'])); $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-EMAIL-DOMAIN'] = array_pop(explode('@', $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-EMAIL'])); $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-ROOM'] = ExternModule::ExtHtmlReady($curRow['raum']); $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-PHONE'] = ExternModule::ExtHtmlReady($curRow['Telefon']); $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-FAX'] = ExternModule::ExtHtmlReady($curRow['Fax']); $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-HOMEPAGE-HREF'] = ExternModule::ExtHtmlReady(trim($curRow['Home'])); $content['PERSONDETAILS']['ALL-INST']['SINGLE-INST'][$j]['SINGLE-INST-OFFICE-HOURS'] = ExternModule::ExtHtmlReady($curRow['sprechzeiten']); $j++; } // generic data fields if ($generic_datafields = $this->config->getValue('Main', 'genericdatafields')) { $localEntries = DataFieldEntry::getDataFieldEntries($this->user_id, 'user'); $k = 1; foreach ($generic_datafields as $datafield) { if (isset($localEntries[$datafield]) && is_object($localEntries[$datafield]) && Visibility::verify($localEntries[$datafield]->getId(), $this->user_id)) { if ($localEntries[$datafield]->getType() == 'link') { $localEntry = ExternModule::extHtmlReady($localEntries[$datafield]->getValue()); } else { $localEntry = $localEntries[$datafield]->getDisplayValue(); } if ($localEntry) { $content['PERSONDETAILS']["DATAFIELD_$k"] = $localEntry; } } $k++; } } // homepage plugins $plugins = PluginEngine::getPlugins('HomepagePlugin'); foreach ($plugins as $plugin) { $template = $plugin->getHomepageTemplate($this->user_id); if ($template) { $keyname = 'PLUGIN_' . strtoupper($plugin->getPluginName()); $content['PERSONDETAILS'][$keyname] = $template->render(); } } if (Visibility::verify('lebenslauf', $this->user_id)) { $content['PERSONDETAILS']['CV'] = ExternModule::ExtFormatReady($row['lebenslauf']); } if (Visibility::verify('schwerp', $this->user_id)) { $content['PERSONDETAILS']['RESEARCH-INTERESTS'] = ExternModule::ExtFormatReady($row['schwerp']); } if (Visibility::verify('publi', $this->user_id)) { $content['PERSONDETAILS']['PUBLICATIONS'] = ExternModule::ExtFormatReady($row['publi']); } $content['PERSONDETAILS']['LECTURES'] = $this->elements['TemplateLectures']->toString(array('content' => $this->getContentLectures(), 'subpart' => 'LECTURES')); if (Visibility::verify('news', $this->user_id)) { $content['PERSONDETAILS']['NEWS'] = $this->elements['TemplateNews']->toString(array('content' => $this->getContentNews(), 'subpart' => 'NEWS')); } if (Visibility::verify('dates', $this->user_id)) { $content['PERSONDETAILS']['APPOINTMENTS'] = $this->elements['TemplateAppointments']->toString(array('content' => $this->getContentAppointments(), 'subpart' => 'APPOINTMENTS')); } if (Visibility::verify('literature', $this->user_id)) { $content['PERSONDETAILS']['LITERATURE'] = $this->elements['TemplateLitList']->toString(array('content' => $this->elements['LitList']->getContent(array('user_id' => $this->user_id)), 'subpart' => 'LITLISTS')); } $content['PERSONDETAILS']['OWNCATEGORIES'] = $this->elements['TemplateOwnCategories']->toString(array('content' => $this->getContentOwnCategories(), 'subpart' => 'OWNCATEGORIES')); return $content; }
/** * Creates a visibilitySetting for every homepagePlugin * * @param type $user the user for whom the settings should be created */ private function createHomepagePluginEntries($user) { self::getUser($user); $homepageplugins = PluginEngine::getPlugins('HomepagePlugin'); foreach ($homepageplugins as $plugin) { self::addPrivacySetting($plugin->getPluginName(), "plugin" . $plugin->getPluginId(), 'plugins', 1, $user, null, $plugin->getPluginId()); } }
/** * 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 in_archiv ($sem_id) { global $SEM_CLASS,$SEM_TYPE, $ARCHIV_PATH, $TMP_PATH, $ZIP_PATH, $ZIP_OPTIONS, $_fullname_sql; NotificationCenter::postNotification('CourseWillArchive', $sem_id); //Besorgen der Grunddaten des Seminars $query = "SELECT Seminar_id, Name, Untertitel, Beschreibung, start_time, Institut_id, status FROM seminare WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($sem_id)); $row = $statement->fetch(PDO::FETCH_ASSOC); $seminar_id = $row['Seminar_id']; $name = $row['Name']; $untertitel = $row['Untertitel']; $beschreibung = $row['Beschreibung']; $start_time = $row['start_time']; $heimat_inst_id = $row['Institut_id']; //Besorgen von einzelnen Daten zu dem Seminar $semester = new SemesterData; $all_semester = $semester->getAllSemesterData(); foreach ($all_semester as $sem) { if (($start_time >= $sem['beginn']) && ($start_time <= $sem['ende'])) { $semester_tmp = $sem['name']; } } //Studienbereiche if ($SEM_CLASS[$SEM_TYPE[$row['status']]['class']]['bereiche']) { $sem_path = get_sem_tree_path($seminar_id); if (is_array($sem_path)) { $studienbereiche = join(', ', $sem_path); } } // das Heimatinstitut als erstes $query = "SELECT Name FROM Institute WHERE Institut_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($heimat_inst_id)); $institute = $statement->fetchColumn(); // jetzt den Rest $query = "SELECT Name FROM Institute LEFT JOIN seminar_inst USING (institut_id) WHERE seminar_id = ? AND Institute.Institut_id != ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id, $heimat_inst_id)); while ($temp = $statement->fetchColumn()) { $institute .= ', ' . $temp; } $query = "SELECT GROUP_CONCAT({$_fullname_sql['full']} SEPARATOR ', ') FROM seminar_user LEFT JOIN auth_user_md5 USING (user_id) LEFT JOIN user_info USING (user_id) WHERE seminar_id = ? AND seminar_user.status = 'dozent'"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); $dozenten = $statement->fetchColumn(); $query = "SELECT fakultaets_id FROM seminare LEFT JOIN Institute USING (Institut_id) WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); $fakultaet_id = $statement->fetchColumn(); $query = "SELECT GROUP_CONCAT(DISTINCT c.Name SEPARATOR ' | ') FROM seminar_inst AS a LEFT JOIN Institute AS b USING (Institut_id) LEFT JOIN Institute AS c ON (c.Institut_id = b.fakultaets_id) WHERE a.seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); $fakultaet = $statement->fetchColumn(); setTempLanguage(); // use $DEFAULT_LANGUAGE for archiv-dumps //Dump holen $dump = dump_sem($sem_id, 'nobody'); //Forumdump holen foreach (PluginEngine::getPlugins('ForumModule', $sem_id) as $plugin) { $forumdump .= $plugin->getDump($sem_id); } // Wikidump holen $wikidump = getAllWikiPages($sem_id, $name, FALSE); restoreLanguage(); //OK, naechster Schritt: Kopieren der Personendaten aus seminar_user in archiv_user $query = "INSERT INTO archiv_user (seminar_id, user_id, status) SELECT Seminar_id, user_id, status FROM seminar_user WHERE Seminar_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); // Eventuelle Vertretungen in der Veranstaltung haben weiterhin Zugriff mit Dozentenrechten if (get_config('DEPUTIES_ENABLE')) { $deputies = getDeputies($seminar_id); // Eintragen ins Archiv mit Zugriffsberechtigung "dozent" $query = "INSERT IGNORE INTO archiv_user SET seminar_id = ?, user_id = ?, status = 'dozent'"; $statement = DBManager::get()->prepare($query); foreach ($deputies as $deputy) { $statement->execute(array($seminar_id, $deputy['user_id'])); } } $Modules = new Modules; $Modules = $Modules->getLocalModules($sem_id); $folder_tree = TreeAbstract::GetInstance('StudipDocumentTree', array('range_id' => $sem_id,'entity_type' => 'sem')); if ($Modules['documents_folder_permissions'] || StudipDocumentTree::ExistsGroupFolders($sem_id)) { $unreadable_folders = $folder_tree->getUnReadableFolders('nobody'); } $query = "SELECT COUNT(dokument_id) FROM dokumente WHERE seminar_id = ? AND url = ''"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id)); $count = $statement->fetchColumn(); if ($count) { $hash_secret = "frauen"; $archiv_file_id = md5(uniqid($hash_secret,1)); //temporaeres Verzeichnis anlegen $tmp_full_path = "$TMP_PATH/$archiv_file_id"; mkdir($tmp_full_path, 0700); if($folder_tree->getNumKids('root')) { $list = $folder_tree->getKids('root'); } if (is_array($list) && count($list) > 0) { $query = "SELECT folder_id, name FROM folder WHERE range_id IN (?) ORDER BY name"; $statement = DBManager::get()->prepare($query); $statement->execute(array($list)); $folder = 0; while ($row = $statement->fetch(PDO::FETCH_ASSOC)) { $folder += 1; $temp_folder = $tmp_full_path . "/[$folder]_" . prepareFilename($row['name'], FALSE); mkdir($temp_folder, 0700); createTempFolder($row['folder_id'], $temp_folder, $seminar_id, 'nobody'); } //zip all the stuff $archiv_full_path = "$ARCHIV_PATH/$archiv_file_id"; create_zip_from_directory($tmp_full_path, $tmp_full_path); @rename($tmp_full_path . '.zip', $archiv_full_path); } rmdirr($tmp_full_path); if (is_array($unreadable_folders)) { $query = "SELECT dokument_id FROM dokumente WHERE seminar_id = ? AND url = '' AND range_id IN (?)"; $statement = DBManager::get()->prepare($query); $statement->execute(array($seminar_id, $unreadable_folders)); $archiv_protected_file_id = createSelectedZip($statement->fetchAll(PDO::FETCH_COLUMN), false, false); @rename("$TMP_PATH/$archiv_protected_file_id", "$ARCHIV_PATH/$archiv_protected_file_id"); } } else { $archiv_file_id = ''; } //Reinschreiben von diversem Klumpatsch in die Datenbank $query = "INSERT INTO archiv (seminar_id, name, untertitel, beschreibung, start_time, semester, heimat_inst_id, institute, dozenten, fakultaet, dump, archiv_file_id,archiv_protected_file_id, forumdump, wikidump, studienbereiche, mkdate) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, UNIX_TIMESTAMP())"; $statement = DBManager::get()->prepare($query); $success = $statement->execute(array( $seminar_id, $name ?: '', $untertitel ?: '', $beschreibung ?: '', $start_time, $semester_tmp ?: '', $heimat_inst_id, $institute ?: '', $dozenten ?: '', $fakultaet ?: '', $dump ?: '', $archiv_file_id ?: '', $archiv_protected_file_id ?: '', $forumdump ?: '', $wikidump ?: '', $studienbereiche ?: '', )); if ($success) { NotificationCenter::postNotification('CourseDidArchive', $seminar_id); } }
echo htmlReady($entry->getName()); ?> : </b> <?php echo $entry->getDisplayValue(); ?> </li> <? endif?> <? endforeach ?> </ul> <?php echo $news; echo $dates; echo $questionnaires; ?> <? // display plugins $plugins = PluginEngine::getPlugins('StandardPlugin', $institute_id); $layout = $GLOBALS['template_factory']->open('shared/index_box'); foreach ($plugins as $plugin) { $template = $plugin->getInfoTemplate($institute_id); if ($template) { echo $template->render(NULL, $layout); $layout->clear_attributes(); } } ?>