/** * 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']))); } }
function show_action() { $this->url_params = array(); if (Request::get('from')) { $this->url_params['from'] = Request::get('from'); } if (Request::get('open_node')) { $this->url_params['open_node'] = Request::get('open_node'); } if (!Request::isXhr()) { Navigation::activateItem('course/admin/study_areas'); $sidebar = Sidebar::get(); $sidebar->setImage('sidebar/admin-sidebar.png'); if ($this->course) { $links = new ActionsWidget(); foreach (Navigation::getItem('/course/admin/main') as $nav) { if ($nav->isVisible(true)) { $image = $nav->getImage(); $links->addLink($nav->getTitle(), URLHelper::getLink($nav->getURL(), array('studip_ticket' => Seminar_Session::get_ticket())), $image); } } $sidebar->addWidget($links); // Entry list for admin upwards. if ($GLOBALS['perm']->have_studip_perm("admin", $GLOBALS['SessionSeminar'])) { $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); } } } if (Request::get('open_node')) { $this->values['StudyAreasWizardStep']['open_node'] = Request::get('open_node'); } $this->tree = $this->step->getStepTemplate($this->values, 0, 0); }
/** * Display the list of room requests */ public function index_action() { $this->url_params = array(); if (Request::get('origin') !== null) { $this->url_params['origin'] = Request::get('origin'); } $room_requests = RoomRequest::findBySQL(sprintf('seminar_id = %s ORDER BY seminar_id, metadate_id, termin_id', DbManager::get()->quote($this->course_id))); $this->room_requests = $room_requests; $this->request_id = Request::option('request_id'); $actions = new ActionsWidget(); $actions->addLink(_('Neue Raumanfrage erstellen'), $this->url_for('course/room_requests/new/' . $this->course_id), Icon::create('add', 'clickable')); Sidebar::get()->addWidget($actions); 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); Sidebar::get()->addWidget($list); } }
$sidebar = Sidebar::get(); $sidebar->setImage('sidebar/admin-sidebar.png'); if (Course::findCurrent()) { $links = new ActionsWidget(); foreach (Navigation::getItem('/course/admin/main') as $nav) { if ($nav->isVisible(true)) { $links->addLink($nav->getTitle(), URLHelper::getLink($nav->getURL(), array('studip_ticket' => Seminar_Session::get_ticket())), $nav->getImage(), $nav->getLinkAttributes()); } } $sidebar->addWidget($links); // Entry list for admin upwards. if ($GLOBALS['perm']->have_studip_perm("admin", $GLOBALS['SessionSeminar'])) { $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); } } ?> <ul class="boxed-grid"> <? foreach (Navigation::getItem('/course/admin') as $name => $nav): ?> <? if ($nav->isVisible() && $name != 'main'): ?> <li> <a href="<?php echo URLHelper::getLink($nav->getURL()); ?>
/** * 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\">" : " ") . 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\">" : " ") . 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:") . " </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); } }
/** * Creates the sidebar */ private function setSidebar() { $actions = new ActionsWidget(); $actions->addLink(_('Startsemester ändern'), $this->url_for('course/timesrooms/editSemester'), Icon::create('date', 'clickable'))->asDialog('size=400'); Sidebar::Get()->addWidget($actions); $widget = new SelectWidget(_('Semesterfilter'), $this->url_for('course/timesrooms/index', array('cmd' => 'applyFilter')), 'newFilter'); foreach ($this->selection as $item) { $element = new SelectElement($item['value'], $item['linktext'], $item['is_selected']); $widget->addElement($element); } Sidebar::Get()->addWidget($widget); if ($GLOBALS['perm']->have_perm('admin')) { $list = new SelectorWidget(); $list->setUrl($this->url_for('/index')); $list->setSelectParameterName('cid'); foreach (AdminCourseFilter::get()->getCourses(false) as $seminar) { $element = new SelectElement($seminar['Seminar_id'], $seminar['Name']); $list->addElement($element, 'select-' . $seminar['Seminar_id']); } $list->setSelection($this->course->id); Sidebar::Get()->addWidget($list); } }
/** * Returns all courses matching set criteria. * * @param Array $params Additional parameters * @return Array of courses */ private function getCourses($params = array()) { // Init if ($GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT === "all") { $inst = new SimpleCollection($this->insts); $inst->filter(function ($a) use(&$inst_ids) { $inst_ids[] = $a->Institut_id; }); } else { $institut = new Institute($GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT); $inst_ids[] = $GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT; if ($institut->isFaculty()) { foreach ($institut->sub_institutes->pluck("Institut_id") as $institut_id) { $inst_ids[] = $institut_id; } } } $filter = AdminCourseFilter::get(true); $filter->where("sem_classes.studygroup_mode = '0'"); if (is_object($this->semester)) { $filter->filterBySemester($this->semester->getId()); } if ($params['typeFilter'] && $params['typeFilter'] !== "all") { list($class_filter, $type_filter) = explode('_', $params['typeFilter']); if (!$type_filter && !empty($GLOBALS['SEM_CLASS'][$class_filter])) { $type_filter = array_keys($GLOBALS['SEM_CLASS'][$class_filter]->getSemTypes()); } $filter->filterByType($type_filter); } if ($GLOBALS['user']->cfg->ADMIN_COURSES_SEARCHTEXT) { $filter->filterBySearchString($GLOBALS['user']->cfg->ADMIN_COURSES_SEARCHTEXT); } if ($GLOBALS['user']->cfg->ADMIN_COURSES_TEACHERFILTER && $GLOBALS['user']->cfg->ADMIN_COURSES_TEACHERFILTER !== "all") { $filter->filterByDozent($GLOBALS['user']->cfg->ADMIN_COURSES_TEACHERFILTER); } $filter->filterByInstitute($inst_ids); if ($params['sortby'] === "status") { $filter->orderBy(sprintf('sem_classes.name %s, sem_types.name %s, VeranstaltungsNummer', $params['sortFlag'], $params['sortFlag'], $params['sortFlag']), $params['sortFlag']); } elseif ($params['sortby'] === 'completion') { $filter->orderBy('is_complete', $params['sortFlag']); } elseif ($params['sortby']) { $filter->orderBy($params['sortby'], $params['sortFlag']); } $filter->storeSettings(); $this->count_courses = $filter->countCourses(); if ($this->count_courses && $this->count_courses <= $filter->max_show_courses) { $courses = $filter->getCourses(); } else { return array(); } if (in_array('contents', $params['view_filter'])) { $sem_types = SemType::getTypes(); $modules = new Modules(); } $seminars = array_map('reset', $courses); if (!empty($seminars)) { foreach ($seminars as $seminar_id => $seminar) { $dozenten = $this->getTeacher($seminar_id); $seminars[$seminar_id]['dozenten'] = $dozenten; if (in_array('teachers', $params['view_filter'])) { if (SeminarCategories::getByTypeId($seminar['status'])->only_inst_user) { $search_template = "user_inst_not_already_in_sem"; } else { $search_template = "user_not_already_in_sem"; } $sem_helper = new Seminar(Course::buildExisting($seminar)); $dozentUserSearch = new PermissionSearch($search_template, sprintf(_("%s suchen"), get_title_for_status('dozent', 1, $seminar['status'])), "user_id", array('permission' => 'dozent', 'seminar_id' => $this->course_id, 'sem_perm' => 'dozent', 'institute' => $sem_helper->getInstitutes())); $seminars[$seminar_id]['teacher_search'] = MultiPersonSearch::get("add_member_dozent" . $seminar_id)->setTitle(_('Mehrere Lehrende hinzufügen'))->setSearchObject($dozentUserSearch)->setDefaultSelectedUser(array_keys($dozenten))->setDataDialogStatus(Request::isXhr())->setExecuteURL(URLHelper::getLink('dispatch.php/course/basicdata/add_member/' . $seminar_id, array('from' => 'admin/courses'))); } if (in_array('contents', $params['view_filter'])) { $seminars[$seminar_id]['sem_class'] = $sem_types[$seminar['status']]->getClass(); $seminars[$seminar_id]['modules'] = $modules->getLocalModules($seminar_id, 'sem', $seminar['modules'], $seminar['status']); $seminars[$seminar_id]['navigation'] = MyRealmModel::getAdditionalNavigations($seminar_id, $seminars[$seminar_id], $seminars[$seminar_id]['sem_class'], $GLOBALS['user']->id); } if ($this->selected_action == 17) { $seminars[$seminar_id]['admission_locked'] = false; if ($seminar['course_set']) { $set = new CourseSet($seminar['course_set']); if (!is_null($set) && $set->hasAdmissionRule('LockedAdmission')) { $seminars[$seminar_id]['admission_locked'] = 'locked'; } else { $seminars[$seminar_id]['admission_locked'] = 'disable'; } unset($set); } } } } return $seminars; }