本文整理汇总了PHP中Request::isXhr方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::isXhr方法的具体用法?PHP Request::isXhr怎么用?PHP Request::isXhr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::isXhr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before_filter
/**
* Before filter, set up the page by initializing the session and checking
* all conditions.
*
* @param String $action Name of the action to be invoked
* @param Array $args Arguments to be passed to the action method
*/
public function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
if (!Config::Get()->LITERATURE_ENABLE) {
throw new AccessDeniedException(_('Die Literaturverwaltung ist nicht aktiviert.'));
}
$this->attributes['textarea'] = array('style' => 'width:98%', 'rows' => 2);
$this->attributes['select'] = array();
$this->attributes['date'] = array();
$this->attributes['combo'] = array('style' => 'width:45%; display: inline;');
$this->attributes['lit_select'] = array('style' => 'font-size:8pt;width:100%');
// on AJAX request set no page layout.
if (Request::isXhr()) {
$this->via_ajax = true;
$this->set_layout(null);
$request = Request::getInstance();
foreach ($request as $key => $value) {
$request[$key] = studip_utf8decode($value);
}
}
$this->set_content_type('text/html;charset=windows-1252');
/* checkObject(); // do we have an open object?
checkObjectModule('literature');
object_set_visit_module('literature');/**/
}
示例2: js_form_action
/**
* Action which shows a js-enabled dialog form.
*/
public function js_form_action($name)
{
$mp = MultiPersonSearch::load($name);
$this->name = $name;
$this->description = $mp->getDescription();
$this->quickfilter = $mp->getQuickfilterIds();
$this->additionHTML = $mp->getAdditionHTML();
$this->data_dialog_status = $mp->getDataDialogStatus();
foreach ($this->quickfilter as $title => $users) {
$tmp = User::findMany($users, 'ORDER BY nachname asc, vorname asc');
$this->quickfilter[$title] = $tmp;
}
$this->executeURL = $mp->getExecuteURL();
$this->jsFunction = $mp->getJSFunctionOnSubmit();
$tmp = User::findMany($mp->getDefaultSelectableUsersIDs(), 'ORDER BY nachname asc, vorname asc');
$this->defaultSelectableUsers = $tmp;
$tmp = User::findMany($mp->getDefaultSelectedUsersIDs(), 'ORDER BY nachname asc, vorname asc');
$this->defaultSelectedUsers = $tmp;
$this->ajax = Request::isXhr();
if ($this->ajax) {
$this->set_layout(null);
} else {
$this->title = $mp->getTitle();
if ($mp->getNavigationItem() != "") {
Navigation::activateItem($mp->getNavigationItem());
}
}
}
示例3: 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();
}
}
示例4: edit_images_action
public function edit_images_action($plugin_id)
{
$this->marketplugin = new MarketPlugin($plugin_id);
if (Request::isXhr()) {
$this->response->add_header('X-Title', _("Galerie bearbeiten"));
$this->set_layout(null);
}
}
示例5: setDialogLayout
protected function setDialogLayout($icon = false)
{
$layout = $this->get_template_factory()->open('document/dialog-layout.php');
$layout->icon = $icon;
if (!Request::isXhr()) {
$layout->set_layout($GLOBALS['template_factory']->open('layouts/base'));
}
$this->set_layout($layout);
}
示例6: index_action
/**
* Display the block appointments
*/
public function index_action()
{
if (!Request::isXhr()) {
Navigation::activateItem('/course/admin/timesrooms');
}
$this->editParams = array('fromDialog' => Request::get('fromDialog'));
$this->start_ts = strtotime('this monday');
$this->request = $this->flash['request'];
}
示例7: keys_action
/**
*
**/
public function keys_action($key)
{
$details = $this->render_keys($key);
if (Request::isXhr()) {
$this->render_text(implode('<br>', $details));
} else {
PageLayout::postMessage(Messagebox::info(_('Die Schlüssel in den Details dieser Meldung sollten vertraulich behandelt werden!'), $details, true));
$this->redirect('admin/index#' . $key);
}
}
示例8: review_action
public function review_action($plugin_id)
{
$this->marketplugin = new MarketPlugin($plugin_id);
if ($this->marketplugin['approved']) {
throw new Exception("Plugin ist schon reviewt.");
}
if (Request::isXhr()) {
$this->response->add_header('X-Title', _("Review schreiben"));
$this->set_layout(null);
}
}
示例9: details_action
public function details_action($termin_id)
{
Navigation::activateItem('/course/schedule/dates');
$this->date = new CourseDate($termin_id);
$this->cancelled_dates_locked = LockRules::Check($this->date->range_id, 'cancelled_dates');
$this->dates_locked = LockRules::Check($this->date->range_id, 'room_time');
if (Request::isXhr()) {
$this->set_layout(null);
$this->set_content_type('text/html;Charset=windows-1252');
$this->response->add_header('X-Title', $this->date->getTypeName() . ": " . $this->date->getFullname());
}
}
示例10: index_action
function index_action()
{
$this->questions = Question::findAll($this->cid);
if (Request::isXhr()) {
$this->render_json(array_map(function ($q) {
return $q->toJSON();
}, $this->questions));
} else {
$this->setupStudipNavigation();
$this->short_url = $this->generateShortURL();
# now render template implicitly
}
}
示例11: store_action
public function store_action($version)
{
$body = Request::get('body');
if (Request::isXhr()) {
$body = studip_utf8decode($body);
}
submitWikiPage($this->keyword, $version, $body, $GLOBALS['user']->id, $this->range_id);
$latest_version = getLatestVersion($this->keyword, $this->range_id);
if (Request::isXhr()) {
$this->render_json(array('version' => $latest_version['version'], 'body' => $latest_version['body'], 'messages' => implode(PageLayout::getMessages()) ?: false, 'zusatz' => getZusatz($latest_version)));
} else {
// Yeah, wait for the whole trailification of the wiki...
}
}
示例12: after_filter
function after_filter($action, $args)
{
if (Request::isXhr()) {
foreach ($this->response->headers as $k => $v) {
if ($k === 'Location') {
$this->response->headers['X-Location'] = $v;
unset($this->response->headers['Location']);
$this->response->set_status(200);
$this->response->body = '';
}
}
}
parent::after_filter($action, $args);
}
示例13: before_filter
/**
* Callback function being called before an action is executed.
*/
function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
if (Request::isXhr()) {
$this->set_layout(null);
$this->set_content_type('text/html;Charset=windows-1252');
}
Navigation::activateItem('/start');
PageLayout::setTabNavigation(NULL);
// disable display of tabs
PageLayout::setHelpKeyword("Basis.Startseite");
// set keyword for new help
PageLayout::setTitle(_('Startseite'));
}
示例14: mark_notification_read_action
/**
* Marks a personal notification as read by the user so it won't be displayed
* in the list in the header.
* @param string $id : hash-id of the notification
*/
public function mark_notification_read_action($id)
{
PersonalNotifications::markAsRead($id);
if (Request::isXhr()) {
$this->render_nothing();
} else {
$notification = new PersonalNotifications($id);
if ($notification->url) {
$this->redirect(URLHelper::getUrl(TransformInternalLinks($notification->url)));
} else {
$this->render_nothing();
}
}
}
示例15: before_filter
/**
* common tasks for all actions
*/
function before_filter(&$action, &$args)
{
parent::before_filter($action, $args);
$this->course_id = $args[0];
if (!in_array($action, words('apply claim delete order_down order_up'))) {
$this->redirect($this->url_for('/apply/' . $action));
return false;
}
if (!get_object_type($this->course_id, array('sem'))) {
throw new Trails_Exception(400);
}
$course = Seminar::GetInstance($this->course_id);
$enrolment_info = $course->getEnrolmentInfo($GLOBALS['user']->id);
//Ist bereits Teilnehmer/Admin/freier Zugriff -> gleich weiter
if ($enrolment_info['enrolment_allowed'] && (in_array($enrolment_info['cause'], words('root courseadmin member')) || $enrolment_info['cause'] == 'free_access' && $GLOBALS['user']->id == 'nobody')) {
$redirect_url = UrlHelper::getUrl('seminar_main.php', array('auswahl' => $this->course_id));
if (Request::isXhr()) {
$this->response->add_header('X-Location', $redirect_url);
$this->render_nothing();
} else {
$this->redirect($redirect_url);
}
return false;
}
//Grundsätzlich verboten
if (!$enrolment_info['enrolment_allowed']) {
throw new AccessDeniedException($enrolment_info['description']);
}
PageLayout::setTitle($course->getFullname() . " - " . _("Veranstaltungsanmeldung"));
PageLayout::addSqueezePackage('enrolment');
if (Request::isXhr()) {
$this->set_layout(null);
$this->response->add_header('X-No-Buttons', 1);
$this->response->add_header('X-Title', PageLayout::getTitle());
$request = Request::getInstance();
foreach ($request as $key => $value) {
$request[$key] = studip_utf8decode($value);
}
} else {
$this->set_layout($GLOBALS['template_factory']->open('layouts/base'));
}
$this->set_content_type('text/html;charset=windows-1252');
if (Request::submitted('cancel')) {
$this->redirect(URLHelper::getURL('dispatch.php/course/details/', array('sem_id' => $this->course_id)));
}
}