summaryrefslogtreecommitdiff
path: root/app/php/web/TemplateControl.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-06-07 15:17:49 +0200
committeremkael <emkael@tlen.pl>2016-06-10 11:46:41 +0200
commit823d71ced9b4947b1a5a5ade7245d521ed490061 (patch)
treea9a6c7cb0de74ff705e8320c284de423a698f5b5 /app/php/web/TemplateControl.php
parentdf401552aac363655ab8f056a6c910a7611954d6 (diff)
* renaming php directory
Diffstat (limited to 'app/php/web/TemplateControl.php')
-rw-r--r--app/php/web/TemplateControl.php176
1 files changed, 0 insertions, 176 deletions
diff --git a/app/php/web/TemplateControl.php b/app/php/web/TemplateControl.php
deleted file mode 100644
index aa95d75..0000000
--- a/app/php/web/TemplateControl.php
+++ /dev/null
@@ -1,176 +0,0 @@
-<?php
-
-class TemplateControl extends TTemplateControl {
-
- public function onPreRender($param) {
- parent::onPreRender($param);
- $scriptFile = $this->_getControlScriptPath(get_class($this));
- if (file_exists($scriptFile)) {
- $this->_registerScriptFile($scriptFile);
- }
- $styleFile = $this->_getControlStylePath(get_class($this));
- if (file_exists($styleFile)) {
- $this->_registerStyleFile($styleFile);
- }
- }
-
- protected function getExternalScriptDependencies() {
- return [];
- }
-
- protected function getLibScriptDependencies() {
- return [];
- }
-
- protected function getPradoScriptDependencies() {
- return [];
- }
-
- protected function getControlScriptDependencies() {
- return [];
- }
-
- protected function getExternalStyleDependencies() {
- return [];
- }
-
- protected function getLibStyleDependencies() {
- return [];
- }
-
- protected function getControlStyleDependencies() {
- return [];
- }
-
- private function _getControlScriptPath($className) {
- return Prado::getPathOfNamespace('Application.controls.scripts')
- . DIRECTORY_SEPARATOR
- . $className
- . '.js';
- }
-
- private function _getControlStylePath($className) {
- return Prado::getPathOfNamespace('Application.controls.styles')
- . DIRECTORY_SEPARATOR
- . $className
- . '.css';
- }
-
- private function _getLibPath($identifier, $extension = '') {
- return Prado::getPathOfNamespace('Lib')
- . DIRECTORY_SEPARATOR
- . $identifier
- . $extension;
- }
-
- private function _registerScriptFile($scriptFile) {
- $this->_registerExternalScriptDependencies(
- $this->getExternalScriptDependencies()
- );
- $this->_registerLibScriptDependencies(
- $this->getLibScriptDependencies()
- );
- $this->_registerPradoScriptDependencies(
- $this->getPradoScriptDependencies()
- );
- $this->_registerControlScriptDependencies(
- $this->getControlScriptDependencies()
- );
- $this->Page->ClientScript->registerScriptFile(
- 'TemplateControl.' . get_class($this),
- $this->Application->AssetManager->publishFilePath($scriptFile)
- );
- }
-
- private function _registerExternalScriptDependencies(array $dependencies) {
- foreach ($dependencies as $dependency) {
- $this->Page->ClientScript->registerHeadScriptFile(
- $dependency, $dependency
- );
- }
- }
-
- private function _registerLibScriptDependencies(array $dependencies) {
- foreach ($dependencies as $dependency) {
- $this->Page->ClientScript->registerScriptFile(
- 'LibScript.' . $dependency,
- $this->Application->AssetManager->publishFilePath(
- $this->_getLibPath($dependency, '.js')
- )
- );
- }
- }
-
- private function _registerPradoScriptDependencies(array $dependencies) {
- foreach ($dependencies as $dependency) {
- $this->Page->ClientScript->registerPradoScript($dependency);
- }
- }
-
- private function _registerControlScriptDependencies(array $dependencies) {
- foreach ($dependencies as $dependency) {
- $this->Page->ClientScript->registerScriptFile(
- 'TemplateControl.' . $dependency,
- $this->Application->AssetManager->publishFilePath(
- $this->_getControlScriptPath($dependency)
- )
- );
- }
- }
-
- private function _registerStyleFile($styleFile) {
- $this->_registerExternalStyleDependencies(
- $this->getExternalStyleDependencies()
- );
- $this->_registerLibStyleDependencies(
- $this->getLibStyleDependencies()
- );
- $this->_registerControlStyleDependencies(
- $this->getControlStyleDependencies()
- );
- if (method_exists($this->Page->ClientScript, 'registerThemeStyleSheetFile')) {
- $this->Page->ClientScript->registerThemeStyleSheetFile(
- 'TemplateControl.' . get_class($this),
- $this->Application->AssetManager->publishFilePath($styleFile)
- );
- } else {
- $this->Page->ClientScript->registerStyleSheetFile(
- 'TemplateControl.' . get_class($this),
- $this->Application->AssetManager->publishFilePath($styleFile)
- );
- }
- }
-
- private function _registerExternalStyleDependencies(array $dependencies) {
- foreach ($dependencies as $dependency) {
- $this->Page->ClientScript->registerStyleSheetFile(
- $dependency, $dependency
- );
- }
- }
-
- private function _registerLibStyleDependencies(array $dependencies) {
- foreach ($dependencies as $dependency) {
- $this->Page->ClientScript->registerStyleSheetFile(
- 'LibStyle.' . $dependency,
- $this->Application->AssetManager->publishFilePath(
- $this->_getLibPath($dependency, '.css')
- )
- );
- }
- }
-
- private function _registerControlStyleDependencies(array $dependencies) {
- foreach ($dependencies as $dependency) {
- $this->Page->ClientScript->registerStyleSheetFile(
- 'TemplateControl.' . $dependency,
- $this->Application->AssetManager->publishFilePath(
- $this->_getControlStylePath($dependency)
- )
- );
- }
- }
-
-}
-
-?>