本文整理汇总了PHP中Request::option方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::option方法的具体用法?PHP Request::option怎么用?PHP Request::option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::option方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_action
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();
}
}
示例2: build
public static function build()
{
self::$get = (object) $_GET;
self::$post = (object) $_POST;
// pegando parametros via :(:+) ou ?(&+)
$options = clone self::$get;
unset($options->controller);
unset($options->method);
unset($options->ident);
if (preg_match("/[:]/", $_SERVER['REQUEST_URI'])) {
$opt = array();
$tmp = explode(":", $options->options);
foreach ($tmp as $t) {
$o = explode("=", $t);
$o[1] = isset($o[1]) ? $o[1] : TRUE;
$opt[$o[0]] = $o[1];
}
$options = (object) $opt;
} else {
foreach ($options as $key => $value) {
if ($value == "") {
$options->{$key} = TRUE;
}
}
}
self::$option = empty($options) ? NULL : $options;
}
示例3: index_action
public function index_action()
{
if ($_SESSION['sem_portal']['bereich'] != "all") {
$class = $GLOBALS['SEM_CLASS'][$_SESSION['sem_portal']['bereich']];
$this->anzahl_seminare_class = $class->countSeminars();
$sem_status = array_keys($class->getSemTypes());
} else {
$sem_status = false;
}
$init_data = array("level" => "f", "cmd" => "qs", "show_class" => $_SESSION['sem_portal']['bereich'], "group_by" => 0, "default_sem" => ($default_sem = SemesterData::GetSemesterIndexById($_SESSION['_default_sem'])) !== false ? $default_sem : "all", "sem_status" => $sem_status);
if (Request::option('reset_all')) {
$_SESSION['sem_browse_data'] = null;
}
$this->sem_browse_obj = new SemBrowse($init_data);
$sem_browse_data['show_class'] = $_SESSION['sem_portal']['bereich'];
if (!$GLOBALS['perm']->have_perm("root")) {
$this->sem_browse_obj->target_url = "dispatch.php/course/details/";
$this->sem_browse_obj->target_id = "sem_id";
} else {
$this->sem_browse_obj->target_url = "seminar_main.php";
$this->sem_browse_obj->target_id = "auswahl";
}
$this->toplist_entries = $this->getToplistEntries($sem_status);
$this->controller = $this;
}
示例4: show_action
/**
* show and search log events
*/
function show_action()
{
$this->action_id = Request::option('action_id');
$this->object_id = Request::option('object_id');
$this->log_actions = $this->event_log->get_used_log_actions();
$this->types = $this->event_log->get_object_types();
// restrict log events to object scope
if (Request::get('search') && Request::get('search') != '') {
$this->type = Request::get('type');
$this->search = Request::get('search');
$objects = $this->event_log->find_objects($this->type, $this->search, $this->action_id);
if (count($objects) > 0) {
$this->objects = $objects;
} else {
$this->error_msg = _('Kein passendes Objekt gefunden.');
}
}
// find all matching log events
if (Request::get('search') === '' || isset($this->object_id)) {
$this->start = (int) Request::int('start');
$this->format = Request::quoted('format');
$this->num_entries = $this->event_log->count_log_events($this->action_id, $this->object_id);
if (Request::get('back') || Request::submitted('back')) {
$this->start = max(0, $this->start - 50);
} else {
if (Request::get('forward') || Request::submitted('forward')) {
$this->start = min($this->num_entries, $this->start + 50);
}
}
$this->log_events = $this->event_log->get_log_events($this->action_id, $this->object_id, $this->start);
}
}
示例5: store_action
/**
* Stores the user domain settings of a user.
*/
public function store_action()
{
$this->check_ticket();
$any_change = false;
$userdomain_delete = Request::optionArray('userdomain_delete');
if (count($userdomain_delete) > 0) {
foreach ($userdomain_delete as $id) {
$domain = new UserDomain($id);
$domain->removeUser($this->user->user_id);
}
$any_change = true;
}
$new_userdomain = Request::option('new_userdomain');
if ($new_userdomain && $new_userdomain != 'none') {
$domain = new UserDomain($new_userdomain);
$domain->addUser($this->user->user_id);
$any_change = true;
}
if ($any_change) {
$this->reportSuccess(_('Die Zuordnung zu Nutzerdomänen wurde geändert.'));
setTempLanguage($this->user->user_id);
$this->postPrivateMessage(_("Die Zuordnung zu Nutzerdomänen wurde geändert!\n"));
restoreLanguage();
}
$this->redirect('settings/userdomains');
}
示例6: testOptionParam
public function testOptionParam()
{
$this->assertNull(Request::option('null'));
$this->assertSame(Request::option('a'), 'test');
$this->assertNull(Request::option('b'));
$this->assertNull(Request::option('v1'));
}
示例7: global_action
/**
* Stores the privacy settings concerning the appearance of a user inside
* the system.
*/
public function global_action()
{
$this->check_ticket();
$visibility = Request::option('global_visibility');
// Globally visible or unknown -> set local visibilities accordingly.
if ($visibility != 'no') {
$online = Request::int('online') ?: 0;
$search = Request::int('search') ?: 0;
$email = Request::int('email') ?: 0;
$foaf_show_identity = Request::int('foaf_show_identity') ?: 0;
// Globally invisible -> set all local fields to invisible.
} else {
$online = $search = $foaf_show_identity = 0;
$email = get_config('DOZENT_ALLOW_HIDE_EMAIL') ? 0 : 1;
$success = $this->about->change_all_homepage_visibility(VISIBILITY_ME);
}
$this->config->store('FOAF_SHOW_IDENTITY', $foaf_show_identity);
$this->user->visible = $visibility;
$this->user->store();
$query = "INSERT INTO user_visibility\n (user_id, online, search, email, mkdate)\n VALUES (?, ?, ?, ?, UNIX_TIMESTAMP())\n ON DUPLICATE KEY\n UPDATE online = VALUES(online),\n search = VALUES(search), email = VALUES(email)";
$statement = DBManager::get()->prepare($query);
$statement->execute(array($this->user->user_id, $online, $search, $email));
$this->reportSuccess(_('Ihre Sichtbarkeitseinstellungen wurden gespeichert.'));
$this->redirect('settings/privacy');
}
示例8: store_action
/**
* Stores a user's calendar settings
*/
public function store_action()
{
$this->check_ticket();
$this->config->store('CALENDAR_SETTINGS', array('view' => Request::option('cal_view'), 'start' => Request::option('cal_start'), 'end' => Request::option('cal_end'), 'step_day' => Request::option('cal_step_day'), 'step_week' => Request::option('cal_step_week'), 'type_week' => Request::option('cal_type_week'), 'holidays' => Request::option('cal_holidays'), 'sem_data' => Request::option('cal_sem_data'), 'delete' => Request::option('cal_delete'), 'step_week_group' => Request::option('cal_step_week_group'), 'step_day_group' => Request::option('cal_step_day_group')));
$this->reportSuccess(_('Ihre Einstellungen wurden gespeichert'));
$this->redirect('settings/calendar');
}
示例9: before_filter
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$course_id = Request::option('sem_id', $args[0]);
if (empty($course_id)) {
checkObject();
//wirft Exception, wenn $SessionSeminar leer ist
$course_id = $GLOBALS['SessionSeminar'];
}
$this->course = Course::find($course_id);
if (!$this->course) {
throw new Trails_Exception(400);
}
$this->send_from_search_page = Request::get('send_from_search_page');
if ($GLOBALS['SessionSeminar'] != $this->course->id && !(int) $this->course->visible && !($GLOBALS['perm']->have_perm(Config::get()->SEM_VISIBILITY_PERM) || $GLOBALS['perm']->have_studip_perm('user', $this->course->id))) {
throw new AccessDeniedException(_('Diese Veranstaltung ist versteckt. Hier gibt es nichts zu sehen.'));
}
if (!preg_match('/^(' . preg_quote($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'], '/') . ')?([a-zA-Z0-9_-]+\\.php)([a-zA-Z0-9_?&=-]*)$/', $this->send_from_search_page)) {
$this->send_from_search_page = '';
}
if ($this->course->getSemClass()->offsetGet('studygroup_mode')) {
if ($GLOBALS['perm']->have_studip_perm('autor', $this->course->id)) {
// participants may see seminar_main
$link = URLHelper::getUrl('seminar_main.php', array('auswahl' => $this->course->id));
} else {
$link = URLHelper::getUrl('dispatch.php/course/studygroup/details/' . $this->course->id, array('send_from_search_page' => $this->send_from_search_page));
}
$this->redirect($link);
return;
}
}
示例10: trigger_automaticupdate_action
public function trigger_automaticupdate_action($class)
{
$output = array();
if (Request::isPost()) {
$plugin = PluginManager::getInstance()->getPluginInfo($class);
$low_cost_secret = md5($GLOBALS['STUDIP_INSTALLATION_ID'] . $plugin['id']);
if ($plugin['automatic_update_url'] && $low_cost_secret === \Request::option("s")) {
if ($plugin['automatic_update_secret'] && !$this->verify_secret($plugin['automatic_update_secret'])) {
$output['error'] = "Incorrect payload.";
} else {
//everything fine, we can download and install the plugin
$update_url = $plugin['automatic_update_url'];
require_once 'app/models/plugin_administration.php';
$plugin_admin = new PluginAdministration();
try {
$plugin_admin->installPluginFromURL($update_url);
} catch (Exception $e) {
$output['exception'] = $e->getMessage();
}
}
} else {
$output['error'] = "Wrong URL.";
}
if (!count($output)) {
$output['message'] = "ok";
}
} else {
$output['error'] = "Only POST requests allowed.";
}
$this->render_json($output);
}
示例11: index_action
/**
* Administrtion view for smileys
*/
public function index_action()
{
$this->view = Request::option('view', Smiley::getFirstUsedCharacter() ?: 'a');
$this->smileys = Smiley::getGrouped($this->view);
$this->favorites_enabled = SmileyFavorites::isEnabled();
$this->setSidebar($this->view);
}
示例12: before_filter
/**
* common tasks for all actions
*/
function before_filter(&$action, &$args)
{
global $perm;
parent::before_filter($action, $args);
if (Request::get('termin_id')) {
$this->dates[0] = new SingleDate(Request::option('termin_id'));
$this->course_id = $this->dates[0]->range_id;
}
if (Request::get('issue_id')) {
$this->issue_id = Request::option('issue_id');
$this->dates = array_values(array_map(function ($data) {
$d = new SingleDate();
$d->fillValuesFromArray($data);
return $d;
}, IssueDB::getDatesforIssue(Request::option('issue_id'))));
$this->course_id = $this->dates[0]->range_id;
}
if (!get_object_type($this->course_id, array('sem')) || SeminarCategories::GetBySeminarId($this->course_id)->studygroup_mode || !$perm->have_studip_perm("tutor", $this->course_id)) {
throw new Trails_Exception(400);
}
PageLayout::setHelpKeyword("Basis.VeranstaltungenVerwaltenAendernVonZeitenUndTerminen");
PageLayout::setTitle(Course::findCurrent()->getFullname() . " - " . _("Veranstaltungstermine absagen"));
$this->set_content_type('text/html;charset=windows-1252');
if (Request::isXhr()) {
$this->set_layout(null);
$this->response->add_header('X-Title', PageLayout::getTitle());
$request = Request::getInstance();
foreach ($request as $key => $value) {
$request[$key] = studip_utf8decode($value);
}
}
}
示例13: handleOpenRanges
/**
* manages the session variables used for the open/close thing
*
* @access private
*/
function handleOpenRanges()
{
global $_REQUEST;
$this->open_ranges[$this->start_item_id] = true;
if (Request::option('close_item') || Request::option('open_item')) {
$toggle_item = Request::option('close_item') ? Request::option('close_item') : Request::option('open_item');
if (!$this->open_items[$toggle_item]) {
$this->open_items[$toggle_item] = true;
} else {
unset($this->open_items[$toggle_item]);
}
if ($this->tree->hasKids(Request::option('open_item'))) {
$this->start_item_id = Request::option('open_item');
$this->open_ranges = null;
$this->open_items = null;
$this->open_items[Request::option('open_item')] = true;
$this->open_ranges[Request::option('open_item')] = true;
}
$this->anchor = $toggle_item;
}
if ($this->start_item_id == "root") {
$this->open_ranges = null;
$this->open_ranges[$this->start_item_id] = true;
}
}
示例14: setConnection
/**
* set connection
*
* sets connection with seminar
* @access public
* @param string $seminar_id seminar-id
* @return boolean successful
*/
function setConnection($seminar_id)
{
global $connected_cms, $messages;
$write_permission = Request::option("write_permission");
$crs_id = ObjectConnections::getConnectionModuleId($seminar_id, "crs", $this->cms_type);
$connected_cms[$this->cms_type]->soap_client->setCachingStatus(false);
$connected_cms[$this->cms_type]->soap_client->clearCache();
// Check, ob Kurs in ILIAS gelöscht wurde
if ($crs_id != false and $connected_cms[$this->cms_type]->soap_client->getObjectByReference($crs_id) == false) {
ObjectConnections::unsetConnection($seminar_id, $crs_id, "crs", $this->cms_type);
$messages["info"] .= _("Der zugeordnete ILIAS-Kurs (ID {$crs_id}) existiert nicht mehr. Ein neuer Kurs wird angelegt.") . "<br>";
$crs_id = false;
}
$crs_id == $connected_cms[$this->cms_type]->createCourse($seminar_id);
if ($crs_id == false) {
return false;
}
$ref_id = $this->getId();
if (Request::get("copy_object") == "1") {
$connected_cms[$this->cms_type]->soap_client->user_type = 'user';
$ref_id = $connected_cms[$this->cms_type]->soap_client->copyObject($this->id, $crs_id);
$connected_cms[$this->cms_type]->soap_client->user_type = 'admin';
} else {
$ref_id = $connected_cms[$this->cms_type]->soap_client->addReference($this->id, $crs_id);
}
if (!$ref_id) {
$messages["error"] .= _("Zuordnungs-Fehler: Objekt konnte nicht angelegt werden.");
return false;
}
$local_roles = $connected_cms[$this->cms_type]->soap_client->getLocalRoles($crs_id);
$member_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ));
$admin_operations = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ, OPERATION_WRITE, OPERATION_DELETE));
$admin_operations_no_delete = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ, OPERATION_WRITE));
$admin_operations_readonly = $connected_cms[$this->cms_type]->permissions->getOperationArray(array(OPERATION_VISIBLE, OPERATION_READ, OPERATION_DELETE));
foreach ($local_roles as $key => $role_data) {
// check only if local role is il_crs_member, -tutor or -admin
if (strpos($role_data["title"], "il_crs_") === 0) {
if (strpos($role_data["title"], 'il_crs_member') === 0) {
$operations = $write_permission == "autor" ? $admin_operations_no_delete : $member_operations;
} elseif (strpos($role_data["title"], 'il_crs_tutor') === 0) {
$operations = $write_permission == "tutor" || $write_permission == "autor" ? $admin_operations : $admin_operations_readonly;
} elseif (strpos($role_data["title"], 'il_crs_admin') === 0) {
$operations = $write_permission == "dozent" || $write_permission == "tutor" || $write_permission == "autor" ? $admin_operations : $admin_operations_readonly;
} else {
continue;
}
$connected_cms[$this->cms_type]->soap_client->revokePermissions($role_data["obj_id"], $ref_id);
$connected_cms[$this->cms_type]->soap_client->grantPermissions($operations, $role_data["obj_id"], $ref_id);
}
}
if ($ref_id) {
$this->setId($ref_id);
return ContentModule::setConnection($seminar_id);
} else {
$messages["error"] .= _("Die Zuordnung konnte nicht gespeichert werden.");
}
return false;
}
示例15: export_action
public function export_action($id)
{
$this->table = FleximportTable::find($id);
if (Request::option("secret") !== $this->table->getExportSecret()) {
throw new AccessDeniedException();
}
$this->table->fetchData();
$this->render_csv();
}