Example #1
0
 /**
  * Displays the global ranking list.
  *
  * @param int $page Page of the ranking list to be displayed.
  */
 public function index_action($page = 1)
 {
     $vis_query = get_vis_query('b');
     // Calculate offsets
     $max_per_page = get_config('ENTRIES_PER_PAGE');
     if ($page < 1) {
         $page = 1;
     }
     $offset = max(0, ($page - 1) * $max_per_page);
     // Liste aller die mutig (oder eitel?) genug sind
     $query = "SELECT SQL_CALC_FOUND_ROWS a.user_id,username,score,geschlecht, {$GLOBALS['_fullname_sql']['full']} AS fullname\n                  FROM user_info AS a\n                  LEFT JOIN auth_user_md5 AS b USING (user_id)\n                  WHERE score > 0 AND locked = 0 AND {$vis_query}\n                  ORDER BY score DESC\n                  LIMIT " . (int) $offset . "," . (int) $max_per_page;
     $result = DBManager::get()->fetchAll($query);
     $count = DBManager::get()->fetchColumn("SELECT FOUND_ROWS()");
     $persons = array();
     foreach ($result as $row) {
         $row['is_king'] = StudipKing::is_king($row['user_id'], true);
         $persons[$row['user_id']] = $row;
     }
     $persons = Score::getScoreContent($persons);
     $this->persons = array_values($persons);
     $this->numberOfPersons = $count;
     $this->page = $page;
     $this->offset = $offset;
     $this->max_per_page = $max_per_page;
     $this->current_user = User::findCurrent();
     $this->current_user_score = Score::getMyScore($this->current_user);
     // Set up sidebar and helpbar
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/medal-sidebar.png');
     $actions = new OptionsWidget();
     $actions->addCheckbox(_('Ihren Wert veröffentlichen'), $this->current_user->score, $this->url_for('score/publish'), $this->url_for('score/unpublish'));
     $sidebar->addWidget($actions);
     $helpbar = Helpbar::get();
 }
Example #2
0
 /**
  * Before filter, set up the page by initializing the session and checking
  * all conditions.
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     $this->priviledged = $GLOBALS['perm']->have_studip_perm('tutor', $GLOBALS['SessSemName'][1]);
     if (Request::isXhr()) {
         $this->set_content_type('text/html;charset=Windows-1252');
     } else {
         $this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
     }
     if (!in_array($action, words('index create edit move delete'))) {
         array_unshift($args, $action);
         $action = 'index';
     }
     if (in_array($action, words('create edit move delete')) && !$this->priviledged) {
         throw new AccessDeniedException(_('Sie sind nicht berechtigt, auf diesen Bereich zuzugreifen'));
     }
     if ($GLOBALS['perm']->have_studip_perm('tutor', $GLOBALS['SessSemName'][1])) {
         $widget = new ActionsWidget();
         $widget->addLink(_('Neuen Eintrag anlegen'), $this->url_for('show/create'), 'icons/16/blue/add.png')->asDialog();
         Sidebar::get()->addWidget($widget);
     }
     PageLayout::setHelpKeyword('Basis.Informationsseite');
     /**
             checkObject(); // do we have an open object?
             checkObjectModule('scm');
             object_set_visit_module('scm');
     	 **/
 }
Example #3
0
 /**
  * Set up this controller and define the infobox
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setHelpKeyword('Basis.HomepagePersönlicheDaten');
     PageLayout::setTitle(_('Benutzerkonto bearbeiten'));
     Navigation::activateItem('/profile/edit/profile');
     SkipLinks::addIndex(_('Benutzerkonto bearbeiten'), 'layout_content');
     Sidebar::get()->setImage('sidebar/person-sidebar.png');
 }
Example #4
0
 /**
  * show institute overview page
  *
  * @return void
  */
 function index_action()
 {
     $this->sidebar = Sidebar::get();
     $this->sidebar->setImage('sidebar/institute-sidebar.png');
     if (get_config('NEWS_RSS_EXPORT_ENABLE') && $this->institute_id) {
         $rss_id = StudipNews::GetRssIdFromRangeId($this->institute_id);
         if ($rss_id) {
             PageLayout::addHeadElement('link', array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => 'RSS', 'href' => 'rss.php?id=' . $rss_id));
         }
     }
     URLHelper::bindLinkParam("inst_data", $this->institut_main_data);
     // (un)subscribe to institute
     if (Config::get()->ALLOW_SELFASSIGN_INSTITUTE && $GLOBALS['user']->id !== 'nobody' && !$GLOBALS['perm']->have_perm('admin')) {
         $widget = new ActionsWidget();
         if (!$GLOBALS['perm']->have_studip_perm('user', $this->institute_id)) {
             $url = URLHelper::getLink('dispatch.php/institute/overview', array('follow_inst' => 'on'));
             $widget->addLink(_('Einrichtung abonnieren'), $url);
         } elseif (!$GLOBALS['perm']->have_studip_perm('autor', $this->institute_id)) {
             $url = URLHelper::getLink('dispatch.php/institute/overview', array('follow_inst' => 'off'));
             $widget->addLink(_('Austragen aus der Einrichtung'), $url);
         }
         $this->sidebar->addWidget($widget);
         if (!$GLOBALS['perm']->have_studip_perm('user', $this->institute_id) and Request::option('follow_inst') == 'on') {
             $query = "INSERT IGNORE INTO user_inst\n                          (user_id, Institut_id, inst_perms)\n                          VALUES (?, ?, 'user')";
             $statement = DBManager::get()->prepare($query);
             $statement->execute(array($GLOBALS['user']->user_id, $this->institute_id));
             if ($statement->rowCount() > 0) {
                 log_event('INST_USER_ADD', $this->institute_id, $GLOBALS['user']->user_id, 'user');
                 PageLayout::postMessage(MessageBox::success(_("Sie haben die Einrichtung abonniert.")));
                 header('Location: ' . URLHelper::getURL('', array('cid' => $this->institute_id)));
                 die;
             }
         } elseif (!$GLOBALS['perm']->have_studip_perm('autor', $this->institute_id) and Request::option('follow_inst') == 'off') {
             $query = "DELETE FROM user_inst\n                          WHERE user_id = ?  AND Institut_id = ?";
             $statement = DBManager::get()->prepare($query);
             $statement->execute(array($GLOBALS['user']->user_id, $this->institute_id));
             if ($statement->rowCount() > 0) {
                 log_event('INST_USER_DEL', $this->institute_id, $GLOBALS['user']->user_id, 'user');
                 PageLayout::postMessage(MessageBox::success(_("Sie haben sich aus der Einrichtung ausgetragen.")));
                 header('Location: ' . URLHelper::getURL('', array('cid' => $this->institute_id)));
                 die;
             }
         }
     }
     // Fetch news
     $response = $this->relay('news/display/' . $this->institute_id);
     $this->news = $response->body;
     // Fetch  votes
     if (get_config('VOTE_ENABLE')) {
         $response = $this->relay('questionnaire/widget/' . $this->institute_id . '/institute');
         $this->questionnaires = $response->body;
     }
     // Fetch dates
     $response = $this->relay("calendar/contentbox/display/{$this->institute_id}/1210000");
     $this->dates = $response->body;
 }
Example #5
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setTitle(_('Studiengruppen suchen'));
     Navigation::activateItem('/community/studygroups/browse');
     PageLayout::setHelpKeyword('Basis.SuchenStudiengruppen');
     // add skip link
     SkipLinks::addIndex(Navigation::getItem('/community/studygroups/browse')->getTitle(), 'layout_content', 100);
     Sidebar::get()->setImage('sidebar/studygroup-sidebar.png');
 }
Example #6
0
 /**
  * Set up this controller.
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     PageLayout::setHelpKeyword('Basis.HomepageNutzerdomänen');
     PageLayout::setTitle(_('Nutzerdomänen bearbeiten'));
     Navigation::activateItem('/profile/edit/userdomains');
     SkipLinks::addIndex(_('Zugeordnete Nutzerdomänen'), 'assigned_userdomains');
     SkipLinks::addIndex(_('Nutzerdomäne auswählen'), 'select_userdomains');
     Sidebar::get()->setImage('sidebar/admin-sidebar.png');
 }
Example #7
0
 /**
  * Before filter, set up the page by initializing the session and checking
  * all conditions.
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!Config::Get()->ELEARNING_INTERFACE_ENABLE) {
         throw new AccessDeniedException(_('Elearning-Interface ist nicht aktiviert.'));
     } else {
         $this->elearning_active = true;
     }
     PageLayout::setHelpKeyword('Basis.Ilias');
     PageLayout::setTitle($_SESSION['SessSemName']["header_line"] . " - " . _("Lernmodule"));
     checkObject();
     // do we have an open object?
     checkObjectModule('elearning_interface');
     object_set_visit_module('elearning_interface');
     $this->search_key = Request::get('search_key');
     $GLOBALS['search_key'] = $this->search_key;
     $this->cms_select = Request::quoted('cms_select');
     $GLOBALS['cms_select'] = $this->cms_select;
     $this->open_all = Request::get('open_all');
     $this->close_all = Request::get('close_all');
     $this->new_account_cms = Request::get('new_account_cms');
     $this->module_system_type = Request::get('module_system_type');
     $this->module_id = Request::get('module_id');
     $this->module_type = Request::get('module_type');
     $this->anker_target = Request::get('anker_target');
     $this->seminar_id = $_SESSION['SessSemName'][1];
     $this->rechte = $GLOBALS['perm']->have_studip_perm('tutor', $this->seminar_id);
     if (!isset($GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->new_account_cms])) {
         unset($this->new_account_cms);
     }
     if (!isset($GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_select])) {
         unset($this->cms_select);
     }
     if ($this->seminar_id != $_SESSION['elearning_open_close']["id"]) {
         unset($_SESSION['cache_data']);
         unset($_SESSION['elearning_open_close']);
     }
     if ($this->open_all != "") {
         $_SESSION['elearning_open_close']["all open"] = true;
     } elseif ($this->close_all != "") {
         $_SESSION['elearning_open_close']["all open"] = "";
     }
     $_SESSION['elearning_open_close']["type"] = "seminar";
     $_SESSION['elearning_open_close']["id"] = $this->seminar_id;
     if (Request::get('do_open')) {
         $this->anker_target = Request::get('do_open');
         $_SESSION['elearning_open_close'][Request::get('do_open')] = true;
     } elseif (Request::get('do_close')) {
         $this->anker_target = Request::get('do_close');
         $_SESSION['elearning_open_close'][Request::get('do_close')] = false;
     }
     $this->sidebar = Sidebar::get();
     $this->sidebar->setImage('sidebar/learnmodule-sidebar.png');
     $this->sidebar->setContextAvatar(CourseAvatar::getAvatar($this->seminar_id));
 }
Example #8
0
 /**
  * Set up this controller and define the infobox
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     if ($action === 'verify') {
         $action = 'index';
     }
     parent::before_filter($action, $args);
     require_once 'lib/statusgruppe.inc.php';
     PageLayout::setHelpKeyword('Basis.HomepageUniversitäreDaten');
     PageLayout::setTitle(_('Einrichtungsdaten bearbeiten'));
     Navigation::activateItem('/profile/edit/statusgruppen');
     SkipLinks::addIndex(_('Einrichtungsdaten bearbeiten'), 'layout_content', 100);
     Sidebar::get()->setImage('sidebar/group-sidebar.png');
 }
Example #9
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'])));
     }
 }
Example #10
0
 /**
  * Set up this controller and define the infobox
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  * @throws AccessDeniedException if notifications are not globally enabled
  *                               or if the user has no access to these
  *                               notifications (admin or root accounts).
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     if (!get_config('MAIL_NOTIFICATION_ENABLE')) {
         $message = _('Die Benachrichtigungsfunktion wurde in den Systemeinstellungen nicht freigeschaltet.');
         throw new AccessDeniedException($message);
     }
     if (!$GLOBALS['auth']->is_authenticated() || $GLOBALS['perm']->have_perm('admin')) {
         throw new AccessDeniedException();
     }
     PageLayout::setHelpKeyword('Basis.MyStudIPBenachrichtigung');
     PageLayout::setTitle(_('Benachrichtigung über neue Inhalte anpassen'));
     Navigation::activateItem('/profile/settings/notification');
     SkipLinks::addIndex(_('Benachrichtigung über neue Inhalte anpassen'), 'layout_content', 100);
     Sidebar::get()->setImage('sidebar/seminar-sidebar.png');
 }
Example #11
0
 /**
  * The only method, loads the navigation object and displays it.
  */
 public function index_action()
 {
     PageLayout::setTitle(_('Sitemap'));
     foreach (Navigation::getItem('/start') as $nav) {
         $nav->setEnabled(false);
     }
     $this->navigation = Navigation::getItem('/');
     $this->quicklinks = Navigation::getItem('/links');
     $this->footer = Navigation::getItem('/footer');
     // Add sidebar
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/admin-sidebar.png');
     $info = new InfoboxWidget();
     $info->setTitle(_('Hinweise'));
     $info->addElement(new WidgetElement(_('Auf dieser Seite finden Sie eine Übersicht über alle verfügbaren Seiten.')));
     $sidebar->addWidget($info);
 }
Example #12
0
File: api.php Project: ratbird/hope
 /**
  *
  **/
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     require_once 'lib/bootstrap-api.php';
     $GLOBALS['perm']->check('root');
     Navigation::activateItem('/admin/config/api');
     PageLayout::setTitle(_('API Verwaltung'));
     $this->types = array('website' => _('Website'), 'desktop' => _('Herkömmliches Desktopprogramm'), 'mobile' => _('Mobile App'));
     // Sidebar
     $views = new ViewsWidget();
     $views->addLink(_('Registrierte Applikationen'), $this->url_for('admin/api'))->setActive($action === 'index');
     $views->addLink(_('Globale Zugriffseinstellungen'), $this->url_for('admin/api/permissions'))->setActive($action == 'permissions');
     $views->addLink(_('Konfiguration'), $this->url_for('admin/api/config'))->setActive($action == 'config');
     Sidebar::get()->addWidget($views);
     $actions = new ActionsWidget();
     $actions->addLink(_('Neue Applikation registrieren'), $this->url_for('admin/api/edit'), Icon::create('add', 'clickable'))->asDialog();
     Sidebar::get()->addWidget($actions);
 }
Example #13
0
 public function before_filter(&$action, &$args)
 {
     $this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
     $this->course = Course::findCurrent();
     if (!$this->course) {
         throw new CheckObjectException(_('Sie haben kein Objekt gewählt.'));
     } else {
         $this->sem_id = $this->course->getID();
         $this->seminar = new Seminar($this->sem_id);
     }
     //if ($GLOBALS['perm']->have_studip_perm('tutor', $GLOBALS['SessSemName'][1])) {
     $widget = new ActionsWidget();
     $widget->addLink(_('Kursverwaltung'), $this->url_for('show/course'), false);
     $widget->addLink(_('Teilnehmerverwaltung'), $this->url_for('show'), false);
     Sidebar::get()->addWidget($widget);
     //}
     Navigation::activateItem('/admin/kursadmin');
 }
Example #14
0
 /**
  * Sets up the controller
  *
  * @param String $action Which action shall be invoked
  * @param Array $args Arguments passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     // Abwärtskompatibilität, erst ab 1.1 bekannt
     if (!isset($GLOBALS['ALLOW_CHANGE_NAME'])) {
         $GLOBALS['ALLOW_CHANGE_NAME'] = TRUE;
     }
     parent::before_filter($action, $args);
     // Ensure user is logged in
     $GLOBALS['auth']->login_if($action !== 'logout' && $GLOBALS['auth']->auth['uid'] === 'nobody');
     // extract username
     $username = Request::username('username', $GLOBALS['user']->username);
     $user = User::findByUsername($username);
     if (!$GLOBALS['perm']->have_profile_perm('user', $user->user_id)) {
         $username = $GLOBALS['user']->username;
     } else {
         $username = $user->username;
         URLHelper::addLinkParam('username', $username);
     }
     $this->about = new about($username, null);
     $this->about->get_user_details();
     if (!$this->about->check) {
         $this->reportErrorWithDetails(_('Zugriff verweigert.'), array(_("Wahrscheinlich ist Ihre Session abgelaufen. Bitte " . "nutzen Sie in diesem Fall den untenstehenden Link, " . "um zurück zur Anmeldung zu gelangen.\n\n" . "Eine andere Ursache kann der Versuch des Zugriffs " . "auf Userdaten, die Sie nicht bearbeiten dürfen, sein. " . "Nutzen Sie den untenstehenden Link, um zurück auf " . "die Startseite zu gelangen."), sprintf(_('%s Hier%s geht es wieder zur Anmeldung beziehungsweise Startseite.'), '<a href="index.php">', '</a>')));
         $this->render_nothing();
         return;
     }
     $this->user = User::findByUsername($username);
     $this->restricted = $GLOBALS['perm']->get_profile_perm($this->user->user_id) !== 'user' && $username !== $GLOBALS['user']->username;
     $this->config = UserConfig::get($this->user->user_id);
     $this->validator = new email_validation_class();
     # Klasse zum Ueberpruefen der Eingaben
     $this->validator->timeout = 10;
     // Default auth plugin to standard
     if (!$this->user->auth_plugin) {
         $this->user->auth_plugin = 'standard';
     }
     PageLayout::addSqueezePackage('settings');
     // Show info message if user is not on his own profile
     if ($username != $GLOBALS['user']->username) {
         $message = sprintf(_('Daten von: %s %s (%s), Status: %s'), htmlReady($this->user->Vorname), htmlReady($this->user->Nachname), $username, $this->user->perms);
         $this->reportInfo($message);
     }
     Sidebar::get()->setImage('sidebar/person-sidebar.png');
     $this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
 }
Example #15
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     global $perm;
     if (Request::isXhr()) {
         $this->dialog = true;
     }
     PageLayout::setTitle(_('Neue Veranstaltung anlegen'));
     $navigation = new Navigation(_('Neue Veranstaltung anlegen'), 'dispatch.php/course/wizard');
     Navigation::addItem('/browse/my_courses/new_course', $navigation);
     Navigation::activateItem('/browse/my_courses/new_course');
     $this->sidebar = Sidebar::get();
     $this->sidebar->setImage('sidebar/seminar-sidebar.png');
     $this->sidebar->setTitle(_('Neue Veranstaltung anlegen'));
     $this->steps = CourseWizardStepRegistry::findBySQL("`enabled`=1 ORDER BY `number`");
     // Special handling for studygroups.
     if (Request::int('studygroup')) {
         $this->flash['studygroup'] = true;
     }
 }
Example #16
0
 /**
  * Entry point of the controller that displays the start page of Stud.IP
  *
  * @param string $action
  * @param string $widgetId
  *
  * @return void
  */
 function index_action($action = false, $widgetId = null)
 {
     $this->left = WidgetHelper::getUserWidgets($GLOBALS['user']->id, 0);
     $this->right = WidgetHelper::getUserWidgets($GLOBALS['user']->id, 1);
     if (!(count($this->left) + count($this->right))) {
         WidgetHelper::setInitialPositions();
         $this->left = WidgetHelper::getUserWidgets($GLOBALS['user']->id, 0);
         $this->right = WidgetHelper::getUserWidgets($GLOBALS['user']->id, 1);
     }
     WidgetHelper::setActiveWidget(Request::get('activeWidget'));
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/home-sidebar.png');
     $sidebar->setTitle(_("Meine Startseite"));
     $nav = new NavigationWidget();
     $nav->setTitle(_('Sprungmarken'));
     foreach (array_merge($this->left, $this->right) as $widget) {
         $nav->addLink($widget->getPluginName(), $this->url_for('start#widget-' . $widget->widget_id));
     }
     $sidebar->addWidget($nav);
     // Show action to add widget only if not all widgets have already been added.
     $actions = new ActionsWidget();
     if (WidgetHelper::getAvailableWidgets($GLOBALS['user']->id)) {
         $actions->addLink(_('Neues Widget hinzufügen'), $this->url_for('start/add'), Icon::create('add', 'clickable'))->asDialog();
     }
     $actions->addLink(_('Standard wiederherstellen'), $this->url_for('start/reset'), Icon::create('accept', 'clickable'));
     $sidebar->addWidget($actions);
     // Root may set initial positions
     if ($GLOBALS['perm']->have_perm('root')) {
         $settings = new ActionsWidget();
         $settings->setTitle(_('Einstellungen'));
         $settings->addElement(new WidgetElement(_('Standard-Startseite bearbeiten:')));
         foreach ($GLOBALS['perm']->permissions as $permission => $useless) {
             $settings->addElement(new LinkElement(ucfirst($permission), $this->url_for('start/edit_defaults/' . $permission), Icon::create('link-intern', 'clickable'), array('data-dialog' => '')));
         }
         $sidebar->addWidget($settings);
     }
     if ($GLOBALS['perm']->get_perm() == 'user') {
         PageLayout::postMessage(MessageBox::info(_('Sie haben noch nicht auf Ihre Bestätigungsmail geantwortet.'), array(_('Bitte holen Sie dies nach, um Stud.IP Funktionen wie das Belegen von Veranstaltungen nutzen zu können.'), sprintf(_('Bei Problemen wenden Sie sich an: %s'), '<a href="mailto:' . $GLOBALS['UNI_CONTACT'] . '">' . $GLOBALS['UNI_CONTACT'] . '</a>'))));
         PageLayout::postMessage(MessageBox::info(sprintf(_('Haben Sie die Bestätigungsmail an Ihre Adresse "%s" nicht erhalten?'), htmlReady($GLOBALS['user']->Email)), array(Studip\LinkButton::create(_('Bestätigungsmail erneut verschicken'), $this->url_for('start/resend_validation_mail')) . ' ' . Studip\LinkButton::create(_('Email-Adresse ändern'), $this->url_for('start/edit_mail_address'), array('data-dialog' => "size=auto", 'title' => _('Email-Adresse'))))));
     }
 }
Example #17
0
 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);
 }
Example #18
0
File: scm.php Project: ratbird/hope
 /**
  * Before filter, set up the page by initializing the session and checking
  * all conditions.
  *
  * @param String $action Name of the action to be invoked
  * @param Array  $args   Arguments to be passed to the action method
  */
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // open session
     page_open(array('sess' => 'Seminar_Session', 'auth' => 'Seminar_Default_Auth', 'perm' => 'Seminar_Perm', 'user' => 'Seminar_User'));
     // set up user session
     include 'lib/seminar_open.php';
     if (!Config::Get()->SCM_ENABLE) {
         throw new AccessDeniedException(_('Die freien Informationsseiten sind nicht aktiviert.'));
     }
     $GLOBALS['auth']->login_if(Request::get('again') && $GLOBALS['auth']->auth['uid'] == 'nobody');
     $this->priviledged = $GLOBALS['perm']->have_studip_perm('tutor', $GLOBALS['SessSemName'][1]);
     if (Request::isXhr()) {
         $this->set_content_type('text/html;charset=Windows-1252');
     } else {
         $this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
     }
     if (!in_array($action, words('index create edit move delete'))) {
         array_unshift($args, $action);
         $action = 'index';
     }
     if (in_array($action, words('create edit move delete')) && !$this->priviledged) {
         throw new AccessDeniedException();
     }
     if ($GLOBALS['perm']->have_studip_perm('tutor', $GLOBALS['SessSemName'][1])) {
         $widget = new ActionsWidget();
         $widget->addLink(_('Neuen Eintrag anlegen'), URLHelper::getLink('dispatch.php/course/scm/create'), Icon::create('add', 'clickable'))->asDialog();
         Sidebar::get()->addWidget($widget);
     }
     PageLayout::setHelpKeyword('Basis.Informationsseite');
     Navigation::activateItem('/course/scm');
     checkObject();
     // do we have an open object?
     checkObjectModule('scm');
     object_set_visit_module('scm');
     // Set sidebar image
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/info-sidebar.png');
 }
Example #19
0
 /**
  * Displays the online list.
  **/
 public function index_action()
 {
     $this->contact_count = Contact::countBySQL('owner_id=?', array(User::findCurrent()->id));
     // Total number of contacts
     $this->users = $this->getOnlineUsers($this->settings['show_groups']);
     $this->showOnlyBuddies = $this->settings['show_only_buddys'];
     $this->showGroups = $this->settings['show_groups'];
     $this->limit = Config::getInstance()->ENTRIES_PER_PAGE;
     $max_page = ceil(count($this->users['users']) / $this->limit);
     $this->page = min(Request::int('page', 1), $max_page);
     // Setup sidebar
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/person-sidebar.png');
     // Add buddy configuration option to sidebar only if the user actually
     // has buddies
     if ($this->contact_count > 0) {
         $actions = new OptionsWidget();
         $actions->addCheckbox(_('Nur Kontakte in der Übersicht der aktiven Benutzer anzeigen'), $this->settings['show_only_buddys'], $this->url_for('online/config/show_buddies/' . get_ticket()));
         $actions->addCheckbox(_('Kontaktgruppen bei der Darstellung berücksichtigen'), $this->settings['show_groups'], $this->url_for('online/config/show_groups/' . get_ticket()));
         $sidebar->addWidget($actions);
     }
 }
Example #20
0
 /**
  * Display the categories 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)
 {
     $categories = Kategorie::findByUserId($this->user->user_id);
     $visibilities = array();
     $hidden_count = 0;
     foreach ($categories as $index => $category) {
         $visibilities[$category->kategorie_id] = Visibility::getStateDescription('kat_' . $category->kategorie_id, $this->user->user_id);
         if ($this->restricted && $GLOBALS['perm']->have_perm('admin') && $visibilities[$category->kategorie_id] == VISIBILITY_ME) {
             $hidden_count += 1;
             unset($categories[$index]);
         }
     }
     $this->categories = array_values($categories);
     $this->count = count($categories);
     $this->hidden_count = $hidden_count;
     $this->visibilities = $visibilities;
     $this->verify = $verify_action ? array('action' => $verify_action, 'id' => $verify_id) : false;
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/category-sidebar.png');
     $actions = new ActionsWidget();
     $actions->addLink(_('Neue Kategorie anlegen'), $this->url_for('settings/categories/create'), Icon::create('add', 'clickable'));
     $sidebar->addWidget($actions);
 }
Example #21
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);
     }
 }
Example #22
0
 protected function createSidebarFilter()
 {
     $tmpl_factory = $this->get_template_factory();
     $filters = new SidebarWidget();
     $filters->setTitle('Auswahl');
     $tmpl = $tmpl_factory->open('calendar/single/_jump_to');
     $tmpl->atime = $this->atime;
     $tmpl->action = $this->action;
     $tmpl->action_url = $this->url_for('calendar/single/jump_to');
     $filters->addElement(new WidgetElement($tmpl->render()));
     $tmpl = $tmpl_factory->open('calendar/single/_select_category');
     $tmpl->action_url = $this->url_for();
     $tmpl->category = $this->category;
     $filters->addElement(new WidgetElement($tmpl->render()));
     if (get_config('CALENDAR_GROUP_ENABLE') || get_config('CALENDAR_COURSE_ENABLE')) {
         $tmpl = $tmpl_factory->open('calendar/single/_select_calendar');
         $tmpl->range_id = $this->range_id;
         $tmpl->action_url = $this->url_for('calendar/group/switch');
         $tmpl->view = $this->action;
         $filters->addElement(new WidgetElement($tmpl->render()));
     }
     Sidebar::get()->addWidget($filters);
 }
Example #23
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');
 }
Example #24
0
 protected function setupSidebar()
 {
     $sidebar = Sidebar::get();
     if (!$GLOBALS['rubrics_empty']) {
         $actions = new ActionsWidget();
         $actions->setTitle(_('Seiten-Aktionen'));
         if ($this->currentrubric) {
             $actions->addLink(_('Neue Seite anlegen'), $this->url_for('siteinfo/new/' . $this->currentrubric), Icon::create('add', 'clickable'));
         }
         if ($this->currentdetail) {
             $actions->addLink(_('Seite bearbeiten'), $this->url_for('siteinfo/edit/' . $this->currentrubric . '/' . $this->currentdetail), Icon::create('edit', 'clickable'));
             $actions->addLink(_('Seite löschen'), $this->url_for('siteinfo/delete/' . $this->currentrubric . '/' . $this->currentdetail), Icon::create('trash', 'clickable'));
         }
         $sidebar->addWidget($actions);
     }
     $actions = new ActionsWidget();
     $actions->setTitle(_('Rubrik-Aktionen'));
     $actions->addLink(_('Neue Rubrik anlegen'), $this->url_for('siteinfo/new'), Icon::create('add', 'clickable'));
     if ($this->currentrubric) {
         $actions->addLink(_('Rubrik bearbeiten'), $this->url_for('siteinfo/edit/' . $this->currentrubric), Icon::create('edit', 'clickable'));
         $actions->addLink(_('Rubrik löschen'), $this->url_for('siteinfo/delete/' . $this->currentrubric), Icon::create('trash', 'clickable'));
     }
     $sidebar->addWidget($actions);
 }
Example #25
0
                    printf("<font size=\"-1\"><b>%s&nbsp;</b></font>\n", htmlReady($field["name"]));
                    echo "</a>\n";
                } else
                    printf("<font size=\"-1\" color=\"black\"><b>%s&nbsp;</b></font>\n", htmlReady($field["name"]));
                echo "</td>\n";
            }
            ?>
        </tr>
        </thead>
        <?php 
echo $table_content;
?>
    </table>
<?
}
$sidebar = Sidebar::get();
$sidebar->setImage('sidebar/person-sidebar.png');
$widget = new ViewsWidget();
$widget->addLink(_('Standard'), URLHelper::getURL('?extend=no'))->setActive($extend != 'yes');
$widget->addLink(_('Erweitert'), URLHelper::getURL('?extend=yes'))->setActive($extend == 'yes');
$sidebar->addWidget($widget);

if ($admin_view) {

    if (!LockRules::Check($inst_id, 'participants')) {

        $edit = new SidebarWidget();
        $edit->setTitle(_('Personenverwaltung'));
        $edit->addElement(new WidgetElement($mp));
        $sidebar->addWidget($edit);
    }
Example #26
0
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                //
                                // Show Page
                                //
                                SkipLinks::addIndex(_("Aktuelle Seite"), 'main_content', 100);
                                showWikiPage($keyword, $version, $special, $show_wiki_comments, Request::get('hilight'));
                            }
                        }
                    }
                }
            }
        }
    }
}
// end default action
$layout = $GLOBALS['template_factory']->open('layouts/base');
$layout->content_for_layout = ob_get_clean();
if (in_array($cmd, words('show abortedit really_delete really_delete_all'))) {
    // redirect to normal view to avoid duplicate edits on reload or back/forward
    header('Location: ' . URLHelper::getURL('', compact('keyword')));
} else {
    Sidebar::get()->setImage('sidebar/wiki-sidebar.png');
    echo $layout->render();
}
// Save data back to database.
page_close();
Example #27
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);
     }
 }
Example #28
0
 /**
  * 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);
 }
Example #29
0
 /**
  * Autor / Tutor / Teacher action
  */
 public function index_action($order_by = null, $order = 'asc')
 {
     if ($GLOBALS['perm']->have_perm('root')) {
         throw new AccessDeniedException();
     }
     if ($GLOBALS['perm']->have_perm('admin')) {
         $this->redirect('my_courses/admin');
         return;
     }
     Navigation::activateItem('/browse/my_courses/list');
     PageLayout::setHelpKeyword("Basis.MeineVeranstaltungen");
     PageLayout::setTitle(_("Meine Veranstaltungen"));
     $config_sem = $GLOBALS['user']->cfg->MY_COURSES_SELECTED_CYCLE;
     if (!Config::get()->MY_COURSES_ENABLE_ALL_SEMESTERS && $config_sem == 'all') {
         $config_sem = 'future';
     }
     $this->_my_sem_open = $GLOBALS['user']->cfg->MY_COURSES_OPEN_GROUPS;
     $group_field = $GLOBALS['user']->cfg->MY_COURSES_GROUPING;
     $deputies_enabled = Config::get()->DEPUTIES_ENABLE;
     $default_deputies_enabled = Config::get()->DEPUTIES_DEFAULTENTRY_ENABLE;
     $deputies_edit_about_enabled = Config::get()->DEPUTIES_EDIT_ABOUT_ENABLE;
     $studygroups_enabled = Config::get()->MY_COURSES_ENABLE_STUDYGROUPS;
     $this->config_sem_number = Config::get()->IMPORTANT_SEMNUMBER;
     $sem_create_perm = in_array(Config::get()->SEM_CREATE_PERM, array('root', 'admin', 'dozent')) ? Config::get()->SEM_CREATE_PERM : 'dozent';
     $this->sem_data = SemesterData::GetSemesterArray();
     $sem = $config_sem && $config_sem != '0' ? $config_sem : Config::get()->MY_COURSES_DEFAULT_CYCLE;
     if (Request::option('sem_select')) {
         $sem = Request::get('sem_select', $sem);
     }
     if (!in_array($sem, words('future all last current')) && isset($sem)) {
         Request::set('sem_select', $sem);
     }
     $forced_grouping = in_array(Config::get()->MY_COURSES_FORCE_GROUPING, getValidGroupingFields()) ? Config::get()->MY_COURSES_FORCE_GROUPING : 'sem_number';
     if ($forced_grouping == 'not_grouped') {
         $forced_grouping = 'sem_number';
     }
     if (!$group_field) {
         $group_field = 'sem_number';
     }
     if ($group_field == 'sem_number' && $forced_grouping != 'sem_number') {
         $group_field = $forced_grouping;
     }
     $this->group_field = $group_field === 'not_grouped' ? 'sem_number' : $group_field;
     // Needed parameters for selecting courses
     $params = array('group_field' => $this->group_field, 'order_by' => $order_by, 'order' => $order, 'studygroups_enabled' => $studygroups_enabled, 'deputies_enabled' => $deputies_enabled);
     // Save the semester in session
     $this->sem_courses = MyRealmModel::getPreparedCourses($sem, $params);
     $this->waiting_list = MyRealmModel::getWaitingList($GLOBALS['user']->id);
     $this->sem = $sem;
     $this->order = $order;
     $this->order_by = $order_by;
     $this->default_deputies_enabled = $default_deputies_enabled;
     $this->deputies_edit_about_enabled = $deputies_edit_about_enabled;
     $this->my_bosses = $default_deputies_enabled ? getDeputyBosses($GLOBALS['user']->id) : array();
     // Check for new contents
     $new_contents = $this->check_for_new($this->sem_courses, $this->group_field);
     $this->nav_elements = MyRealmModel::calc_nav_elements($this->sem_courses, $this->group_field);
     //
     if ($tabularasa = $this->flash['tabularasa']) {
         $details = array();
         if ($new_contents) {
             $details[] = sprintf(_('Seit Ihrem letzten Seitenaufruf (%s) sind allerdings neue Inhalte hinzugekommen.'), reltime($tabularasa));
         }
         $message_box = MessageBox::success(_('Alles als gelesen markiert!'), $details);
         PageLayout::postMessage($message_box);
     }
     // create settings url depended on selected cycle
     if (isset($sem) && !in_array($sem, words('future all last current'))) {
         $this->settings_url = sprintf('dispatch.php/my_courses/groups/%s', $sem);
     } else {
         $this->settings_url = 'dispatch.php/my_courses/groups';
     }
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/seminar-sidebar.png');
     $this->setSemesterWidget($sem);
     $setting_widget = new ActionsWidget();
     if ($new_contents) {
         $setting_widget->addLink(_('Alles als gelesen markieren'), $this->url_for('my_courses/tabularasa/' . $sem . '/', time()), Icon::create('accept', 'clickable'));
     }
     $setting_widget->addLink(_('Farbgruppierung ändern'), URLHelper::getLink($this->settings_url), Icon::create('group4', 'clickable'), array('data-dialog' => ''));
     if (Config::get()->MAIL_NOTIFICATION_ENABLE) {
         $setting_widget->addLink(_('Benachrichtigungen anpassen'), URLHelper::getLink('dispatch.php/settings/notification'), Icon::create('mail', 'clickable'));
     }
     if ($sem_create_perm == 'dozent' && $GLOBALS['perm']->have_perm('dozent')) {
         $setting_widget->addLink(_('Neue Veranstaltung anlegen'), URLHelper::getLink('dispatch.php/course/wizard'), Icon::create('seminar+add', 'clickable'));
     }
     $setting_widget->addLink(_('Veranstaltung hinzufügen'), URLHelper::getLink('dispatch.php/search/courses'), Icon::create('seminar', 'clickable'));
     $sidebar->addWidget($setting_widget);
     $this->setGroupingSelector($this->group_field);
 }
Example #30
0
 /**
  * Displays accounts and elearning modules for active user
  */
 public function my_accounts_action()
 {
     global $connected_cms, $current_module, $messages;
     Navigation::activateItem('/tools/my_elearning');
     PageLayout::setTitle(_("Meine Lernmodule und Benutzer-Accounts"));
     if ($this->new_account_cms != "") {
         $this->new_account_form = ELearningUtils::getNewAccountForm($this->new_account_cms);
     }
     foreach ($GLOBALS['ELEARNING_INTERFACE_MODULES'] as $cms => $cms_preferences) {
         if (ELearningUtils::isCMSActive($cms)) {
             ELearningUtils::loadClass($cms);
             if ($cms_preferences["auth_necessary"] == true) {
                 $this->new_module_form[$cms] = ELearningUtils::getNewModuleForm($cms);
             }
             $connection_status = $connected_cms[$cms]->getConnectionStatus($cms);
             foreach ($connection_status as $type => $msg) {
                 if ($msg["error"] != "") {
                     PageLayout::postMessage(MessageBox::error(_("Es traten Probleme bei der Anbindung einzelner Lermodule auf. Bitte wenden Sie sich an Ihren Systemadministrator."), array($cms . ': ' . $msg["error"])));
                     $GLOBALS["ELEARNING_INTERFACE_" . $cms . "_ACTIVE"] = false;
                 }
             }
         }
     }
     $connected_cms = array();
     // prepare cms list
     foreach ($GLOBALS['ELEARNING_INTERFACE_MODULES'] as $cms => $cms_preferences) {
         if (ELearningUtils::isCMSActive($cms) and $cms_preferences["auth_necessary"]) {
             ELearningUtils::loadClass($cms);
             $this->cms_list[$cms] = $cms_preferences;
             $this->cms_list[$cms]['name'] = $connected_cms[$cms]->getName();
             $this->cms_list[$cms]['logo'] = $connected_cms[$cms]->getLogo();
             $this->cms_list[$cms]['modules'] = array();
             if ($this->new_account_cms != $cms) {
                 $this->cms_list[$cms]['show_account_form'] = $cms_preferences;
             }
             if ($GLOBALS["module_type_" . $cms] != "") {
                 $this->cms_list[$cms]['cms_anker_target'] = true;
             }
             if ($connected_cms[$cms]->user->isConnected()) {
                 $this->cms_list[$cms]['start_link'] = $connected_cms[$cms]->link->getStartpageLink();
             }
             if ($this->new_account_cms != $cms) {
                 if ($connected_cms[$cms]->user->isConnected()) {
                     $this->cms_list[$cms]['user'] = $connected_cms[$cms]->user->getUsername();
                     $connected_cms[$cms]->soap_client->setCachingStatus(false);
                     $this->user_content_modules = $connected_cms[$cms]->getUserContentModules();
                     $connected_cms[$cms]->soap_client->setCachingStatus(true);
                     if (!($this->user_content_modules == false)) {
                         foreach ($this->user_content_modules as $key => $connection) {
                             $connected_cms[$cms]->setContentModule($connection, false);
                             $this->cms_list[$cms]['modules'][] = $connected_cms[$cms]->content_module[$current_module]->view->show();
                         }
                     }
                     $this->cms_list[$cms]['new_module_form'] = $this->new_module_form[$cms];
                 }
             } else {
                 $this->cms_list[$cms]['account_form'] = $this->new_account_form;
             }
         }
     }
     $sidebar = Sidebar::get();
     $sidebar->setImage('sidebar/learnmodule-sidebar.png');
     $widget = new ActionsWidget();
     if ($GLOBALS['perm']->have_perm('autor') and count($this->cms_list)) {
         foreach ($this->cms_list as $cms_key => $cms_data) {
             if ($connected_cms[$cms_key]->user->isConnected()) {
                 $widget->addLink(sprintf(_('Zur %s Startseite'), $cms_data['name']), URLHelper::getScriptLink($cms_data['start_link']), Icon::create('link-extern', 'clickable'), array('target' => '_blank'));
                 $link_count++;
             }
         }
     }
     if ($link_count) {
         $sidebar->addWidget($widget);
     }
     // terminate objects
     if (is_array($connected_cms)) {
         foreach ($connected_cms as $system) {
             $system->terminate();
         }
     }
     if (is_array($messages)) {
         foreach ($messages as $mtype => $mtext) {
             PageLayout::postMessage(MessageBox::$mtype($mtext));
         }
     }
 }