本文整理汇总了PHP中ThemeUtil类的典型用法代码示例。如果您正苦于以下问题:PHP ThemeUtil类的具体用法?PHP ThemeUtil怎么用?PHP ThemeUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ThemeUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: smarty_function_html_select_themes
/**
* Zikula_View function to display a drop down list of themes.
*
* Available parameters:
* - name: Name for the control (optional) if not present then only the option tags are output
* - id: ID for the control
* - selected: Selected value
* - filter: Filter themes use (possible values: ThemeUtil::FILTER_ALL (default) ThemeUtil::FILTER_USER, ThemeUtil::FILTER_SYSTEM, ThemeUtil::FILTER_ADMIN
* - state: Filter themes by state (possible values: ThemeUtil::STATE_ALL (default), ThemeUtil::STATE_ACTIVE, ThemeUtil::STATE_INACTIVE
* - type: Filter themes by type (possible values: ThemeUtil::TYPE_ALL (default), ThemeUtil::TYPE_XANTHIA3
* - assign: If set, the results are assigned to the corresponding variable instead of printed out
*
* Examples
*
* {html_select_themes name=mytheme selected=mythemechoice}
*
* <select name="mytheme">
* <option value="">{ml name=_DEFAULT}</option>
* {html_select_themes selected=$mythemechoice}
* </select>
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string The value of the last status message posted, or void if no status message exists.
*/
function smarty_function_html_select_themes($params, Zikula_View $view)
{
if (!isset($params['filter']) || !defined($params['filter'])) {
$filter = ThemeUtil::FILTER_ALL;
} else {
$filter = constant($params['filter']);
}
if (!isset($params['state']) || !defined($params['state'])) {
$state = ThemeUtil::STATE_ALL;
} else {
$state = constant($params['state']);
}
if (!isset($params['type']) || !defined($params['type'])) {
$type = ThemeUtil::TYPE_ALL;
} else {
$type = constant($params['type']);
}
$themelist = array();
$themes = ThemeUtil::getAllThemes($filter, $state, $type);
if (!empty($themes)) {
foreach ($themes as $theme) {
$themelist[$theme['name']] = $theme['displayname'];
}
}
natcasesort($themelist);
require_once $view->_get_plugin_filepath('function', 'html_options');
$output = smarty_function_html_options(array('options' => $themelist, 'selected' => isset($params['selected']) ? $params['selected'] : null, 'name' => isset($params['name']) ? $params['name'] : null, 'id' => isset($params['id']) ? $params['id'] : null), $view);
if (isset($params['assign'])) {
$view->assign($params['assign'], $output);
} else {
return $output;
}
}
开发者ID:Silwereth,项目名称:core,代码行数:59,代码来源:function.html_select_themes.php
示例2: pageLock
public function pageLock($args)
{
$lockName = $args['lockName'];
$returnUrl = (array_key_exists('returnUrl', $args) ? $args['returnUrl'] : null);
$ignoreEmptyLock = (array_key_exists('ignoreEmptyLock', $args) ? $args['ignoreEmptyLock'] : false);
$uname = UserUtil::getVar('uname');
$lockedHtml = '';
if (!empty($lockName) || !$ignoreEmptyLock) {
PageUtil::AddVar('javascript', 'zikula.ui');
PageUtil::AddVar('javascript', 'system/PageLock/javascript/pagelock.js');
PageUtil::AddVar('stylesheet', ThemeUtil::getModuleStylesheet('pagelock'));
$lockInfo = ModUtil::apiFunc('pagelock', 'user', 'requireLock',
array('lockName' => $lockName,
'lockedByTitle' => $uname,
'lockedByIPNo' => $_SERVER['REMOTE_ADDR']));
$hasLock = $lockInfo['hasLock'];
if (!$hasLock) {
$view = Zikula_View::getInstance('pagelock');
$view->assign('lockedBy', $lockInfo['lockedBy']);
$lockedHtml = $view->fetch('PageLock_lockedwindow.tpl');
}
} else {
$hasLock = true;
}
$html = "<script type=\"text/javascript\">/* <![CDATA[ */ \n";
if (!empty($lockName)) {
if ($hasLock) {
$html .= "document.observe('dom:loaded', PageLock.UnlockedPage);\n";
} else {
$html .= "document.observe('dom:loaded', PageLock.LockedPage);\n";
}
}
$lockedHtml = str_replace("\n", "", $lockedHtml);
$lockedHtml = str_replace("\r", "", $lockedHtml);
// Use "PageLockLifetime*2/3" to add a good margin to lock timeout when pinging
// disabled due to #2556 and #2745
// $returnUrl = DataUtil::formatForDisplayHTML($returnUrl);
$html .= "
PageLock.LockName = '$lockName';
PageLock.ReturnUrl = '$returnUrl';
PageLock.PingTime = " . (PageLockLifetime*2/3) . ";
PageLock.LockedHTML = '" . $lockedHtml . "';
/* ]]> */</script>";
PageUtil::addVar('header', $html);
return true;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:60,代码来源:User.php
示例3: smarty_function_previewimage
/**
* Zikula_View function to display a preview image from a theme
*
* Available parameters:
* - name name of the theme to display the preview image for
* - name if set, the id assigned to the image
* - size if set, the size of the image to use from small, medium, large (optional: default 'medium')
* - assign if set, the title will be assigned to this variable
*
* Example
* {previewimage name=andreas08 size=large}
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @see function.title.php::smarty_function_previewimage()
*
* @return string The markup to display the theme image.
*/
function smarty_function_previewimage($params, Zikula_View $view)
{
if (!isset($params['name'])) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('previewimage', 'name')));
return false;
}
if (!isset($params['size']) || !in_array($params['size'], array('large', 'medium', 'small'))) {
$params['size'] = 'medium';
}
$idstring = '';
if (isset($params['id'])) {
$idstring = " id=\"{$params['id']}\"";
}
$themeinfo = ThemeUtil::getInfo(ThemeUtil::getIDFromName($params['name']));
$theme = ThemeUtil::getTheme($themeinfo['name']);
$themePath = null === $theme ? "themes/{$themeinfo['directory']}/images" : $theme->getRelativePath() . '/Resources/public/images';
if (file_exists("{$themePath}/preview_{$params['size']}.png")) {
$filesrc = "{$themePath}/preview_{$params['size']}.png";
} else {
$filesrc = "system/ThemeModule/Resources/public/images/preview_{$params['size']}.png";
}
$markup = "<img{$idstring} src=\"{$filesrc}\" alt=\"\" />";
if (isset($params['assign'])) {
$view->assign($params['assign'], $markup);
} else {
return $markup;
}
}
开发者ID:Silwereth,项目名称:core,代码行数:47,代码来源:function.previewimage.php
示例4: smarty_function_admincategorymenu
/**
* Smarty function to display the category menu for admin links. This also adds the
* navtabs.css to the page vars array for stylesheets.
*
* Admin
* {admincategorymenu}
*
* @see function.admincategorymenu.php::smarty_function_admincategoreymenu()
* @param array $params All attributes passed to this function from the template
* @param object $view Reference to the Zikula_View object
* @return string the results of the module function
*/
function smarty_function_admincategorymenu($params, $view)
{
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Admin'));
$modinfo = ModUtil::getInfoFromName($view->getTplVar('toplevelmodule'));
$acid = ModUtil::apiFunc('AdminModule', 'admin', 'getmodcategory', array('mid' => $modinfo['id']));
return ModUtil::func('AdminModule', 'admin', 'categorymenu', array('acid' => $acid));
}
开发者ID:planetenkiller,项目名称:core,代码行数:19,代码来源:function.admincategorymenu.php
示例5: main
/**
* display theme changing user interface
*/
public function main()
{
// check if theme switching is allowed
if (!System::getVar('theme_change')) {
LogUtil::registerError($this->__('Notice: Theme switching is currently disabled.'));
$this->redirect(ModUtil::url('Users', 'user', 'main'));
}
if (!SecurityUtil::checkPermission('Theme::', '::', ACCESS_COMMENT)) {
return LogUtil::registerPermissionError();
}
// get our input
$startnum = FormUtil::getPassedValue('startnum', isset($args['startnum']) ? $args['startnum'] : 1, 'GET');
// we need this value multiple times, so we keep it
$itemsperpage = $this->getVar('itemsperpage');
// get some use information about our environment
$currenttheme = ThemeUtil::getInfo(ThemeUtil::getIDFromName(UserUtil::getTheme()));
// get all themes in our environment
$allthemes = ThemeUtil::getAllThemes(ThemeUtil::FILTER_USER);
$previewthemes = array();
$currentthemepic = null;
foreach ($allthemes as $key => $themeinfo) {
$themename = $themeinfo['name'];
if (file_exists($themepic = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/images/preview_medium.png')) {
$themeinfo['previewImage'] = $themepic;
$themeinfo['largeImage'] = 'themes/'.DataUtil::formatForOS($themeinfo['directory']).'/images/preview_large.png';
} else {
$themeinfo['previewImage'] = 'system/Theme/images/preview_medium.png';
$themeinfo['largeImage'] = 'system/Theme/images/preview_large.png';
}
if ($themename == $currenttheme['name']) {
$currentthemepic = $themepic;
unset($allthemes[$key]);
} else {
$previewthemes[$themename] = $themeinfo;
}
}
$previewthemes = array_slice($previewthemes, $startnum-1, $itemsperpage);
$this->view->setCaching(Zikula_View::CACHE_DISABLED);
$this->view->assign('currentthemepic', $currentthemepic)
->assign('currenttheme', $currenttheme)
->assign('themes', $previewthemes)
->assign('defaulttheme', ThemeUtil::getInfo(ThemeUtil::getIDFromName(System::getVar('Default_Theme'))));
// assign the values for the pager plugin
$this->view->assign('pager', array('numitems' => sizeof($allthemes),
'itemsperpage' => $itemsperpage));
// Return the output that has been generated by this function
return $this->view->fetch('theme_user_main.tpl');
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:62,代码来源:User.php
示例6: _getpurifierdefaultconfig
/**
* Retrieves default configuration array for HTML Purifier.
*
* @return array HTML Purifier default configuration settings.
*/
private static function _getpurifierdefaultconfig()
{
$purifierDefaultConfig = HTMLPurifier_Config::createDefault();
$purifierDefaultConfigValues = $purifierDefaultConfig->def->defaults;
$config = array();
foreach ($purifierDefaultConfigValues as $key => $val) {
$keys = explode(".", $key, 2);
$config[$keys[0]][$keys[1]] = $val;
}
$charset = ZLanguage::getEncoding();
if (strtolower($charset) != 'utf-8') {
// set a different character encoding with iconv
$config['Core']['Encoding'] = $charset;
// Note that HTML Purifier's support for non-Unicode encodings is crippled by the
// fact that any character not supported by that encoding will be silently
// dropped, EVEN if it is ampersand escaped. If you want to work around
// this, you are welcome to read docs/enduser-utf8.html in the full package for a fix,
// but please be cognizant of the issues the "solution" creates (for this
// reason, I do not include the solution in this document).
}
// determine doctype of current theme
// supported doctypes include:
//
// HTML 4.01 Strict
// HTML 4.01 Transitional
// XHTML 1.0 Strict
// XHTML 1.0 Transitional (default)
// XHTML 1.1
//
// TODO - we need a new theme field for doctype declaration
// for now we will use non-strict modes
$currentThemeID = ThemeUtil::getIDFromName(UserUtil::getTheme());
$themeInfo = ThemeUtil::getInfo($currentThemeID);
$useXHTML = (isset($themeInfo['xhtml']) && $themeInfo['xhtml']) ? true : false;
// as XHTML 1.0 Transitional is the default, we only set HTML (for now)
if (!$useXHTML) {
$config['HTML']['Doctype'] = 'HTML 4.01 Transitional';
}
// allow nofollow and imageviewer to be used as document relationships in the rel attribute
// see http://htmlpurifier.org/live/configdoc/plain.html#Attr.AllowedRel
$config['Attr']['AllowedRel'] = array('nofollow' => true, 'imageviewer' => true, 'lightbox' => true);
// allow Youtube by default
$config['Filter']['YouTube'] = false; // technically deprecated in favour of HTML.SafeEmbed and HTML.Object
// general enable for embeds and objects
$config['HTML']['SafeObject'] = true;
$config['Output']['FlashCompat'] = true;
$config['HTML']['SafeEmbed'] = true;
return $config;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:64,代码来源:Util.php
示例7: smarty_function_themeinfo
/**
* Smarty function to display the theme info
*
* Example
* {themeinfo}
*
* @see function.themeinfo.php::smarty_function_themeinfo()
* @param array $params All attributes passed to this function from the template
* @param object $smarty Reference to the Smarty object
* @return string the themeinfo
*/
function smarty_function_themeinfo($params, $smarty)
{
LogUtil::log(__f('Warning! Template plugin {%1$s} is deprecated, please use {%2$s} instead.', array('themeinfo', '$themeinfo')), E_USER_DEPRECATED);
$thistheme = UserUtil::getTheme();
$themeinfo = ThemeUtil::getInfo(ThemeUtil::getIDFromName($thistheme));
$themecredits = '<!-- ' . __f('Theme: %1$s by %2$s - %3$s', array(DataUtil::formatForDisplay($themeinfo['display']), DataUtil::formatForDisplay($themeinfo['author']), DataUtil::formatForDisplay($themeinfo['contact']))) . ' -->';
return $themecredits;
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:19,代码来源:function.themeinfo.php
示例8: smarty_function_admincategorymenu
/**
* Smarty function to display the category menu for admin links. This also adds the
* navtabs.css to the page vars array for stylesheets.
*
* Admin
* {admincategorymenu}
*
* @see function.admincategorymenu.php::smarty_function_admincategorymenu()
* @param array $params All attributes passed to this function from the template
* @param \Zikula_View $view Reference to the Zikula_View object
* @return string the results of the module function
*/
function smarty_function_admincategorymenu($params, \Zikula_View $view)
{
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('ZikulaAdminModule'));
$modinfo = ModUtil::getInfoFromName($view->getTplVar('toplevelmodule'));
$acid = ModUtil::apiFunc('ZikulaAdminModule', 'admin', 'getmodcategory', array('mid' => $modinfo['id']));
$path = array('_controller' => 'ZikulaAdminModule:Admin:categorymenu', 'acid' => $acid);
$subRequest = $view->getRequest()->duplicate(array(), null, $path);
return $view->getContainer()->get('http_kernel')->handle($subRequest, \Symfony\Component\HttpKernel\HttpKernelInterface::SUB_REQUEST)->getContent();
}
开发者ID:Silwereth,项目名称:core,代码行数:21,代码来源:function.admincategorymenu.php
示例9: smarty_function_themesetvar
/**
* Plugin to set a variable on the theme
*
* This function set the corresponding value on a theme variable
*
* Available parameters:
* - name: Name of the variable
* - value: The value to set on the variable
*
* Example
* {themesetvar name='master' value='1col'} for Andreas08
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return mixed
*/
function smarty_function_themesetvar($params, Zikula_View $view)
{
$name = isset($params['name']) ? $params['name'] : null;
$value = isset($params['value']) ? $params['value'] : null;
if (!$name) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('themegetvar', 'name')));
return false;
}
ThemeUtil::setVar($name, $value);
}
开发者ID:planetenkiller,项目名称:core,代码行数:27,代码来源:function.themesetvar.php
示例10: __construct
public function __construct()
{
$themeName = \UserUtil::getTheme();
$theme = \ThemeUtil::getTheme($themeName);
if (null !== $theme && is_readable($path = $theme->getConfigPath() . '/overrides.yml')) {
// bundle type theme
$this->overrideMap = Yaml::parse(file_get_contents($path));
} elseif (is_readable("themes/{$themeName}/templates/overrides.yml")) {
// pre-1.4.0 style theme
$this->_overrideMap = Yaml::parse(file_get_contents("themes/{$themeName}/templates/overrides.yml"));
}
}
开发者ID:Silwereth,项目名称:core,代码行数:12,代码来源:ThemeTemplateOverrideYamlListener.php
示例11: smarty_function_themegetvar
/**
* Plugin to get a variable from the theme
*
* This function returns the corresponding value set on the theme
*
* Available parameters:
* - name: Name of the variable
* - default: If set, the default value to return if the variable is not set
* - assign: If set, the results are assigned to the corresponding variable instead of printed out
*
* Example
* {themegetvar name='themepath'}
* {themegetvar name='scriptpath' assign='scriptpath'}
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string The colour definition.
*/
function smarty_function_themegetvar($params, Zikula_View $view)
{
$assign = isset($params['assign']) ? $params['assign'] : null;
$default = isset($params['default']) ? $params['default'] : null;
$name = isset($params['name']) ? $params['name'] : null;
if (!$name) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('themegetvar', 'name')));
return false;
}
$result = ThemeUtil::getVar($name, $default);
if ($assign) {
$view->assign($assign, $result);
} else {
return $result;
}
}
开发者ID:Silwereth,项目名称:core,代码行数:35,代码来源:function.themegetvar.php
示例12: smarty_function_cotypeEditor
/**
* CoType
*
* @copyright (C) 2007, Jorn Wildt
* @link http://www.elfisk.dk
* @version $Id$
* @license See license.txt
*/
function smarty_function_cotypeEditor($params, &$render)
{
$inputId = $params['inputId'];
$documentId = (int) $params['documentId'];
static $firstTime = true;
if ($firstTime) {
PageUtil::AddVar('javascript', 'javascript/ajax/prototype.js');
$moduleStylesheet = '../../../../' . ThemeUtil::getModuleStylesheet('cotype', 'editor.css');
$url = System::getBaseUrl();
$head = "<script type=\"text/javascript\">\nCoTypeStylesheet = '{$moduleStylesheet}';\nCoTypeDocumentId = {$documentId};\n</script>";
PageUtil::AddVar('header', $head);
}
$firstTime = false;
$html = "";
return $html;
}
开发者ID:rmaiwald,项目名称:Scribite,代码行数:24,代码来源:function.cotypeEditor.php
示例13: handler
/**
* Event handler here.
*
* @param GenericEvent $event Event handler.
*
* @return void
*/
public function handler(GenericEvent $event)
{
// check if this is for this handler
$subject = $event->getSubject();
if (!($event['method'] == 'extensions' && $subject instanceof \Users\Controller\AdminController)) {
return;
}
if (!SecurityUtil::checkPermission('Users::', '::', ACCESS_ADMIN)) {
throw new \Zikula\Framework\Exception\ForbiddenException();
}
// Zikula Modules and Themes versions
$view = Zikula_View::getInstance('Users');
$view->assign('mods', ModUtil::getModules());
$view->assign('themes', ThemeUtil::getAllThemes());
$event->setData($view->fetch('users_admin_extensions.tpl'));
$event->stopPropagation();
}
开发者ID:planetenkiller,项目名称:core,代码行数:24,代码来源:Extensions.php
示例14: handler
/**
* Event handler here.
*
* @param Zikula_Event $event Event handler.
*
* @return void
*/
public function handler(Zikula_Event $event)
{
// check if this is for this handler
$subject = $event->getSubject();
if (!($event['method'] == 'extensions' && $subject instanceof Users_Controller_Admin)) {
return;
}
if (!SecurityUtil::checkPermission('Users::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
// Zikula Modules and Themes versions
$view = Zikula_View::getInstance('Users');
$view->assign('mods', ModuleUtil::getModules());
$view->assign('themes', ThemeUtil::getAllThemes());
$event->setData($view->fetch('users_admin_extensions.tpl'));
$event->stop();
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:24,代码来源:Extensions.php
示例15: render
/**
* Render event handler.
*
* @param Zikula_Form_View $view Reference to Zikula_Form_View object.
*
* @return string The rendered output
*/
public function render(Zikula_Form_View $view)
{
static $firstTime = true;
if ($firstTime) {
PageUtil::addVar('javascript', 'prototype');
PageUtil::addVar('javascript', 'Zikula.UI');
// imageviewer
PageUtil::addVar('javascript', 'modules/Reviews/javascript/Reviews_finder.js');
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Reviews'));
}
$firstTime = false;
if (!SecurityUtil::checkPermission('Reviews:' . ucwords($this->objectType) . ':', '::', ACCESS_COMMENT)) {
return false;
}
$categorisableObjectTypes = array('review');
$catIds = array();
if (in_array($this->objectType, $categorisableObjectTypes)) {
// fetch selected categories to reselect them in the output
// the actual filtering is done inside the repository class
$catIds = ModUtil::apiFunc('Reviews', 'category', 'retrieveCategoriesFromRequest', array('ot' => $this->objectType));
}
$this->selectedItemId = $this->text;
$entityClass = 'Reviews_Entity_' . ucwords($this->objectType);
$serviceManager = ServiceUtil::getManager();
$entityManager = $serviceManager->getService('doctrine.entitymanager');
$repository = $entityManager->getRepository($entityClass);
$sort = $repository->getDefaultSortingField();
$sdir = 'asc';
// convenience vars to make code clearer
$where = '';
$sortParam = $sort . ' ' . $sdir;
$entities = $repository->selectWhere($where, $sortParam);
$view = Zikula_View::getInstance('Reviews', false);
$view->assign('objectType', $this->objectType)->assign('items', $entities)->assign('selectedId', $this->selectedItemId);
// assign category properties
$properties = null;
if (in_array($this->objectType, $categorisableObjectTypes)) {
$properties = ModUtil::apiFunc('Reviews', 'category', 'getAllProperties', array('ot' => $this->objectType));
}
$view->assign('properties', $properties)->assign('catIds', $catIds);
return $view->fetch('external/' . $this->objectType . '/select.tpl');
}
开发者ID:rmaiwald,项目名称:Reviews,代码行数:49,代码来源:ItemSelector.php
示例16: bbsmiles
/**
* bbsmiles
* returns a html snippet with buttons for inserting bbsmiles into a text
*
* @param $args['textfieldid'] id of the textfield for inserting smilies
*/
public function bbsmiles($args)
{
if (!isset($args['textfieldid']) || empty($args['textfieldid'])) {
return LogUtil::registerArgsError();
}
// if we have more than one textarea we need to distinguish them, so we simply use
// a counter stored in a session var until we find a better solution
$counter = SessionUtil::getVar('bbsmile_counter', 0);
$counter++;
SessionUtil::setVar('bbsmile_counter', $counter);
$this->view->assign('counter', $counter);
$this->view->assign('textfieldid', $args['textfieldid']);
PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('BBSmile'));
$templatefile = DataUtil::formatForOS(ModUtil::getName()) . '.tpl';
if ($this->view->template_exists($templatefile)) {
return $this->view->fetch($templatefile);
}
$this->view->add_core_data();
return $this->view->fetch('bbsmile_user_bbsmiles.tpl');
}
开发者ID:rmaiwald,项目名称:BBSmile,代码行数:26,代码来源:User.php
示例17: getStylesheets
public static function getStylesheets()
{
$stylesheets = array();
$styles = array();
// restricted stylesheets, array for possible future changes
$sysStyles = array('system/Blocks/style/menutree/adminstyle.css', 'system/Blocks/style/menutree/contextmenu.css', 'system/Blocks/style/menutree/tree.css');
// module stylesheets
$modulesStyles = FileUtil::getFiles('system/Blocks/style/menutree', false, false, 'css', false);
$configStyles = FileUtil::getFiles('config/style/Blocks/menutree', false, false, 'css', false);
$styles['modules'] = array_merge($modulesStyles, $configStyles);
// themes stylesheets - get user and admin themes
$userThemes = ThemeUtil::getAllThemes(ThemeUtil::FILTER_USER);
$adminThemes = ThemeUtil::getAllThemes(ThemeUtil::FILTER_ADMIN);
$themesStyles = array();
foreach ($userThemes as $ut) {
$themesStyles[$ut['name']] = FileUtil::getFiles('themes/' . $ut['name'] . '/style/Blocks/menutree', false, false, 'css', false);
}
foreach ($adminThemes as $at) {
if (!array_key_exists($at['name'], $themesStyles)) {
$themesStyles[$at['name']] = FileUtil::getFiles('themes/' . $at['name'] . '/style/Blocks/menutree', false, false, 'css', false);
}
}
// get stylesheets which exist in every theme
$styles['themes']['all'] = call_user_func_array('array_intersect', $themesStyles);
// get stylesheets which exist in some themes
$styles['themes']['some'] = array_unique(call_user_func_array('array_merge', $themesStyles));
$styles['themes']['some'] = array_diff($styles['themes']['some'], $styles['themes']['all'], $styles['modules'], $sysStyles);
$stylesheets = array_unique(array_merge($styles['modules'], $styles['themes']['all']));
$stylesheets = array_diff($stylesheets, $sysStyles);
sort($stylesheets);
// fill array keys using values
$stylesheets = array_combine($stylesheets, $stylesheets);
$someThemes = __('Only in some themes');
if (!empty($styles['themes']['some'])) {
sort($styles['themes']['some']);
$stylesheets[$someThemes] = array_combine($styles['themes']['some'], $styles['themes']['some']);
}
return self::normalize($stylesheets);
}
开发者ID:,项目名称:,代码行数:39,代码来源:
示例18: varAction
/**
* Configure a theme's variables based on provided .yml definitions for each field.
* @Route("/admin/var/{themeName}")
* @todo change route name to /admin/variable/{themeName} when similar named is removed?
* @Theme("admin")
*
* @param Request $request
* @param string $themeName
* @return mixed
* @throws \InvalidArgumentException if theme type is not twig-based
*/
public function varAction(Request $request, $themeName)
{
$themeBundle = \ThemeUtil::getTheme($themeName);
if (!$themeBundle->isTwigBased()) {
throw new NotFoundHttpException('Theme type must be twig-based in ' . __FILE__ . ' at line ' . __LINE__ . '.');
}
$themeVarsPath = $themeBundle->getConfigPath() . '/variables.yml';
if (!file_exists($themeVarsPath)) {
$this->addFlash('warning', $this->__f('%theme% has no configuration.', array('%theme%' => $themeName)));
return $this->redirect($this->generateUrl('zikulathememodule_admin_view'));
}
$variableDefinitions = Yaml::parse(file_get_contents($themeVarsPath));
/** @var \Symfony\Component\Form\FormBuilder $formBuilder */
$formBuilder = $this->createFormBuilder($themeBundle->getThemeVars());
foreach ($variableDefinitions as $fieldName => $definitions) {
$options = isset($definitions['options']) ? $definitions['options'] : [];
if (isset($definitions['type'])) {
$formBuilder->add($fieldName, $definitions['type'], $options);
}
}
$formBuilder->add('save', 'submit', array('label' => $this->__('Save'), 'icon' => 'fa-check fa-lg', 'attr' => array('class' => "btn btn-success")))->add('toDefault', 'submit', array('label' => $this->__('Set to defaults'), 'icon' => 'fa-refresh fa-lg', 'attr' => array('class' => "btn btn-primary")))->add('cancel', 'submit', array('label' => $this->__('Cancel'), 'icon' => 'fa-times fa-lg', 'attr' => array('class' => "btn btn-danger")));
$form = $formBuilder->getForm();
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->get('save')->isClicked()) {
// pseudo-hack to save theme vars in to modvars table
\ModUtil::setVars($themeName, $form->getData());
$this->addFlash('status', $this->__('Done! Theme configuration updated.'));
} elseif ($form->get('toDefault')->isClicked()) {
\ModUtil::setVars($themeName, $themeBundle->getDefaultThemeVars());
$this->addFlash('status', $this->__('Done! Theme configuration updated to default values.'));
} elseif ($form->get('cancel')->isClicked()) {
$this->addFlash('status', $this->__('Operation cancelled.'));
}
return $this->redirect($this->generateUrl('zikulathememodule_admin_view'));
}
return $this->render('ZikulaThemeModule:Admin:var.html.twig', ['themeName' => $themeName, 'form' => $form->createView()]);
}
开发者ID:Silwereth,项目名称:core,代码行数:49,代码来源:VarController.php
示例19: setupPersonality
static function setupPersonality()
{
$persona = self::getPersonality();
if (!isset($persona) || trim($persona) == '') {
return;
}
ThemeUtil::printStyleSheetLink("personality/{$persona}/styles.css", "persona", true);
$validBanner = ThemeUtil::exists("/personality/" . $persona . "/banner.png");
$validFooter = ThemeUtil::exists("/personality/" . $persona . "/footer.png");
echo "<!-- setting up persona: {$persona} : {$validFooter} ; {$validBanner} -->";
if ($validFooter || $validBanner) {
echo "<style>\n";
if ($validBanner) {
$banner = WEBPATH . "/themes/" . basename(dirname(dirname(__FILE__))) . "/personality/" . $persona . "/banner.png";
echo "#banner {\t\n" . "\tbackground: transparent url({$banner}) no-repeat 0 -10px; \n" . "} \n";
}
if ($validFooter) {
$footer = WEBPATH . "/themes/" . basename(dirname(dirname(__FILE__))) . "/personality/" . $persona . "/footer.png";
echo "#footer {\t\n" . "\tbackground: transparent url({$footer}) no-repeat 0 -10px; \n" . "} \n";
}
echo "</style> \n";
}
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:23,代码来源:PersonalityUtil.php
示例20: initialize
public function initialize(Zikula_Form_View $view)
{
if (!SecurityUtil::checkPermission('Content:page:', '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
// Include categories only when 2nd category enabled in settings
$pages = ModUtil::apiFunc('Content', 'Page', 'getPages', array('editing' => true, 'filter' => array('checkActive' => false, 'expandedPageIds' => SessionUtil::getVar('contentExpandedPageIds', array())), 'enableEscape' => true, 'translate' => false, 'includeLanguages' => true, 'includeCategories' => $this->getVar('categoryUsage') < 3, 'orderBy' => 'setLeft'));
if ($pages === false) {
return $this->view->registerError(null);
}
// Get categories names if enabled
if ($this->getVar('$categoryUsage') < 4) {
$lang = ZLanguage::getLanguageCode();
$categories = array();
foreach ($pages as $page) {
$cat = CategoryUtil::getCategoryByID($page['categoryId']);
$categories[$page['id']] = array();
$categories[$page['id']][] = isset($cat['display_name'][$lang]) ? $cat['display_name'][$lang] : $cat['name'];
if (isset($page['categories']) && is_array($page['categories'])) {
foreach ($page['categories'] as $pageCat) {
$cat = CategoryUtil::getCategoryByID($pageCat['categoryId']);
$categories[$page['id']][] = isset($cat['display_name'][$lang]) ? $cat['display_name'][$lang] : $cat['name'];
}
}
}
$this->view->assign('categories', $categories);
}
PageUtil::setVar('title', $this->__('Page list and content structure'));
$csssrc = ThemeUtil::getModuleStylesheet('admin', 'admin.css');
PageUtil::addVar('stylesheet', $csssrc);
$this->view->assign('pages', $pages);
$this->view->assign('multilingual', ModUtil::getVar(ModUtil::CONFIG_MODULE, 'multilingual'));
$this->view->assign('enableVersioning', $this->getVar('enableVersioning'));
$this->view->assign('language', ZLanguage::getLanguageCode());
Content_Util::contentAddAccess($this->view, null);
return true;
}
开发者ID:robbrandt,项目名称:Content,代码行数:37,代码来源:Main.php
注:本文中的ThemeUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论