/** * Main action to display contacts */ function index_action($filter = null) { // Check if we need to add contacts $mps = MultiPersonSearch::load('contacts'); $imported = 0; foreach ($mps->getAddedUsers() as $userId) { $user_to_add = User::find($userId); if ($user_to_add) { $new_contact = array('owner_id' => User::findCurrent()->id, 'user_id' => $user_to_add->id); if ($filter && $this->group) { $new_contact['group_assignments'][] = array('statusgruppe_id' => $this->group->id, 'user_id' => $user_to_add->id); } $imported += (bool) Contact::import($new_contact)->store(); } } if ($imported) { PageLayout::postMessage(MessageBox::success(sprintf(_("%s Kontakte wurden hinzugefügt."), $imported))); } $mps->clearSession(); // write filter to local $this->filter = $filter; // Deal with navigation Navigation::activateItem('community/contacts'); // Edit CSS for quicknavigation PageLayout::addStyle('div.letterlist span {color: #c3c8cc;}'); if ($filter) { $selected = $this->group; $contacts = SimpleCollection::createFromArray(User::findMany($selected->members->pluck('user_id'))); } else { $contacts = User::findCurrent()->contacts; } $this->allContacts = $contacts; // Retrive first letter and store in that contactgroup $this->contacts = array(); foreach ($contacts as $contact) { $this->contacts[strtoupper(SimpleCollection::translitLatin1($contact->nachname[0]))][] = $contact; } // Humans are a lot better with sorted results ksort($this->contacts); $this->contacts = array_map(function ($g) { return SimpleCollection::createFromArray($g)->orderBy('nachname, vorname'); }, $this->contacts); // Init sidebar $this->initSidebar($filter); // Init person search $mps = MultiPersonSearch::get('contacts')->setTitle(_('Kontakte hinzufügen'))->setDefaultSelectedUser($this->allContacts->pluck('user_id'))->setExecuteURL($this->url_for('contact/index/' . $filter))->setSearchObject(new StandardSearch('user_id')); // Set default title $this->title = _('Alle Kontakte'); // If we have a group if ($selected) { // Set title of Table $this->title = $selected->name; // Set title of multipersonsearch $mps->setTitle(sprintf(_('Kontakte zu %s hinzufügen'), $selected->name)); $mps->addQuickfilter(_('Kontakte'), User::findCurrent()->contacts->pluck('user_id')); } // Render multiperson search $this->multiPerson = $mps->render(); }
/** * Displays the deputy information of a user. */ public function index_action() { if (Request::submitted('add_deputy') && ($deputy_id = Request::option('deputy_id'))) { $this->check_ticket(); if (isDeputy($deputy_id, $this->user->user_id)) { $this->reportError(_('%s ist bereits als Vertretung eingetragen.'), get_fullname($deputy_id, 'full')); } else { if ($deputy_id == $this->user->user_id) { $this->reportError(_('Sie können sich nicht als Ihre eigene Vertretung eintragen!')); } else { if (addDeputy($deputy_id, $this->user->user_id)) { $this->reportSuccess(_('%s wurde als Vertretung eingetragen.'), get_fullname($deputy_id, 'full')); } else { $this->reportError(_('Fehler beim Eintragen der Vertretung!')); } } } $this->redirect('settings/deputies'); return; } $deputies = getDeputies($this->user->user_id, true); $exclude_users = array($this->user->user_id); if (is_array($deputies)) { $exclude_users = array_merge($exclude_users, array_map(function ($d) { return $d['user_id']; }, $deputies)); } $this->deputies = $deputies; $this->search = new PermissionSearch('user', _('Vor-, Nach- oder Benutzername'), 'user_id', array('permission' => getValidDeputyPerms(), 'exclude_user' => $exclude_users)); $sidebar = Sidebar::Get(); $sidebar->setTitle(PageLayout::getTitle()); $actions = new ActionsWidget(); // add "add dozent" to infobox $mp = MultiPersonSearch::get('settings_add_deputy')->setLinkText(_('Neue Standardvertretung festlegen'))->setDefaultSelectedUser(array_keys($this->deputies))->setLinkIconPath('')->setTitle(_('Neue Standardvertretung festlegen'))->setExecuteURL(URLHelper::getLink('dispatch.php/settings/deputies/add_member'))->setSearchObject($this->search)->setNavigationItem('/links/settings/deputies')->render(); $element = LinkElement::fromHTML($mp, Icon::create('community+add', 'clickable')); $actions->addElement($element); Sidebar::Get()->addWidget($actions); }
<span class="visual"> <?php echo htmlReady($user['fullname']); ?> </span> <a class="remove_adressee"><?php echo Icon::create('trash', 'clickable')->asImg(['class' => "text-bottom"]); ?> </a> </li> <? endforeach ?> </ul> <?php echo QuickSearch::get("user_id", new StandardSearch("user_id"))->fireJSFunctionOnSelect("STUDIP.Messages.add_adressee")->withButton()->render(); $search_obj = new SQLSearch("SELECT auth_user_md5.user_id, {$GLOBALS['_fullname_sql']['full_rev']} as fullname, username, perms " . "FROM auth_user_md5 " . "LEFT JOIN user_info ON (auth_user_md5.user_id = user_info.user_id) " . "WHERE " . "username LIKE :input OR Vorname LIKE :input " . "OR CONCAT(Vorname,' ',Nachname) LIKE :input " . "OR CONCAT(Nachname,' ',Vorname) LIKE :input " . "OR CONCAT(Nachname,', ',Vorname) LIKE :input " . "OR Nachname LIKE :input OR " . "OR Vorname LIKE :input" . " ORDER BY fullname ASC", _("Nutzer suchen"), "user_id"); $mps = MultiPersonSearch::get("add_adressees")->setLinkText(_('Mehrere Adressaten hinzufügen'))->setTitle(_('Mehrere Adressaten hinzufügen'))->setExecuteURL(URLHelper::getURL("dispatch.php/messages/write"))->setJSFunctionOnSubmit("STUDIP.Messages.add_adressees")->setSearchObject($search_obj); foreach (Statusgruppen::findContactGroups() as $group) { $mps->addQuickfilter($group['name'], $group->members->pluck('user_id')); } echo $mps->render(); ?> <script> STUDIP.MultiPersonSearch.init(); </script> </div> <div> <label> <h4><?php echo _("Betreff"); ?> </h4>
<? # Lifter010: TODO ?> <? $roles_pos = 1; if (!isset($all_roles)) $all_roles = $roles; if (is_array($roles)) foreach ($roles as $id => $role) : $topic_class = 'table_header_bold'; if ($edit_role == $id) $topic_class = 'red_gradient'; // get dialog URLHelper::setBaseURL($GLOBALS['ABSOLUTE_URI_STUDIP']); $mp = MultiPersonSearch::get("contacts_statusgroup_" . $id) ->setLinkText("") ->setDefaultSelectedUser(array_keys(getPersonsForRole($id))) ->setTitle(_('Personen eintragen')) ->setExecuteURL(URLHelper::getLink("admin_statusgruppe.php")) ->setSearchObject($search_obj) ->addQuickfilter(_("Veranstaltungsteilnehmende"), $quickfilter_sem) ->addQuickfilter(_("MitarbeiterInnen"), $quickfilter_inst) ->addQuickfilter(_("Personen ohne Gruppe"), $quickfilter_sem_no_group) ->render(); ?> <a name="<?php echo $id; ?> " ></a> <table class="default" cellspacing="0" cellpadding="0" border="0"> <tr> <th></th>
/** * displays a paginated member overview of a studygroup * * @param string id of a studypgroup * @param string page number the current page * * @return void * */ function members_action() { $id = $_SESSION['SessionSeminar']; PageLayout::setTitle(getHeaderLine($_SESSION['SessionSeminar']) . ' - ' . _("Teilnehmende")); Navigation::activateItem('/course/members'); PageLayout::setHelpKeyword('Basis.StudiengruppenBenutzer'); Request::set('choose_member_parameter', $this->flash['choose_member_parameter']); object_set_visit_module('participants'); $this->last_visitdate = object_get_visit($id, 'participants'); $sem = Course::find($id); $this->anzahl = StudygroupModel::countMembers($id); $this->groupname = $sem->getFullname(); $this->sem_id = $id; $this->groupdescription = $sem->beschreibung; $this->moderators = $sem->getMembersWithStatus('dozent'); $this->tutors = $sem->getMembersWithStatus('tutor'); $this->autors = $sem->getMembersWithStatus('autor'); $this->accepted = $sem->admission_applicants->findBy('status', 'accepted'); $this->sem_class = Course::findCurrent()->getSemClass(); $inviting_search = new SQLSearch("SELECT auth_user_md5.user_id, {$GLOBALS['_fullname_sql']['full_rev']} as fullname, username, perms " . "FROM auth_user_md5 " . "LEFT JOIN user_info ON (auth_user_md5.user_id = user_info.user_id) " . "LEFT JOIN seminar_user ON (auth_user_md5.user_id = seminar_user.user_id AND seminar_user.Seminar_id = '" . addslashes($id) . "') " . "WHERE perms NOT IN ('root', 'admin') " . "AND " . get_vis_query() . " AND (username LIKE :input OR Vorname LIKE :input " . "OR CONCAT(Vorname,' ',Nachname) LIKE :input " . "OR CONCAT(Nachname,' ',Vorname) LIKE :input " . "OR Nachname LIKE :input OR {$GLOBALS['_fullname_sql']['full_rev']} LIKE :input) " . "ORDER BY fullname ASC", _("Nutzer suchen"), "user_id"); $this->rechte = $GLOBALS['perm']->have_studip_perm("tutor", $id); $actions = new ActionsWidget(); if ($this->rechte) { $mp = MultiPersonSearch::get('studygroup_invite_' . $id)->setLinkText(_('Neue Gruppenmitglieder-/innen einladen'))->setLinkIconPath("")->setTitle(_('Neue Gruppenmitglieder/-innen einladen'))->setExecuteURL($this->url_for('course/studygroup/execute_invite/' . $id, array('view' => Request::get('view'))))->setSearchObject($inviting_search)->addQuickfilter(_('Adressbuch'), User::findCurrent()->contacts->pluck('user_id'))->setNavigationItem('/course/members')->render(); $element = LinkElement::fromHTML($mp, Icon::create('community+add', 'clickable')); $actions->addElement($element); } if ($this->rechte || $sem->getSemClass()['studygroup_mode']) { $actions->addLink(_('Nachricht an alle Gruppenmitglieder verschicken'), $this->url_for('course/studygroup/message/' . $id), Icon::create('mail', 'clickable'), array('data-dialog' => 1)); } if ($actions->hasElements()) { Sidebar::get()->addWidget($actions); } $this->invitedMembers = StudygroupModel::getInvitations($id); }
$('#factor-slider').css('width', 150); $('#factor').val(factor); $('#factor').css('display', 'none'); $('#factordiv').prepend('<span id="factorval">'+factor+'</span>'); }); </script> </div> <br/> <table class="default"> <caption> <?php echo _('Personen'); ?> <span class="actions"> <?php echo MultiPersonSearch::get('add_userlist_member_' . $userlist_id)->setTitle(_('Personen zur Liste hinzufügen'))->setSearchObject($userSearch)->setDefaultSelectedUser(array_map(function ($u) { return $u->id; }, $users))->setDataDialogStatus(Request::isXhr())->setJSFunctionOnSubmit(Request::isXhr() ? 'jQuery(this).closest(".ui-dialog-content").dialog("close");' : false)->setExecuteURL($controller->url_for('admission/userlist/add_members', $userlist_id))->render(); ?> </span> </caption> <thead> <tr> <th></th> <th><?php echo _('Name'); ?> </th> <th class="actions"><?php echo _('Aktion'); ?>
?> <? endif; ?> <? endif; ?> <a data-dialog="size=auto" title="<?php echo _('Gruppe ändern'); ?> " href="<?php echo $controller->url_for("admin/statusgroups/editGroup/{$group->id}"); ?> "> <?php echo Icon::create('edit', 'clickable', ['title' => _('Gruppe ändern')])->asImg(); ?> </a> <?php echo MultiPersonSearch::get("add_statusgroup" . $group->id)->setLinkText()->setDefaultSelectedUser($group->members->pluck('user_id'))->setTitle(_('MitgliederInnen hinzufügen'))->setExecuteURL($controller->url_for("admin/statusgroups/memberAdd/{$group->id}"))->setSearchObject($searchType)->addQuickfilter(_("aktuelle Einrichtung"), $membersOfInstitute)->render(); ?> <a data-dialog="size=auto" title="<?php echo _('Gruppe löschen'); ?> " href="<?php echo $controller->url_for("admin/statusgroups/deleteGroup/{$group->id}"); ?> "> <?php echo Icon::create('trash', 'clickable', ['title' => _('Gruppe löschen')])->asImg(); ?> </a> <a data-dialog="size=auto" title="<?php echo _('Gruppe alphabetisch sortieren'); ?>
<? endforeach ?> <? endif ?> </tbody> </table> <? endif ?> <!-- Tutoren --> <table class="default"> <caption> <?php echo htmlReady($tutor_title); ?> <? if ($perm_dozent && !$tutor_is_locked): ?> <span class="actions"> <?php echo MultiPersonSearch::get('add_member_tutor' . $course_id)->setTitle(_('Mehrere TutorInnen hinzufügen'))->setSearchObject($tutorUserSearch)->setDefaultSelectedUser(array_merge(array_keys($dozenten), array_keys($tutoren)))->setDataDialogStatus(Request::isXhr())->setJSFunctionOnSubmit(Request::isXhr() ? 'jQuery(this).closest(".ui-dialog-content").dialog("close");' : false)->setExecuteURL($controller->url_for('course/basicdata/add_member/' . $course_id . '/tutor'))->addQuickfilter(sprintf(_('%s der Einrichtung'), get_title_for_status('dozent', 2)), $lecturersOfInstitute)->addQuickfilter(sprintf(_('%s der Einrichtung'), get_title_for_status('tutor', 2)), $tutorsOfInstitute)->render(); ?> </span> <? endif; ?> </caption> <thead> <tr> <th></th> <th><?php echo _('Name'); ?> </th> <th><?php echo _('Funktion'); ?> </th>
/** * 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; }
private function createSidebar($filtered_members) { $sidebar = Sidebar::get(); $sem = Seminar::GetInstance($this->course_id); if ($this->is_tutor) { $widget = new ActionsWidget(); $url = URLHelper::getLink('dispatch.php/messages/write', array('course_id' => $this->course_id, 'default_subject' => $this->subject, 'filter' => 'all', 'emailrequest' => 1)); $widget->addLink(_('Nachricht an alle (Rundmail)'), $url, Icon::create('inbox', 'clickable'), array('data-dialog' => "buttons")); if ($this->is_dozent) { if (!$this->dozent_is_locked) { $sem_institutes = $sem->getInstitutes(); if (SeminarCategories::getByTypeId($sem->status)->only_inst_user) { $search_template = "user_inst"; } else { $search_template = "user"; } // create new search for dozent $searchtype = new PermissionSearch($search_template, sprintf(_("%s suchen"), get_title_for_status('dozent', 1, $sem->status)), "user_id", array('permission' => 'dozent', 'exclude_user' => array(), 'institute' => $sem_institutes)); // quickfilter: dozents of institut $sql = "SELECT user_id FROM user_inst WHERE Institut_id = ? AND inst_perms = 'dozent'"; $db = DBManager::get(); $statement = $db->prepare($sql, array(PDO::FETCH_NUM)); $statement->execute(array(Seminar::getInstance($this->course_id)->getInstitutId())); $membersOfInstitute = $statement->fetchAll(PDO::FETCH_COLUMN, 0); // add "add dozent" to infobox $mp = MultiPersonSearch::get('add_dozent' . $this->course_id)->setLinkText(sprintf(_('Neue/n %s eintragen'), $this->status_groups['dozent']))->setDefaultSelectedUser($filtered_members['dozent']->pluck('user_id'))->setLinkIconPath("")->setTitle(sprintf(_('Neue/n %s eintragen'), $this->status_groups['dozent']))->setExecuteURL(URLHelper::getLink('dispatch.php/course/members/execute_multipersonsearch_dozent'))->setSearchObject($searchtype)->addQuickfilter(sprintf(_('%s der Einrichtung'), $this->status_groups['dozent']), $membersOfInstitute)->setNavigationItem('/course/members/view')->render(); $element = LinkElement::fromHTML($mp, Icon::create('community+add', 'clickable')); $widget->addElement($element); } if (!$this->tutor_is_locked) { $sem_institutes = $sem->getInstitutes(); if (SeminarCategories::getByTypeId($sem->status)->only_inst_user) { $search_template = 'user_inst'; } else { $search_template = 'user'; } // create new search for tutor $searchType = new PermissionSearch($search_template, sprintf(_('%s suchen'), get_title_for_status('tutor', 1, $sem->status)), 'user_id', array('permission' => array('dozent', 'tutor'), 'exclude_user' => array(), 'institute' => $sem_institutes)); // quickfilter: tutors of institut $sql = "SELECT user_id FROM user_inst WHERE Institut_id = ? AND inst_perms = 'tutor'"; $db = DBManager::get(); $statement = $db->prepare($sql, array(PDO::FETCH_NUM)); $statement->execute(array(Seminar::getInstance($this->course_id)->getInstitutId())); $membersOfInstitute = $statement->fetchAll(PDO::FETCH_COLUMN, 0); // add "add tutor" to infobox $mp = MultiPersonSearch::get("add_tutor" . $this->course_id)->setLinkText(sprintf(_('Neue/n %s eintragen'), $this->status_groups['tutor']))->setDefaultSelectedUser($filtered_members['tutor']->pluck('user_id'))->setLinkIconPath("")->setTitle(sprintf(_('Neue/n %s eintragen'), $this->status_groups['tutor']))->setExecuteURL(URLHelper::getLink('dispatch.php/course/members/execute_multipersonsearch_tutor'))->setSearchObject($searchType)->addQuickfilter(sprintf(_('%s der Einrichtung'), $this->status_groups['tutor']), $membersOfInstitute)->setNavigationItem('/course/members/view')->render(); $element = LinkElement::fromHTML($mp, Icon::create('community+add', 'clickable')); $widget->addElement($element); } } if (!$this->is_locked) { // create new search for members $searchType = new SQLSearch("SELECT auth_user_md5.user_id, CONCAT(" . $GLOBALS['_fullname_sql']['full'] . ", \" (\", auth_user_md5.username, \")\") as fullname " . "FROM auth_user_md5 " . "LEFT JOIN user_info ON (user_info.user_id = auth_user_md5.user_id) " . "WHERE (CONCAT(auth_user_md5.Vorname, \" \", auth_user_md5.Nachname) LIKE :input " . "OR CONCAT(auth_user_md5.Nachname, \" \", auth_user_md5.Vorname) LIKE :input " . "OR auth_user_md5.username LIKE :input) " . "AND auth_user_md5.perms IN ('autor', 'tutor', 'dozent') " . " AND auth_user_md5.visible <> 'never' " . "ORDER BY Vorname, Nachname", _("Teilnehmer suchen"), "username"); // quickfilter: tutors of institut $sql = "SELECT user_id FROM user_inst WHERE Institut_id = ? AND inst_perms = 'autor'"; $db = DBManager::get(); $statement = $db->prepare($sql, array(PDO::FETCH_NUM)); $statement->execute(array(Seminar::getInstance($this->course_id)->getInstitutId())); $membersOfInstitute = $statement->fetchAll(PDO::FETCH_COLUMN, 0); // add "add autor" to infobox $mp = MultiPersonSearch::get("add_autor" . $this->course_id)->setLinkText(sprintf(_('Neue/n %s eintragen'), $this->status_groups['autor']))->setDefaultSelectedUser($filtered_members['autor']->pluck('user_id'))->setLinkIconPath("")->setTitle(sprintf(_('Neue/n %s eintragen'), $this->status_groups['autor']))->setExecuteURL(URLHelper::getLink('dispatch.php/course/members/execute_multipersonsearch_autor'))->setSearchObject($searchType)->addQuickfilter(sprintf(_('%s der Einrichtung'), $this->status_groups['autor']), $membersOfInstitute)->setNavigationItem('/course/members/view')->render(); $element = LinkElement::fromHTML($mp, Icon::create('community+add', 'clickable')); $widget->addElement($element); // add "add person to waitlist" to sidebar if ($sem->isAdmissionEnabled() && !$sem->admission_disable_waitlist && (!$sem->getFreeSeats() || $sem->admission_disable_waitlist_move)) { $ignore = array_merge($filtered_members['dozent']->pluck('user_id'), $filtered_members['tutor']->pluck('user_id'), $filtered_members['autor']->pluck('user_id'), $filtered_members['user']->pluck('user_id'), $filtered_members['awaiting']->pluck('user_id')); $mp = MultiPersonSearch::get('add_waitlist' . $this->course_id)->setLinkText(_('Neue/n Person auf Warteliste eintragen'))->setDefaultSelectedUser($ignore)->setLinkIconPath('')->setTitle(_('Neue/n Person auf Warteliste eintragen'))->setExecuteURL(URLHelper::getLink('dispatch.php/course/members/execute_multipersonsearch_waitlist'))->setSearchObject($searchType)->addQuickfilter(_('Mitglieder der Einrichtung'), $membersOfInstitute)->setNavigationItem('/course/members/view')->render(); $element = LinkElement::fromHTML($mp, Icon::create('community+add', 'clickable')); $widget->addElement($element); } } $widget->addLink(_('Teilnehmerliste importieren'), $this->url_for('course/members/import_autorlist'), Icon::create('community+add', 'clickable')); $sidebar->addWidget($widget); if (Config::get()->EXPORT_ENABLE) { include_once $GLOBALS['PATH_EXPORT'] . '/export_linking_func.inc.php'; $widget = new ExportWidget(); // create csv-export link $csvExport = export_link($this->course_id, "person", sprintf('%s %s', htmlReady($this->status_groups['autor']), htmlReady($this->course_title)), 'csv', 'csv-teiln', '', _('Teilnehmendenliste als csv-Dokument exportieren'), 'passthrough'); $widget->addLink(_('Teilnehmendenliste als CSV-Dokument exportieren'), $this->parseHref($csvExport), Icon::create('file-office', 'clickable')); // create csv-export link $rtfExport = export_link($this->course_id, "person", sprintf('%s %s', htmlReady($this->status_groups['autor']), htmlReady($this->course_title)), 'rtf', 'rtf-teiln', '', _('Teilnehmendenliste als rtf-Dokument exportieren'), 'passthrough'); $widget->addLink(_('Teilnehmendenliste als rtf-Dokument exportieren'), $this->parseHref($rtfExport), Icon::create('file-text', 'clickable')); if (count($this->awaiting) > 0) { $awaiting_rtf = export_link($this->course_id, "person", sprintf('%s %s', _("Warteliste"), htmlReady($this->course_title)), "rtf", "rtf-warteliste", $this->waiting_type, _("Warteliste als Textdokument (.rtf) exportieren"), 'passthrough'); $widget->addLink(_('Warteliste als rtf-Dokument exportieren'), $this->parseHref($awaiting_rtf), Icon::create('file-office+export', 'clickable')); $awaiting_csv = export_link($this->course_id, "person", sprintf('%s %s', _("Warteliste"), htmlReady($this->course_title)), "csv", "csv-warteliste", $this->waiting_type, _("Warteliste als Tabellendokument (.csv) exportieren"), 'passthrough'); $widget->addLink(_('Warteliste als csv-Dokument exportieren'), $this->parseHref($awaiting_csv), Icon::create('file-text+export', 'clickable')); } $sidebar->addWidget($widget); } } else { if ($this->is_autor || $this->is_user) { // Visibility preferences if (!$this->my_visibility['iam_visible']) { $text = _('Sie sind für andere Teilnehmenden auf der Teilnehmendenliste nicht sichtbar.'); $icon = Icon::create('visibility-visible', 'clickable'); $modus = 'make_visible'; $link_text = _('Klicken Sie hier, um sichtbar zu werden.'); } else { $text = _('Sie sind für andere Teilnehmenden auf der Teilnehmendenliste sichtbar.'); $icon = Icon::create('visibility-invisible', 'clickable'); $modus = 'make_invisible'; $link_text = _('Klicken Sie hier, um unsichtbar zu werden.'); } $actions = new ActionsWidget(); $actions->addLink($link_text, $this->url_for('course/members/change_visibility', $modus, $this->my_visibility['visible_mode']), $icon, array('title' => $text)); $sidebar->addWidget($actions); } } }
public function edit_action($range_id = null, $event_id = null) { $this->range_id = $range_id ?: $this->range_id; // get group and the calendars of the members // the first calendar is the calendar of the actual user $this->calendar = new SingleCalendar($GLOBALS['user']->id); $group = $this->getGroup($this->calendar); if ($group) { $calendar_owners = CalendarUser::getOwners($GLOBALS['user']->id, Calendar::PERMISSION_WRITABLE)->pluck('owner_id'); $members = $group->members->pluck('user_id'); $user_id = Request::option('user_id'); $this->attendee_ids = array_intersect($calendar_owners, $members); $this->attendee_ids[] = $GLOBALS['user']->id; if ($user_id && in_array($user_id, $this->attendee_ids)) { $this->attendee_ids = array($user_id); } } $this->event = $this->calendar->getEvent($event_id); if ($this->event->isNew()) { $this->event = $this->calendar->getNewEvent(); if (Request::get('isdayevent')) { $this->event->setStart(mktime(0, 0, 0, date('n', $this->atime), date('j', $this->atime), date('Y', $this->atime))); $this->event->setEnd(mktime(23, 59, 59, date('n', $this->atime), date('j', $this->atime), date('Y', $this->atime))); } else { $this->event->setStart($this->atime); $this->event->setEnd($this->atime + 3600); } $this->event->setAuthorId($GLOBALS['user']->id); $this->event->setEditorId($GLOBALS['user']->id); $this->event->setAccessibility('PRIVATE'); if ($this->attendee_ids) { foreach ($this->attendee_ids as $attendee_id) { $attendee_event = clone $this->event; $attendee_event->range_id = $attendee_id; $this->attendees[] = $attendee_event; } } if (!Request::isXhr()) { PageLayout::setTitle($this->getTitle($this->calendar, _('Neuer Termin'))); } } else { // open read only events and course events not as form // show information in dialog instead if (!$this->event->havePermission(Event::PERMISSION_WRITABLE) || $this->event instanceof CourseEvent) { $this->redirect($this->url_for('calendar/single/event/' . implode('/', array($this->range_id, $this->event->event_id)))); return null; } $this->attendees = $this->event->getAttendees(); if (!Request::isXhr()) { PageLayout::setTitle($this->getTitle($this->calendar, _('Termin bearbeiten'))); } } if (get_config('CALENDAR_GROUP_ENABLE') && $this->calendar->getRange() == Calendar::RANGE_USER) { $search_obj = new SQLSearch("SELECT auth_user_md5.user_id, {$GLOBALS['_fullname_sql']['full_rev']} as fullname, username, perms " . "FROM calendar_user " . "LEFT JOIN auth_user_md5 ON calendar_user.owner_id = auth_user_md5.user_id " . "LEFT JOIN user_info ON (auth_user_md5.user_id = user_info.user_id) " . 'WHERE calendar_user.user_id = ' . DBManager::get()->quote($GLOBALS['user']->id) . ' AND calendar_user.permission > ' . Event::PERMISSION_READABLE . ' AND (username LIKE :input OR Vorname LIKE :input ' . "OR CONCAT(Vorname,' ',Nachname) LIKE :input " . "OR CONCAT(Nachname,' ',Vorname) LIKE :input " . "OR Nachname LIKE :input OR {$GLOBALS['_fullname_sql']['full_rev']} LIKE :input " . ") ORDER BY fullname ASC", _('Person suchen'), 'user_id'); $this->quick_search = QuickSearch::get('user_id', $search_obj)->fireJSFunctionOnSelect('STUDIP.Messages.add_adressee'); // $default_selected_user = array($this->calendar->getRangeId()); $this->mps = MultiPersonSearch::get('add_adressees')->setLinkText(_('Mehrere Teilnehmer hinzufügen'))->setTitle(_('Mehrere Teilnehmer hinzufügen'))->setExecuteURL($this->url_for($this->base . 'edit'))->setJSFunctionOnSubmit('STUDIP.Messages.add_adressees')->setSearchObject($search_obj); $owners = SimpleORMapCollection::createFromArray(CalendarUser::findByUser_id($this->calendar->getRangeId()))->pluck('owner_id'); foreach (Calendar::getGroups($GLOBALS['user']->id) as $group) { $this->mps->addQuickfilter($group->name, $group->members->filter(function ($member) use($owners) { if (in_array($member->user_id, $owners)) { return $member; } })->pluck('user_id')); } } $stored = false; if (Request::submitted('store')) { $stored = $this->storeEventData($this->event, $this->calendar); } if ($stored !== false) { // switch back to group context $this->range_id = $group->getId(); if ($stored === 0) { if (Request::isXhr()) { header('X-Dialog-Close: 1'); exit; } else { PageLayout::postMessage(MessageBox::success(_('Der Termin wurde nicht geändert.'))); $this->relocate('calendar/group/' . $this->last_view, array('atime' => $this->atime)); } } else { PageLayout::postMessage(MessageBox::success(_('Der Termin wurde gespeichert.'))); $this->relocate('calendar/group/' . $this->last_view, array('atime' => $this->atime)); } } else { $this->createSidebar('edit', $this->calendar); $this->createSidebarFilter(); $this->render_template('calendar/single/edit', $this->layout); } }
/** * */ protected function getMultiPersonSearch($role_id) { // Multiperson search $query = "SELECT aum.user_id,\n {$GLOBALS['_fullname_sql']['full_rev']} AS fullname,\n username, perms\n FROM auth_user_md5 AS aum\n LEFT JOIN user_info AS ui ON (aum.user_id = ui.user_id)\n LEFT JOIN roles_user AS ru ON (aum.user_id = ru.userid AND ru.roleid = {$role_id})\n WHERE ru.userid IS NULL\n AND (username LIKE :input\n OR Vorname LIKE :input\n OR Nachname LIKE :input\n OR CONCAT(Vorname, ' ', Nachname) LIKE :input\n OR CONCAT(Nachname, ' ', Vorname) LIKE :input\n OR {$GLOBALS['_fullname_sql']['full_rev']} LIKE :input)\n ORDER BY fullname ASC"; $url = URLHelper::getURL('dispatch.php/admin/role/add_user/' . $role_id . '/bulk'); return MultiPersonSearch::get('add_role_users')->setLinkText(_('Personen hinzufügen'))->setTitle(_('Personen zur Rolle hinzufügen'))->setExecuteURL($url)->setSearchObject(new SQLSearch($query, _('Nutzer suchen'), 'user_id')); }
public function manage_access_action($range_id = null) { $this->range_id = $range_id ?: $this->range_id; $this->calendar = new SingleCalendar($this->range_id); $all_calendar_users = CalendarUser::getUsers($this->calendar->getRangeId()); $this->filter_groups = Statusgruppen::findByRange_id($this->calendar->getRangeId()); $this->users = array(); $this->group_filter_selected = Request::option('group_filter', 'list'); if ($this->group_filter_selected != 'list') { $contact_group = Statusgruppen::find($this->group_filter_selected); $calendar_users = array(); foreach ($contact_group->members as $member) { $calendar_users[] = new CalendarUser(array($this->calendar->getRangeId(), $member->user_id)); } $this->calendar_users = SimpleORMapCollection::createFromArray($calendar_users); } else { $this->group_filter_selected = 'list'; $this->calendar_users = $all_calendar_users; } $this->own_perms = array(); foreach ($this->calendar_users as $calendar_user) { $other_user = CalendarUser::find(array($calendar_user->user_id, $this->calendar->getRangeId())); if ($other_user) { $this->own_perms[$calendar_user->user_id] = $other_user->permission; } else { $this->own_perms[$calendar_user->user_id] = Calendar::PERMISSION_FORBIDDEN; } $this->users[strtoupper(SimpleCollection::translitLatin1($calendar_user->nachname[0]))][] = $calendar_user; } ksort($this->users); $this->users = array_map(function ($g) { return SimpleCollection::createFromArray($g)->orderBy('nachname, vorname'); }, $this->users); $this->mps = MultiPersonSearch::get('calendar-manage_access')->setTitle(_('Personhinzufügen'))->setLinkText(_('Person hinzufügen'))->setDefaultSelectedUser($all_calendar_users->pluck('user_id'))->setJSFunctionOnSubmit('STUDIP.CalendarDialog.closeMps')->setExecuteURL($this->url_for('calendar/single/add_users/' . $this->calendar->getRangeId()))->setSearchObject(new StandardSearch('user_id')); PageLayout::setTitle($this->getTitle($this->calendar, _('Kalender freigeben'))); $this->createSidebar('manage_access', $this->calendar); $this->createSidebarFilter(); }