Commit 87cd8dfd authored by Nigel McNie's avatar Nigel McNie
Browse files

(#3419) Import profile view as a profile view



The export includes the view type now, and we import the views having
the correct type.

On second thoughts, I'm guessing the importer will die horribly if
someone makes an export with two profile views, but that can be a
problem for another day.
Signed-off-by: default avatarNigel McNie <nigel@catalyst.net.nz>
parent 04cd72e5
......@@ -220,6 +220,7 @@ class PluginExportLeap extends PluginExport {
$this->smarty->assign('content', $view->build_columns());
$this->smarty->assign('viewdata', $config['columns']);
$this->smarty->assign('layout', $view->get_layout()->widths);
$this->smarty->assign('type', $config['type']);
$ownerformat = ($config['ownerformat']) ? $config['ownerformat'] : FORMAT_NAME_DISPLAYNAME;
$this->smarty->assign('ownerformat', $ownerformat);
$this->smarty->assign('leaptype', 'selection');
......
{include file="export:leap:entry.tpl" skipfooter=true}
<mahara:view{if $layout} mahara:layout="{$layout|escape}"{/if} mahara:ownerformat="{$ownerformat|escape}">
<mahara:view{if $layout} mahara:layout="{$layout|escape}"{/if}{if $type} mahara:type="{$type|escape}"{/if} mahara:ownerformat="{$ownerformat|escape}">
{foreach from=$viewdata item=column}
<mahara:column>
{foreach from=$column item=blockinstance}
......
......@@ -577,6 +577,7 @@ class PluginImportLeap extends PluginImport {
private function import_entry_as_mahara_view(SimpleXMLElement $entry) {
static $blocktypes_installed = null;
static $viewlayouts = null;
static $viewtypes = null;
$viewelement = $entry->xpath('mahara:view[1]');
if (count($viewelement) != 1) {
......@@ -587,6 +588,9 @@ class PluginImportLeap extends PluginImport {
if (is_null($viewlayouts)) {
$viewlayouts = get_records_assoc('view_layout', '', '', '', 'widths, id');
}
if (is_null($viewtypes)) {
$viewtypes = get_column('view_type', 'type');
}
$maharaattributes = PluginImportLeap::get_attributes($viewelement[0], PluginImportLeap::NS_MAHARA);
......@@ -594,6 +598,10 @@ class PluginImportLeap extends PluginImport {
if (isset($viewlayouts[$maharaattributes['layout']])) {
$layout = $viewlayouts[$maharaattributes['layout']]->id;
}
$type = 'portfolio';
if (isset($maharaattributes['type']) && in_array($maharaattributes['type'], $viewtypes)) {
$type = $maharaattributes['type'];
}
$ownerformat = intval($maharaattributes['ownerformat']);
if (!$ownerformat) {
$ownerformat = FORMAT_NAME_DISPLAYNAME;
......@@ -610,7 +618,7 @@ class PluginImportLeap extends PluginImport {
$config = array(
'title' => (string)$entry->title,
'description' => (string)$entry->summary,
'type' => 'portfolio', // TODO
'type' => $type,
'layout' => $layout,
'tags' => self::get_entry_tags($entry),
'numcolumns' => $columncount,
......
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