当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_Template::__construct方法代码示例

本文整理汇总了PHP中OC_Template::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Template::__construct方法的具体用法?PHP OC_Template::__construct怎么用?PHP OC_Template::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_Template的用法示例。


在下文中一共展示了OC_Template::__construct方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($renderas)
 {
     // Decide which page we show
     if ($renderas == 'user') {
         parent::__construct('core', 'layout.user');
         if (in_array(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) {
             $this->assign('bodyid', 'body-settings', false);
         } else {
             $this->assign('bodyid', 'body-user', false);
         }
         // Add navigation entry
         $navigation = OC_App::getNavigation();
         $this->assign('navigation', $navigation, false);
         $this->assign('settingsnavigation', OC_App::getSettingsNavigation(), false);
         foreach ($navigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name'], false);
                 break;
             }
         }
     } else {
         if ($renderas == 'guest') {
             parent::__construct('core', 'layout.guest');
         } else {
             parent::__construct('core', 'layout.base');
         }
     }
     $apps_paths = array();
     foreach (OC_App::getEnabledApps() as $app) {
         $apps_paths[$app] = OC_App::getAppWebPath($app);
     }
     $this->assign('apps_paths', str_replace('\\/', '/', json_encode($apps_paths)), false);
     // Ugly unescape slashes waiting for better solution
     if (OC_Config::getValue('installed', false) && !OC_AppConfig::getValue('core', 'remote_core.css', false)) {
         OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php');
         OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php');
     }
     // Add the js files
     $jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
     $this->assign('jsfiles', array(), false);
     if (!empty(OC_Util::$core_scripts)) {
         $this->append('jsfiles', OC_Helper::linkToRemoteBase('core.js', false));
     }
     foreach ($jsfiles as $info) {
         $root = $info[0];
         $web = $info[1];
         $file = $info[2];
         $this->append('jsfiles', $web . '/' . $file);
     }
     // Add the css files
     $cssfiles = self::findStylesheetFiles(OC_Util::$styles);
     $this->assign('cssfiles', array());
     if (!empty(OC_Util::$core_styles)) {
         $this->append('cssfiles', OC_Helper::linkToRemoteBase('core.css', false));
     }
     foreach ($cssfiles as $info) {
         $root = $info[0];
         $web = $info[1];
         $file = $info[2];
         $paths = explode('/', $file);
         $in_root = false;
         foreach (OC::$APPSROOTS as $app_root) {
             if ($root == $app_root['path']) {
                 $in_root = true;
                 break;
             }
         }
         if ($in_root) {
             $app = $paths[0];
             unset($paths[0]);
             $path = implode('/', $paths);
             $this->append('cssfiles', OC_Helper::linkTo($app, $path));
         } else {
             $this->append('cssfiles', $web . '/' . $file);
         }
     }
 }
开发者ID:ryanshoover,项目名称:core,代码行数:77,代码来源:templatelayout.php

示例2: __construct

 /**
  * @param string $renderAs
  * @param string $appId application id
  */
 public function __construct($renderAs, $appId = '')
 {
     // yes - should be injected ....
     $this->config = \OC::$server->getConfig();
     // Decide which page we show
     if ($renderAs == 'user') {
         parent::__construct('core', 'layout.user');
         if (in_array(OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
             $this->assign('bodyid', 'body-settings');
         } else {
             $this->assign('bodyid', 'body-user');
         }
         // Update notification
         if ($this->config->getSystemValue('updatechecker', true) === true && OC_User::isAdminUser(OC_User::getUser())) {
             $updater = new \OC\Updater(\OC::$server->getHTTPHelper(), \OC::$server->getConfig());
             $data = $updater->check();
             if (isset($data['version']) && $data['version'] != '' and $data['version'] !== array()) {
                 $this->assign('updateAvailable', true);
                 $this->assign('updateVersion', $data['versionstring']);
                 $this->assign('updateLink', $data['web']);
                 \OCP\Util::addScript('core', 'update-notification');
             } else {
                 $this->assign('updateAvailable', false);
                 // No update available or not an admin user
             }
         } else {
             $this->assign('updateAvailable', false);
             // Update check is disabled
         }
         // Add navigation entry
         $this->assign('application', '');
         $this->assign('appid', $appId);
         $navigation = OC_App::getNavigation();
         $this->assign('navigation', $navigation);
         $settingsNavigation = OC_App::getSettingsNavigation();
         $this->assign('settingsnavigation', $settingsNavigation);
         foreach ($navigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name']);
                 break;
             }
         }
         foreach ($settingsNavigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name']);
                 break;
             }
         }
         $userDisplayName = OC_User::getDisplayName();
         $this->assign('user_displayname', $userDisplayName);
         $this->assign('user_uid', OC_User::getUser());
         $this->assign('appsmanagement_active', strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0);
         $this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true));
         $this->assign('userAvatarSet', \OC_Helper::userAvatarSet(OC_User::getUser()));
     } else {
         if ($renderAs == 'error') {
             parent::__construct('core', 'layout.guest', '', false);
             $this->assign('bodyid', 'body-login');
         } else {
             if ($renderAs == 'guest') {
                 parent::__construct('core', 'layout.guest');
                 $this->assign('bodyid', 'body-login');
             } else {
                 parent::__construct('core', 'layout.base');
             }
         }
     }
     // Send the language to our layouts
     $this->assign('language', OC_L10N::findLanguage());
     if (empty(self::$versionHash)) {
         $v = OC_App::getAppVersions();
         $v['core'] = implode('.', \OC_Util::getVersion());
         self::$versionHash = md5(implode(',', $v));
     }
     $useAssetPipeline = self::isAssetPipelineEnabled();
     if ($useAssetPipeline) {
         $this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
         $this->generateAssets();
     } else {
         // Add the js files
         $jsFiles = self::findJavascriptFiles(OC_Util::$scripts);
         $this->assign('jsfiles', array(), false);
         if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
             $this->append('jsfiles', OC_Helper::linkToRoute('js_config', array('v' => self::$versionHash)));
         }
         foreach ($jsFiles as $info) {
             $web = $info[1];
             $file = $info[2];
             $this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash);
         }
         // Add the css files
         $cssFiles = self::findStylesheetFiles(OC_Util::$styles);
         $this->assign('cssfiles', array());
         foreach ($cssFiles as $info) {
             $web = $info[1];
             $file = $info[2];
//.........这里部分代码省略.........
开发者ID:alfrescoo,项目名称:core,代码行数:101,代码来源:templatelayout.php

示例3: __construct

 /**
  * @param string $renderas
  * @param string $appid application id
  */
 public function __construct($renderas, $appid = '')
 {
     // Decide which page we show
     if ($renderas == 'user') {
         parent::__construct('core', 'layout.user');
         if (in_array(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) {
             $this->assign('bodyid', 'body-settings');
         } else {
             $this->assign('bodyid', 'body-user');
         }
         // Update notification
         if (OC_Config::getValue('updatechecker', true) === true) {
             $data = OC_Updater::check();
             if (isset($data['version']) && $data['version'] != '' and $data['version'] !== array() && OC_User::isAdminUser(OC_User::getUser())) {
                 $this->assign('updateAvailable', true);
                 $this->assign('updateVersion', $data['versionstring']);
                 $this->assign('updateLink', $data['web']);
             } else {
                 $this->assign('updateAvailable', false);
                 // No update available or not an admin user
             }
         } else {
             $this->assign('updateAvailable', false);
             // Update check is disabled
         }
         // Add navigation entry
         $this->assign('application', '', false);
         $this->assign('appid', $appid);
         $navigation = OC_App::getNavigation();
         $this->assign('navigation', $navigation);
         $this->assign('settingsnavigation', OC_App::getSettingsNavigation());
         foreach ($navigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name']);
                 break;
             }
         }
         $user_displayname = OC_User::getDisplayName();
         $this->assign('user_displayname', $user_displayname);
         $this->assign('user_uid', OC_User::getUser());
         $this->assign('appsmanagement_active', strpos(OC_Request::requestUri(), OC_Helper::linkToRoute('settings_apps')) === 0);
         $this->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true));
     } else {
         if ($renderas == 'error') {
             parent::__construct('core', 'layout.guest', '', false);
         } else {
             if ($renderas == 'guest') {
                 parent::__construct('core', 'layout.guest');
             } else {
                 parent::__construct('core', 'layout.base');
             }
         }
     }
     $versionParameter = '?v=' . md5(implode(OC_Util::getVersion()));
     $useAssetPipeline = $this->isAssetPipelineEnabled();
     if ($useAssetPipeline) {
         $this->append('jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
         $this->generateAssets();
     } else {
         // Add the js files
         $jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
         $this->assign('jsfiles', array(), false);
         if (OC_Config::getValue('installed', false) && $renderas != 'error') {
             $this->append('jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
         }
         foreach ($jsfiles as $info) {
             $web = $info[1];
             $file = $info[2];
             $this->append('jsfiles', $web . '/' . $file . $versionParameter);
         }
         // Add the css files
         $cssfiles = self::findStylesheetFiles(OC_Util::$styles);
         $this->assign('cssfiles', array());
         foreach ($cssfiles as $info) {
             $web = $info[1];
             $file = $info[2];
             $this->append('cssfiles', $web . '/' . $file . $versionParameter);
         }
     }
 }
开发者ID:CyrodiilSavior,项目名称:core,代码行数:84,代码来源:templatelayout.php

示例4: __construct

 /**
  * @param string $renderAs
  * @param string $appId application id
  */
 public function __construct($renderAs, $appId = '')
 {
     // yes - should be injected ....
     $this->config = \OC::$server->getConfig();
     // Decide which page we show
     if ($renderAs == 'user') {
         parent::__construct('core', 'layout.user');
         if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
             $this->assign('bodyid', 'body-settings');
         } else {
             $this->assign('bodyid', 'body-user');
         }
         // Code integrity notification
         $integrityChecker = \OC::$server->getIntegrityCodeChecker();
         if (!$integrityChecker->hasPassedCheck()) {
             \OCP\Util::addScript('core', 'integritycheck-failed-notification');
         }
         // Add navigation entry
         $this->assign('application', '');
         $this->assign('appid', $appId);
         $navigation = \OC_App::getNavigation();
         $this->assign('navigation', $navigation);
         $settingsNavigation = \OC_App::getSettingsNavigation();
         $this->assign('settingsnavigation', $settingsNavigation);
         foreach ($navigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name']);
                 break;
             }
         }
         foreach ($settingsNavigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name']);
                 break;
             }
         }
         $userDisplayName = \OC_User::getDisplayName();
         $appsMgmtActive = strpos(\OC::$server->getRequest()->getRequestUri(), \OC::$server->getURLGenerator()->linkToRoute('settings.AppSettings.viewApps')) === 0;
         if ($appsMgmtActive) {
             $l = \OC::$server->getL10N('lib');
             $this->assign('application', $l->t('Apps'));
         }
         $this->assign('user_displayname', $userDisplayName);
         $this->assign('user_uid', \OC_User::getUser());
         $this->assign('appsmanagement_active', $appsMgmtActive);
         $this->assign('enableAvatars', $this->config->getSystemValue('enable_avatars', true) === true);
         if (\OC_User::getUser() === false) {
             $this->assign('userAvatarSet', false);
         } else {
             $this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists());
         }
     } else {
         if ($renderAs == 'error') {
             parent::__construct('core', 'layout.guest', '', false);
             $this->assign('bodyid', 'body-login');
         } else {
             if ($renderAs == 'guest') {
                 parent::__construct('core', 'layout.guest');
                 $this->assign('bodyid', 'body-login');
             } else {
                 parent::__construct('core', 'layout.base');
             }
         }
     }
     // Send the language to our layouts
     $this->assign('language', \OC_L10N::findLanguage());
     if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
         if (empty(self::$versionHash)) {
             $v = \OC_App::getAppVersions();
             $v['core'] = implode('.', \OCP\Util::getVersion());
             self::$versionHash = md5(implode(',', $v));
         }
     } else {
         self::$versionHash = md5('not installed');
     }
     $useAssetPipeline = self::isAssetPipelineEnabled();
     if ($useAssetPipeline) {
         $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash]));
         $this->generateAssets();
     } else {
         // Add the js files
         $jsFiles = self::findJavascriptFiles(\OC_Util::$scripts);
         $this->assign('jsfiles', array());
         if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') {
             $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('js_config', ['v' => self::$versionHash]));
         }
         foreach ($jsFiles as $info) {
             $web = $info[1];
             $file = $info[2];
             $this->append('jsfiles', $web . '/' . $file . '?v=' . self::$versionHash);
         }
         // Add the css files
         $cssFiles = self::findStylesheetFiles(\OC_Util::$styles);
         $this->assign('cssfiles', array());
         foreach ($cssFiles as $info) {
             $web = $info[1];
//.........这里部分代码省略.........
开发者ID:ZverAleksey,项目名称:core,代码行数:101,代码来源:templatelayout.php

示例5: __construct

 public function __construct($renderas)
 {
     // Decide which page we show
     if ($renderas == 'user') {
         parent::__construct('core', 'layout.user');
         if (in_array(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) {
             $this->assign('bodyid', 'body-settings');
         } else {
             $this->assign('bodyid', 'body-user');
         }
         // Add navigation entry
         $this->assign('application', '', false);
         $navigation = OC_App::getNavigation();
         $this->assign('navigation', $navigation);
         $this->assign('settingsnavigation', OC_App::getSettingsNavigation());
         foreach ($navigation as $entry) {
             if ($entry['active']) {
                 $this->assign('application', $entry['name']);
                 break;
             }
         }
         $user_displayname = OC_User::getDisplayName();
         $this->assign('user_displayname', $user_displayname);
         $this->assign('user_uid', OC_User::getUser());
     } else {
         if ($renderas == 'guest' || $renderas == 'error') {
             parent::__construct('core', 'layout.guest');
         } else {
             parent::__construct('core', 'layout.base');
         }
     }
     $versionParameter = '?v=' . md5(implode(OC_Util::getVersion()));
     // Add the js files
     $jsfiles = self::findJavascriptFiles(OC_Util::$scripts);
     $this->assign('jsfiles', array(), false);
     if (OC_Config::getValue('installed', false) && $renderas != 'error') {
         $this->append('jsfiles', OC_Helper::linkToRoute('js_config') . $versionParameter);
     }
     if (!empty(OC_Util::$core_scripts)) {
         $this->append('jsfiles', OC_Helper::linkToRemoteBase('core.js', false) . $versionParameter);
     }
     foreach ($jsfiles as $info) {
         $root = $info[0];
         $web = $info[1];
         $file = $info[2];
         $this->append('jsfiles', $web . '/' . $file . $versionParameter);
     }
     // Add the css files
     $cssfiles = self::findStylesheetFiles(OC_Util::$styles);
     $this->assign('cssfiles', array());
     if (!empty(OC_Util::$core_styles)) {
         $this->append('cssfiles', OC_Helper::linkToRemoteBase('core.css', false) . $versionParameter);
     }
     foreach ($cssfiles as $info) {
         $root = $info[0];
         $web = $info[1];
         $file = $info[2];
         $paths = explode('/', $file);
         $in_root = false;
         foreach (OC::$APPSROOTS as $app_root) {
             if ($root == $app_root['path']) {
                 $in_root = true;
                 break;
             }
         }
         if ($in_root) {
             $app = $paths[0];
             unset($paths[0]);
             $path = implode('/', $paths);
             $this->append('cssfiles', OC_Helper::linkTo($app, $path) . $versionParameter);
         } else {
             $this->append('cssfiles', $web . '/' . $file . $versionParameter);
         }
     }
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:75,代码来源:templatelayout.php


注:本文中的OC_Template::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。