本文整理汇总了PHP中Request::getArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getArray方法的具体用法?PHP Request::getArray怎么用?PHP Request::getArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::getArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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);
}
}
示例2: showResult
/**
* 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'));
}
示例3: getRequest
/**
* 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();
}
示例4: __construct
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);
}
}
示例5: createAnswer
public function createAnswer()
{
$answer = $this->getMyAnswer();
$answers = Request::getArray("answers");
$answer_data = $answers[$this->getId()];
$answer->setData($answer_data);
return $answer;
}
示例6: extract
/**
* 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;
}
示例7: save_usage_action
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++;
}
}
示例8: index_action
/**
* 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'));
}
}
示例9: select_type_action
/**
* 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);
}
}
}
示例10: edit_action
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());
}
}
示例11: store_sg_action
/**
* 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');
}
示例12: save_order_action
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();
}
示例13: edit_action
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());
}
}
}
示例14: edit_action
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");
}
示例15: tablemapping_action
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)));
}
}