|
|
@@ -13,8 +13,7 @@ use function ModulesGarden\Servers\ProxmoxVps\Core\Helper\sl;
|
|
|
*
|
|
|
* @author inbs
|
|
|
*/
|
|
|
-class Context
|
|
|
-{
|
|
|
+class Context {
|
|
|
use \ModulesGarden\Servers\ProxmoxVps\Core\UI\Traits\Title;
|
|
|
use \ModulesGarden\Servers\ProxmoxVps\Core\UI\Traits\HtmlElements;
|
|
|
use \ModulesGarden\Servers\ProxmoxVps\Core\UI\Traits\Template;
|
|
|
@@ -43,8 +42,7 @@ class Context
|
|
|
|
|
|
protected $initialized = true;
|
|
|
|
|
|
- public function __construct($baseId = null)
|
|
|
- {
|
|
|
+ public function __construct($baseId = null) {
|
|
|
$this->addNewElementsContainer('buttons');
|
|
|
|
|
|
$this->namespace = str_replace('\\', '_', get_class($this));
|
|
|
@@ -54,18 +52,15 @@ class Context
|
|
|
$this->loadTemplateVars();
|
|
|
}
|
|
|
|
|
|
- public function getErrorMessage()
|
|
|
- {
|
|
|
+ public function getErrorMessage() {
|
|
|
return $this->errorMessage;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function getHtml()
|
|
|
- {
|
|
|
- if ($this->html === '')
|
|
|
- {
|
|
|
+ public function getHtml() {
|
|
|
+ if ($this->html === '') {
|
|
|
$this->buildHtml();
|
|
|
}
|
|
|
|
|
|
@@ -75,23 +70,19 @@ class Context
|
|
|
/**
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function __toString()
|
|
|
- {
|
|
|
+ public function __toString() {
|
|
|
return $this->getHtml();
|
|
|
}
|
|
|
|
|
|
- protected function buildHtml()
|
|
|
- {
|
|
|
+ protected function buildHtml() {
|
|
|
$this->html = self::generate($this);
|
|
|
}
|
|
|
|
|
|
- public function getCustomTplVars()
|
|
|
- {
|
|
|
+ public function getCustomTplVars() {
|
|
|
return $this->customTplVars;
|
|
|
}
|
|
|
|
|
|
- public function getCustomTplVarsValue($varName)
|
|
|
- {
|
|
|
+ public function getCustomTplVarsValue($varName) {
|
|
|
return $this->customTplVars[$varName];
|
|
|
}
|
|
|
|
|
|
@@ -99,8 +90,7 @@ class Context
|
|
|
* @param \ModulesGarden\Servers\ProxmoxVps\Core\UI\Builder\Context $object
|
|
|
* @return string
|
|
|
*/
|
|
|
- public static function generate(Context $object)
|
|
|
- {
|
|
|
+ public static function generate(Context $object) {
|
|
|
$tpl = $object->getTemplateName();
|
|
|
|
|
|
$vars = [
|
|
|
@@ -126,23 +116,19 @@ class Context
|
|
|
$lang->stagCurrentContext('builder' . $object->getName());
|
|
|
$lang->addToContext(lcfirst($object->getName()));
|
|
|
$return = ServiceLocator::call('smarty')->setLang($lang)->view($tpl, $vars, $object->getTemplateDir());
|
|
|
- if (!$object->isVueRegistrationAllowed())
|
|
|
- {
|
|
|
+ if (!$object->isVueRegistrationAllowed()) {
|
|
|
return $return;
|
|
|
}
|
|
|
|
|
|
- if ($object->isVueComponent() && file_exists($object->getTemplateDir() . str_replace('.tpl', '', $tpl) . '_components.tpl'))
|
|
|
- {
|
|
|
+ if ($object->isVueComponent() && file_exists($object->getTemplateDir() . str_replace('.tpl', '', $tpl) . '_components.tpl')) {
|
|
|
$vueComponents = ServiceLocator::call('smarty')->setLang($lang)->view(str_replace('.tpl', '', $tpl) . '_components', $vars, $object->getTemplateDir());
|
|
|
$object->addVueComponentTemplate($vueComponents, $object->getId());
|
|
|
}
|
|
|
- if ($object->isVueComponent() && file_exists($object->getTemplateDir() . str_replace('.tpl', '', $tpl) . '_components.js'))
|
|
|
- {
|
|
|
+ if ($object->isVueComponent() && file_exists($object->getTemplateDir() . str_replace('.tpl', '', $tpl) . '_components.js')) {
|
|
|
$vueComponentsJs = file_get_contents($object->getTemplateDir() . str_replace('.tpl', '', $tpl) . '_components.js');
|
|
|
$object->addVueComponentJs($vueComponentsJs, $object->getDefaultVueComponentName());
|
|
|
}
|
|
|
- if ($object->isVueComponent() && $object->getDefaultVueComponentName())
|
|
|
- {
|
|
|
+ if ($object->isVueComponent() && $object->getDefaultVueComponentName()) {
|
|
|
$object->registerVueComponent($object->getId(), $object->getDefaultVueComponentName());
|
|
|
}
|
|
|
|