public function __construct()
 {
     parent::__construct();
     if ($GLOBALS['perm']->have_perm("autor")) {
         $topicon = new Navigation(_("Lernmaterialien"), PluginEngine::getURL($this, array(), "market/overview"));
         $topicon->setImage(Icon::create('service', 'navigation'));
         Navigation::addItem("/lernmarktplatz", $topicon);
         Navigation::addItem("/lernmarktplatz/overview", new Navigation(_("Lernmarktplatz"), PluginEngine::getURL($this, array(), "market/overview")));
         Navigation::addItem("/lernmarktplatz/mymaterial", new Navigation(_("Meine Materialien"), PluginEngine::getURL($this, array(), "mymaterial/overview")));
     }
     if ($GLOBALS['perm']->have_perm("root")) {
         $tab = new Navigation(_("Lernmarktplatz"), PluginEngine::getURL($this, array(), "admin/hosts"));
         Navigation::addItem("/admin/config/lernmarktplatz", $tab);
     }
     if (UpdateInformation::isCollecting() && stripos(Request::get("page"), "plugins.php/lernmarktplatz/market/discussion/") !== false) {
         $data = Request::getArray("page_info");
         $last_update = Request::get("server_timestamp", time() - 30);
         $review_id = $data['Lernmarktplatz']['review_id'];
         $output = array('comments' => array());
         $comments = LernmarktplatzComment::findBySQL("review_id = :review_id AND mkdate >= :last_update ORDER BY mkdate ASC", array('last_update' => $last_update, 'review_id' => $review_id));
         $tf = new Flexi_TemplateFactory(__DIR__ . "/views");
         foreach ($comments as $comment) {
             $template = $tf->open("market/_comment.php");
             $template->set_attribute('comment', $comment);
             $output['comments'][] = array('comment_id' => $comment->getId(), 'html' => $template->render());
         }
         UpdateInformation::setInformation("Lernmarktplatz.update", $output);
     }
 }
Beispiel #2
0
 /**
  * Determines if a vote should show its result
  *
  * @param StudipVote $vote the vote to check
  * @return boolean true if result should be shown
  */
 public function showResult($vote)
 {
     if (Request::submitted('change') && $vote->changeable) {
         return false;
     }
     return $vote->userVoted() || in_array($vote->id, Request::getArray('preview'));
 }
 /**
  * Extracts updater data from request
  *
  * @return Array Request data (may be empty if no data is present)
  */
 protected static function getRequest()
 {
     if (self::$request === null) {
         self::$request = Request::getArray('page_info');
     }
     return self::$request ?: array();
 }
Beispiel #4
0
 function __construct($form_fields, $form_buttons, $form_name = "studipform", $persistent_values = true)
 {
     $this->form_name = $form_name;
     $this->persistent_values = $persistent_values;
     $this->form_fields = $form_fields;
     $this->form_buttons = $form_buttons;
     if ($this->persistent_values) {
         $this->form_values =& $_SESSION["_p_values"]["_" . $this->form_name . "_values"];
     }
     if ($this->isSended()) {
         foreach ($this->form_fields as $name => $foo) {
             if (!$foo['disabled']) {
                 if (($field_value = Request::get($this->form_name . "_" . $name)) !== null) {
                     $new_form_values[$name] = trim($field_value);
                 } elseif (is_array($field_value = Request::getArray($this->form_name . "_" . $name))) {
                     foreach ($field_value as $key => $value) {
                         $new_form_values[$name][$key] = trim($value);
                     }
                 } else {
                     $new_form_values[$name] = null;
                 }
             }
         }
         foreach ($this->form_fields as $name => $value) {
             if (!$value['disabled']) {
                 if ($value['type'] == 'combo') {
                     if ($this->form_values[$name] != $new_form_values[$value['text']]) {
                         //textfeld wurde verändert
                         $new_form_values[$name] = $new_form_values[$value['text']];
                     } else {
                         if ($this->form_values[$name] != $new_form_values[$value['select']] && !$new_form_values[$value['text']]) {
                             //textfeld nicht geändert, select geändert
                             $new_form_values[$name] = $new_form_values[$value['select']];
                         } else {
                             $new_form_values[$name] = $this->form_values[$name];
                         }
                     }
                 }
                 if ($value['type'] == 'date') {
                     $new_form_values[$name] = Request::int($this->form_name . "_" . $name . "_year") . "-" . sprintf('%02s', Request::int($this->form_name . "_" . $name . "_month")) . "-" . sprintf('%02s', Request::int($this->form_name . "_" . $name . "_day"));
                 }
                 if ($value['type'] == 'datepicker') {
                     $date = explode('.', Request::get($this->form_name . "_" . $name));
                     $new_form_values[$name] = $date[2] . "-" . sprintf('%02s', $date[1]) . "-" . sprintf('%02s', $date[0]);
                 }
                 if ($value['type'] == 'time') {
                     $new_form_values[$name] = sprintf('%02s', Request::int($this->form_name . "_" . $name . "_hours")) . ":" . sprintf('%02s', Request::int($this->form_name . "_" . $name . "_minutes"));
                 }
                 if ($value['type'] == 'checkbox') {
                     $new_form_values[$name] = Request::int($this->form_name . "_" . $name, 0);
                 }
                 if (isset($this->form_values[$name]) && $this->form_values[$name] != $new_form_values[$name] || !isset($this->form_values[$name]) && $new_form_values[$name] != $this->form_fields[$name]['default_value']) {
                     $this->value_changed[$name] = true;
                 }
             }
         }
         $this->form_values = array_merge((array) $this->form_values, (array) $new_form_values);
     }
 }
Beispiel #5
0
 public function createAnswer()
 {
     $answer = $this->getMyAnswer();
     $answers = Request::getArray("answers");
     $answer_data = $answers[$this->getId()];
     $answer->setData($answer_data);
     return $answer;
 }
 /**
  * Extract plugin part from request
  *
  * @param string $step
  * @param array  $errors
  **/
 private function extract($step, &$errors = array())
 {
     $steps = array('manifest' => words('pluginname author origin studipMinVersion studipMaxVersion pluginclassname version interfaces'), 'details' => words('description homepage updateURL tab'), 'assets' => words('migration environment dbscheme dbscheme_content uninstalldbscheme uninstalldbscheme_content ' . 'css css_content js js_content assets'), 'navigation' => words('navigation'), 'icon' => words('sprite'), 'polyfill' => words('polyfills'));
     if (!isset($steps[$step])) {
         throw new Exception('Invalid step "' . $step . '" invoked');
     }
     $result = array();
     $errors = array();
     $request = Request::getInstance();
     foreach ($steps[$step] as $variable) {
         $result[$variable] = $request[$variable];
     }
     if ($step === 'manifest') {
         $result['interfaces'] = Request::optionArray('interfaces');
         if (!$result['pluginname']) {
             $errors['pluginname'] = _('Pluginname nicht angegeben');
         }
         if (!$result['author']) {
             $errors['author'] = _('Kein Autor angegeben');
         }
         if (!$result['origin']) {
             $errors['origin'] = _('Keine Herkunft angegeben');
         }
         if (!$result['pluginclassname']) {
             $errors['pluginclassname'] = _('Kein Klassenname für das Plugin angegeben');
         }
         if (!$result['version']) {
             $errors['version'] = _('Keine Version angegeben');
         }
         if (!$result['studipMinVersion']) {
             $errors['studipMinVersion'] = _('Keine minimale Stud.IP-Version angegeben');
         }
         if (empty($result['interfaces'])) {
             $errors['interfaces'] = _('Kein Interface ausgewählt');
         }
     } else {
         if ($step === 'navigation') {
             $result['navigation'] = Request::getArray('navigation');
         } else {
             if ($step === 'icon' and !empty($_FILES['file']['name'])) {
                 $tmp_icon = $GLOBALS['TMP_PATH'] . '/' . md5(uniqid('plugin-icon', true));
                 if (strpos($_FILES['file']['type'], 'image/') !== 0) {
                     $errors['file'] = sprintf(_('Ungültiger Dateityp "%s"'), $_FILES['file']['type']);
                 } else {
                     if ($_FILES['file']['error'] !== 0 or !move_uploaded_file($_FILES['file']['tmp_name'], $tmp_icon)) {
                         $errors['file'] = _('Fehler bei der Datenübertragung');
                     } else {
                         $content = file_get_contents($tmp_icon);
                         unlink($tmp_icon);
                         $result['file'] = $content;
                     }
                 }
             }
         }
     }
     return $result;
 }
Beispiel #7
0
 public function save_usage_action()
 {
     // delete old usage
     MarketPluginUsage::deleteBySQL('user_id = ? AND name = ?', array(User::findCurrent()->id, Request::get('tag')));
     // create new usages
     foreach (Request::getArray('plugins') as $pluginid) {
         MarketPluginUsage::create(array('plugin_id' => $pluginid, 'user_id' => User::findCurrent()->id, 'name' => Request::get('tag')));
         $this->done++;
     }
 }
Beispiel #8
0
 /**
  * this action is the main action of the schedule-controller, setting the environment for the timetable,
  * accepting a comma-separated list of days.
  *
  * @param  string  a list of an arbitrary mix of the numbers 0-6, separated with a comma (e.g. 1,2,3,4,5 (for Monday to Friday, the default))
  */
 function index_action($days = false)
 {
     if ($GLOBALS['perm']->have_perm('admin')) {
         $inst_mode = true;
     }
     $my_schedule_settings = $GLOBALS['user']->cfg->SCHEDULE_SETTINGS;
     // set the days to be displayed
     if ($days === false) {
         if (Request::getArray('days')) {
             $this->days = array_keys(Request::getArray('days'));
         } else {
             $this->days = array(0, 1, 2, 3, 4, 5, 6);
         }
     } else {
         $this->days = explode(',', $days);
     }
     // try to find the correct institute-id
     $institute_id = Request::option('institute_id', $SessSemName[1] ? $SessSemName[1] : Request::option('cid', false));
     if (!$institute_id) {
         $institute_id = $GLOBALS['user']->cfg->MY_INSTITUTES_DEFAULT;
     }
     if (!$institute_id || in_array(get_object_type($institute_id), words('inst fak')) === false) {
         throw new Exception(sprintf(_('Kann Einrichtungskalendar nicht anzeigen!' . 'Es wurde eine ungültige Instituts-Id übergeben (%s)!', $institute_id)));
     }
     // load semester-data and current semester
     $semdata = new SemesterData();
     $this->semesters = $semdata->getAllSemesterData();
     if (Request::option('semester_id')) {
         $this->current_semester = $semdata->getSemesterData(Request::option('semester_id'));
     } else {
         $this->current_semester = $semdata->getCurrentSemesterData();
     }
     $this->entries = (array) CalendarInstscheduleModel::getInstituteEntries($GLOBALS['user']->id, $this->current_semester, 8, 20, $institute_id, $this->days);
     Navigation::activateItem('/course/main/schedule');
     PageLayout::setHelpKeyword('Basis.TerminkalenderStundenplan');
     PageLayout::setTitle($GLOBALS['SessSemName']['header_line'] . ' - ' . _('Veranstaltungs-Stundenplan'));
     $zoom = Request::int('zoom', 0);
     $this->controller = $this;
     $this->calendar_view = new CalendarWeekView($this->entries, 'instschedule');
     $this->calendar_view->setHeight(40 + 20 * $zoom);
     $this->calendar_view->setRange($my_schedule_settings['glb_start_time'], $my_schedule_settings['glb_end_time']);
     $this->calendar_view->groupEntries();
     // if enabled, group entries with same start- and end-date
     URLHelper::addLinkParam('zoom', $zoom);
     URLHelper::addLinkParam('semester_id', $this->current_semester['semester_id']);
     $style_parameters = array('whole_height' => $this->calendar_view->getOverallHeight(), 'entry_height' => $this->calendar_view->getHeight());
     $factory = new Flexi_TemplateFactory($this->dispatcher->trails_root . '/views');
     PageLayout::addStyle($factory->render('calendar/stylesheet', $style_parameters));
     if (Request::option('printview')) {
         PageLayout::addStylesheet('print.css');
     } else {
         PageLayout::addStylesheet('print.css', array('media' => 'print'));
     }
 }
Beispiel #9
0
 /**
  * Shows a form for selecting which rule type to use.
  *
  * @param String $cs_id ID of a courseset the rule shall belong to.
  */
 public function select_type_action($cs_id = '')
 {
     $this->ruleTypes = AdmissionRule::getAvailableAdmissionRules();
     $this->courseset = new CourseSet($cs_id);
     $this->courseset->clearAdmissionRules();
     foreach (Request::getArray('rules') as $rule) {
         $rule = unserialize($rule);
         if ($rule instanceof AdmissionRule) {
             $this->courseset->addAdmissionRule($rule);
         }
     }
 }
Beispiel #10
0
 public function edit_action($material_id = null)
 {
     $this->material = new LernmarktplatzMaterial($material_id);
     Pagelayout::setTitle($this->material->isNew() ? _("Neues Material hochladen") : _("Material bearbeiten"));
     if ($this->material['user_id'] && $this->material['user_id'] !== $GLOBALS['user']->id) {
         throw new AccessDeniedException();
     }
     if (Request::submitted("delete") && Request::isPost()) {
         $this->material->pushDataToIndexServers("delete");
         $this->material->delete();
         PageLayout::postMessage(MessageBox::success(_("Ihr Material wurde gelöscht.")));
         $this->redirect("market/overview");
     } elseif (Request::isPost()) {
         $was_new = $this->material->setData(Request::getArray("data"));
         $this->material['user_id'] = $GLOBALS['user']->id;
         $this->material['host_id'] = null;
         $this->material['license'] = "CC BY 4.0";
         if ($_FILES['file']['tmp_name']) {
             $this->material['content_type'] = $_FILES['file']['type'];
             if (in_array($this->material['content_type'], array("application/x-zip-compressed", "application/zip", "application/x-zip"))) {
                 $tmp_folder = $GLOBALS['TMP_PATH'] . "/temp_folder_" . md5(uniqid());
                 mkdir($tmp_folder);
                 unzip_file($_FILES['file']['tmp_name'], $tmp_folder);
                 $this->material['structure'] = $this->getFolderStructure($tmp_folder);
                 rmdirr($tmp_folder);
             } else {
                 $this->material['structure'] = null;
             }
             $this->material['filename'] = $_FILES['file']['name'];
             move_uploaded_file($_FILES['file']['tmp_name'], $this->material->getFilePath());
         }
         if ($_FILES['image']['tmp_name']) {
             $this->material['front_image_content_type'] = $_FILES['image']['type'];
             move_uploaded_file($_FILES['image']['tmp_name'], $this->material->getFrontImageFilePath());
         }
         if (Request::get("delete_front_image")) {
             $this->material['front_image_content_type'] = null;
         }
         $this->material->store();
         //Topics:
         $topics = Request::getArray("tags");
         foreach ($topics as $key => $topic) {
             if (!trim($topic)) {
                 unset($topics[$key]);
             }
         }
         $this->material->setTopics($topics);
         $this->material->pushDataToIndexServers();
         PageLayout::postMessage(MessageBox::success(_("Lernmaterial erfolgreich gespeichert.")));
         $this->redirect("market/details/" . $this->material->getId());
     }
 }
Beispiel #11
0
 /**
  * Stores the study information of a user (subject and degree-wise).
  */
 public function store_sg_action()
 {
     $this->check_ticket();
     $any_change = false;
     $fach_abschluss_delete = Request::getArray('fach_abschluss_delete');
     if (count($fach_abschluss_delete) > 0) {
         $query = "DELETE FROM user_studiengang\n                      WHERE user_id = ? AND studiengang_id = ? AND abschluss_id IN (?)";
         $statement = DBManager::get()->prepare($query);
         foreach ($fach_abschluss_delete as $studiengang_id => $abschluesse) {
             $statement->execute(array($this->user->user_id, $studiengang_id, $abschluesse));
             if ($statement->rowCount() > 0) {
                 $any_change = true;
             }
             // if we have no studies anymore we delete the visibilitysetting
             if (!$this->hasStudiengang()) {
                 Visibility::removePrivacySetting('studying');
             }
         }
     }
     if (!$any_change) {
         $query = "UPDATE IGNORE user_studiengang\n                      SET semester = ?\n                      WHERE user_id = ? AND studiengang_id = ? AND abschluss_id = ?";
         $statement = DBManager::get()->prepare($query);
         $change_fachsem = Request::getArray('change_fachsem');
         foreach ($change_fachsem as $studiengang_id => $abschluesse) {
             foreach ($abschluesse as $abschluss_id => $semester) {
                 $statement->execute(array($semester, $this->user->user_id, $studiengang_id, $abschluss_id));
                 if ($statement->rowCount() > 0) {
                     $any_change = true;
                 }
             }
         }
         $new_studiengang = Request::option('new_studiengang');
         if ($new_studiengang && $new_studiengang != 'none') {
             if (!$this->hasStudiengang()) {
                 Visibility::addPrivacySetting(_("Wo ich studiere"), 'studying', 'studdata');
             }
             $query = "INSERT IGNORE INTO user_studiengang\n                            (user_id, studiengang_id, abschluss_id, semester)\n                          VALUES (?, ?, ?, ?)";
             $statement = DBManager::get()->prepare($query);
             $statement->execute(array($this->user->user_id, $new_studiengang, Request::option('new_abschluss'), Request::int('fachsem')));
             if ($statement->rowCount() > 0) {
                 $any_change = true;
             }
         }
     }
     if ($any_change) {
         $this->reportSuccess(_('Die Zuordnung zu Studiengängen wurde geändert.'));
         setTempLanguage($this->user->user_id);
         $this->postPrivateMessage(_("Die Zuordnung zu Studiengängen wurde geändert!\n"));
         restoreLanguage();
     }
     $this->redirect('settings/studies');
 }
Beispiel #12
0
 function save_order_action()
 {
     ForumPerm::check('sort_area', $this->getId());
     foreach (Request::getArray('areas') as $category_id => $areas) {
         $pos = 0;
         foreach ($areas as $area_id) {
             ForumPerm::checkCategoryId($this->getId(), $category_id);
             ForumPerm::check('sort_area', $this->getId(), $area_id);
             ForumCat::addArea($category_id, $area_id);
             ForumCat::setAreaPosition($area_id, $pos);
             $pos++;
         }
     }
     $this->render_nothing();
 }
Beispiel #13
0
 public function edit_action($process_id = null)
 {
     $this->process = new FleximportProcess($process_id);
     if (Request::isPost()) {
         if (Request::submitted("delete_process")) {
             $this->process->delete();
             PageLayout::postMessage(MessageBox::success(_("Prozess wurde gelöscht.")));
             $processes = FleximportProcess::findBySQL("1=1 ORDER BY name ASC");
             $this->redirect("import/overview" . (count($processes) ? "/" . $processes[0]['process_id'] : ""));
         } else {
             $this->process->setData(Request::getArray("data"));
             $this->process->store();
             PageLayout::postMessage(MessageBox::success(_("Prozess wurde gespeichert")));
             $this->redirect("import/overview/" . $this->process->getId());
         }
     }
 }
Beispiel #14
0
 public function edit_action()
 {
     if (Request::isPost()) {
         $configs = Request::getArray("configs");
         foreach ($configs as $name => $data) {
             if ($name !== $data['name'] || !$data['value']) {
                 FleximportConfig::delete($name);
             }
             if ($data['name'] && $data['value']) {
                 FleximportConfig::set($data['name'], $data['value']);
             }
         }
         if (Request::get("new_name") && Request::get("new_value")) {
             FleximportConfig::set(Request::get("new_name"), Request::get("new_value"));
         }
     }
     $this->redirect("config/overview");
 }
Beispiel #15
0
 public function tablemapping_action($table_id)
 {
     PageLayout::setTitle(_("Datenmapping einstellen"));
     $this->table = new FleximportTable($table_id);
     Navigation::activateItem("/fleximport/process_" . $this->table['process_id']);
     if (Request::isPost()) {
         $tabledata = Request::getArray("tabledata");
         $tabledata = array_merge($this->table['tabledata'], $tabledata);
         $this->table['tabledata'] = $tabledata;
         $this->table->store();
         PageLayout::postMessage(MessageBox::success(_("Daten wurden gespeichert.")));
     }
     $datafield_object_types = array('User' => "user", 'Course' => "sem", 'CourseMember' => "usersemdata");
     $this->datafields = Datafield::findBySQL("object_type = :object_type", array('object_type' => $datafield_object_types[$this->table['import_type']]));
     if (Request::isAjax() && Request::isPost()) {
         $output = array('func' => "STUDIP.Fleximport.updateTable", 'payload' => array('table_id' => $table_id, 'name' => $this->table['name'], 'html' => $this->render_template_as_string("import/_table.php")));
         $this->response->add_header("X-Dialog-Execute", json_encode(studip_utf8encode($output)));
     }
 }
Beispiel #16
0
 public function save_action()
 {
     if (count($_POST) === 0) {
         throw new Exception("Kein Zugriff über GET");
     }
     $sem_class = $GLOBALS['SEM_CLASS'][Request::int("sem_class_id")];
     foreach (Request::getArray("core_module_slots") as $slot => $module) {
         $sem_class->setSlotModule($slot, studip_utf8decode($module));
     }
     $sem_class->setModules(Request::getArray("modules"));
     $sem_class->set('name', Request::get("sem_class_name"));
     $sem_class->set('description', studip_utf8decode(Request::get("sem_class_description")));
     $sem_class->set('title_dozent', Request::get("title_dozent") ? studip_utf8decode(Request::get("title_dozent")) : null);
     $sem_class->set('title_dozent_plural', Request::get("title_dozent_plural") ? studip_utf8decode(Request::get("title_dozent_plural")) : null);
     $sem_class->set('title_tutor', Request::get("title_tutor") ? studip_utf8decode(Request::get("title_tutor")) : null);
     $sem_class->set('title_tutor_plural', Request::get("title_tutor_plural") ? studip_utf8decode(Request::get("title_tutor_plural")) : null);
     $sem_class->set('title_autor', Request::get("title_autor") ? studip_utf8decode(Request::get("title_autor")) : null);
     $sem_class->set('title_autor_plural', Request::get("title_autor_plural") ? studip_utf8decode(Request::get("title_autor_plural")) : null);
     $sem_class->set('compact_mode', Request::int("compact_mode"));
     $sem_class->set('workgroup_mode', Request::int("workgroup_mode"));
     $sem_class->set('studygroup_mode', Request::int("studygroup_mode"));
     $sem_class->set('only_inst_user', Request::int("only_inst_user"));
     $sem_class->set('turnus_default', Request::int("turnus_default"));
     $sem_class->set('default_read_level', Request::int("default_read_level"));
     $sem_class->set('default_write_level', Request::int("default_write_level"));
     $sem_class->set('bereiche', Request::int("bereiche"));
     $sem_class->set('show_browse', Request::int("show_browse"));
     $sem_class->set('write_access_nobody', Request::int("write_access_nobody"));
     $sem_class->set('topic_create_autor', Request::int("topic_create_autor"));
     $sem_class->set('visible', Request::int("visible"));
     $sem_class->set('course_creation_forbidden', Request::int("course_creation_forbidden"));
     $sem_class->set('create_description', studip_utf8decode(Request::get("create_description")));
     $sem_class->set('admission_prelim_default', Request::int("admission_prelim_default"));
     $sem_class->set('admission_type_default', Request::int("admission_type_default"));
     $sem_class->store();
     if (!count($sem_class->getSemTypes())) {
         $notice = "<br>" . _("Beachten Sie, dass es noch keine Veranstaltungstypen gibt!");
     }
     $output = array('html' => studip_utf8encode((string) MessageBox::success(_("Änderungen wurden gespeichert." . " " . '<a href="' . URLHelper::getLink("dispatch.php/admin/sem_classes/overview") . '">' . _("Zurück zur Übersichtsseite.") . '</a>') . $notice)));
     echo json_encode($output);
     $this->render_nothing();
 }
Beispiel #17
0
 /**
  * Adds a condition.
  */
 public function add_action()
 {
     $condition = new UserFilter();
     $fields = Request::getArray('field');
     $compareOps = Request::getArray('compare_operator');
     $values = Request::getArray('value');
     $data = array();
     for ($i = 0; $i < sizeof($fields); $i++) {
         $current = $fields[$i];
         if ($this->conditionFields[$current]) {
             list($fieldType, $param) = explode('_', $current);
             $field = new $fieldType($param);
             $field->setCompareOperator($compareOps[$i]);
             $field->setValue($values[$i]);
             $condition->addField($field);
             $condition->show_user_count = true;
         }
     }
     $this->condition = $condition;
 }
Beispiel #18
0
 /**
  * move the submitted topics[] to the passed destination
  * 
  * @param string $destination id of seminar to move topics to
  */
 function move_action($destination)
 {
     // check if destination is a category_id. if yes, use seminar_id instead
     if (ForumCat::get($destination)) {
         $category_id = $destination;
         $destination = $this->getId();
     }
     ForumPerm::check('admin', $this->getId(), $destination);
     foreach (Request::getArray('topics') as $topic_id) {
         // make sure every passed topic_id is checked against the current seminar
         ForumPerm::check('admin', $this->getId(), $topic_id);
         // if the source is an area and the target a category, just move this area to the category
         $entry = ForumEntry::getEntry($topic_id);
         if ($entry['depth'] == 1 && $category_id) {
             ForumCat::removeArea($topic_id);
             ForumCat::addArea($category_id, $topic_id);
         } else {
             // first step: move the whole topic with all childs
             ForumEntry::move($topic_id, $destination);
             // if the current topic id is an area, remove it from any categories
             ForumCat::removeArea($topic_id);
             // second step: move all to deep childs a level up (depth > 3)
             $data = ForumEntry::getList('depth_to_large', $topic_id);
             foreach ($data['list'] as $entry) {
                 $path = ForumEntry::getPathToPosting($entry['topic_id']);
                 array_shift($path);
                 // Category
                 array_shift($path);
                 // Area
                 $thread = array_shift($path);
                 // Thread
                 ForumEntry::move($entry['topic_id'], $thread['id']);
             }
             // add entry to passed category when moving to the top
             if ($category_id) {
                 ForumCat::addArea($category_id, $topic_id);
             }
         }
     }
     $this->render_nothing();
 }
Beispiel #19
0
 /**
  * Edit or create a rule
  *
  * @param md5 $edit_id
  */
 function edit_action($id = null)
 {
     //get data
     $user_field = 'user';
     $semdata_field = 'usersemdata';
     $this->semFields = AuxLockRules::getSemFields();
     $this->entries_user = DataField::getDataFields($user_field);
     $this->entries_semdata = DataField::getDataFields($semdata_field);
     $this->rule = is_null($id) ? false : AuxLockRules::getLockRuleByID($id);
     if ($GLOBALS['perm']->have_perm('root') && count($this->entries_semdata) == 0) {
         $this->flash['info'] = sprintf(_('Sie müssen zuerst im Bereich %sDatenfelder%s in der Kategorie ' . '<i>Datenfelder für Personenzusatzangaben in Veranstaltungen</i> einen neuen Eintrag erstellen.'), '<a href="' . URLHelper::getLink('dispatch.php/admin/datafields') . '">', '</a>');
     }
     // save action
     if (Request::submitted('erstellen') || Request::submitted('uebernehmen')) {
         //checking for errors
         $errors = array();
         if (!Request::get('rulename')) {
             array_push($errors, _("Bitte geben Sie der Regel mindestens einen Namen!"));
         }
         if (!AuxLockRules::checkLockRule(Request::getArray('fields'))) {
             array_push($errors, _('Bitte wählen Sie mindestens ein Feld aus der Kategorie "Zusatzinformationen" aus!'));
         }
         if (!empty($errors)) {
             $this->flash['error'] = _("Ihre Eingaben sind ungültig.");
             $this->flash['error_detail'] = $errors;
             // save
         } else {
             //new
             if (is_null($id)) {
                 AuxLockRules::createLockRule(Request::get('rulename'), Request::get('description'), Request::getArray('fields'), Request::getArray('order'));
                 //edit
             } else {
                 AuxLockRules::updateLockRule($id, Request::get('rulename'), Request::get('description'), Request::getArray('fields'), Request::getArray('order'));
             }
             $this->flash['success'] = sprintf(_('Die Regel "%s" wurde erfolgreich gespeichert!'), htmlReady(Request::get('rulename')));
             $this->redirect('admin/specification');
         }
     }
 }
Beispiel #20
0
 /**
  * SystemPlugins may call UpdateInformation::setInformation to set information
  * to be sent via ajax to the main request. Core-functionality-data should be
  * collected and set here.
  * @return array: array(array('js_function' => $data), ...)
  */
 protected function coreInformation()
 {
     $data = array();
     if (PersonalNotifications::isActivated()) {
         $notifications = PersonalNotifications::getMyNotifications();
         if ($notifications && count($notifications)) {
             $ret = array();
             foreach ($notifications as $notification) {
                 $info = $notification->toArray();
                 $info['html'] = $notification->getLiElement();
                 $ret[] = $info;
             }
             $data['PersonalNotifications.newNotifications'] = $ret;
         } else {
             $data['PersonalNotifications.newNotifications'] = array();
         }
     }
     $page_info = Request::getArray("page_info");
     if (stripos(Request::get("page"), "dispatch.php/messages") !== false) {
         $messages = Message::findNew($GLOBALS["user"]->id, $page_info['Messages']['received'], $page_info['Messages']['since'], $page_info['Messages']['tag']);
         $template_factory = $this->get_template_factory();
         foreach ($messages as $message) {
             $data['Messages.newMessages']['messages'][$message->getId()] = $template_factory->open("messages/_message_row.php")->render(compact("message") + array('controller' => $this));
         }
     }
     if (count($page_info['Questionnaire']['questionnaire_ids']) > 0) {
         foreach ($page_info['Questionnaire']['questionnaire_ids'] as $questionnaire_id) {
             $questionnaire = new Questionnaire($questionnaire_id);
             if ($questionnaire->latestAnswerTimestamp() > $page_info['Questionnaire']['last_update']) {
                 $template = $this->get_template_factory()->open("questionnaire/evaluate");
                 $template->set_layout(null);
                 $template->set_attribute("questionnaire", $questionnaire);
                 $data['Questionnaire.updateQuestionnaireResults'][$questionnaire->getId()] = array('html' => $template->render());
             }
         }
     }
     return $data;
 }
Beispiel #21
0
 public function save_review_action($plugin_id)
 {
     if (!Request::isPost()) {
         throw new Exception("Wrong method, use POST.");
     }
     $this->marketplugin = MarketPlugin::find($plugin_id);
     if (!$this->marketplugin) {
         throw new Exception("Unknown plugin.");
     }
     $reviews = MarketReview::findBySQL("plugin_id = ? AND user_id = ?", array($plugin_id, $GLOBALS['user']->id));
     if (count($reviews)) {
         $this->review = $reviews[0];
     } else {
         $this->review = new MarketReview();
         $this->review['plugin_id'] = $plugin_id;
         $this->review['user_id'] = $GLOBALS['user']->id;
     }
     $data = Request::getArray("data");
     $this->review['review'] = trim($data['review']) ?: null;
     if ($data['rating'] <= 5 && $data['rating'] >= 0) {
         $this->review['rating'] = $data['rating'];
     } else {
         throw new Exception("Rating is not in accepted range.");
     }
     $this->review->store();
     PersonalNotifications::add($this->marketplugin['user_id'], PluginEngine::getURL($this->plugin, array(), "presenting/details/" . $plugin_id), sprintf(_("Ihr Plugin %s wurde von %s bewertet."), $this->marketplugin['name'], get_fullname($GLOBALS['user']->id)), null, Assets::image_path("icons/blue/star.svg"));
     PageLayout::postMessage(MessageBox::success(_("Review/Bewertung wurde gespeichert.")));
     $this->redirect('presenting/details/' . $plugin_id);
 }
 /**
  * deletes questions
  *
  * @access   private
  * @return   boolean  true (reinits the tree)
  */
 function execCommandDeleteQuestions()
 {
     $questions = Request::getArray('questions');
     $deleteQuestions = Request::getArray('DeleteQuestions');
     $deletecount = 0;
     for ($i = 0; $i < count($questions); $i++) {
         $question = new EvaluationQuestion($questions[$i]['questionID'], NULL, EVAL_LOAD_ALL_CHILDREN);
         // remove any empty questions
         if ($deleteQuestions[$i]) {
             $question->delete();
             $deletecount++;
         }
     }
     if ($deletecount == "1") {
         $this->msg[$this->itemID] = "msg§" . _("Es wurde eine Frage gelöscht.");
     } elseif ($deletecount > 1) {
         $this->msg[$this->itemID] = "msg§" . sprintf(_("Es wurden %s Fragen gelöscht."), $deletecount);
     } else {
         $this->msg[$this->itemID] = "msg§" . _("Es wurde keine Frage gelöscht.");
     }
     $this->execCommandUpdateItem();
     return true;
 }
Beispiel #23
0
            $query = "INSERT INTO resources_properties
                        (property_id, options, name, type)
                      VALUES (?, ?, ?, ?)";
            $statement = DBManager::get()->prepare($query);
            $statement->execute(array(
                $id,
                $options,
                Request::get('add_property'),
                Request::get('add_property_type')
            ));
        }

        if (Request::submitted('_send_property_type')) {
            $change_property_name = Request::getArray('change_property_name');
            $send_property_type = Request::optionArray('send_property_type');
            $send_property_select_opt = Request::getArray('send_property_select_opt');
            $send_property_bool_desc = Request::optionArray('send_property_bool_desc');

            $query = "UPDATE resources_properties
                      SET name = ?, options = ?, type = ?
                      WHERE property_id = ?";
            $statement = DBManager::get()->prepare($query);

            foreach ($change_property_name as $key => $val) {
                if ($send_property_type[$key] == 'select') {
                    $tmp_options = explode(';', $send_property_select_opt[$key]);
                    $tmp_options = array_map('trim', $tmp_options);
                    $options = implode(';', $tmp_options);
                } elseif ($send_property_type[$key] == 'bool') {
                    $options = $send_property_bool_desc[$key];
                } else {
Beispiel #24
0
 /**
  * Stores a user's details.
  */
 public function store_action()
 {
     $this->check_ticket();
     $changed = false;
     if (Config::get()->ENABLE_SKYPE_INFO) {
         $new_skype_name = Request::get('skype_name');
         if ($new_skype_name != $this->config->SKYPE_NAME) {
             $this->config->store('SKYPE_NAME', $new_skype_name);
             Visibility::updatePrivacySettingWithTest(Request::get('skype_name'), _("Skype Name"), "skype_name", 'privatedata', 1, $this->user->user_id);
             $changed = true;
         }
         if (Request::int('skype_online_status') != $this->config->SKYPE_ONLINE_STATUS) {
             $this->config->store('SKYPE_ONLINE_STATUS', Request::int('skype_online_status'));
             Visibility::updatePrivacySettingWithTest(Request::int('skype_online_status'), _("Skype Online Status"), "skype_online_status", 'skype_name', 1, $this->user->user_id);
             $changed = true;
         }
     }
     $mapping = array('telefon' => 'privatnr', 'cell' => 'privatcell', 'anschrift' => 'privadr', 'home' => 'Home', 'motto' => 'motto', 'hobby' => 'hobby', 'lebenslauf' => 'lebenslauf', 'schwerp' => 'schwerp', 'publi' => 'publi');
     // Visibilitymapping Remove in Stud.IP 3.0 with a migration
     $vis_mapping = array('telefon' => 'private_phone', 'cell' => 'private_cell', 'anschrift' => 'privadr', 'home' => 'homepage', 'motto' => 'motto', 'hobby' => 'hobby', 'lebenslauf' => 'lebenslauf', 'schwerp' => 'schwerp', 'publi' => 'publi');
     $settingsname = array('telefon' => _('Private Telefonnummer'), 'cell' => _('Private Handynummer'), 'anschrift' => _('Private Adresse'), 'home' => _('Homepage-Adresse'), 'motto' => _('Motto'), 'hobby' => _('Hobbies'), 'lebenslauf' => _('Lebenslauf'), 'schwerp' => _('Arbeitsschwerpunkte'), 'publi' => _('Publikationen'));
     foreach ($mapping as $key => $column) {
         $value = Request::get($key);
         if (in_array($key, array('hobby', 'lebenslauf', 'schwerp', 'publi'))) {
             // purify HTML input for these fields if wysiwyg is used
             $value = Studip\Markup::purifyHtml($value);
         }
         if ($this->user->{$column} != $value && $this->shallChange('user_info.' . $column, $column, $value)) {
             $this->user->{$column} = $value;
             Visibility::updatePrivacySettingWithTest($value, $settingsname[$key], $vis_mapping[$key], 'privatedata', 1, $this->user->user_id);
             $changed = true;
         }
     }
     $datafields_changed = false;
     $errors = array();
     $datafields = DataFieldEntry::getDataFieldEntries($this->user->user_id, 'user');
     $data = Request::getArray('datafields');
     foreach ($datafields as $id => $entry) {
         if (isset($data[$id]) && $data[$id] != $entry->getValue()) {
             // i really dont know if this is correct but it works
             Visibility::updatePrivacySettingWithTest($data[$id], $entry->getName(), $entry->getID(), 'additionaldata', 1, $this->user->user_id);
             $entry->setValueFromSubmit($data[$id]);
             if ($entry->isValid()) {
                 if ($entry->store()) {
                     $datafields_changed = true;
                 }
             } else {
                 $errors[] = sprintf(_('Fehlerhafter Eintrag im Feld <em>%s</em>: %s (Eintrag wurde nicht gespeichert)'), $entry->getName(), $entry->getDisplayValue());
             }
         }
     }
     if (count($errors) > 0) {
         $this->reportErrorWithDetails(_('Bitte überprüfen Sie Ihre Eingaben.'), $errors);
     } else {
         if ($this->user->store() || $changed || $datafields_changed) {
             $this->reportSuccess(_('Daten im Lebenslauf u.a. wurden geändert.'));
             setTempLanguage($this->user->user_id);
             $this->postPrivateMessage(_('Daten im Lebenslauf u.a. wurden geändert.'));
             restoreLanguage();
         }
     }
     $this->redirect('settings/details');
 }
Beispiel #25
0
 function vcard_action($group = null)
 {
     // Set constants for export
     $charset = 'utf-8';
     $filename = _('Kontakte');
     // Set layout
     $this->set_layout(null);
     // If we got an array of user
     if (Request::submitted('user')) {
         $user = User::findManyByUsername(Request::getArray('user'));
     }
     // If we got a group
     if ($group) {
         $user = User::findMany(Statusgruppen::find($group)->members->pluck('user_id'));
     }
     // Fallback to all contacts if we got nothing
     if (!$user) {
         $user = User::findCurrent()->contacts;
     }
     header("Content-type: text/x-vCard;charset=" . $charset);
     //application/octet-stream MIME
     header("Content-disposition: attachment; filename=" . $filename . ".vcf");
     header("Pragma: private");
     $this->vCard = vCard::export($user);
 }
Beispiel #26
0
 /**
  * Saves the given user list to database.
  * 
  * @param String $userlistId user list to save
  */
 public function save_action($userlistId = '')
 {
     CSRFProtection::verifyUnsafeRequest();
     $userlist = new AdmissionUserList($userlistId);
     $userlist->setName(Request::get('name'))->setFactor(Request::float('factor'))->setUsers(Request::getArray('users'))->setOwnerId($GLOBALS['user']->id);
     if ($userlist->store()) {
         PageLayout::postSuccess(_('Die Personenliste wurde gespeichert.'));
     } else {
         PageLayout::postError(_('Die Personenliste konnte nicht gespeichert werden.'));
     }
     $this->redirect('admission/userlist');
 }
Beispiel #27
0
 /**
  * Interface to edit a group or create a new one.
  *
  * @param string group id
  */
 public function editGroup_action($group_id = null)
 {
     $this->check('edit');
     if (Request::isPost()) {
         $group = new Statusgruppen($group_id);
         if ($group->isNew()) {
             $group->range_id = $_SESSION['SessionSeminar'];
         }
         $group->name = Request::get('name');
         $group->name_w = Request::get('name_w');
         $group->name_m = Request::get('name_m');
         $group->size = Request::int('size');
         $group->range_id = Request::option('range_id', $group->range_id);
         $group->position = Request::int('position', $group->position);
         $group->selfassign = Request::int('selfassign', 0);
         $group->store();
         $group->setDatafields(Request::getArray('datafields'));
         $message = $group->isNew() ? _('Die Gruppe wurde angelegt.') : _('Die Gruppe wurde gespeichert');
         PageLayout::postMessage(MessageBox::success($message));
         $this->redirect('admin/statusgroups');
         return;
     }
     $this->group = new Statusgruppen($group_id);
     $this->loadGroups();
 }
Beispiel #28
0
 /**
  * updates studygroups with respect to the corresponding form data
  *
  * @param string id of a studygroup
  *
  * @return void
  */
 function update_action($id)
 {
     global $perm;
     // if we are permitted to edit the studygroup get some data...
     if ($perm->have_studip_perm('dozent', $id)) {
         $errors = array();
         $admin = $perm->have_studip_perm('admin', $id);
         $founders = StudygroupModel::getFounders($id);
         $sem = new Seminar($id);
         $sem_class = $GLOBALS['SEM_CLASS'][$GLOBALS['SEM_TYPE'][$sem->status]['class']];
         CSRFProtection::verifyUnsafeRequest();
         if (Request::get('abort_deactivate')) {
             // let's do nothing and go back to the studygroup
             return $this->redirect('course/studygroup/edit/' . $id);
         } else {
             if (Request::get('really_deactivate')) {
                 $modules = Request::optionArray('deactivate_modules');
                 $plugins = Request::optionArray('deactivate_plugins');
                 // really deactive modules
                 // 1. Modules
                 if (is_array($modules)) {
                     $mods = new Modules();
                     $admin_mods = new AdminModules();
                     $bitmask = $sem->modules;
                     foreach ($modules as $key) {
                         $module_name = $sem_class->getSlotModule($key);
                         if ($module_name && ($sem_class->isModuleMandatory($module_name) || !$sem_class->isModuleAllowed($module_name))) {
                             continue;
                         }
                         $mods->clearBit($bitmask, $mods->registered_modules[$key]["id"]);
                         $methodDeactivate = "module" . ucfirst($key) . "Deactivate";
                         if (method_exists($admin_mods, $methodDeactivate)) {
                             $admin_mods->{$methodDeactivate}($sem->id);
                             $studip_module = $sem_class->getModule($key);
                             if (is_a($studip_module, "StandardPlugin")) {
                                 PluginManager::getInstance()->setPluginActivated($studip_module->getPluginId(), $id, false);
                             }
                         }
                     }
                     $sem->modules = $bitmask;
                     $sem->store();
                 }
                 // 2. Plugins
                 if (is_array($plugins)) {
                     $plugin_manager = PluginManager::getInstance();
                     $available_plugins = StudygroupModel::getInstalledPlugins();
                     foreach ($plugins as $class) {
                         $plugin = $plugin_manager->getPlugin($class);
                         // Deaktiviere Plugin
                         if ($available_plugins[$class] && !$sem_class->isModuleMandatory($class) && !$sem_class->isSlotModule($class)) {
                             $plugin_manager->setPluginActivated($plugin->getPluginId(), $id, false);
                         }
                     }
                 }
                 // Success message
                 $this->flash['success'] .= _("Inhaltselement(e) erfolgreich deaktiviert.");
                 return $this->redirect('course/studygroup/edit/' . $id);
             } else {
                 if (Request::submitted('replace_founder')) {
                     // retrieve old founder
                     $old_dozent = current(StudygroupModel::getFounder($id));
                     // remove old founder
                     StudygroupModel::promote_user($old_dozent['uname'], $id, 'tutor');
                     // add new founder
                     $new_founder = Request::option('choose_founder');
                     StudygroupModel::promote_user(get_username($new_founder), $id, 'dozent');
                     //checks
                 } else {
                     // test whether we have a group name...
                     if (!Request::get('groupname')) {
                         $errors[] = _("Bitte Gruppennamen angeben");
                         //... if so, test if this is not taken by another group
                     } else {
                         $query = "SELECT 1 FROM seminare WHERE name = ? AND Seminar_id != ?";
                         $statement = DBManager::get()->prepare($query);
                         $statement->execute(array(Request::get('groupname'), $id));
                         if ($statement->fetchColumn()) {
                             $errors[] = _("Eine Veranstaltung/Studiengruppe mit diesem Namen existiert bereits. Bitte wählen Sie einen anderen Namen");
                         }
                     }
                     if (count($errors)) {
                         $this->flash['errors'] = $errors;
                         $this->flash['edit'] = true;
                         // Everything seems fine, let's update the studygroup
                     } else {
                         $sem->name = Request::get('groupname');
                         // seminar-class quotes itself
                         $sem->description = Request::get('groupdescription');
                         // seminar-class quotes itself
                         $sem->read_level = 1;
                         $sem->write_level = 1;
                         $sem->visible = 1;
                         if (Request::get('groupaccess') == 'all') {
                             $sem->admission_prelim = 0;
                         } else {
                             $sem->admission_prelim = 1;
                             if (Config::get()->STUDYGROUPS_INVISIBLE_ALLOWED && Request::get('groupaccess') == 'invisible') {
                                 $sem->visible = 0;
                             }
                             $sem->admission_prelim_txt = _("Die ModeratorInnen der Studiengruppe können Ihren Aufnahmewunsch bestätigen oder ablehnen. Erst nach Bestätigung erhalten Sie vollen Zugriff auf die Gruppe.");
                         }
                         // get the current bitmask
                         $mods = new Modules();
                         $admin_mods = new AdminModules();
                         $bitmask = $sem->modules;
                         // de-/activate modules
                         $available_modules = StudygroupModel::getInstalledModules();
                         $orig_modules = $mods->getLocalModules($sem->id, "sem");
                         $active_plugins = Request::getArray("groupplugin");
                         $deactivate_modules = array();
                         foreach (array_keys($available_modules) as $key) {
                             $module_name = $sem_class->getSlotModule($key);
                             if (!$module_name || $module_name && ($sem_class->isModuleMandatory($module_name) || !$sem_class->isModuleAllowed($module_name))) {
                                 continue;
                             }
                             if (!$module_name) {
                                 $module_name = $key;
                             }
                             if ($active_plugins[$module_name]) {
                                 // activate modules
                                 $mods->setBit($bitmask, $mods->registered_modules[$key]["id"]);
                                 if (!$orig_modules[$key]) {
                                     $methodActivate = "module" . ucfirst($key) . "Activate";
                                     if (method_exists($admin_mods, $methodActivate)) {
                                         $admin_mods->{$methodActivate}($sem->id);
                                         $studip_module = $sem_class->getModule($key);
                                         if (is_a($studip_module, "StandardPlugin")) {
                                             PluginManager::getInstance()->setPluginActivated($studip_module->getPluginId(), $id, true);
                                         }
                                     }
                                 }
                             } else {
                                 // prepare for deactivation
                                 // (user will have to confirm)
                                 if ($orig_modules[$key]) {
                                     $deactivate_modules[] = $key;
                                 }
                             }
                         }
                         $this->flash['deactivate_modules'] = $deactivate_modules;
                         $sem->modules = $bitmask;
                         $sem->store();
                         // de-/activate plugins
                         $available_plugins = StudygroupModel::getInstalledPlugins();
                         $plugin_manager = PluginManager::getInstance();
                         $deactivate_plugins = array();
                         foreach ($available_plugins as $key => $name) {
                             $plugin = $plugin_manager->getPlugin($key);
                             $plugin_id = $plugin->getPluginId();
                             if ($active_plugins[$key] && $name && $sem_class->isModuleAllowed($key)) {
                                 $plugin_manager->setPluginActivated($plugin_id, $id, true);
                             } else {
                                 if ($plugin_manager->isPluginActivated($plugin_id, $id) && !$sem_class->isSlotModule($key)) {
                                     $deactivate_plugins[$plugin_id] = $key;
                                 }
                             }
                         }
                         $this->flash['deactivate_plugins'] = $deactivate_plugins;
                     }
                 }
             }
         }
     }
     if (!$this->flash['errors'] && !$deactivate_modules && !$deactivate_plugins) {
         // Everything seems fine
         $this->flash['success'] = _("Die Änderungen wurden erfolgreich übernommen.");
     }
     // let's go to the studygroup
     $this->redirect('course/studygroup/edit/' . $id);
 }
Beispiel #29
0
 /**
  * save tour data
  * 
  * @param String $tour_id    tour id
  */
 function save_action($tour_id = '')
 {
     // check permission
     $GLOBALS['perm']->check('root');
     // initialize
     Navigation::activateItem('/admin/config/tour');
     $this->tour = new HelpTour($tour_id);
     if ($tour_id and $this->tour->isNew()) {
         throw new AccessDeniedException(_('Die Tour mit der angegebenen ID existiert nicht.'));
     }
     if (Request::submitted('save_tour_details')) {
         CSRFProtection::verifySecurityToken();
         $this->tour->name = trim(Request::get('tour_name'));
         $this->tour->description = trim(Request::get('tour_description'));
         if (Request::option('tour_language')) {
             $this->tour->language = Request::option('tour_language');
         }
         $this->tour->type = Request::option('tour_type');
         $this->tour->settings->access = Request::option('tour_access');
         $this->tour->roles = implode(',', Request::getArray('tour_roles'));
         if ($this->tour->isNew()) {
             $this->tour->global_tour_id = md5(uniqid('help_tours', 1));
             $this->tour->settings->active = 0;
         }
         $this->tour->author_email = $GLOBALS['user']->Email;
         $this->tour->studip_version = $GLOBALS['SOFTWARE_VERSION'];
         if ($this->tour->validate()) {
             $this->tour->store();
             if (!count($this->tour->steps)) {
                 $step_data = array('title' => '', 'tip' => _('(Neue Tour)'), 'interactive' => 0, 'route' => trim(Request::get('tour_startpage')), 'css_selector' => '', 'action_prev' => '', 'action_next' => '', 'orientation' => '', 'mkdate' => time(), 'author_email' => $GLOBALS['user']->Email);
                 $this->tour->addStep($step_data, 1);
                 $this->tour_startpage = trim(Request::get('tour_startpage'));
             }
             PageLayout::postMessage(MessageBox::success(_('Die Angaben wurden gespeichert.')));
         } else {
             $roles = '';
             if (count(Request::getArray('tour_roles'))) {
                 foreach (Request::getArray('tour_roles') as $role) {
                     $roles .= '&tour_roles[]=' . $role;
                 }
             }
             $this->redirect('tour/admin_details?tour_name=' . Request::get('tour_name') . '&tour_language=' . Request::get('tour_language') . '&tour_description=' . Request::get('tour_description') . '&tour_type=' . Request::get('tour_type') . '&tour_access=' . Request::get('tour_access') . '&tour_startpage=' . Request::get('tour_startpage') . $roles);
         }
     }
     $this->redirect('tour/admin_details/' . $this->tour->tour_id);
 }
Beispiel #30
0
 public function testStringArrayParam()
 {
     $this->assertSame(Request::getArray('null'), array());
     $this->assertSame(Request::getArray('b'), array());
     $this->assertSame(Request::getArray('v1'), array('1', '2.4', '3,7'));
     $this->assertSame(Request::getArray('v2'), array('on\'e', 'two', 'thr33'));
     $this->assertSame(Request::quotedArray('null'), array());
     $this->assertSame(Request::quotedArray('b'), array());
     $this->assertSame(Request::quotedArray('v1'), array('1', '2.4', '3,7'));
     $this->assertSame(Request::quotedArray('v2'), array('on\\\'e', 'two', 'thr33'));
 }