Commit d7f48f9a authored by Nigel McNie's avatar Nigel McNie
Browse files

Theme cleanups: export: templates, smarty resource etc.

parent 15df531c
......@@ -41,7 +41,7 @@ if (!$exportdata = $SESSION->get('exportdata')) {
}
$SESSION->set('exportdata', '');
$stylesheets = array_reverse(theme_get_url('style/style.css', null, true));
$stylesheets = array_reverse($THEME->get_url('style/style.css', true));
?>
<html>
<head>
......
......@@ -67,6 +67,7 @@ class PluginExportHtml extends PluginExport {
* to set up smarty and the attachment directory
*/
public function __construct(User $user, $views, $artefacts, $progresscallback=null) {
global $THEME;
parent::__construct($user, $views, $artefacts, $progresscallback);
$this->rootdir = 'portfolio-for-' . self::text_to_path($user->get('username'));
......@@ -81,7 +82,7 @@ class PluginExportHtml extends PluginExport {
. $this->get('user')->get('id') . '-' . $this->exporttime . '.zip';
// Find what stylesheets need to be included
$themedirs = theme_get_path('', 'export/html/', true);
$themedirs = $THEME->get_path('', true, 'export/html');
$stylesheets = array('style.css', 'print.css');
foreach ($themedirs as $theme => $themedir) {
foreach ($stylesheets as $stylesheet) {
......@@ -112,6 +113,7 @@ class PluginExportHtml extends PluginExport {
* Main export routine
*/
public function export() {
global $THEME;
raise_memory_limit('128M');
$summaries = array();
......@@ -139,7 +141,7 @@ class PluginExportHtml extends PluginExport {
safe_require('artefact', $plugin);
// Find out whether the plugin has static data for us
$themestaticdirs = array_reverse(theme_get_path('', 'artefact/' . $plugin . '/export/html/', true));
$themestaticdirs = array_reverse($THEME->get_path('', true, 'artefact/' . $plugin . '/export/html'));
foreach ($themestaticdirs as $dir) {
$staticdir = substr($dir, strlen(get_config('docroot') . 'artefact/'));
$this->pluginstaticdirs[] = $staticdir;
......@@ -249,7 +251,8 @@ class PluginExportHtml extends PluginExport {
* This returns the path in the most appropriate theme.
*/
private function theme_path($path) {
$themestaticdirs = theme_get_path('', 'export/html/', true);
global $THEME;
$themestaticdirs = $THEME->get_path('', true, 'export/html');
foreach ($themestaticdirs as $theme => $dir) {
if (is_readable($dir . $path)) {
return 'static/theme/' . $theme . '/static/' . $path;
......@@ -361,12 +364,13 @@ class PluginExportHtml extends PluginExport {
* Copies the static files (stylesheets etc.) into the export
*/
private function copy_static_files() {
global $THEME;
require_once('file.php');
$staticdir = $this->get('exportdir') . '/' . $this->get('rootdir') . '/static/';
$directoriestocopy = array();
// Get static directories from each theme for HTML export
$themestaticdirs = theme_get_path('', 'export/html/', true);
$themestaticdirs = $THEME->get_path('', true, 'export/html');
foreach ($themestaticdirs as $theme => $dir) {
$themedir = $staticdir . 'theme/' . $theme . '/static/';
$directoriestocopy[$dir] = $themedir;
......
......@@ -141,7 +141,7 @@ $smarty = smarty(
array(),
array('stylesheets' => array('style/views.css'))
);
$smarty->assign('heading', '');
$smarty->assign('PAGEHEADING', hsc(get_string('exportyourportfolio', 'export')));
$smarty->assign('form', $form);
$smarty->display('export/index.tpl');
......
......@@ -32,6 +32,7 @@ $string['clicktopreview'] = 'Click to preview';
$string['Export'] = 'Export';
$string['exportgeneratedsuccessfully'] = 'Export generated successfully. %sClick here to download it%s';
$string['exportgeneratedsuccessfullyjs'] = 'Export generated successfully. %sContinue%s';
$string['exportpagedescription'] = 'Here you can export your portfolio. This tool exports all of your portfolio information and Views, but it does not export your site settings.';
$string['exportyourportfolio'] = 'Export Your Portfolio';
$string['generateexport'] = 'Generate export';
$string['noexportpluginsenabled'] = 'No export plugins have been enabled by the administrator, so you are unable to use this feature';
......
......@@ -41,6 +41,7 @@ function smarty_resource_export_trusted($tpl_name, &$smarty_obj)
}
function smarty_resource_export_get_filepath($tpl_name) {
global $THEME;
static $filepaths = array();
if (isset($filepaths[$tpl_name])) {
return $filepaths[$tpl_name];
......@@ -60,7 +61,7 @@ function smarty_resource_export_get_filepath($tpl_name) {
$basedir .= 'export/' . $plugin . '/theme/';
}
foreach (theme_setup()->inheritance as $theme) {
foreach ($THEME->inheritance as $theme) {
$filename = $basedir . $theme . '/' . $template_path;
if (is_readable($filename)) {
return $filepaths[$tpl_name] = $filename;
......
<?php
function export_form_cell_html($element) {
global $THEME;
$strclicktopreview = get_string('clicktopreview', 'export');
$previewimg = theme_get_url('images/icon-display.png');
$previewimg = $THEME->get_url('images/icon-display.png');
$strpreview = get_string('Preview');
$element['description'] = clean_html($element['description']);
return <<<EOF
......
{include file="header.tpl"}
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
<div id="exportgeneration">
<h3>{str tag=pleasewaitwhileyourexportisbeinggenerated section=export}</h3>
<iframe src="{$WWWROOT}export/download.php" id="progress" scrolling="no" frameborder="none"></iframe>
</div>
{include file="columnleftend.tpl"}
{include file="footer.tpl"}
{include file="header.tpl"}
{include file="sidebar.tpl"}
{include file="columnleftstart.tpl"}
{str tag=exportpagedescription section=export}
{$form}
{include file="columnleftend.tpl"}
{include file="footer.tpl"}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment