本文整理汇总了PHP中Manager::isAjaxCall方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::isAjaxCall方法的具体用法?PHP Manager::isAjaxCall怎么用?PHP Manager::isAjaxCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manager
的用法示例。
在下文中一共展示了Manager::isAjaxCall方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apply
public function apply($request, $response)
{
$response->status = MStatusCode::OK;
if (Manager::isAjaxCall()) {
$this->page->onLoad("manager.doRedirect('{$this->url}','');");
$json = new MRenderJSON();
$json->apply($request, $response);
} else {
header('Location:' . $this->url);
}
}
示例2: renderHandler
public function renderHandler()
{
$view = Manager::getView($this->getApplication(), $this->getModule(), 'handler', $this->getAction());
$page = Manager::getPage();
if ($go = $page->redirectTo) {
//mdump('redirecting: ' . $go);
$this->setResult(new MRedirect($view, $go));
} else {
if ($window = $page->window) {
$this->setResult(new MBrowserWindow());
} else {
if ($binary = $page->binary) {
//mdump('binary: ' . $binary);
$this->setResult(new MRenderBinary($binary));
} else {
if ($download = $page->download) {
//mdump('download: ' . $download);
$this->setResult(new MRenderBinary($download, false));
} else {
if ($prompt = $page->prompt) {
$page->clearContent();
parent::renderPrompt($prompt);
} else {
if (Manager::isAjaxCall()) {
//mdump('mhandler:: renderjson');
$render = new MRenderJSON();
if (!$this->getResult()) {
$this->setResult($render);
}
} else {
//mdump('mhandler:: renderpage');
$render = new MRenderPage();
if (!$this->getResult()) {
$this->setResult($render);
}
}
}
}
}
}
}
}
示例3: addStyleSheetCode
public function addStyleSheetCode($code)
{
if (Manager::isAjaxCall()) {
$fileName = md5($code) . '.css';
$file = Manager::getFrameworkPath('var/files/' . $fileName);
file_put_contents($file, $code);
$url = Manager::getDownloadURL('cache', $fileName, true);
$this->onLoad("dojo.create(\"link\", {href:'{$url}', type:'text/css', rel:'stylesheet'}, document.getElementsByTagName('head')[0]);");
} else {
$this->styleSheetCode .= "\n" . $code;
}
}
示例4: generate
public function generate($id)
{
$isAjax = Manager::isAjaxCall();
$scripts = $this->getArray();
$hasCode = $scripts[0] . $scripts[1] . $scripts[2] . $scripts[3] . $scripts[4];
if ($hasCode != '') {
$code = "";
if ($scripts[0] != '') {
$code .= <<<HERE
{$scripts['0']}
HERE;
}
$code .= "\n<script type=\"text/javascript\">\n";
if ($scripts[1] != '') {
$code .= <<<HERE
{$scripts['1']}
HERE;
}
if ($isAjax) {
if (Manager::isAjaxEvent()) {
$code .= <<<HERE
{$scripts[2]}
HERE;
} else {
$code .= <<<HERE
manager.onLoad["{$id}"] = function() {
console.log("inside onload {$id}");
{$scripts[2]}
};
HERE;
}
} else {
$code .= <<<HERE
require(["dojo/parser", "dojo/ready"], function(parser, ready){
ready(function(){
console.log("inside onload {$id}");
{$scripts[2]}
});
});
HERE;
}
$code .= <<<HERE
{$scripts[3]}
{$scripts[4]}
HERE;
$code .= <<<HERE
//-->
</script>
HERE;
return "<div id=\"{$id}\" class=\"mScripts\">{$code}</div>";
// return $code;
} else {
return '';
}
}
示例5: shutdown
function shutdown()
{
$error = error_get_last();
Manager::errorHandler($error['type'], $error['message'], $error['file'], $error['line']);
if ($error['type'] & (E_ALL & ~E_NOTICE & ~E_STRICT)) {
if (Manager::isAjaxCall()) {
$ajax = Manager::getAjax();
$ob = ob_get_clean();
if ($ajax->isEmpty()) {
$ajax->setType('page');
$ajax->setData($ob);
}
$result = $ajax->returnData();
echo $result;
}
}
}
示例6: handlerComponent
public function handlerComponent()
{
$module = $this->context->getModule();
$component = $this->context->getComponent();
mtrace('handler component=' . $component);
$fileName = $component . '.php';
$file = Manager::getAppPath('components/' . $fileName, $module);
$mlabelTemporario = new MFieldLabel();
// remover esta linha
if (file_exists($file)) {
include_once $file;
$control = new $component();
$action = $this->context->getAction();
if ($action) {
$content = $control->{$action}();
} else {
$content = $control->generate();
}
Manager::getPage()->setContent($content);
if (Manager::isAjaxCall()) {
$this->setResult(new MRenderJSON());
} else {
$this->setResult(new MRenderPage());
}
} else {
throw new ERunTimeException(_M("App: [{$this->context->app}], Module: [{$this->context->module}], Component: [{$component}] not found!"));
}
}
示例7: render
public function render($viewName = '', $parameters = array())
{
$this->renderContent($viewName, $parameters);
if (Manager::isAjaxCall()) {
$this->setResult(new MRenderJSON());
} else {
$this->setResult(new MRenderPage());
}
}