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

Ensure that two different composites of the same type can be displayed in the...

Ensure that two different composites of the same type can be displayed in the same view, by suffixing their variables/IDs with something random
parent 9585196c
......@@ -458,31 +458,33 @@ abstract class ArtefactTypeResumeComposite extends ArtefactTypeResume {
}
public function render_self($options) {
$suffix = substr(md5(microtime()), 0, 4);
$smarty = smarty();
$smarty->assign('hidetitle', true);
$smarty->assign('suffix', $suffix);
$type = $this->get('artefacttype');
$content = array(
'html' => $smarty->fetch('artefact:resume:fragments/' . $type . '.tpl'),
'javascript' =>
$this->get_showhide_composite_js()
."
var {$type}list = new TableRenderer(
'{$type}list',
var {$type}list_{$suffix} = new TableRenderer(
'{$type}list_{$suffix}',
'" . get_config('wwwroot') . "artefact/resume/composite.json.php',
[
" . call_static_method(generate_artefact_class_name($type), 'get_tablerenderer_js') ."
]
);
{$type}list.type = '{$type}';
{$type}list.statevars.push('type');
{$type}list_{$suffix}.type = '{$type}';
{$type}list_{$suffix}.statevars.push('type');
" .
(( array_key_exists('viewid', $options))
? "{$type}list.view = " . $options['viewid'] . ";
{$type}list.statevars.push('view');"
? "{$type}list_{$suffix}.view = " . $options['viewid'] . ";
{$type}list_{$suffix}.statevars.push('view');"
: ""
) . "
{$type}list.updateOnLoad();
{$type}list_{$suffix}.updateOnLoad();
");
return $content;
}
......
......@@ -3,7 +3,7 @@
{contextualhelp plugintype='artefact' pluginname='resume' section='addbook'}
{/if}
</h3>{/if}
<table id="booklist" class="tablerenderer hidden resumefour">
<table id="booklist_{$suffix}" class="tablerenderer hidden resumefour">
<thead>
<tr>
<th class="resumedate">{str tag='date' section='artefact.resume'}</th>
......
......@@ -3,7 +3,7 @@
{contextualhelp plugintype='artefact' pluginname='resume' section='addcertification'}
{/if}
</h3>{/if}
<table id="certificationlist" class="tablerenderer hidden resumefour">
<table id="certificationlist_{$suffix}" class="tablerenderer hidden resumefour">
<thead>
<tr>
<th class="resumedate">{str tag='date' section='artefact.resume'}</th>
......
......@@ -3,7 +3,7 @@
{contextualhelp plugintype='artefact' pluginname='resume' section='addeducationhistory'}
{/if}
</h3>{/if}
<table id="educationhistorylist" class="tablerenderer hidden resumefive">
<table id="educationhistorylist_{$suffix}" class="tablerenderer hidden resumefive">
<thead>
<tr>
<th class="resumedate">{str tag='startdate' section='artefact.resume'}</th>
......
......@@ -3,7 +3,7 @@
{contextualhelp plugintype='artefact' pluginname='resume' section='addemploymenthistory'}
{/if}
</h3>{/if}
<table id="employmenthistorylist" class="tablerenderer hidden resumefive">
<table id="employmenthistorylist_{$suffix}" class="tablerenderer hidden resumefive">
<thead>
<tr>
<th class="resumedate">{str tag='startdate' section='artefact.resume'}</th>
......
......@@ -3,7 +3,7 @@
{contextualhelp plugintype='artefact' pluginname='resume' section='addmembership'}
{/if}
</h3>{/if}
<table id="membershiplist" class="tablerenderer hidden resumefive">
<table id="membershiplist_{$suffix}" class="tablerenderer hidden resumefive">
<thead>
<tr>
<th class="resumedate">{str tag='startdate' section='artefact.resume'}</th>
......
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