本文整理汇总了PHP中Theme::ItemPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Theme::ItemPath方法的具体用法?PHP Theme::ItemPath怎么用?PHP Theme::ItemPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme
的用法示例。
在下文中一共展示了Theme::ItemPath方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render()
{
$favicon = Theme::ImageUrl('favicon.ico');
// Render a specific layout in the previewer
// layoutid must be provided
$pfl = __('Preview for Layout');
$previewCss = Theme::ItemPath('css/html-preview.css');
$output = <<<EOT
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>{$pfl} {$this->layoutid}</title>
<link rel="stylesheet" type="text/css" href="{$previewCss}" />
<script type="text/JavaScript" src="theme/default/libraries/jquery/jquery-1.9.1.js"></script>
<script type="text/JavaScript" src="modules/preview/html5Preloader.js"></script>
<script type="text/JavaScript" src="modules/preview/html-preview.js"></script>
<link rel="shortcut icon" href="{$favicon}" />
</head>
<body onload="dsInit({$this->layoutid})">
<div id="player">
<div id="info"></div>
<div id="log"></div>
<div id="screen">
<div id="splash">
<div id="loader"></div>
<div id="loaderCaption"><p>
EOT;
$output .= __("Loading layout...");
$output .= "</p></div>";
$output .= "</div>";
$output .= '<div id="end"><a href="javascript:history.go(0)" style="text-decoration: none; color: #ffffff">';
$output .= __("Play again?");
$output .= "</a></div></div></div></body></html>";
print $output;
}
示例2: GetResource
/**
* GetResource
* Return the rendered resource to be used by the client (or a preview)
* for displaying this content.
* @param integer $displayId If this comes from a real client, this will be the display id.
* @return string
*/
public function GetResource($displayId = 0)
{
// Make sure we are set up correctly
if ($this->GetSetting('apiKey') == '' || $this->GetSetting('apiSecret') == '') {
Debug::Error('Twitter Module not configured. Missing API Keys');
return '';
}
// Load in the template
$template = file_get_contents('modules/preview/HtmlTemplate.html');
$isPreview = Kit::GetParam('preview', _REQUEST, _WORD, 'false') == 'true';
// Replace the View Port Width?
if ($isPreview) {
$template = str_replace('[[ViewPortWidth]]', $this->width, $template);
}
// Information from the Module
$duration = $this->duration;
// Generate a JSON string of substituted items.
$items = $this->getTwitterFeed($displayId, $isPreview);
// Return empty string if there are no items to show.
if (count($items) == 0) {
return '';
}
$options = array('type' => $this->type, 'fx' => $this->GetOption('effect', 'none'), 'speed' => $this->GetOption('speed', 500), 'duration' => $duration, 'durationIsPerItem' => $this->GetOption('durationIsPerItem', 0) == 1, 'numItems' => count($items), 'itemsPerPage' => 1, 'originalWidth' => $this->width, 'originalHeight' => $this->height, 'previewWidth' => Kit::GetParam('width', _GET, _DOUBLE, 0), 'previewHeight' => Kit::GetParam('height', _GET, _DOUBLE, 0), 'scaleOverride' => Kit::GetParam('scale_override', _GET, _DOUBLE, 0));
// Replace the control meta with our data from twitter
$controlMeta = '<!-- NUMITEMS=' . count($items) . ' -->' . PHP_EOL . '<!-- DURATION=' . ($this->GetOption('durationIsPerItem', 0) == 0 ? $duration : $duration * count($items)) . ' -->';
$template = str_replace('<!--[[[CONTROLMETA]]]-->', $controlMeta, $template);
// Replace the head content
$headContent = '';
// Add the CSS if it isn't empty
$css = $this->GetRawNode('styleSheet');
if ($css != '') {
$headContent .= '<style type="text/css">' . $css . '</style>';
}
$backgroundColor = $this->GetOption('backgroundColor');
if ($backgroundColor != '') {
$headContent .= '<style type="text/css">body, .page, .item { background-color: ' . $backgroundColor . ' }</style>';
}
// Add our fonts.css file
$headContent .= '<link href="' . ($isPreview ? 'modules/preview/' : '') . 'fonts.css" rel="stylesheet" media="screen">';
$headContent .= '<link href="' . ($isPreview ? 'modules/theme/twitter/' : '') . 'emoji.css" rel="stylesheet" media="screen">';
$headContent .= '<style type="text/css">' . file_get_contents(Theme::ItemPath('css/client.css')) . '</style>';
// Replace the Head Content with our generated javascript
$template = str_replace('<!--[[[HEADCONTENT]]]-->', $headContent, $template);
// Add some scripts to the JavaScript Content
$javaScriptContent = '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery-1.11.1.min.js"></script>';
// Need the cycle plugin?
if ($this->GetSetting('effect') != 'none') {
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery-cycle-2.1.6.min.js"></script>';
}
// Need the marquee plugin?
if (stripos($this->GetSetting('effect'), 'marquee')) {
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery.marquee.min.js"></script>';
}
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/' : '') . 'xibo-layout-scaler.js"></script>';
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/' : '') . 'xibo-text-render.js"></script>';
$javaScriptContent .= '<script type="text/javascript">';
$javaScriptContent .= ' var options = ' . json_encode($options) . ';';
$javaScriptContent .= ' var items = ' . Kit::jsonEncode($items) . ';';
$javaScriptContent .= ' $(document).ready(function() { ';
$javaScriptContent .= ' $("body").xiboLayoutScaler(options); $("#content").xiboTextRender(options, items); ';
$javaScriptContent .= ' }); ';
$javaScriptContent .= '</script>';
// Replace the Head Content with our generated javascript
$template = str_replace('<!--[[[JAVASCRIPTCONTENT]]]-->', $javaScriptContent, $template);
// Replace the Body Content with our generated text
$template = str_replace('<!--[[[BODYCONTENT]]]-->', '', $template);
return $template;
}
示例3: GetResource
/**
* GetResource
* Return the rendered resource to be used by the client (or a preview)
* for displaying this content.
* @param integer $displayId If this comes from a real client, this will be the display id.
*/
public function GetResource($displayId = 0)
{
// Behave exactly like the client.
if (!($data = $this->getForecastData($displayId))) {
return '';
}
// A template is provided which contains a number of different libraries that might
// be useful (jQuery, etc).
$pathPrefix = Kit::GetParam('preview', _REQUEST, _WORD, 'false') == 'true' ? 'modules/theme/forecastio/weather_icons/' : '';
// Get the template
$template = file_get_contents('modules/preview/HtmlTemplate.html');
// Replace the View Port Width?
if (isset($_GET['preview'])) {
$template = str_replace('[[ViewPortWidth]]', $this->width, $template);
}
$headContent = '
<link href="' . $pathPrefix . 'weather-icons.min.css" rel="stylesheet" media="screen">
<style type="text/css">
.container { color: ' . $this->GetOption('color', '000') . '; }
#content { zoom: ' . $this->GetOption('size', 1) . '; }
' . $this->GetRawNode('styleSheet') . '
</style>
';
// Add our fonts.css file
$isPreview = Kit::GetParam('preview', _REQUEST, _WORD, 'false') == 'true';
$headContent .= '<link href="' . ($isPreview ? 'modules/preview/' : '') . 'fonts.css" rel="stylesheet" media="screen">';
$headContent .= '<style type="text/css">' . file_get_contents(Theme::ItemPath('css/client.css')) . '</style>';
$template = str_replace('<!--[[[HEADCONTENT]]]-->', $headContent, $template);
// Make some body content
$body = $this->GetRawNode('currentTemplate');
$dailyTemplate = $this->GetRawNode('dailyTemplate');
// Handle the daily template (if its here)
if (stripos($body, '[dailyForecast]')) {
// Pull it out, and run substitute over it for each day
$dailySubs = '';
// Substitute for every day (i.e. 7 times).
for ($i = 0; $i < 7; $i++) {
$dailySubs .= $this->makeSubstitutions($data['daily']['data'][$i], $dailyTemplate);
}
// Substitute the completed template
$body = str_replace('[dailyForecast]', $dailySubs, $body);
}
// Run replace over the main template
$template = str_replace('<!--[[[BODYCONTENT]]]-->', $this->makeSubstitutions($data['currently'], $body), $template);
// Replace any icon sets
$template = str_replace('[[ICONS]]', ($isPreview ? 'modules/theme/forecastio/weather_icons/' : '') . $this->GetOption('icons'), $template);
// JavaScript to control the size (override the original width and height so that the widget gets blown up )
$options = array('previewWidth' => Kit::GetParam('width', _GET, _DOUBLE, 0), 'previewHeight' => Kit::GetParam('height', _GET, _DOUBLE, 0), 'originalWidth' => $this->width, 'originalHeight' => $this->height, 'scaleOverride' => Kit::GetParam('scale_override', _GET, _DOUBLE, 0));
$javaScriptContent = '<script src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery-1.11.1.min.js"></script>';
$javaScriptContent .= '<script src="' . ($isPreview ? 'modules/preview/' : '') . 'xibo-layout-scaler.js"></script>';
$javaScriptContent .= '<script>
var options = ' . json_encode($options) . '
$(document).ready(function() {
$("body").xiboLayoutScaler(options);
});
</script>';
// Replace the After body Content
$template = str_replace('<!--[[[JAVASCRIPTCONTENT]]]-->', $javaScriptContent, $template);
// Return that content.
return $template;
}
示例4: GetResource
/**
* GetResource
* Return the rendered resource to be used by the client (or a preview)
* for displaying this content.
* @param integer $displayId If this comes from a real client, this will be the display id.
*/
public function GetResource($displayId = 0)
{
// Clock Type
switch ($this->GetOption('clockTypeId', 1)) {
case 1:
// Analogue
$template = file_get_contents('modules/theme/HtmlTemplateForClock.html');
// Render our clock face
$theme = $this->GetOption('theme') == 1 ? 'light' : 'dark';
$theme_face = $this->GetOption('theme') == 1 ? 'clock_bg_modern_light.png' : 'clock_bg_modern_dark.png';
$template = str_replace('<!--[[[CLOCK_FACE]]]-->', base64_encode(file_get_contents('modules/theme/' . $theme_face)), $template);
// Light or dark?
$template = str_replace('<!--[[[CLOCK_THEME]]]-->', $theme, $template);
$template = str_replace('<!--[[[OFFSET]]]-->', $this->GetOption('offset', 0), $template);
// After body content
$isPreview = Kit::GetParam('preview', _REQUEST, _WORD, 'false') == 'true';
$javaScriptContent = '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery-1.11.1.min.js"></script>';
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'moment.js"></script>';
// Replace the After body Content
$template = str_replace('<!--[[[JAVASCRIPTCONTENT]]]-->', $javaScriptContent, $template);
break;
case 2:
// Digital
// Digital clock is essentially a cut down text module which always fits to the region
$template = file_get_contents('modules/preview/HtmlTemplate.html');
// Extract the format from the raw node in the XLF
$rawXml = new DOMDocument();
$rawXml->loadXML($this->GetRaw());
$formatNodes = $rawXml->getElementsByTagName('format');
$formatNode = $formatNodes->item(0);
$format = $formatNode->nodeValue;
// Strip out the bit between the [] brackets and use that as the format mask for moment.
$matches = '';
preg_match_all('/\\[.*?\\]/', $format, $matches);
foreach ($matches[0] as $subs) {
$format = str_replace($subs, '<span class="clock" format="' . str_replace('[', '', str_replace(']', '', $subs)) . '"></span>', $format);
}
// Replace all the subs
$template = str_replace('<!--[[[BODYCONTENT]]]-->', $format, $template);
// After body content
$options = array('previewWidth' => Kit::GetParam('width', _GET, _DOUBLE, 0), 'previewHeight' => Kit::GetParam('height', _GET, _DOUBLE, 0), 'originalWidth' => $this->width, 'originalHeight' => $this->height, 'scaleOverride' => Kit::GetParam('scale_override', _GET, _DOUBLE, 0));
$isPreview = Kit::GetParam('preview', _REQUEST, _WORD, 'false') == 'true';
$javaScriptContent = '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery-1.11.1.min.js"></script>';
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'moment.js"></script>';
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/' : '') . 'xibo-layout-scaler.js"></script>';
$javaScriptContent .= '<script type="text/javascript">
var locale = "' . TranslationEngine::GetJsLocale() . '";
var options = ' . json_encode($options) . ';
function updateClock() {
$(".clock").each(function() {
$(this).html(moment().add(' . $this->GetOption('offset', 0) . ', "m").format($(this).attr("format")));
});
}
$(document).ready(function() {
moment.locale(locale);
updateClock();
setInterval(updateClock, 1000);
$("body").xiboLayoutScaler(options);
});
</script>';
// Replace the After body Content
$template = str_replace('<!--[[[JAVASCRIPTCONTENT]]]-->', $javaScriptContent, $template);
// Add our fonts.css file
$headContent = '<link href="' . ($isPreview ? 'modules/preview/' : '') . 'fonts.css" rel="stylesheet" media="screen">';
$headContent .= '<style type="text/css">' . file_get_contents(Theme::ItemPath('css/client.css')) . '</style>';
$template = str_replace('<!--[[[HEADCONTENT]]]-->', $headContent, $template);
break;
case 3:
// Flip Clock
$template = file_get_contents('modules/theme/HtmlTemplateForFlipClock.html');
// Head Content (CSS for flip clock)
$template = str_replace('<!--[[[HEADCONTENT]]]-->', '<style type="text/css">' . file_get_contents('modules/preview/vendor/flipclock.css') . '</style>', $template);
$template = str_replace('<!--[[[OFFSET]]]-->', $this->GetOption('offset', 0), $template);
// After body content
$isPreview = Kit::GetParam('preview', _REQUEST, _WORD, 'false') == 'true';
$javaScriptContent = '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery-1.11.1.min.js"></script>';
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'flipclock.min.js"></script>';
// Replace the After body Content
$template = str_replace('<!--[[[JAVASCRIPTCONTENT]]]-->', $javaScriptContent, $template);
break;
}
// If we are a preview, then pass in the width and height
$template = str_replace('<!--[[[PREVIEW_WIDTH]]]-->', Kit::GetParam('width', _GET, _DOUBLE, 0), $template);
$template = str_replace('<!--[[[PREVIEW_HEIGHT]]]-->', Kit::GetParam('height', _GET, _DOUBLE, 0), $template);
// Replace the View Port Width?
if (isset($_GET['preview'])) {
$template = str_replace('[[ViewPortWidth]]', $this->width, $template);
}
// Return that content.
return $template;
}
示例5: GetResource
/**
* Raw Preview
*/
public function GetResource($displayId = 0)
{
// Load in the template
if ($this->layoutSchemaVersion == 1) {
$template = file_get_contents('modules/preview/Html4TransitionalTemplate.html');
} else {
$template = file_get_contents('modules/preview/HtmlTemplate.html');
}
// Replace the View Port Width?
if (isset($_GET['preview'])) {
$template = str_replace('[[ViewPortWidth]]', $this->width, $template);
}
$width = Kit::GetParam('width', _REQUEST, _DOUBLE);
$height = Kit::GetParam('height', _REQUEST, _DOUBLE);
$duration = $this->duration;
// Get the text out of RAW
$rawXml = new DOMDocument();
$rawXml->loadXML($this->GetRaw());
// Get the Text Node
$textNodes = $rawXml->getElementsByTagName('text');
$textNode = $textNodes->item(0);
$text = $textNode->nodeValue;
// Handle older layouts that have a direction node but no effect node
$oldDirection = $this->GetOption('direction', 'none');
if ($oldDirection != 'none') {
$oldDirection = 'marquee' . ucfirst($oldDirection);
}
$effect = $this->GetOption('effect', $oldDirection);
// Set some options
$options = array('type' => $this->type, 'fx' => $effect, 'duration' => $duration, 'durationIsPerItem' => false, 'numItems' => 1, 'takeItemsFrom' => 'start', 'itemsPerPage' => 0, 'speed' => $this->GetOption('speed', 0), 'originalWidth' => $this->width, 'originalHeight' => $this->height, 'previewWidth' => Kit::GetParam('width', _GET, _DOUBLE, 0), 'previewHeight' => Kit::GetParam('height', _GET, _DOUBLE, 0), 'scaleOverride' => Kit::GetParam('scale_override', _GET, _DOUBLE, 0));
// See if we need to replace out any [clock] or [date] tags
$clock = false;
if (stripos($text, '[Clock]')) {
$clock = true;
$text = str_replace('[Clock]', '[HH:mm]', $text);
}
if (stripos($text, '[Clock|')) {
$clock = true;
$text = str_replace('[Clock|', '[', $text);
}
if (stripos($text, '[Date]')) {
$clock = true;
$text = str_replace('[Date]', '[DD/MM/YYYY]', $text);
}
if ($clock) {
// Strip out the bit between the [] brackets and use that as the format mask for moment.
$matches = '';
preg_match_all('/\\[.*?\\]/', $text, $matches);
foreach ($matches[0] as $subs) {
$text = str_replace($subs, '<span class="clock" format="' . str_replace('[', '', str_replace(']', '', $subs)) . '"></span>', $text);
}
}
// Generate a JSON string of substituted items.
$items[] = $text;
// Replace the head content
$isPreview = Kit::GetParam('preview', _REQUEST, _WORD, 'false') == 'true';
$javaScriptContent = '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery-1.11.1.min.js"></script>';
// Need the marquee plugin?
if (stripos($effect, 'marquee') !== false) {
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery.marquee.min.js"></script>';
}
// Need the cycle plugin?
if ($effect != 'none') {
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery-cycle-2.1.6.min.js"></script>';
}
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/' : '') . 'xibo-layout-scaler.js"></script>';
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/' : '') . 'xibo-text-render.js"></script>';
// Do we need to include moment?
if ($clock) {
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'moment.js"></script>';
}
$javaScriptContent .= '<script type="text/javascript">';
$javaScriptContent .= ' var options = ' . json_encode($options) . ';';
$javaScriptContent .= ' var items = ' . json_encode($items) . ';';
$javaScriptContent .= ' $(document).ready(function() { ';
$javaScriptContent .= ' $("#content").xiboTextRender(options, items); $("body").xiboLayoutScaler(options);';
if ($clock) {
$javaScriptContent .= ' updateClock(); setInterval(updateClock, 1000); moment.locale("' . TranslationEngine::GetJsLocale() . '"); ';
}
$javaScriptContent .= ' }); ';
if ($clock) {
$javaScriptContent .= '
function updateClock() {
$(".clock").each(function() {
$(this).html(moment().format($(this).attr("format")));
});
}
';
}
$javaScriptContent .= '</script>';
// Replace the Head Content with our generated javascript
$template = str_replace('<!--[[[JAVASCRIPTCONTENT]]]-->', $javaScriptContent, $template);
// Add our fonts.css file
$headContent = '<link href="' . ($isPreview ? 'modules/preview/' : '') . 'fonts.css" rel="stylesheet" media="screen">';
$headContent .= '<style type="text/css">' . file_get_contents(Theme::ItemPath('css/client.css')) . '</style>';
$template = str_replace('<!--[[[HEADCONTENT]]]-->', $headContent, $template);
// Replace the Body Content with our generated text
//.........这里部分代码省略.........
示例6: GetResource
public function GetResource($display = 0)
{
// Behave exactly like the client.
$isPreview = Kit::GetParam('preview', _REQUEST, _WORD, 'false') == 'true';
// Load in the template
$template = file_get_contents('modules/preview/HtmlTemplate.html');
// Replace the View Port Width?
if (isset($_GET['preview'])) {
$template = str_replace('[[ViewPortWidth]]', $this->width, $template);
}
// Get the text out of RAW
$rawXml = new DOMDocument();
$rawXml->loadXML($this->GetRaw());
// Get the Text Node
$html = $this->parseLibraryReferences($isPreview, $this->GetRawNode('embedHtml', ''));
// Include some vendor items
$javaScriptContent = '<script src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery-1.11.1.min.js"></script>';
$javaScriptContent .= '<script src="' . ($isPreview ? 'modules/preview/' : '') . 'xibo-layout-scaler.js"></script>';
// Get the Script
$javaScriptContent .= $this->parseLibraryReferences($isPreview, $this->GetRawNode('embedScript', ''));
// Get the Style Sheet
$styleSheetContent = $this->parseLibraryReferences($isPreview, $this->GetRawNode('embedStyle', ''));
// Set some options
$options = array('originalWidth' => $this->width, 'originalHeight' => $this->height, 'previewWidth' => Kit::GetParam('width', _GET, _DOUBLE, 0), 'previewHeight' => Kit::GetParam('height', _GET, _DOUBLE, 0), 'scaleOverride' => Kit::GetParam('scale_override', _GET, _DOUBLE, 0));
// Add an options variable with some useful information for scaling
$javaScriptContent .= '<script type="text/javascript">';
$javaScriptContent .= ' var options = ' . json_encode($options) . ';';
$javaScriptContent .= ' $(document).ready(function() { EmbedInit(); });';
$javaScriptContent .= '</script>';
// Do we want to scale?
if ($this->GetOption('scaleContent') == 1) {
$javaScriptContent .= '<script>
$(document).ready(function() {
$("body").xiboLayoutScaler(options);
});
</script>';
}
// Add our fonts.css file
$headContent = '<link href="' . ($isPreview ? 'modules/preview/' : '') . 'fonts.css" rel="stylesheet" media="screen">';
$headContent .= '<style type="text/css">' . file_get_contents(Theme::ItemPath('css/client.css')) . '</style>';
$template = str_replace('<!--[[[HEADCONTENT]]]-->', $headContent, $template);
// Replace the Style Sheet Content with our generated Style Sheet
$template = str_replace('<!--[[[STYLESHEETCONTENT]]]-->', $styleSheetContent, $template);
// Replace the Head Content with our generated java script
$template = str_replace('<!--[[[JAVASCRIPTCONTENT]]]-->', $javaScriptContent, $template);
// Replace the Body Content with our generated text
$template = str_replace('<!--[[[BODYCONTENT]]]-->', $html, $template);
return $template;
}
示例7: GetResource
/**
* Get Resource
*/
public function GetResource($displayId = 0)
{
// Load in the template
if ($this->layoutSchemaVersion == 1) {
$template = file_get_contents('modules/preview/Html4TransitionalTemplate.html');
} else {
$template = file_get_contents('modules/preview/HtmlTemplate.html');
}
$isPreview = Kit::GetParam('preview', _REQUEST, _WORD, 'false') == 'true';
// Replace the View Port Width?
if ($isPreview) {
$template = str_replace('[[ViewPortWidth]]', $this->width, $template);
}
// What is the data source for this ticker?
$sourceId = $this->GetOption('sourceId', 1);
// Information from the Module
$itemsSideBySide = $this->GetOption('itemsSideBySide', 0);
$duration = $this->duration;
$durationIsPerItem = $this->GetOption('durationIsPerItem', 0);
$numItems = $this->GetOption('numItems', 0);
$takeItemsFrom = $this->GetOption('takeItemsFrom', 'start');
$itemsPerPage = $this->GetOption('itemsPerPage', 0);
// Get the text out of RAW
$rawXml = new DOMDocument();
$rawXml->loadXML($this->GetRaw());
// Get the Text Node
$textNodes = $rawXml->getElementsByTagName('template');
$textNode = $textNodes->item(0);
$text = $textNode->nodeValue;
// Get the CSS Node
$cssNodes = $rawXml->getElementsByTagName('css');
if ($cssNodes->length > 0) {
$cssNode = $cssNodes->item(0);
$css = $cssNode->nodeValue;
} else {
$css = '';
}
// Handle older layouts that have a direction node but no effect node
$oldDirection = $this->GetOption('direction', 'none');
if ($oldDirection == 'single') {
$oldDirection = 'fade';
} else {
if ($oldDirection != 'none') {
$oldDirection = 'marquee' . ucfirst($oldDirection);
}
}
$effect = $this->GetOption('effect', $oldDirection);
$options = array('type' => $this->type, 'fx' => $effect, 'duration' => $duration, 'durationIsPerItem' => $durationIsPerItem == 0 ? false : true, 'numItems' => $numItems, 'takeItemsFrom' => $takeItemsFrom, 'itemsPerPage' => $itemsPerPage, 'speed' => $this->GetOption('speed'), 'originalWidth' => $this->width, 'originalHeight' => $this->height, 'previewWidth' => Kit::GetParam('width', _GET, _DOUBLE, 0), 'previewHeight' => Kit::GetParam('height', _GET, _DOUBLE, 0), 'scaleOverride' => Kit::GetParam('scale_override', _GET, _DOUBLE, 0));
// Generate a JSON string of substituted items.
if ($sourceId == 2) {
$items = $this->GetDataSetItems($displayId, $isPreview, $text);
} else {
$items = $this->GetRssItems($isPreview, $text);
}
// Return empty string if there are no items to show.
if (count($items) == 0) {
return '';
}
// Work out how many pages we will be showing.
$pages = $numItems;
if ($numItems > count($items) || $numItems == 0) {
$pages = count($items);
}
$pages = $itemsPerPage > 0 ? ceil($pages / $itemsPerPage) : $pages;
$totalDuration = $durationIsPerItem == 0 ? $duration : $duration * $pages;
// Replace and Control Meta options
$template = str_replace('<!--[[[CONTROLMETA]]]-->', '<!-- NUMITEMS=' . $pages . ' -->' . PHP_EOL . '<!-- DURATION=' . $totalDuration . ' -->', $template);
// Replace the head content
$headContent = '';
if ($itemsSideBySide == 1) {
$headContent .= '<style type="text/css">';
$headContent .= ' .item, .page { float: left; }';
$headContent .= '</style>';
}
if ($this->GetOption('textDirection') == 'rtl') {
$headContent .= '<style type="text/css">';
$headContent .= ' #content { direction: rtl; }';
$headContent .= '</style>';
}
if ($this->GetOption('backgroundColor') != '') {
$headContent .= '<style type="text/css">';
$headContent .= ' body { background-color: ' . $this->GetOption('backgroundColor') . '; }';
$headContent .= '</style>';
}
// Add the CSS if it isn't empty
if ($css != '') {
$headContent .= '<style type="text/css">' . $css . '</style>';
}
// Add our fonts.css file
$headContent .= '<link href="' . ($isPreview ? 'modules/preview/' : '') . 'fonts.css" rel="stylesheet" media="screen">';
$headContent .= '<style type="text/css">' . file_get_contents(Theme::ItemPath('css/client.css')) . '</style>';
// Replace the Head Content with our generated javascript
$template = str_replace('<!--[[[HEADCONTENT]]]-->', $headContent, $template);
// Add some scripts to the JavaScript Content
$javaScriptContent = '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery-1.11.1.min.js"></script>';
// Need the marquee plugin?
if (stripos($effect, 'marquee') !== false) {
//.........这里部分代码省略.........
示例8: GetResource
public function GetResource($displayId = 0)
{
// Load in the template
if ($this->layoutSchemaVersion == 1) {
$template = file_get_contents('modules/preview/Html4TransitionalTemplate.html');
} else {
$template = file_get_contents('modules/preview/HtmlTemplate.html');
}
$isPreview = Kit::GetParam('preview', _REQUEST, _WORD, 'false') == 'true';
// Replace the View Port Width?
if ($isPreview) {
$template = str_replace('[[ViewPortWidth]]', $this->width, $template);
}
// Get the embedded HTML out of RAW
$styleSheet = $this->GetRawNode('styleSheet', $this->DefaultStyleSheet());
$options = array('type' => $this->type, 'duration' => $this->duration, 'originalWidth' => $this->width, 'originalHeight' => $this->height, 'rowsPerPage' => $this->GetOption('rowsPerPage'), 'previewWidth' => Kit::GetParam('width', _GET, _DOUBLE, 0), 'previewHeight' => Kit::GetParam('height', _GET, _DOUBLE, 0), 'scaleOverride' => Kit::GetParam('scale_override', _GET, _DOUBLE, 0));
// Add our fonts.css file
$headContent = '<link href="' . ($isPreview ? 'modules/preview/' : '') . 'fonts.css" rel="stylesheet" media="screen">';
$headContent .= '<style type="text/css">' . file_get_contents(Theme::ItemPath('css/client.css')) . '</style>';
$headContent .= '<style type="text/css">' . $styleSheet . '</style>';
$template = str_replace('<!--[[[HEADCONTENT]]]-->', $headContent, $template);
$template = str_replace('<!--[[[BODYCONTENT]]]-->', $this->DataSetTableHtml($displayId, $isPreview), $template);
// Build some JS nodes
$javaScriptContent = '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery-1.11.1.min.js"></script>';
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/vendor/' : '') . 'jquery-cycle-2.1.6.min.js"></script>';
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/' : '') . 'xibo-layout-scaler.js"></script>';
$javaScriptContent .= '<script type="text/javascript" src="' . ($isPreview ? 'modules/preview/' : '') . 'xibo-dataset-render.js"></script>';
$javaScriptContent .= '<script type="text/javascript">';
$javaScriptContent .= ' var options = ' . json_encode($options) . ';';
$javaScriptContent .= ' $(document).ready(function() { ';
$javaScriptContent .= ' $("#DataSetTableContainer").dataSetRender(options); $("body").xiboLayoutScaler(options);';
$javaScriptContent .= ' }); ';
$javaScriptContent .= '</script>';
// Replace the Head Content with our generated javascript
$template = str_replace('<!--[[[JAVASCRIPTCONTENT]]]-->', $javaScriptContent, $template);
return $template;
}
示例9:
?>
" rel="stylesheet" media="screen">
<link href="<?php
echo Theme::ItemPath('css/timeline.css');
?>
" rel="stylesheet" media="screen">
<link href="<?php
echo Theme::ItemPath('css/calendar.css');
?>
" rel="stylesheet" media="screen">
<link href="<?php
echo Theme::ItemPath('css/xibo.css');
?>
" rel="stylesheet" media="screen">
<link href="<?php
echo Theme::ItemPath('css/override.css');
?>
" rel="stylesheet" media="screen">
<!-- Copyright 2006-2013 Daniel Garner. Part of the Xibo Open Source Digital Signage Solution. Released under the AGPLv3 or later. -->
</head>
<body>
<div id="page-wrapper" class="active">
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<div id="sidebar-wrapper">
<?php
if (Theme::Get('sidebar_html') != NULL) {
echo Theme::Get('sidebar_html');
}
?>