|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ubiquity\scaffolding; |
|
4
|
|
|
|
|
5
|
|
|
use Ajax\semantic\html\elements\HtmlButton; |
|
6
|
|
|
use Ubiquity\controllers\Startup; |
|
7
|
|
|
use Ubiquity\utils\http\USession; |
|
8
|
|
|
|
|
9
|
|
|
class AdminScaffoldController extends ScaffoldController { |
|
10
|
|
|
private $msgCallback; |
|
11
|
|
|
|
|
12
|
|
|
public function __construct($controller) { |
|
13
|
|
|
$this->msgCallback = function ($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null) use ($controller) { |
|
14
|
|
|
$controller->showSimpleMessage ( $content, $type, $title, $icon, $timeout, $staticName ); |
|
15
|
|
|
}; |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
protected function getTemplateDir() { |
|
19
|
|
|
return Startup::getFrameworkDir () . "/admin/templates/"; |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
protected function showSimpleMessage($content, $type, $title = null, $icon = "info", $timeout = NULL, $staticName = null) { |
|
23
|
|
|
return $this->msgCallback ( $content, $type, $title, $icon, $timeout, $staticName ); |
|
|
|
|
|
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
protected function _addMessageForRouteCreation($path, $jsCallback = "") { |
|
27
|
|
|
$msgContent = "<br>Created route : <b>" . $path . "</b>"; |
|
28
|
|
|
$msgContent .= "<br>You need to re-init Router cache to apply this update:"; |
|
29
|
|
|
$btReinitCache = new HtmlButton ( "bt-init-cache", "(Re-)Init router cache", "orange" ); |
|
30
|
|
|
$btReinitCache->addIcon ( "refresh" ); |
|
31
|
|
|
$msgContent .= " " . $btReinitCache; |
|
32
|
|
|
$this->jquery->getOnClick ( "#bt-init-cache", $this->_getFiles ()->getAdminBaseRoute () . "/_refreshCacheControllers", "#messages", [ "attr" => "","hasLoader" => false,"dataType" => "html","jsCallback" => $jsCallback ] ); |
|
|
|
|
|
|
33
|
|
|
return $msgContent; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
protected function storeControllerNameInSession($controller) { |
|
37
|
|
|
USession::addOrRemoveValueFromArray ( "filtered-controllers", $controller, true ); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public static function createClass($controller, $template, $classname, $namespace, $uses, $extendsOrImplements, $classContent) { |
|
41
|
|
|
$self = new AdminScaffoldController ( $controller ); |
|
42
|
|
|
return $self->_createClass ( $template, $classname, $namespace, $uses, $extendsOrImplements, $classContent ); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public static function createMethod($controller, $access, $name, $parameters, $return, $content, $comment) { |
|
46
|
|
|
$self = new AdminScaffoldController ( $controller ); |
|
47
|
|
|
return $self->_createMethod ( $access, $name, $parameters, $return, $content, $comment ); |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.