phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
_JsUtils.php
Go to the documentation of this file.
1<?php
2
4
5
6use Cake\Routing\Router;
7use Cake\View\View;
8use Cake\Network\Response;
9use Cake\Core\App;
10
11class _JsUtils extends \Ajax\JsUtils{
12 public function getUrl($url){
13 return Router::url($url);
14 }
15 public function addViewElement($identifier,$content,&$view){
16 $viewVars=$view->viewVars;
17 if (isset($viewVars["q"]) === false) {
18 $controls=array ();
19 }else{
20 $controls=$viewVars["q"];
21 }
22 $controls[$identifier]=$content;
23 $view->set("q", $controls);
24 }
25
26 public function createScriptVariable(&$view,$view_var, $output){
27 $view->set($view_var,$output);
28 }
29
37 public function forward($initialControllerInstance,$controllerName,$actionName,$params=array()){
38 \ob_start();
39 if(isset($params) && !\is_array($params)){
41 }
42 $url=h(Router::url(\array_merge([
43 'controller' => $controllerName,
44 'action' => $actionName],$params),false
45 ));
46 $base=Router::url("/");
47 if (substr($url, 0, strlen($base)) == $base) {
48 $url = substr($url, strlen($base));
49 }
50 $initialControllerInstance->requestAction($url);
51 $result=\ob_get_contents();
52 \ob_end_clean();
53 return $result;
54 }
55
56 public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
57 $view = new View(Router::getRequest(true), new Response());
58 if(\is_array($params)){
59 foreach ($params as $k=>$v){
60 $view->set($k, $v);
61 }
62 }
63 return $view->render($viewName);
64 }
65
66 public function fromDispatcher($dispatcher){
67 return \explode("/", Router::getRequest(true)->url);
68 }
69}
JQuery PHP library.
Definition JsUtils.php:23
fromDispatcher($dispatcher)
Collects url parts from the request dispatcher : controllerName, actionName, parameters Used internal...
Definition _JsUtils.php:66
getUrl($url)
Generates an URL Used internally by phpMv.
Definition _JsUtils.php:12
renderContent($initialControllerInstance, $viewName, $params=NULL)
render the content of an existing view : $viewName and set the response to the modal content Used int...
Definition _JsUtils.php:56
createScriptVariable(&$view, $view_var, $output)
Creates the script variable script_foot Used internally by phpMv.
Definition _JsUtils.php:26
forward($initialControllerInstance, $controllerName, $actionName, $params=array())
Definition _JsUtils.php:37
addViewElement($identifier, $content, &$view)
Adds the array of controls q in the $view element Used internally by phpMv.
Definition _JsUtils.php:15