Skip to content

Commit 4051fc8

Browse files
committed
micro JsUtils class (not tested)
1 parent 9bc3143 commit 4051fc8

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

Ajax/php/micro/JsUtils.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace Ajax\php\micro;
4+
5+
use micro\controllers\Startup;
6+
use micro\utils\RequestUtils;
7+
class JsUtils extends \Ajax\JsUtils{
8+
9+
public function getUrl($url){
10+
return RequestUtils::getUrl($url);
11+
}
12+
13+
public function addViewElement($identifier,$content,&$view){
14+
$controls=$view->getVar("q");
15+
if (isset($controls) === false) {
16+
$controls=array ();
17+
}
18+
$controls[$identifier]=$content;
19+
$view->setVar("q", $controls);
20+
}
21+
22+
public function createScriptVariable(&$view,$view_var, $output){
23+
$view->setVar($view_var,$output);
24+
}
25+
26+
public function forward($initialController,$controller,$action,$params=array()){
27+
return $initialController->forward($controller,$action,$params,true,true,true);
28+
}
29+
30+
public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
31+
return $initialControllerInstance->loadView($viewName,$params,true);
32+
}
33+
34+
public function fromDispatcher($dispatcher){
35+
return Startup::$urlParts;
36+
}
37+
}

0 commit comments

Comments
 (0)