/** * Maintenance view for the auto insert parameters * */ function index_action() { // search seminars if (Request::submitted('suchen')) { if (Request::get('sem_search')) { $this->sem_search = Request::get('sem_search'); $this->sem_select = Request::option('sem_select'); $search = new SeminarSearch(); $this->seminar_search = $search->getResults(Request::get('sem_search'), array('search_sem_sem' => Request::option('sem_select'))); if (count($this->seminar_search) == 0) { $this->flash['message'] = _("Es wurden keine Veranstaltungen gefunden."); } } else { $this->flash['error'] = _("Bitte geben Sie einen Suchparameter ein."); } } $seminare = AutoInsert::getAllSeminars(); $this->auto_sems = $seminare; $domains = array(); $domains[] = array('id' => 'keine', 'name' => _('Ohne Domain')); foreach (UserDomain::getUserDomains() as $domain) { $domains[] = array('id' => $domain->getId(), 'name' => $domain->getName()); } $this->userdomains = $domains; }
/** * Shows the current restrictions for course participation. */ function index_action() { URLHelper::addLinkParam('return_to_dialog', Request::isDialog()); $this->sidebar = Sidebar::get(); $this->sidebar->setImage("sidebar/seminar-sidebar.png"); if ($GLOBALS['perm']->have_perm('admin')) { $list = new SelectorWidget(); $list->setUrl("?#admin_top_links"); $list->setSelectParameterName("cid"); foreach (AdminCourseFilter::get()->getCoursesForAdminWidget() as $seminar) { $list->addElement(new SelectElement($seminar['Seminar_id'], $seminar['Name']), 'select-' . $seminar['Seminar_id']); } $list->setSelection($this->course_id); $this->sidebar->addWidget($list); } $this->all_domains = UserDomain::getUserDomains(); $this->seminar_domains = array_map(function ($d) { return $d->getId(); }, UserDomain::getUserDomainsForSeminar($this->course_id)); $this->current_courseset = CourseSet::getSetForCourse($this->course_id); $this->activated_admission_rules = AdmissionRule::getAvailableAdmissionRules(); if (!$this->current_courseset) { $available_coursesets = new SimpleCollection(); foreach (CourseSet::getCoursesetsByInstituteId($this->course->institut_id) as $cs) { $cs = new CourseSet($cs['set_id']); if ($cs->isUserAllowedToAssignCourse($this->user_id, $this->course_id)) { $available_coursesets[] = array('id' => $cs->getId(), 'name' => $cs->getName(), 'chdate' => $cs->chdate, 'my_own' => $cs->getUserId() === $GLOBALS['user']->id); } } foreach (CourseSet::getglobalCoursesets() as $cs) { $cs = new CourseSet($cs['set_id']); if ($cs->isUserAllowedToAssignCourse($this->user_id, $this->course_id)) { $available_coursesets[] = array('id' => $cs->getId(), 'name' => $cs->getName(), 'chdate' => $cs->chdate, 'my_own' => $cs->getUserId() === $GLOBALS['user']->id); } } $available_coursesets = $available_coursesets->findBy('chdate', strtotime('-1 year'), '>'); $available_coursesets->orderBy('name'); $this->available_coursesets = $available_coursesets; PageLayout::postMessage(MessageBox::info(_("Für diese Veranstaltung sind keine Anmelderegeln festgelegt. Die Veranstaltung ist damit für alle Nutzer zugänglich."))); } else { if ($this->current_courseset->isSeatDistributionEnabled() && !$this->course->admission_turnout) { PageLayout::postMessage(MessageBox::info(_("Diese Veranstaltung ist teilnahmebeschränkt, aber die maximale Teilnehmeranzahl ist nicht gesetzt."))); } } $lockdata = LockRules::getObjectRule($this->course_id); if ($lockdata['description'] && LockRules::CheckLockRulePermission($this->course_id, $lockdata['permission'])) { PageLayout::postMessage(MessageBox::info(formatLinks($lockdata['description']))); } }
/** * Displays the privacy settings of a user. */ public function index_action() { // Get visibility settings from database. $this->global_visibility = get_global_visibility_by_id($this->user->user_id); $this->online_visibility = get_local_visibility_by_id($this->user->user_id, 'online'); $this->search_visibility = get_local_visibility_by_id($this->user->user_id, 'search'); $this->email_visibility = get_local_visibility_by_id($this->user->user_id, 'email'); // Get default visibility for homepage elements. $this->default_homepage_visibility = Visibility::get_default_homepage_visibility(); $this->NOT_HIDEABLE_FIELDS = $GLOBALS['NOT_HIDEABLE_FIELDS']; $this->user_perm = $GLOBALS['perm']->get_perm($this->user->user_id); $this->user_domains = UserDomain::getUserDomains(); // Calculate colWidth and colCount for different visibilities $this->colCount = Visibility::getColCount(); $this->colWidth = 67 / $this->colCount; $this->visibilities = Visibility::getVisibilities(); $this->homepage_elements = Visibility::getHTMLArgs(); }
/** * Delete an existing user domain. */ function delete_action() { $id = Request::get('id'); $domain = new UserDomain($id); if (count($domain->getUsers()) == 0) { $domain->delete(); } else { $this->message = MessageBox::error(_('Domänen, denen noch Personen zugewiesen sind, können nicht gelöscht werden.')); } $this->domains = UserDomain::getUserDomains(); $this->render_action('index'); }
/** * Initialize the subnavigation of this item. This method * is called once before the first item is added or removed. */ public function initSubNavigation() { global $user, $perm; parent::initSubNavigation(); $username = Request::username('username', $user->username); $current_user = $username == $user->username ? $user : User::findByUsername($username); // profile $navigation = new Navigation(_('Profil'), 'dispatch.php/profile/index'); $this->addSubNavigation('index', $navigation); if ($perm->have_profile_perm('user', $current_user->user_id)) { // avatar $navigation = new Navigation(_('Bild'), 'dispatch.php/settings/avatar'); $this->addSubNavigation('avatar', $navigation); // profile data $navigation = new Navigation(_('Nutzerdaten')); $navigation->addSubNavigation('profile', new Navigation(_('Grunddaten'), 'dispatch.php/settings/account')); if (($perm->get_profile_perm($current_user->user_id) == 'user' || $perm->have_perm('root') && Config::get()->ALLOW_ADMIN_USERACCESS) && !StudipAuthAbstract::CheckField('auth_user_md5.password', $current_user->auth_plugin) && !LockRules::check($current_user->user_id, 'password')) { $navigation->addSubNavigation('password', new Navigation(_('Passwort ändern'), 'dispatch.php/settings/password')); } $navigation->addSubNavigation('details', new Navigation(_('Weitere Daten'), 'dispatch.php/settings/details')); if (!in_array($current_user->perms, words('user admin root'))) { $navigation->addSubNavigation('studies', new Navigation(_('Studiendaten'), 'dispatch.php/settings/studies')); } if ($current_user->perms != 'root') { if (count(UserDomain::getUserDomains())) { $navigation->addSubNavigation('userdomains', new Navigation(_('Nutzerdomänen'), 'dispatch.php/settings/userdomains')); } if ($perm->is_staff_member($current_user->user_id)) { $navigation->addSubNavigation('statusgruppen', new Navigation(_('Einrichtungsdaten'), 'dispatch.php/settings/statusgruppen')); } } $this->addSubNavigation('edit', $navigation); if ($perm->have_perm('autor')) { $navigation = new Navigation(_('Einstellungen')); $navigation->addSubNavigation('general', new Navigation(_('Allgemeines'), 'dispatch.php/settings/general')); $navigation->addSubNavigation('privacy', new Navigation(_('Privatsphäre'), 'dispatch.php/settings/privacy')); $navigation->addSubNavigation('messaging', new Navigation(_('Nachrichten'), 'dispatch.php/settings/messaging')); if (get_config('CALENDAR_ENABLE')) { $navigation->addSubNavigation('calendar_new', new Navigation(_('Terminkalender'), 'dispatch.php/settings/calendar')); } if (!$perm->have_perm('admin') and get_config('MAIL_NOTIFICATION_ENABLE')) { $navigation->addSubNavigation('notification', new Navigation(_('Benachrichtigung'), 'dispatch.php/settings/notification')); } if (isDefaultDeputyActivated() && $perm->get_perm() == 'dozent') { $navigation->addSubNavigation('deputies', new Navigation(_('Standardvertretung'), 'dispatch.php/settings/deputies')); } if (Config::Get()->API_ENABLED) { $navigation->addSubNavigation('api', new Navigation(_('API-Berechtigungen'), 'dispatch.php/api/authorizations')); } $this->addSubNavigation('settings', $navigation); } // user defined sections $navigation = new Navigation(_('Kategorien'), 'dispatch.php/settings/categories'); $this->addSubNavigation('categories', $navigation); } // user documents page if (Config::get()->PERSONALDOCUMENT_ENABLE && ($perm->have_profile_perm('user', $current_user->user_id) || Config::get()->PERSONALDOCUMENT_OPEN_ACCESS)) { $title = _('Meine Dateien'); if (Config::get()->PERSONALDOCUMENT_OPEN_ACCESS && $current_user->id !== $user->id) { $title = _('Dateibereich'); } $navigation = new Navigation($title, 'dispatch.php/document/files'); $this->addSubNavigation('files', $navigation); } }
protected static function domainValues() { $domains = array(); $domains['keine'] = _('Ohne Domain'); foreach (UserDomain::getUserDomains() as $domain) { $domains[$domain->getId()] = $domain->getName(); } return $domains; }
/** * 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; }