本文整理汇总了PHP中Request::int方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::int方法的具体用法?PHP Request::int怎么用?PHP Request::int使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::int方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store_action
/**
* Stores the general settings of a user.
*/
public function store_action()
{
$this->check_ticket();
$language = Request::get('forced_language');
if (array_key_exists($language, $GLOBALS['INSTALLED_LANGUAGES'])) {
$this->user->preferred_language = $_SESSION['_language'] = $language;
$this->user->store();
}
$this->config->store('PERSONAL_STARTPAGE', Request::int('personal_startpage'));
$this->config->store('ACCESSKEY_ENABLE', Request::int('accesskey_enable'));
$this->config->store('SHOWSEM_ENABLE', Request::int('showsem_enable'));
$this->config->store('SKIPLINKS_ENABLE', Request::int('skiplinks_enable'));
$this->config->store('TOUR_AUTOSTART_DISABLE', Request::int('tour_autostart_disable'));
if (Request::int('personal_notifications_activated')) {
PersonalNotifications::activate();
} else {
PersonalNotifications::deactivate();
}
if (Request::int('personal_notifications_audio_activated')) {
PersonalNotifications::activateAudioFeedback();
} else {
PersonalNotifications::deactivateAudioFeedback();
}
$this->reportSuccess(_('Die Einstellungen wurden gespeichert.'));
$this->redirect('settings/general');
}
示例2: findAll
static function findAll($user_id, $days = 1, $future = true)
{
$future = Request::int('future', $future);
$days = Request::int('days', $days);
$items = self::get_dates($user_id, $days, $future);
return $items;
}
示例3: before_filter
/**
* Common code for all actions: set default layout and page title.
*
* @param type $action
* @param type $args
*/
function before_filter(&$action, &$args)
{
$this->validate_args($args, array('option', 'option'));
parent::before_filter($action, $args);
// set correct encoding if this is an ajax-call
if (Request::isAjax()) {
header('Content-Type: text/html; charset=Windows-1252');
}
$this->flash = Trails_Flash::instance();
// set default layout
$layout = $GLOBALS['template_factory']->open('layouts/base');
$this->set_layout($layout);
// Set help keyword for Stud.IP's user-documentation and page title
PageLayout::setHelpKeyword('Basis.Forum');
PageLayout::setTitle($_SESSION['SessSemName']['header_line'] . ' - ' . _('Forum'));
$this->AVAILABLE_DESIGNS = array('web20', 'studip');
if ($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'] && $GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'] != '/') {
$this->picturepath = $GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'] . '/' . $this->dispatcher->trails_root . '/img';
} else {
$this->picturepath = '/' . $this->dispatcher->trails_root . '/img';
}
// we want to display the dates in german
setlocale(LC_TIME, 'de_DE@euro', 'de_DE', 'de', 'ge');
// the default for displaying timestamps
$this->time_format_string = "%a %d. %B %Y, %H:%M";
$this->time_format_string_short = "%d.%m.%Y, %H:%M";
$this->template_factory = new Flexi_TemplateFactory(dirname(__FILE__) . '/../templates');
//$this->check_token();
ForumVisit::setVisit($this->getId());
if (Request::int('page')) {
ForumHelpers::setPage(Request::int('page'));
}
$this->seminar_id = $this->getId();
}
示例4: 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'));
}
}
示例5: 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');
}
示例6: initSubNavigation
/**
* Initialize the subnavigation of this item. This method
* is called once before the first item is added or removed.
*/
public function initSubNavigation()
{
global $perm, $atime;
parent::initSubNavigation();
// schedule
if (!$perm->have_perm('admin') && get_config('SCHEDULE_ENABLE')) {
$navigation = new Navigation(_('Stundenplan'), 'dispatch.php/calendar/schedule');
$this->addSubNavigation('schedule', $navigation);
}
// calendar
$atime = $atime ? intval($atime) : Request::int($atime);
if (get_config('CALENDAR_ENABLE')) {
$navigation = new Navigation(_('Terminkalender'), 'dispatch.php/calendar/single', array('self' => 1));
$this->addSubNavigation('calendar', $navigation);
}
}
示例7: combineAssets
private function combineAssets($target, $sources = array(), $extension = '', $path = 'assets/')
{
$target = $path . $target . $extension;
if (Request::int('reset') or !file_exists($this->getPluginPath() . '/' . $target)) {
$combined = '';
foreach ($sources as $source) {
$file = $this->getPluginPath() . '/' . $path . $source . $extension;
$asset = file_get_contents($file);
$asset = trim($asset) . "\n";
$asset = preg_replace('/assets\\/images\\/([^)]+)\\.png/ex', 'Assets::image_path("$1")', $asset);
$combined .= $asset;
}
file_put_contents($this->getPluginPath() . '/' . $target, $combined);
}
return $this->getPluginURL() . '/' . $target;
}
示例8: index_action
public function index_action($page = 1)
{
$this->entries_per_page = Request::int('entries_per_page', 20);
$images = array();
foreach (scandir($GLOBALS['DYNAMIC_CONTENT_PATH'] . '/user') as $file) {
if (strpos($file, '_normal.png') !== FALSE && $file !== 'nobody_normal.png') {
$images[] = array('time' => @filemtime($GLOBALS['DYNAMIC_CONTENT_PATH'] . '/user/' . $file), 'file' => $file, 'user_id' => substr($file, 0, strrpos($file, '_')));
}
}
usort($images, function ($b, $a) {
return $a['time'] - $b['time'];
});
$this->entries = sizeof($images);
$this->page = $page;
$this->images = array_slice($images, $this->entries_per_page * ($page - 1), $this->entries_per_page);
}
示例9: update_action
function update_action()
{
CSRFProtection::verifyUnsafeRequest();
if (Request::submitted('ok')) {
if (!($rule = $this->ws_rules[Request::int('ws_rule_id')])) {
$rule = new WebserviceAccessRule();
$rule->id = 0;
array_unshift($this->ws_rules, $rule);
}
$rule->api_key = trim(Request::get('ws_rule_api_key'));
$rule->method = trim(Request::get('ws_rule_method'));
$rule->ip_range = trim(Request::get('ws_rule_ip_range'));
$rule->type = trim(Request::get('ws_rule_type'));
$msg = array();
if (strlen($rule->api_key) < 5) {
$msg['error'][] = _("Bitte geben Sie einen API-Key mit min. 5 Zeichen an.");
}
foreach ($rule->ip_range as $key => $ip) {
if (!$ip) {
unset($rule->ip_range[$key]);
continue;
}
list($ip_address, $mask) = split('/', $ip);
if (!ip2long($ip_address) || $mask && ($mask < 8 || $mask > 30)) {
$msg['error'][] = sprintf(_("Der IP Bereich %s ist ungültig."), htmlready($ip));
unset($rule->ip_range[$key]);
}
}
if (!$rule->method) {
$msg['info'][] = _("Eine Regel ohne angegebene Methode gilt für alle Methoden!");
}
if (!count($rule->ip_range)) {
$msg['info'][] = _("Eine Regel ohne IP Bereich gilt für alle IP Adressen!");
}
if ($msg['error']) {
PageLayout::postMessage(MessageBox::error(_("Die Regel wurde nicht gespeichert."), $msg['error']));
$this->edit = $rule->id;
$this->render_action('index');
return;
} else {
if ($rule->store()) {
PageLayout::postMessage(MessageBox::success(_("Die Regel wurde gespeichert."), $msg['info']));
}
}
}
$this->redirect($this->url_for('admin/webservice_access'));
}
示例10: extractConsumerFromRequest
/**
*
**/
public function extractConsumerFromRequest($key)
{
$key = Request::option('consumer_key', $key);
$consumer = self::load($key);
if (Request::submitted('store')) {
$consumer['requester_email'] = trim(Request::get('requester_email'));
$consumer['requester_name'] = trim(Request::get('requester_name'));
$consumer['callback_uri'] = Request::get('callback_uri');
$consumer['application_uri'] = Request::get('application_uri');
$consumer['application_title'] = Request::get('application_title');
$consumer['application_descr'] = Request::get('application_descr');
$consumer['application_notes'] = Request::get('application_notes');
$consumer['application_type'] = Request::option('application_type');
$consumer['application_commercial'] = Request::int('application_commercial');
}
return $consumer;
}
示例11: index_action
public function index_action($verify_action = null)
{
if (Request::submitted('store')) {
$this->check_ticket();
if (Request::get('new_smsforward_rec')) {
$this->user->smsforward_rec = get_userid(Request::get('new_smsforward_rec'));
$this->user->smsforward_copy = 1;
} else {
if (Request::int('smsforward_copy') && !$this->user->smsforward_copy) {
$this->user->smsforward_copy = 1;
} else {
if (!Request::int('smsforward_copy') && $this->user->smsforward_copy) {
$this->user->smsforward_copy = 0;
}
}
}
$this->user->email_forward = Request::int('send_as_email');
$this->user->store();
// write to user config table
$this->config->store('ONLINE_NAME_FORMAT', Request::option('online_format'));
$this->config->store('MAIL_AS_HTML', Request::int('mail_format'));
$settings = $this->settings;
$settings['sms_sig'] = Request::get('sms_sig');
$settings['logout_markreaded'] = Request::int('logout_markreaded');
$settings['save_snd'] = Request::int('save_snd', 2);
$settings['request_mail_forward'] = Request::int('request_mail_forward', 0);
$this->config->store('MESSAGING_SETTINGS', $settings);
$this->reportSuccess(_('Ihre Einstellungen wurden erfolgreich gespeichert.'));
$this->redirect('settings/messaging');
}
if (!$this->user->smsforward_rec && Request::submitted('gosearch')) {
$vis_query = get_vis_query('auth_user_md5');
$query = "SELECT user_id, username, {$GLOBALS['_fullname_sql']['full_rev']} AS fullname, perms\n FROM auth_user_md5\n LEFT JOIN user_info USING (user_id)\n WHERE (username LIKE CONCAT('%', :needle, '%') OR\n Vorname LIKE CONCAT('%', :needle, '%') OR\n Nachname LIKE CONCAT('%', :needle, '%'))\n AND user_id != :user_id AND {$vis_query}\n ORDER BY Nachname ASC";
$statement = DBManager::get()->prepare($query);
$statement->bindValue(':needle', Request::get('search_exp'));
$statement->bindValue(':user_id', $this->user->user_id);
$statement->execute();
$matches = $statement->fetchAll(PDO::FETCH_ASSOC);
} else {
$matches = false;
}
$this->matches = $matches;
$this->verify_action = $verify_action;
}
示例12: approve_action
public function approve_action($plugin_id)
{
$this->marketplugin = new MarketPlugin($plugin_id);
if ($this->marketplugin['approved']) {
throw new Exception("Plugin ist schon reviewt.");
}
$this->marketplugin['approved'] = (int) Request::int("approved");
if (!$this->marketplugin['approved']) {
$this->marketplugin['publiclyvisible'] = 0;
}
if ($this->marketplugin['approved'] && $this->marketplugin['publiclyvisible']) {
$this->marketplugin['published'] = time();
}
$this->marketplugin->store();
$messaging = new messaging();
$messaging->insert_message(sprintf(_("Ihr Plugin %s wurde reviewt:"), $this->marketplugin['name']) . "\n\n" . ($this->marketplugin['approved'] ? _("Es ist in den Marktplatz aufgenommen worden!") : _("Es ist leider noch nicht in den Marktplatz aufgenommen.")) . "\n\n" . (Request::get("review") ? _("Begründung:") . "\n\n" . Request::get("review") : _("Ein ausführliches Review wurde nicht angegeben und muss bei Bedarf direkt angefragt werden.")), get_username($this->marketplugin['user_id']), '', '', '', '', '', _("Pluginreview"), true, 'normal', "pluginreview");
PageLayout::postMessage(MessageBox::success(_("Review wurde gespeichert.")));
$this->redirect('approving/overview');
}
示例13: index_action
/**
* Displays the online list.
**/
public function index_action()
{
$this->contact_count = Contact::countBySQL('owner_id=?', array(User::findCurrent()->id));
// Total number of contacts
$this->users = $this->getOnlineUsers($this->settings['show_groups']);
$this->showOnlyBuddies = $this->settings['show_only_buddys'];
$this->showGroups = $this->settings['show_groups'];
$this->limit = Config::getInstance()->ENTRIES_PER_PAGE;
$max_page = ceil(count($this->users['users']) / $this->limit);
$this->page = min(Request::int('page', 1), $max_page);
// Setup sidebar
$sidebar = Sidebar::get();
$sidebar->setImage('sidebar/person-sidebar.png');
// Add buddy configuration option to sidebar only if the user actually
// has buddies
if ($this->contact_count > 0) {
$actions = new OptionsWidget();
$actions->addCheckbox(_('Nur Kontakte in der Übersicht der aktiven Benutzer anzeigen'), $this->settings['show_only_buddys'], $this->url_for('online/config/show_buddies/' . get_ticket()));
$actions->addCheckbox(_('Kontaktgruppen bei der Darstellung berücksichtigen'), $this->settings['show_groups'], $this->url_for('online/config/show_groups/' . get_ticket()));
$sidebar->addWidget($actions);
}
}
示例14: edit_action
/**
*
**/
public function edit_action($key = null)
{
$this->consumer = $this->store->extractConsumerFromRequest($key);
if (Request::submitted('store')) {
$errors = $this->store->validate($this->consumer);
if (!empty($errors)) {
$message = MessageBox::error(_('Folgende Fehler sind aufgetreten:'), $errors);
PageLayout::postMessage($message);
return;
}
$consumer = $this->store->store($this->consumer, Request::int('enabled', 0));
if ($key) {
$message = MessageBox::success(_('Die Applikation wurde erfolgreich gespeichert.'));
} else {
$details = $this->render_keys($key, $consumer);
$message = MessageBox::success(_('Die Applikation wurde erfolgreich erstellt, die Schlüssel finden Sie in den Details dieser Meldung.'), $details, true);
}
PageLayout::postMessage($message);
$this->redirect('admin/index#' . $consumer['consumer_key']);
return;
}
$this->set_layout($GLOBALS['template_factory']->open('layouts/base_without_infobox'));
$this->id = $id;
}
示例15: array
?>
" href="<?php
echo URLHelper::getLink("?", array('offset' => Request::int("offset") - $messageBufferCount > 0 ? Request::int("offset") - $messageBufferCount : null));
?>
"><?php
echo Icon::create('arr_1left', 'clickable')->asImg(["class" => "text-bottom"]);
?>
</a>
<? endif ?>
<? if ($more) : ?>
<div style="float:right">
<a title="<?php
echo _("weiter");
?>
" href="<?php
echo URLHelper::getLink("?", array('offset' => Request::int("offset") + $messageBufferCount));
?>
"><?php
echo Icon::create('arr_1right', 'clickable')->asImg(["class" => "text-bottom"]);
?>
</a>
</div>
<? endif ?>
</td>
</tr>
</noscript>
<? endif ?>
<? else : ?>
<tr>
<td colspan="7" style="text-align: center"><?php
echo _("Keine Nachrichten");