Exemplo n.º 1
0
 /**
  * Display a user's details.
  */
 public function index_action()
 {
     //add the free administrable datafields
     $userEntries = DataFieldEntry::getDataFieldEntries($this->user->user_id);
     $userEntries = array_filter($userEntries, function ($entry) {
         return $entry->isVisible();
     });
     $this->locked_info = LockRules::CheckLockRulePermission($this->user->user_id) ? LockRules::getObjectRule($this->user->user_id)->description : false;
     $this->is_dozent = $this->user->perms == 'dozent';
     $this->user_entries = $userEntries;
     $this->invalid_entries = $invalidEntries;
 }
Exemplo n.º 2
0
 /**
  * Basic display of the groups
  */
 public function index_action()
 {
     $lockrule = LockRules::getObjectRule($_SESSION['SessionSeminar']);
     $this->is_locked = LockRules::Check($_SESSION['SessionSeminar'], 'groups');
     if ($lockrule->description && $this->is_locked) {
         PageLayout::postMessage(MessageBox::info(formatLinks($lockrule->description)));
     }
     // Setup sidebar.
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/group-sidebar.png');
     if ($this->tutor) {
         $widget = new ActionsWidget();
         $widget->addLink(_('Neue Gruppe anlegen'), $this->url_for('admin/statusgroups/editGroup'), Icon::create('group3+add', 'clickable'))->asDialog('size=auto');
         $widget->addLink(_('Gruppenreihenfolge ändern'), $this->url_for('admin/statusgroups/sortGroups'), Icon::create('arr_2down', 'clickable'))->asDialog();
         $sidebar->addWidget($widget);
     }
     // Collect all groups
     $this->loadGroups();
     $this->membersOfInstitute = Institute::find($_SESSION['SessionSeminar'])->members->orderBy('nachname')->pluck('user_id');
     // Create multiperson search type
     $query = "SELECT auth_user_md5.user_id, CONCAT({$GLOBALS['_fullname_sql']['full']}, ' (', auth_user_md5.username, ')') as fullname\n                  FROM auth_user_md5\n                  LEFT JOIN user_info ON (user_info.user_id = auth_user_md5.user_id)\n                  WHERE (CONCAT(auth_user_md5.Vorname, ' ', auth_user_md5.Nachname) LIKE :input\n                         OR auth_user_md5.username LIKE :input)\n                    AND auth_user_md5.perms IN ('autor', 'tutor', 'dozent')\n                    AND auth_user_md5.visible <> 'never'\n                ORDER BY Vorname, Nachname";
     $this->searchType = new SQLSearch($query, _('Teilnehmer suchen'), 'username');
 }
Exemplo n.º 3
0
 /**
  * Displays the statusgruppen of a user.
  *
  * @param mixed $verify_action Optional name of an action to be verified
  * @param mixed $verify_id     Optional id that belongs to the action to
  *                             be verified
  */
 public function index_action($verify_action = null, $verify_id = null)
 {
     $all_rights = false;
     if ($this->user->username != $GLOBALS['user']->username) {
         $query = "SELECT Institut_id\n                      FROM Institute\n                      WHERE fakultaets_id = ? AND fakultaets_id != Institut_id\n                      ORDER BY Name";
         $inner_statement = DBManager::get()->prepare($query);
         $parameters = array();
         if ($GLOBALS['perm']->have_perm('root')) {
             $all_rights = true;
             $query = "SELECT Institut_id, Name, 1 AS is_fak\n                          FROM Institute\n                          WHERE Institut_id = fakultaets_id\n                          ORDER BY Name";
         } elseif ($GLOBALS['perm']->have_perm('admin')) {
             $query = "SELECT Institut_id, Name, b.Institut_id = b.fakultaets_id AS is_fak\n                          FROM user_inst AS a\n                          LEFT JOIN Institute AS b USING (Institut_id)\n                          WHERE a.user_id = ? AND a.inst_perms = 'admin'\n                          ORDER BY is_fak, Name";
             $parameters[] = $GLOBALS['user']->id;
         } else {
             $query = "SELECT a.Institut_id, Name\n                          FROM user_inst AS a\n                          LEFT JOIN Institute AS b USING (Institut_id)\n                          WHERE inst_perms IN ('tutor', 'dozent') AND user_id = ?\n                          ORDER BY Name";
             $parameters[] = $GLOBALS['user']->id;
         }
         $statement = DBManager::get()->prepare($query);
         $statement->execute($parameters);
         $institutes = $statement->fetchAll(PDO::FETCH_ASSOC);
         $admin_insts = array();
         foreach ($institutes as $institute) {
             $institute['groups'] = GetAllStatusgruppen($institute['Institut_id']) ?: array();
             if ($institute['is_fak']) {
                 $stmt = DBManager::get()->prepare("SELECT Institut_id, Name FROM Institute WHERE fakultaets_id = ? AND Institut_id != fakultaets_id ORDER BY Name");
                 $stmt->execute(array($institute['Institut_id']));
                 $institute['sub'] = $stmt->fetchGrouped(PDO::FETCH_ASSOC);
                 foreach ($institute['sub'] as $id => $sub) {
                     $sub['groups'] = GetAllStatusgruppen($id) ?: array();
                     $institute['sub'][$id] = $sub;
                 }
             }
             $admin_insts[] = $institute;
         }
     } else {
         $all_rights = true;
     }
     // get the roles the user is in
     $institutes = array();
     foreach ($this->about->user_inst as $inst_id => $details) {
         if ($details['inst_perms'] != 'user') {
             $institutes[$inst_id] = $details;
             $roles = GetAllStatusgruppen($inst_id, $this->user->user_id, true);
             $institutes[$inst_id]['roles'] = $roles ?: array();
             $institutes[$inst_id]['flattened'] = array_filter(Statusgruppe::getFlattenedRoles($roles), function ($role) {
                 return $role['user_there'];
             });
             $user_id = $this->user->user_id;
             $datafields = array();
             foreach ($institutes[$inst_id]['flattened'] as $role_id => $role) {
                 $datafields[$role_id] = DataFieldEntry::getDataFieldEntries(array($this->user->user_id, $role_id)) ?: array();
             }
             $institutes[$inst_id]['datafields'] = $datafields;
         }
     }
     // template for tree-view of roles, layout for infobox-location and content-variables
     $this->open = $_SESSION['edit_about_data']['open'];
     // the ids of the currently opened statusgroups
     $this->institutes = $institutes;
     $this->verify_action = $verify_action;
     $this->verify_id = $verify_id;
     // data for edit_about_add_person_to_role
     $this->admin_insts = $admin_insts;
     $this->locked = !$this->shallChange('', 'institute_data');
     if ($this->locked) {
         $message = LockRules::getObjectRule($this->user->user_id)->description;
         if ($message) {
             $this->reportInfo($message);
         }
     }
 }
Exemplo n.º 4
0
 /**
  * This action remove a user from course
  * @param $course_id
  */
 public function decline_action($course_id, $waiting = null)
 {
     $current_seminar = Seminar::getInstance($course_id);
     $ticket_check = Seminar_Session::check_ticket(Request::option('studipticket'));
     if (LockRules::Check($course_id, 'participants')) {
         $lockdata = LockRules::getObjectRule($course_id);
         PageLayout::postMessage(MessageBox::error(sprintf(_("Sie können sich nicht von der Veranstaltung <b>%s</b> abmelden."), htmlReady($current_seminar->name))));
         if ($lockdata['description']) {
             PageLayout::postMessage(MessageBox::info(formatLinks($lockdata['description'])));
         }
         $this->redirect('my_courses/index');
         return;
     }
     if (Request::option('cmd') == 'back') {
         $this->redirect('my_courses/index');
         return;
     }
     if (Request::option('cmd') != 'kill' && Request::option('cmd') != 'kill_admission') {
         if ($current_seminar->admission_binding && Request::get('cmd') != 'suppose_to_kill_admission' && !LockRules::Check($current_seminar->getId(), 'participants')) {
             PageLayout::postMessage(MessageBox::error(sprintf(_("Die Veranstaltung <b>%s</b> ist als <b>bindend</b> angelegt.\n                    Wenn Sie sich abmelden wollen, müssen Sie sich an die Lehrende der Veranstaltung wenden."), htmlReady($current_seminar->name))));
             $this->redirect('my_courses/index');
             return;
         }
         if (Request::get('cmd') == 'suppose_to_kill') {
             // check course admission
             list(, $admission_end_time) = @array_values($current_seminar->getAdmissionTimeFrame());
             $admission_enabled = $current_seminar->isAdmissionEnabled();
             $admission_locked = $current_seminar->isAdmissionLocked();
             if ($admission_enabled || $admission_locked || (int) $current_seminar->admission_prelim == 1) {
                 $message = sprintf(_('Wollen Sie sich von der teilnahmebeschränkten Veranstaltung "%s" wirklich abmelden? Sie verlieren damit die Berechtigung für die Veranstaltung und müssen sich ggf. neu anmelden!'), $current_seminar->name);
             } else {
                 if (isset($admission_end_time) && $admission_end_time < time()) {
                     $message = sprintf(_('Wollen Sie sich von der teilnahmebeschränkten Veranstaltung "%s" wirklich abmelden? Der Anmeldzeitraum ist abgelaufen und Sie können sich nicht wieder anmelden!'), $current_seminar->name);
                 } else {
                     $message = sprintf(_('Wollen Sie sich von der Veranstaltung "%s" wirklich abmelden?'), $current_seminar->name);
                 }
             }
             $this->flash['cmd'] = 'kill';
         } else {
             if (admission_seminar_user_get_position($GLOBALS['user']->id, $course_id) === false) {
                 $message = sprintf(_('Wollen Sie sich von der Anmeldeliste der Veranstaltung "%s" wirklich abmelden?'), $current_seminar->name);
             } else {
                 $message = sprintf(_('Wollen Sie sich von der Warteliste der Veranstaltung "%s" wirklich abmelden? Sie verlieren damit die bereits erreichte Position und müssen sich ggf. neu anmelden!'), $current_seminar->name);
             }
             $this->flash['cmd'] = 'kill_admission';
         }
         $this->flash['decline_course'] = true;
         $this->flash['course_id'] = $course_id;
         $this->flash['message'] = $message;
         $this->flash['studipticket'] = Seminar_Session::get_ticket();
         $this->redirect('my_courses/index');
         return;
     } else {
         if (!LockRules::Check($course_id, 'participants') && $ticket_check && Request::option('cmd') != 'back' && Request::get('cmd') != 'kill_admission') {
             $query = "DELETE FROM seminar_user WHERE user_id = ? AND Seminar_id = ?";
             $statement = DBManager::get()->prepare($query);
             $statement->execute(array($GLOBALS['user']->id, $course_id));
             if ($statement->rowCount() == 0) {
                 PageLayout::postMessage(MessageBox::error(_('In der ausgewählten Veranstaltung wurde die gesuchten Personen nicht gefunden und konnte daher nicht ausgetragen werden.')));
             } else {
                 // LOGGING
                 StudipLog::log('SEM_USER_DEL', $course_id, $GLOBALS['user']->id, 'Hat sich selbst ausgetragen');
                 // enable others to do something after the user has been deleted
                 NotificationCenter::postNotification('UserDidLeaveCourse', $course_id, $GLOBALS['user']->id);
                 // Delete from statusgroups
                 RemovePersonStatusgruppeComplete(get_username(), $course_id);
                 // Are successor available
                 update_admission($course_id);
                 PageLayout::postMessage(MessageBox::success(sprintf(_("Erfolgreich von Veranstaltung <b>%s</b> abgemeldet."), htmlReady($current_seminar->name))));
             }
         } else {
             // LOGGING
             StudipLog::log('SEM_USER_DEL', $course_id, $GLOBALS['user']->id, 'Hat sich selbst aus der Warteliste ausgetragen');
             if ($current_seminar->isAdmissionEnabled()) {
                 $prio_delete = AdmissionPriority::unsetPriority($current_seminar->getCourseSet()->getId(), $GLOBALS['user']->id, $course_id);
             }
             $query = "DELETE FROM admission_seminar_user WHERE user_id = ? AND seminar_id = ?";
             $statement = DBManager::get()->prepare($query);
             $statement->execute(array($GLOBALS['user']->id, $course_id));
             if ($statement->rowCount() || $prio_delete) {
                 //Warteliste neu sortieren
                 renumber_admission($course_id);
                 //Pruefen, ob es Nachruecker gibt
                 update_admission($course_id);
                 PageLayout::postMessage(MessageBox::success(sprintf(_("Der Eintrag in der Anmelde- bzw. Warteliste der Veranstaltung <b>%s</b> wurde aufgehoben.\n                    Wenn Sie an der Veranstaltung teilnehmen wollen, müssen Sie sich erneut bewerben."), htmlReady($current_seminar->name))));
             }
         }
         $this->redirect('my_courses/index');
         return;
     }
 }
Exemplo n.º 5
0
 /**
  * Zeigt die Grunddaten an. Man beachte, dass eventuell zuvor eine andere
  * Action wie Set ausgeführt wurde, von der hierher weitergeleitet worden ist.
  * Wichtige Daten dazu wurden dann über $this->flash übertragen.
  *
  * @param md5 $course_id
  */
 public function view_action($course_id = null)
 {
     global $user, $perm, $_fullname_sql;
     $deputies_enabled = get_config('DEPUTIES_ENABLE');
     //damit QuickSearch funktioniert:
     Request::set('new_doz_parameter', $this->flash['new_doz_parameter']);
     if ($deputies_enabled) {
         Request::set('new_dep_parameter', $this->flash['new_dep_parameter']);
     }
     Request::set('new_tut_parameter', $this->flash['new_tut_parameter']);
     $this->course_id = Request::option('cid', $course_id);
     Navigation::activateItem('/course/admin/details');
     //Berechtigungscheck:
     if (!$perm->have_studip_perm("tutor", $this->course_id)) {
         throw new AccessDeniedException(_("Sie haben keine Berechtigung diese " . "Veranstaltung zu verändern."));
     }
     //Kopf initialisieren:
     PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenGrunddaten");
     PageLayout::setTitle(_("Verwaltung der Grunddaten"));
     if ($this->course_id) {
         PageLayout::setTitle(Course::find($this->course_id)->getFullname() . " - " . PageLayout::getTitle());
     }
     //Daten sammeln:
     $sem = Seminar::getInstance($this->course_id);
     $data = $sem->getData();
     //Erster Reiter des Akkordions: Grundeinstellungen
     $this->attributes = array();
     $this->attributes[] = array('title' => _("Name der Veranstaltung"), 'name' => "course_name", 'must' => true, 'type' => 'text', 'value' => $data['name'], 'locked' => LockRules::Check($this->course_id, 'Name'));
     $this->attributes[] = array('title' => _("Untertitel der Veranstaltung"), 'name' => "course_subtitle", 'type' => 'text', 'value' => $data['subtitle'], 'locked' => LockRules::Check($this->course_id, 'Untertitel'));
     $sem_types = array();
     if ($perm->have_perm("admin")) {
         foreach (SemClass::getClasses() as $sc) {
             foreach ($sc->getSemTypes() as $st) {
                 if (!$sc['course_creation_forbidden']) {
                     $sem_types[$st['id']] = $st['name'] . ' (' . $sc['name'] . ')';
                 }
             }
         }
     } else {
         $sc = $sem->getSemClass();
         foreach ($sc->getSemTypes() as $st) {
             $sem_types[$st['id']] = $st['name'] . ' (' . $sc['name'] . ')';
         }
     }
     if (!isset($sem_types[$data['status']])) {
         $sem_types[$data['status']] = $sem->getSemType()->offsetGet('name');
     }
     $this->attributes[] = array('title' => _("Typ der Veranstaltung"), 'name' => "course_status", 'must' => true, 'type' => 'select', 'value' => $data['status'], 'locked' => LockRules::Check($this->course_id, 'status'), 'choices' => array_map('htmlReady', $sem_types));
     $this->attributes[] = array('title' => _("Art der Veranstaltung"), 'name' => "course_form", 'type' => 'text', 'value' => $data['form'], 'locked' => LockRules::Check($this->course_id, 'art'));
     $this->attributes[] = array('title' => _("Veranstaltungs-Nummer"), 'name' => "course_seminar_number", 'type' => 'text', 'value' => $data['seminar_number'], 'locked' => LockRules::Check($this->course_id, 'VeranstaltungsNummer'));
     $this->attributes[] = array('title' => _("ECTS-Punkte"), 'name' => "course_ects", 'type' => 'text', 'value' => $data['ects'], 'locked' => LockRules::Check($this->course_id, 'ects'));
     $this->attributes[] = array('title' => _("max. Teilnehmerzahl"), 'name' => "course_admission_turnout", 'must' => false, 'type' => 'number', 'value' => $data['admission_turnout'], 'locked' => LockRules::Check($this->course_id, 'admission_turnout'), 'min' => '0');
     $this->attributes[] = array('title' => _("Beschreibung"), 'name' => "course_description", 'type' => 'textarea', 'value' => $data['description'], 'locked' => LockRules::Check($this->course_id, 'Beschreibung'));
     //Zweiter Reiter: Institute
     $this->institutional = array();
     $institute = Institute::getMyInstitutes();
     $choices = array();
     foreach ($institute as $inst) {
         //$choices[$inst['Institut_id']] = $inst['Name'];
         $choices[$inst['Institut_id']] = ($inst['is_fak'] ? "<span style=\"font-weight: bold\">" : "&nbsp;&nbsp;&nbsp;&nbsp;") . htmlReady($inst['Name']) . ($inst['is_fak'] ? "</span>" : "");
     }
     $this->institutional[] = array('title' => _("Heimat-Einrichtung"), 'name' => "course_institut_id", 'must' => true, 'type' => 'select', 'value' => $data['institut_id'], 'choices' => $choices, 'locked' => LockRules::Check($this->course_id, 'Institut_id'));
     $institute = Institute::getInstitutes();
     $choices = array();
     foreach ($institute as $inst) {
         $choices[$inst['Institut_id']] = ($inst['is_fak'] ? "<span style=\"font-weight: bold\">" : "&nbsp;&nbsp;&nbsp;&nbsp;") . htmlReady($inst['Name']) . ($inst['is_fak'] ? "</span>" : "");
     }
     $sem_institutes = $sem->getInstitutes();
     $inst = array_flip($sem_institutes);
     unset($inst[$sem->institut_id]);
     $inst = array_flip($inst);
     $this->institutional[] = array('title' => _("beteiligte Einrichtungen"), 'name' => "related_institutes[]", 'type' => 'multiselect', 'value' => $inst, 'choices' => $choices, 'locked' => LockRules::Check($this->course_id, 'seminar_inst'));
     $this->dozent_is_locked = LockRules::Check($this->course_id, 'dozent');
     $this->tutor_is_locked = LockRules::Check($this->course_id, 'tutor');
     //Dritter Reiter: Personal
     $this->dozenten = $sem->getMembers('dozent');
     $instUsers = new SimpleCollection(InstituteMember::findByInstituteAndStatus($sem->getInstitutId(), 'dozent'));
     $this->lecturersOfInstitute = $instUsers->pluck('user_id');
     if (SeminarCategories::getByTypeId($sem->status)->only_inst_user) {
         $search_template = "user_inst_not_already_in_sem";
     } else {
         $search_template = "user_not_already_in_sem";
     }
     $this->dozentUserSearch = new PermissionSearch($search_template, sprintf(_("%s suchen"), get_title_for_status('dozent', 1, $sem->status)), "user_id", array('permission' => 'dozent', 'seminar_id' => $this->course_id, 'sem_perm' => 'dozent', 'institute' => $sem_institutes));
     $this->dozenten_title = get_title_for_status('dozent', 1, $sem->status);
     $this->deputies_enabled = $deputies_enabled;
     if ($this->deputies_enabled) {
         $this->deputies = getDeputies($this->course_id);
         $this->deputySearch = new PermissionSearch("user_not_already_in_sem_or_deputy", sprintf(_("%s suchen"), get_title_for_status('deputy', 1, $sem->status)), "user_id", array('permission' => getValidDeputyPerms(), 'seminar_id' => $this->course_id));
         $this->deputy_title = get_title_for_status('deputy', 1, $sem->status);
     }
     $this->tutoren = $sem->getMembers('tutor');
     $this->tutorUserSearch = new PermissionSearch($search_template, sprintf(_("%s suchen"), get_title_for_status('tutor', 1, $sem->status)), "user_id", array('permission' => array('dozent', 'tutor'), 'seminar_id' => $this->course_id, 'sem_perm' => array('dozent', 'tutor'), 'institute' => $sem_institutes));
     $this->tutor_title = get_title_for_status('tutor', 1, $sem->status);
     $instUsers = new SimpleCollection(InstituteMember::findByInstituteAndStatus($sem->getInstitutId(), 'tutor'));
     $this->tutorsOfInstitute = $instUsers->pluck('user_id');
     unset($instUsers);
     //Vierter Reiter: Beschreibungen (darunter Datenfelder)
     $this->descriptions[] = array('title' => _("Teilnehmde"), 'name' => "course_participants", 'type' => 'textarea', 'value' => $data['participants'], 'locked' => LockRules::Check($this->course_id, 'teilnehmer'));
     $this->descriptions[] = array('title' => _("Voraussetzungen"), 'name' => "course_requirements", 'type' => 'textarea', 'value' => $data['requirements'], 'locked' => LockRules::Check($this->course_id, 'voraussetzungen'));
     $this->descriptions[] = array('title' => _("Lernorganisation"), 'name' => "course_orga", 'type' => 'textarea', 'value' => $data['orga'], 'locked' => LockRules::Check($this->course_id, 'lernorga'));
     $this->descriptions[] = array('title' => _("Leistungsnachweis"), 'name' => "course_leistungsnachweis", 'type' => 'textarea', 'value' => $data['leistungsnachweis'], 'locked' => LockRules::Check($this->course_id, 'leistungsnachweis'));
     $this->descriptions[] = array('title' => _("Ort") . "<br><span style=\"font-size: 0.8em\"><b>" . _("Achtung:") . "&nbsp;</b>" . _("Diese Ortsangabe wird nur angezeigt, wenn keine " . "Angaben aus Zeiten oder Sitzungsterminen gemacht werden können.") . "</span>", 'name' => "course_location", 'type' => 'textarea', 'value' => $data['location'], 'locked' => LockRules::Check($this->course_id, 'Ort'));
     $datenfelder = DataFieldEntry::getDataFieldEntries($this->course_id, 'sem', $data["status"]);
     if ($datenfelder) {
         foreach ($datenfelder as $datenfeld) {
             if ($datenfeld->isVisible()) {
                 $locked = !$datenfeld->isEditable() || LockRules::Check($this->course_id, $datenfeld->getID());
                 $this->descriptions[] = array('title' => $datenfeld->getName(), 'must' => $datenfeld->isRequired(), 'name' => "datafield_" . $datenfeld->getID(), 'type' => "datafield", 'html_value' => $datenfeld->getHTML("datafields"), 'display_value' => $datenfeld->getDisplayValue(), 'locked' => $locked, 'description' => !$datenfeld->isEditable() ? "Diese Felder werden zentral durch die zuständigen Administratoren erfasst." : $datenfeld->getDescription());
             }
         }
     }
     $this->descriptions[] = array('title' => _("Sonstiges"), 'name' => "course_misc", 'type' => 'textarea', 'value' => $data['misc'], 'locked' => LockRules::Check($this->course_id, 'Sonstiges'));
     $this->perm_dozent = $perm->have_studip_perm("dozent", $this->course_id);
     $this->mkstring = $data['mkdate'] ? date("d.m.Y, G:i", $data['mkdate']) : _("unbekannt");
     $this->chstring = $data['chdate'] ? date("d.m.Y, G:i", $data['chdate']) : _("unbekannt");
     $lockdata = LockRules::getObjectRule($this->course_id);
     if ($lockdata['description'] && LockRules::CheckLockRulePermission($this->course_id, $lockdata['permission'])) {
         $this->flash['msg'] = array_merge((array) $this->flash['msg'], array(array("info", formatLinks($lockdata['description']))));
     }
     $this->flash->discard();
     //schmeißt ab jetzt unnötige Variablen aus der Session.
     $sidebar = Sidebar::get();
     $sidebar->setImage("sidebar/admin-sidebar.png");
     $widget = new ActionsWidget();
     $widget->addLink(_('Bild ändern'), $this->url_for('course/avatar/update', $course_id), Icon::create('edit', 'clickable'));
     if ($this->deputies_enabled) {
         if (isDeputy($user->id, $this->course_id)) {
             $newstatus = 'dozent';
             $text = _('Lehrende werden');
         } else {
             if (in_array($user->id, array_keys($this->dozenten)) && sizeof($this->dozenten) > 1) {
                 $newstatus = 'deputy';
                 $text = _('Vertretung werden');
             }
         }
         $widget->addLink($text, $this->url_for('course/basicdata/switchdeputy', $this->course_id, $newstatus), Icon::create('persons', 'clickable'));
     }
     $sidebar->addWidget($widget);
     // Entry list for admin upwards.
     if ($perm->have_studip_perm("admin", $this->course_id)) {
         $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);
         $sidebar->addWidget($list);
     }
 }
Exemplo n.º 6
0
            $_SESSION['archiv_assi_data']["pos"] = $_SESSION['archiv_assi_data']["pos"] + $i;
    }

// dec if we have lectures left in the lower
if (Request::option('dec'))
    if ($_SESSION['archiv_assi_data']["pos"] > 0) {
        $d = -1;
        while ((!$_SESSION['archiv_assi_data']["sem_check"][$_SESSION['archiv_assi_data']["sems"][$_SESSION['archiv_assi_data']["pos"] + $d]["id"]]) && ($_SESSION['archiv_assi_data']["pos"] + $d > 0))
            $d--;
        if ((sizeof($_SESSION['archiv_assi_data']["sem_check"]) > 1) && ($_SESSION['archiv_assi_data']["sem_check"][$_SESSION['archiv_assi_data']["sems"][$_SESSION['archiv_assi_data']["pos"] + $d]["id"]]))
            $_SESSION['archiv_assi_data']["pos"] = $_SESSION['archiv_assi_data']["pos"] + $d;
    }


if (LockRules::Check($_SESSION['archiv_assi_data']["sems"][$_SESSION['archiv_assi_data']["pos"]]["id"], 'seminar_archive')) {
    $lockdata = LockRules::getObjectRule($_SESSION['archiv_assi_data']["sems"][$_SESSION['archiv_assi_data']["pos"]]["id"]);
    if ($lockdata['description']) {
        $details = formatLinks($lockdata['description']);
    } else {
        $details = _("Die Veranstaltung kann nicht archiviert werden.");
    }
    throw new AccessDeniedException($details);
}

// Delete (and archive) the lecture
if (Request::option('archive_kill')) {
    $run = TRUE;
    $s_id = $_SESSION['archiv_assi_data']["sems"][$_SESSION['archiv_assi_data']["pos"]]["id"];
    // # Do we have permission to do so?

    if (!$perm->have_perm($check_perm)) {
                    printf(_("Module") . "<br>%s", LinkButton::create(_('Bearbeiten'), URLHelper::getURL('', array('range_id' => $seminar_id))));
                    break;
                case 'admin_vote.php':
                    printf(_("Umfragen und Tests") . "<br>%s", LinkButton::create(_('Bearbeiten'),
                    URLHelper::getURL('', array('view' => 'vote_sem', 'showrangeID' => $seminar_id))));
                    break;
                case 'admin_evaluation.php':
                    printf(_("Evaluationen") . "<br>%s", LinkButton::create(_('Bearbeiten'),
                    URLHelper::getURL('', array('view' => 'eval_sem', 'rangeID' => $seminar_id))));
                    break;
                case "copy_assi.php":
                    printf(_("Veranstaltung") . "<br>%s", LinkButton::create(_('Kopieren'),
                    URLHelper::getURL('admin_seminare_assi.php', array('cmd' => 'do_copy', 'start_level' => TRUE, 'class' => '1', 'cp_id' => $seminar_id))));
                    break;
                case "admin_lock.php":
                    $rule = LockRules::getObjectRule($seminar_id);
                    if(!$perm->have_perm('root') && ($rule['permission'] == 'admin' || $rule['permission'] == 'root')){
                        echo '<div style="margin-bottom:3px;font-weight:bold;text-align:left">'._("zugewiesen") . ': ' . htmlReady($rule['name']).'</div>';
                    } else {
                        ?>
                        <input type="hidden" name="make_lock" value=1>
                        <select name=lock_sem[<? echo $seminar_id ?>]>
                        <option value="none" <?php 
echo Request::option('lock_all') == 'none' || !$rule['lock_id'] ? 'selected' : '';
?>
 >-- <?php 
echo _("keine Sperrebene");
?>
 --</option>
                        <?
                            foreach($seminar_lock_rules as $lr) {
Exemplo n.º 8
0
 /**
  * Display the account information of a user
  */
 public function index_action()
 {
     $this->locked_info = LockRules::CheckLockRulePermission($this->user['user_id']) ? LockRules::getObjectRule($this->user['user_id'])->description : false;
     $auth = StudipAuthAbstract::GetInstance($this->user->auth_plugin ?: 'standard');
     $this->is_sso = $auth instanceof StudipAuthSSO;
 }
Exemplo n.º 9
0
 /**
  * returns array with information about enrolment to this course for given user_id
  * ['enrolment_allowed'] : true or false
  * ['cause']: keyword to describe the cause
  * ['description'] : readable description of the cause
  *
  * @param string $user_id
  * @return array
  */
 public function getEnrolmentInfo($user_id)
 {
     $info = array();
     $user = User::find($user_id);
     if ($this->read_level == 0 && get_config('ENABLE_FREE_ACCESS') && !$GLOBALS['perm']->get_studip_perm($this->getId(), $user_id)) {
         $info['enrolment_allowed'] = true;
         $info['cause'] = 'free_access';
         $info['description'] = _("Für die Veranstaltung ist keine Anmeldung erforderlich.");
         return $info;
     }
     if (!$user) {
         $info['enrolment_allowed'] = false;
         $info['cause'] = 'nobody';
         $info['description'] = _("Sie sind nicht angemeldet.");
         return $info;
     }
     if ($GLOBALS['perm']->have_perm('root', $user_id)) {
         $info['enrolment_allowed'] = true;
         $info['cause'] = 'root';
         $info['description'] = _("Sie dürfen ALLES.");
         return $info;
     }
     if ($GLOBALS['perm']->have_studip_perm('admin', $this->getId(), $user_id)) {
         $info['enrolment_allowed'] = true;
         $info['cause'] = 'courseadmin';
         $info['description'] = _("Sie sind Administrator_in der Veranstaltung.");
         return $info;
     }
     if ($GLOBALS['perm']->have_perm('admin', $user_id)) {
         $info['enrolment_allowed'] = false;
         $info['cause'] = 'admin';
         $info['description'] = _("Als Administrator_in können Sie sich nicht für eine Veranstaltung anmelden.");
         return $info;
     }
     //Ist bereits Teilnehmer
     if ($GLOBALS['perm']->have_studip_perm('user', $this->getId(), $user_id)) {
         $info['enrolment_allowed'] = true;
         $info['cause'] = 'member';
         $info['description'] = _("Sie sind für die Veranstaltung angemeldet.");
         return $info;
     }
     $admission_status = $user->admission_applications->findBy('seminar_id', $this->getId())->val('status');
     if ($admission_status == 'accepted') {
         $info['enrolment_allowed'] = false;
         $info['cause'] = 'accepted';
         $info['description'] = _("Sie wurden für diese Veranstaltung vorläufig akzeptiert.");
         return $info;
     }
     if ($admission_status == 'awaiting') {
         $info['enrolment_allowed'] = false;
         $info['cause'] = 'awaiting';
         $info['description'] = _("Sie stehen auf der Warteliste für diese Veranstaltung.");
         return $info;
     }
     if ($GLOBALS['perm']->get_perm($user_id) == 'user') {
         $info['enrolment_allowed'] = false;
         $info['cause'] = 'user';
         $info['description'] = _("Sie haben nicht die erforderliche Berechtigung sich für eine Veranstaltung anzumelden.");
         return $info;
     }
     //falsche Nutzerdomäne
     $same_domain = true;
     $user_domains = UserDomain::getUserDomainsForUser($user_id);
     if (count($user_domains) > 0) {
         $seminar_domains = UserDomain::getUserDomainsForSeminar($this->getId());
         $same_domain = count(array_intersect($seminar_domains, $user_domains)) > 0;
     }
     if (!$same_domain && !$this->isStudygroup()) {
         $info['enrolment_allowed'] = false;
         $info['cause'] = 'domain';
         $info['description'] = _("Sie sind nicht in einer zugelassenenen Nutzerdomäne, Sie können sich nicht eintragen!");
         return $info;
     }
     //Teilnehmerverwaltung mit Sperregel belegt
     if (LockRules::Check($this->getId(), 'participants')) {
         $info['enrolment_allowed'] = false;
         $info['cause'] = 'locked';
         $lockdata = LockRules::getObjectRule($this->getId());
         $info['description'] = _("In diese Veranstaltung können Sie sich nicht eintragen!") . ($lockdata['description'] ? '<br>' . formatLinks($lockdata['description']) : '');
         return $info;
     }
     //Veranstaltung unsichtbar für aktuellen Nutzer
     if (!$this->visible && !$this->isStudygroup() && !$GLOBALS['perm']->have_perm(get_config('SEM_VISIBILITY_PERM'), $user_id)) {
         $info['enrolment_allowed'] = false;
         $info['cause'] = 'invisible';
         $info['description'] = _("Die Veranstaltung ist gesperrt, Sie können sich nicht eintragen!");
         return $info;
     }
     if ($courseset = $this->getCourseSet()) {
         $info['enrolment_allowed'] = true;
         $info['cause'] = 'courseset';
         $info['description'] = _("Die Anmeldung zu dieser Veranstaltung folgt speziellen Regeln. Lesen Sie den Hinweistext.");
         $user_prio = AdmissionPriority::getPrioritiesByUser($courseset->getId(), $user_id);
         if (isset($user_prio[$this->getId()])) {
             $info['description'] .= ' ' . sprintf(_("(Sie stehen auf der Anmeldeliste für die automatische Platzverteilung mit der Priorität %s.)"), $user_prio[$this->getId()]);
         }
         return $info;
     }
     $info['enrolment_allowed'] = true;
     $info['cause'] = 'normal';
     $info['description'] = '';
     return $info;
 }
Exemplo n.º 10
0
 public function index_action()
 {
     global $perm, $PATH_EXPORT;
     $sem = Seminar::getInstance($this->course_id);
     // old message style
     if ($_SESSION['sms_msg']) {
         $this->msg = $_SESSION['sms_msg'];
         unset($_SESSION['sms_msg']);
     }
     $this->sort_by = Request::option('sortby', 'nachname');
     $this->order = Request::option('order', 'desc');
     $this->sort_status = Request::get('sort_status');
     Navigation::activateItem('/course/members/view');
     if (Request::int('toggle')) {
         $this->order = $this->order == 'desc' ? 'asc' : 'desc';
     }
     $filtered_members = $this->members->getMembers($this->sort_status, $this->sort_by . ' ' . $this->order, !$this->is_tutor ? $this->user_id : null);
     if ($this->is_tutor) {
         $filtered_members = array_merge($filtered_members, $this->members->getAdmissionMembers($this->sort_status, $this->sort_by . ' ' . $this->order));
         $this->awaiting = $filtered_members['awaiting']->toArray('user_id username vorname nachname visible mkdate');
         $this->accepted = $filtered_members['accepted']->toArray('user_id username vorname nachname visible mkdate');
         $this->claiming = $filtered_members['claiming']->toArray('user_id username vorname nachname visible mkdate');
     }
     // Check autor-perms
     if (!$this->is_tutor) {
         SkipLinks::addIndex(_("Sichtbarkeit ändern"), 'change_visibility');
         // filter invisible user
         $this->invisibles = count($filtered_members['autor']->findBy('visible', 'no')) + count($filtered_members['user']->findBy('visible', 'no'));
         $current_user_id = $this->user_id;
         $exclude_invisibles = function ($user) use($current_user_id) {
             return $user['visible'] != 'no' || $user['user_id'] == $current_user_id;
         };
         $filtered_members['autor'] = $filtered_members['autor']->filter($exclude_invisibles);
         $filtered_members['user'] = $filtered_members['user']->filter($exclude_invisibles);
         $this->my_visibility = $this->getUserVisibility();
         if (!$this->my_visibility['iam_visible']) {
             $this->invisibles--;
         }
     }
     // get member informations
     $this->dozenten = $filtered_members['dozent']->toArray('user_id username vorname nachname');
     $this->tutoren = $filtered_members['tutor']->toArray('user_id username vorname nachname mkdate');
     $this->autoren = $filtered_members['autor']->toArray('user_id username vorname nachname visible mkdate');
     $this->users = $filtered_members['user']->toArray('user_id username vorname nachname visible mkdate');
     $this->studipticket = Seminar_Session::get_ticket();
     $this->subject = $this->getSubject();
     $this->groups = $this->status_groups;
     // Check Seminar
     if ($this->is_tutor && $sem->isAdmissionEnabled()) {
         $this->course = $sem;
         $distribution_time = $sem->getCourseSet()->getSeatDistributionTime();
         if ($sem->getCourseSet()->hasAlgorithmRun()) {
             $this->waitingTitle = _("Warteliste");
             if (!$sem->admission_disable_waitlist_move) {
                 $this->waitingTitle .= ' (' . _("automatisches Nachrücken ist eingeschaltet") . ')';
             } else {
                 $this->waitingTitle .= ' (' . _("automatisches Nachrücken ist ausgeschaltet") . ')';
             }
             $this->semAdmissionEnabled = 2;
             $this->waiting_type = 'awaiting';
         } else {
             $this->waitingTitle = sprintf(_("Anmeldeliste (Losverfahren am %s)"), strftime('%x %R', $distribution_time));
             $this->semAdmissionEnabled = 1;
             $this->awaiting = $this->claiming;
             $this->waiting_type = 'claiming';
         }
     }
     // Set the infobox
     $this->createSidebar($filtered_members, $course);
     if ($this->is_locked && $this->is_tutor) {
         $lockdata = LockRules::getObjectRule($this->course_id);
         if ($lockdata['description']) {
             PageLayout::postMessage(MessageBox::info(formatLinks($lockdata['description'])));
         }
     }
     // Check for waitlist availability (influences available actions)
     // People can be moved to waitlist if waitlist available and no automatic moving up.
     if (!$sem->admission_disable_waitlist && $sem->admission_disable_waitlist_move) {
         $this->to_waitlist_actions = true;
     }
 }
Exemplo n.º 11
0
 /**
  * show institute basicdata page
  *
  * @param mixed $i_id Optional institute id 
  * @throws AccessDeniedException
  */
 public function index_action($i_id = false)
 {
     PageLayout::setTitle(_('Verwaltung der Grunddaten'));
     Navigation::activateItem('/admin/institute/details');
     //get ID from an open Institut
     $i_view = $i_id ?: Request::option('i_view', $GLOBALS['SessSemName'][1]);
     if (!$i_view) {
         require_once 'lib/admin_search.inc.php';
         // This search just died a little inside, so it should be safe to
         // continue here but we nevertheless return just to be sure
         return;
     } elseif ($i_view === 'new') {
         closeObject();
     }
     //  allow only inst-admin and root to view / edit
     if ($i_view && !$GLOBALS['perm']->have_studip_perm('admin', $i_view) && $i_view !== 'new') {
         throw new AccessDeniedException();
     }
     //Change header_line if open object
     $header_line = getHeaderLine($i_view);
     if ($header_line) {
         PageLayout::setTitle($header_line . ' - ' . PageLayout::getTitle());
     }
     if (Request::get('i_trykill')) {
         $message = _('Sind Sie sicher, dass Sie diese Einrichtung löschen wollen?');
         $post['i_kill'] = 1;
         $post['studipticket'] = get_ticket();
         $this->question = createQuestion2($message, $post, array(), $this->url_for('institute/basicdata/delete/' . $i_view));
     }
     $lockrule = LockRules::getObjectRule($i_view);
     if ($lockrule->description && LockRules::CheckLockRulePermission($i_view, $lockrule['permission'])) {
         PageLayout::postMessage(MessageBox::info(formatLinks($lockrule->description)));
     }
     // Load institute data
     $institute = new Institute($i_view === 'new' ? null : $i_view);
     //add the free administrable datafields
     $datafields = array();
     $localEntries = DataFieldEntry::getDataFieldEntries($institute->id, 'inst');
     if ($localEntries) {
         $invalidEntries = $this->flash['invalid_entries'] ?: array();
         foreach ($localEntries as $entry) {
             if (!$entry->isVisible()) {
                 continue;
             }
             $color = '#000000';
             if (in_array($entry->getId(), $invalidEntries)) {
                 $color = '#ff0000';
             }
             $datafields[] = array('color' => $color, 'title' => $entry->getName(), 'value' => $GLOBALS['perm']->have_perm($entry->isEditable()) && !LockRules::Check($institute['Institut_id'], $entry->getId()) ? $entry->getHTML('datafields') : $entry->getDisplayValue());
         }
     }
     // Read faculties if neccessary
     if (count($institute->sub_institutes) === 0) {
         if ($GLOBALS['perm']->have_perm('root')) {
             $this->faculties = Institute::findBySQL('Institut_id = fakultaets_id ORDER BY Name ASC', array($i_view));
         } else {
             $temp = User::find($GLOBALS['user']->id)->institute_memberships->findBy('inst_perms', 'admin')->pluck('institute');
             $institutes = SimpleORMapCollection::createFromArray($temp);
             $faculties = $institutes->filter(function ($institute) {
                 return $institute->is_fak;
             });
             $this->faculties = $faculties;
         }
     }
     // Indicates whether the current user is allowed to delete the institute
     $this->may_delete = $i_view !== 'new' && !(count($institute->home_courses) || count($institute->sub_institutes)) && ($GLOBALS['perm']->have_perm('root') || $GLOBALS['perm']->is_fak_admin() && get_config('INST_FAK_ADMIN_PERMS') == 'all');
     if (!$this->may_delete) {
         //Set infotext for disabled delete-button
         $reason_txt = _('Löschen nicht möglich.');
         if (count($institute->home_courses) > 0) {
             $reason_txt .= ' ';
             $reason_txt .= sprintf(ngettext('Es ist eine Veranstaltung zugeordnet.', 'Es sind %u Veranstaltungen zugeordnet.', count($institute->home_courses)), count($institute->home_courses));
         }
         if (count($institute->sub_institutes) > 0) {
             $reason_txt .= ' ';
             $reason_txt .= sprintf(ngettext('Es ist eine Einrichtung zugeordnet.', 'Es sind %u Einrichtungen zugeordnet.', count($institute->sub_institutes)), count($institute->sub_institutes));
         }
     }
     // Indicates whether the current user is allowed to change the faculty
     $this->may_edit_faculty = $GLOBALS['perm']->is_fak_admin() && !LockRules::Check($institute['Institut_id'], 'fakultaets_id') && ($GLOBALS['perm']->have_studip_perm('admin', $institute['fakultaets_id']) || $i_view === 'new');
     // Prepare template
     $this->institute = $institute;
     $this->i_view = $i_view;
     $this->datafields = $datafields;
     $this->reason_txt = $reason_txt;
 }
Exemplo n.º 12
0
 /**
  * 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'])));
     }
 }
Exemplo n.º 13
0
$header_line = getHeaderLine($range_id);
if ($header_line)
  PageLayout::setTitle($header_line." - ".PageLayout::getTitle());

//Output starts here

// Rechtecheck
$_range_type = get_object_type($range_id);
if ($_range_type != 'sem' || !$perm->have_studip_perm('tutor', $range_id)) {
    echo "</td></tr></table>";
    page_close();
    die;
}

if(LockRules::Check($range_id, 'groups')) {
        $lockdata = LockRules::getObjectRule($range_id);
        $msg = 'error§' . _("Die Gruppen / Funktionen dieser Veranstaltung dürfen nicht verändert werden.").'§';
        if ($lockdata['description']){
            $msg .= "info§" . formatLinks($lockdata['description']).'§';
        }
        ?>
        <table border=0 align="center" cellspacing=0 cellpadding=0 width="100%">
        <tr><td class="blank" colspan=2><br>
        <?
        parse_msg($msg);
        ?>
        </td></tr>
        </table>
        <?
        page_close();
        die();