/** * 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()->LITERATURE_ENABLE) { throw new AccessDeniedException(_('Die Literaturverwaltung ist nicht aktiviert.')); } $this->attributes['textarea'] = array('style' => 'width:98%', 'rows' => 2); $this->attributes['select'] = array(); $this->attributes['date'] = array(); $this->attributes['combo'] = array('style' => 'width:45%; display: inline;'); $this->attributes['lit_select'] = array('style' => 'font-size:8pt;width:100%'); // on AJAX request set no page layout. if (Request::isXhr()) { $this->via_ajax = true; $this->set_layout(null); $request = Request::getInstance(); foreach ($request as $key => $value) { $request[$key] = studip_utf8decode($value); } } $this->set_content_type('text/html;charset=windows-1252'); /* checkObject(); // do we have an open object? checkObjectModule('literature'); object_set_visit_module('literature');/**/ }
/** * Action which shows a js-enabled dialog form. */ public function js_form_action($name) { $mp = MultiPersonSearch::load($name); $this->name = $name; $this->description = $mp->getDescription(); $this->quickfilter = $mp->getQuickfilterIds(); $this->additionHTML = $mp->getAdditionHTML(); $this->data_dialog_status = $mp->getDataDialogStatus(); foreach ($this->quickfilter as $title => $users) { $tmp = User::findMany($users, 'ORDER BY nachname asc, vorname asc'); $this->quickfilter[$title] = $tmp; } $this->executeURL = $mp->getExecuteURL(); $this->jsFunction = $mp->getJSFunctionOnSubmit(); $tmp = User::findMany($mp->getDefaultSelectableUsersIDs(), 'ORDER BY nachname asc, vorname asc'); $this->defaultSelectableUsers = $tmp; $tmp = User::findMany($mp->getDefaultSelectedUsersIDs(), 'ORDER BY nachname asc, vorname asc'); $this->defaultSelectedUsers = $tmp; $this->ajax = Request::isXhr(); if ($this->ajax) { $this->set_layout(null); } else { $this->title = $mp->getTitle(); if ($mp->getNavigationItem() != "") { Navigation::activateItem($mp->getNavigationItem()); } } }
function update_action($range_id) { $vote_id = self::ensureMD5(Request::option('vote_id')); $choice = self::ensureMD5(Request::option('choice')); $q = \Cliqr\Question::find($vote_id); # no such active question in this range_id if (!$q->isActiveIn($range_id)) { throw new Trails_Exception(400); } $status = $q->recordAnswer($choice); if (Request::isXhr()) { if ($status) { $this->response->set_status(204, "No Content"); return $this->render_nothing(); } else { throw new Trails_Exception(500, "Could not record"); } } else { if ($status) { $this->response->set_status(204, "No Content"); } else { $this->response->set_status(500, "Could not record"); } # TODO $this->render_nothing(); } }
public function edit_images_action($plugin_id) { $this->marketplugin = new MarketPlugin($plugin_id); if (Request::isXhr()) { $this->response->add_header('X-Title', _("Galerie bearbeiten")); $this->set_layout(null); } }
protected function setDialogLayout($icon = false) { $layout = $this->get_template_factory()->open('document/dialog-layout.php'); $layout->icon = $icon; if (!Request::isXhr()) { $layout->set_layout($GLOBALS['template_factory']->open('layouts/base')); } $this->set_layout($layout); }
/** * Display the block appointments */ public function index_action() { if (!Request::isXhr()) { Navigation::activateItem('/course/admin/timesrooms'); } $this->editParams = array('fromDialog' => Request::get('fromDialog')); $this->start_ts = strtotime('this monday'); $this->request = $this->flash['request']; }
/** * **/ public function keys_action($key) { $details = $this->render_keys($key); if (Request::isXhr()) { $this->render_text(implode('<br>', $details)); } else { PageLayout::postMessage(Messagebox::info(_('Die Schlüssel in den Details dieser Meldung sollten vertraulich behandelt werden!'), $details, true)); $this->redirect('admin/index#' . $key); } }
public function review_action($plugin_id) { $this->marketplugin = new MarketPlugin($plugin_id); if ($this->marketplugin['approved']) { throw new Exception("Plugin ist schon reviewt."); } if (Request::isXhr()) { $this->response->add_header('X-Title', _("Review schreiben")); $this->set_layout(null); } }
public function details_action($termin_id) { Navigation::activateItem('/course/schedule/dates'); $this->date = new CourseDate($termin_id); $this->cancelled_dates_locked = LockRules::Check($this->date->range_id, 'cancelled_dates'); $this->dates_locked = LockRules::Check($this->date->range_id, 'room_time'); if (Request::isXhr()) { $this->set_layout(null); $this->set_content_type('text/html;Charset=windows-1252'); $this->response->add_header('X-Title', $this->date->getTypeName() . ": " . $this->date->getFullname()); } }
function index_action() { $this->questions = Question::findAll($this->cid); if (Request::isXhr()) { $this->render_json(array_map(function ($q) { return $q->toJSON(); }, $this->questions)); } else { $this->setupStudipNavigation(); $this->short_url = $this->generateShortURL(); # now render template implicitly } }
public function store_action($version) { $body = Request::get('body'); if (Request::isXhr()) { $body = studip_utf8decode($body); } submitWikiPage($this->keyword, $version, $body, $GLOBALS['user']->id, $this->range_id); $latest_version = getLatestVersion($this->keyword, $this->range_id); if (Request::isXhr()) { $this->render_json(array('version' => $latest_version['version'], 'body' => $latest_version['body'], 'messages' => implode(PageLayout::getMessages()) ?: false, 'zusatz' => getZusatz($latest_version))); } else { // Yeah, wait for the whole trailification of the wiki... } }
function after_filter($action, $args) { if (Request::isXhr()) { foreach ($this->response->headers as $k => $v) { if ($k === 'Location') { $this->response->headers['X-Location'] = $v; unset($this->response->headers['Location']); $this->response->set_status(200); $this->response->body = ''; } } } parent::after_filter($action, $args); }
/** * Callback function being called before an action is executed. */ function before_filter(&$action, &$args) { parent::before_filter($action, $args); if (Request::isXhr()) { $this->set_layout(null); $this->set_content_type('text/html;Charset=windows-1252'); } Navigation::activateItem('/start'); PageLayout::setTabNavigation(NULL); // disable display of tabs PageLayout::setHelpKeyword("Basis.Startseite"); // set keyword for new help PageLayout::setTitle(_('Startseite')); }
/** * Marks a personal notification as read by the user so it won't be displayed * in the list in the header. * @param string $id : hash-id of the notification */ public function mark_notification_read_action($id) { PersonalNotifications::markAsRead($id); if (Request::isXhr()) { $this->render_nothing(); } else { $notification = new PersonalNotifications($id); if ($notification->url) { $this->redirect(URLHelper::getUrl(TransformInternalLinks($notification->url))); } else { $this->render_nothing(); } } }
/** * common tasks for all actions */ function before_filter(&$action, &$args) { parent::before_filter($action, $args); $this->course_id = $args[0]; if (!in_array($action, words('apply claim delete order_down order_up'))) { $this->redirect($this->url_for('/apply/' . $action)); return false; } if (!get_object_type($this->course_id, array('sem'))) { throw new Trails_Exception(400); } $course = Seminar::GetInstance($this->course_id); $enrolment_info = $course->getEnrolmentInfo($GLOBALS['user']->id); //Ist bereits Teilnehmer/Admin/freier Zugriff -> gleich weiter if ($enrolment_info['enrolment_allowed'] && (in_array($enrolment_info['cause'], words('root courseadmin member')) || $enrolment_info['cause'] == 'free_access' && $GLOBALS['user']->id == 'nobody')) { $redirect_url = UrlHelper::getUrl('seminar_main.php', array('auswahl' => $this->course_id)); if (Request::isXhr()) { $this->response->add_header('X-Location', $redirect_url); $this->render_nothing(); } else { $this->redirect($redirect_url); } return false; } //Grundsätzlich verboten if (!$enrolment_info['enrolment_allowed']) { throw new AccessDeniedException($enrolment_info['description']); } PageLayout::setTitle($course->getFullname() . " - " . _("Veranstaltungsanmeldung")); PageLayout::addSqueezePackage('enrolment'); if (Request::isXhr()) { $this->set_layout(null); $this->response->add_header('X-No-Buttons', 1); $this->response->add_header('X-Title', PageLayout::getTitle()); $request = Request::getInstance(); foreach ($request as $key => $value) { $request[$key] = studip_utf8decode($value); } } else { $this->set_layout($GLOBALS['template_factory']->open('layouts/base')); } $this->set_content_type('text/html;charset=windows-1252'); if (Request::submitted('cancel')) { $this->redirect(URLHelper::getURL('dispatch.php/course/details/', array('sem_id' => $this->course_id))); } }
public function perform($unconsumed) { if ($unconsumed !== 'read_all') { return; } $global_news = StudipNews::GetNewsByRange('studip', true); foreach ($global_news as $news) { object_add_view($news['news_id']); object_set_visit($news['news_id'], 'news'); } if (Request::isXhr()) { echo json_encode(true); } else { PageLayout::postMessage(MessageBox::success(_('Alle Ankündigungen wurden als gelesen markiert.'))); header('Location: ' . URLHelper::getLink('dispatch.php/start')); } }
/** * @see AuthenticatedController::before_filter */ public function before_filter(&$action, &$args) { parent::before_filter($action, $args); if (Request::isXhr()) { $this->via_ajax = true; $this->set_layout(null); $request = Request::getInstance(); foreach ($request as $key => $value) { $request[$key] = studip_utf8decode($value); } } else { $layout = $GLOBALS['template_factory']->open('layouts/base'); $this->set_layout($layout); PageLayout::setTitle(_('Anmeldesets')); Navigation::activateItem('/tools/coursesets'); } $this->set_content_type('text/html;charset=windows-1252'); }
/** * Toggles whether a certain smiley is favored for the current user * * @param int $id Id of the smiley to favor/disfavor * @param String $view View to return to */ function favor_action($id, $view) { try { $state = $this->favorites->toggle($id); $message = $state ? _('Der Smiley wurde zu Ihren Favoriten hinzugefügt.') : _('Der Smiley gehört nicht mehr zu Ihren Favoriten.'); $msg_box = MessageBox::success($message); } catch (OutOfBoundsException $e) { $state = $this->favorites->contain($id); $message = _('Maximale Favoritenzahl erreicht. Vielleicht sollten Sie mal ausmisten? :)'); $msg_box = MessageBox::error($message); } if (Request::isXhr()) { $this->response->add_header('Content-Type', 'application/json'); $this->render_text(json_encode(array('state' => $state, 'message' => studip_utf8encode($msg_box)))); } else { PageLayout::postMessage($msg_box); $this->redirect('smileys/index/' . $view . '#smiley' . $id); } }
/** * Callback function being called before an action is executed. */ function before_filter(&$action, &$args) { parent::before_filter($action, $args); // AJAX request, so no page layout. if (Request::isXhr()) { $this->via_ajax = true; $this->set_layout(null); $request = Request::getInstance(); foreach ($request as $key => $value) { $request[$key] = studip_utf8decode($value); } // Open base layout for normal view } else { $layout = $GLOBALS['template_factory']->open('layouts/base'); $this->set_layout($layout); } $this->set_content_type('text/html;charset=windows-1252'); $this->help_admin = $GLOBALS['perm']->have_perm('root') || RolePersistence::isAssignedRole($GLOBALS['user']->id, 'Hilfe-Administrator(in)'); }
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; } }
private function setupNavigation() { global $perm; $cid = $this->getContext(); if (Request::isXhr() || Navigation::hasItem('/course/cliqr') || !$this->isActivated($cid) || !$perm->have_studip_perm("tutor", $cid)) { return; } # /course/cliqr -> plugins.php/cliqrplugin/questions $url = PluginEngine::getURL('cliqrplugin', compact('cid'), 'questions', true); $navigation = new Navigation(_('Cliqr'), $url); $navigation->setImage(Assets::image_path('icons/16/white/test.png')); $navigation->setActiveImage(Assets::image_path('icons/16/black/test.png')); # /course/cliqr/index -> plugins.php/cliqrplugin/questions#index $navigation->addSubNavigation("index", new Navigation(_("Fragen"), $url . '#index')); # /course/cliqr/new -> plugins.php/cliqrplugin/questions#new $navigation->addSubNavigation("new", new Navigation(_("Frage erstellen"), $url . '#new')); # /course/cliqr/help -> plugins.php/cliqrplugin/help $url = PluginEngine::getURL('cliqrplugin', compact('cid'), 'help', true); $navigation->addSubNavigation("help", new Navigation(_("Methodische Informationen"), $url)); Navigation::addItem('/course/cliqr', $navigation); }
function add_action($category_id) { ForumPerm::check('add_area', $this->getId()); $new_id = md5(uniqid(rand())); if (Request::isXhr()) { $name = studip_utf8decode(Request::get('name', _('Kein Titel'))); $content = studip_utf8decode(Request::get('content')); } else { $name = Request::get('name', _('Kein Titel')); $content = Request::get('content'); } ForumEntry::insert(array('topic_id' => $new_id, 'seminar_id' => $this->getId(), 'user_id' => $GLOBALS['user']->id, 'name' => $name, 'content' => $content, 'author' => get_fullname($GLOBALS['user']->id), 'author_host' => getenv('REMOTE_ADDR')), $this->getId()); ForumCat::addArea($category_id, $new_id); if (Request::isXhr()) { $this->set_layout(null); $this->entry = array_pop(ForumEntry::parseEntries(array(ForumEntry::getEntry($new_id)))); $this->visitdate = ForumVisit::getLastVisit($this->getId()); } else { $this->redirect(PluginEngine::getLink('coreforum/index/index/')); } }
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); }
/** * Common tasks for all actions. */ function before_filter(&$action, &$args) { parent::before_filter($action, $args); URLHelper::removeLinkParam('cid'); // ajax if (Request::isXhr()) { $this->via_ajax = true; $this->set_layout(null); } // user must have root permission $GLOBALS['perm']->check('root'); // set navigation Navigation::activateItem('/admin/config/banner'); //pagelayout PageLayout::setTitle(_('Verwaltung der Banner')); // Define banner target types $this->target_types = array('url' => _('URL'), 'seminar' => _('Veranstaltung'), 'inst' => _('Einrichtung'), 'user' => _('Person'), 'none' => _('Kein Verweis')); // Define banner priorities $this->priorities = array(0 => '0 (' . _('nicht anzeigen') . ')', 1 => '1 (' . _('sehr niedrig') . ')', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9', 10 => '10 (' . _('sehr hoch') . ')'); //Infobox $this->setSidebar(); }
/** * @see AuthenticatedController::before_filter */ public function before_filter(&$action, &$args) { parent::before_filter($action, $args); if (Request::isXhr()) { $this->via_ajax = true; $this->set_layout(null); $request = Request::getInstance(); foreach ($request as $key => $value) { $request[$key] = studip_utf8decode($value); } } else { $layout = $GLOBALS['template_factory']->open('layouts/base'); $this->set_layout($layout); PageLayout::setTitle(_('Personenlisten')); Navigation::activateItem('/tools/coursesets/userlists'); } PageLayout::addSqueezePackage('admission'); $this->set_content_type('text/html;charset=windows-1252'); $views = new ViewsWidget(); $views->setTitle(_('Aktionen')); $views->addLink(_('Personenliste anlegen'), $this->url_for('admission/userlist/configure'))->setActive($action == 'configure'); Sidebar::Get()->addWidget($views); }
/** * Shows where the given admission rule is activated (system wide or * only at specific institutes). * * @param String $ruleType Class name of the rule type to check. */ public function check_activation_action($ruleType) { if (Request::isXhr()) { $this->response->add_header('X-Title', _('Verfügbarkeit der Anmelderegel')); $this->response->add_header('X-No-Buttons', 1); } $this->ruleTypes = RuleAdministrationModel::getAdmissionRuleTypes(); $this->type = $ruleType; $stmt = DBManager::get()->prepare("SELECT ai.`institute_id`\n FROM `admissionrule_inst` ai\n JOIN `admissionrules` r ON (ai.`rule_id`=r.`id`)\n WHERE r.`ruletype`=?"); $stmt->execute(array($ruleType)); $this->activated = array(); $this->globally = true; $this->atInst = false; while ($current = $stmt->fetch(PDO::FETCH_ASSOC)) { if ($globally) { $globally = false; } if (!$atInst) { $atInst = true; } $institute = new Institute($current['institute_id']); $this->activated[$current['institute_id']] = $institute->name; } }
public function register_for_pluginnews_action($plugin_id) { $this->marketplugin = MarketPlugin::find($plugin_id); if (Request::isPost()) { if (Request::submitted("follow")) { $following = new MarketPluginFollower(); $following['plugin_id'] = $plugin_id; $following['user_id'] = $GLOBALS['user']->id; $following->store(); PageLayout::postMessage(MessageBox::success(_("Sie bekommen nun Informationen zu Updates dieses Plugins zugeschickt."))); } elseif (Request::submitted("unfollow")) { $following = MarketPluginFollower::findByUserAndPlugin($GLOBALS['user']->id, $plugin_id); $following->delete(); PageLayout::postMessage(MessageBox::success(_("Sie werden jetzt keine weiteren Neuigkeiten über dieses Plugin als Stud.IP Nachricht bekommen."))); } } if (Request::isXhr()) { $this->response->add_header('X-Title', _("Plugin abonnieren")); $this->set_layout(null); $this->set_content_type('text/html;charset=windows-1252'); } }
/** * After filter, closes the page. * * @param String $action Name of the action that has been invoked * @param Array $args Arguments that were passed to the action method */ public function after_filter($action, $args) { parent::after_filter($action, $args); if (Request::isXhr()) { $this->response->add_header('X-Title', PageLayout::getTitle()); } page_close(); }
<? if (!Request::isXhr()) : ?> <h1><?php echo _('Neuen Blocktermin anlegen'); ?> </h1> <? endif ?> <form <?php echo Request::isXhr() ? 'data-dialog="size=big"' : ''; ?> class="default collapsable" action="<?php echo $controller->url_for('course/block_appointments/save/' . $course_id, $editParams); ?> " method="post"> <fieldset> <legend><?php echo _('Die Veranstaltung findet in folgendem Zeitraum statt'); ?> </legend> <label for="block_appointments_start_day"> <?php echo _('Startdatum'); ?> <input type="text" class="size-m has-date-picker" id="block_appointments_start_day" name="block_appointments_start_day" value="<?php echo $request['block_appointments_start_day']; ?> ">
</tr> <tr> <td colspan="3"> <label> <?php echo _('Klicken Sie auf "Durchsuchen", um eine Datei auszuwählen'); ?> <input type="file" name="importfile"> </label> </td> </tr> </table> <?php echo CSRFProtection::tokenTag(); ?> <input type="hidden" name="studip_ticket" value="<?php echo get_ticket(); ?> "> <div style="text-align: center; clear: both" data-dialog-button> <?php echo Button::createAccept(_('Termine importieren'), 'import', array('title' => _('Termine importieren'))); ?> <? if (!Request::isXhr()) : ?> <?php echo LinkButton::create(_('Abbrechen'), $controller->url_for('calendar/single/' . $last_view)); ?> <? endif; ?> </div> </form>