Commit 1a7efc06 authored by Robert Lyon's avatar Robert Lyon

Bug 1826284: Plan block renders different for PDF export

It renders with all the tasks expanded

Also tidied up the taskrows.tpl file to minimise the duplication
Also added back in a missing style for overdue incomplete task

behatnotneeded

Change-Id: Idab864d056cb844fa0699448d8425fc807c72d54
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent f7406158
......@@ -60,8 +60,13 @@ class PluginBlocktypePlans extends MaharaCoreBlocktype {
safe_require('artefact','plans');
$configdata = $instance->get('configdata');
$limit = (!empty($configdata['count'])) ? $configdata['count'] : 10;
$smarty = smarty_core();
$limit = (!empty($configdata['count'])) ? $configdata['count'] : 10;
if ($exporter && get_class($exporter) == 'PluginExportPdf') {
$limit = 0;
$smarty->assign('pdfexport', true);
}
$plans = array();
$alltasks = array();
......@@ -106,6 +111,9 @@ class PluginBlocktypePlans extends MaharaCoreBlocktype {
$configdata['view'] = $instance->get('view');
$configdata['block'] = $blockid;
$configdata['versioning'] = $versioning;
if ($exporter && get_class($exporter) == 'PluginExportPdf') {
$configdata['pdfexport'] = true;
}
ArtefactTypeTask::render_tasks($tasks, $template, $configdata, $pagination, $editing, $versioning);
if (($exporter || $versioning) && $tasks['count'] > $tasks['limit']) {
$artefacturl = get_config('wwwroot') . 'view/view.php?id=' . $instance->get('view') .'&modal=1&artefact=' . $planid;
......
{foreach from=$tasks.data item=task}
{if $task->completed == -1}
<div class="task-item plan_incomplete list-group-item">
{if $editing}
<div class="float-right btn-group">
<a class="btn btn-secondary btn-sm" href="{$WWWROOT}artefact/plans/task/edit.php?id={$task->id}{if $view}&view={$view}{/if}" title="{str tag='editthistask' section='artefact.plans' arg1=$task->title}"><span class="icon icon-pencil-alt text-default"></span></a>
<a class="btn btn-secondary btn-sm" href="{$WWWROOT}artefact/plans/task/delete.php?id={$task->id}{if $view}&view={$view}{/if}" title="{str tag='deletethistask' section='artefact.plans' arg1=$task->title}"><span class="icon icon-trash-alt text-danger"></span></a>
</div>
{/if}
<span class="overdue-task">
<span class="icon icon-times text-danger icon-lg left task{$task->id}{if $editing || $canedit} plan-task-icon{/if}" role="presentation" aria-hidden="true" data-task="{$task->id}"></span>
<div class="plan-task-heading">
{if $task->description || $task->tags}
<a class="collapsed" href="#expand-task-{$task->id}{if $block}-{$block}{/if}{if $versioning}-{$versioning->version}{/if}" data-toggle="collapse" aria-expanded="false" aria-controls="expand-task-{$task->id}{if $block}-{$block}{/if}{if $versioning}-{$versioning->version}{/if}">
{/if}
<span class="text-danger">{$task->title}</span>
{if $task->description || $task->tags}
<span class="icon icon-chevron-down collapse-indicator float-right" role="presentation" aria-hidden="true"></span>
</a>
{/if}
{if $task->completiondate}
<br />
<span class="text-small text-midtone">
{str tag='completiondate' section='artefact.plans'}: {$task->completiondate}
</span>
{/if}
</div>
{if $task->description || $task->tags}
<div class="collapse plan-task-detail" id="expand-task-{$task->id}{if $block}-{$block}{/if}{if $versioning}-{$versioning->version}{/if}">
{if $task->description}
{$task->description|clean_html|safe}
{/if}
{if $task->tags}
<div class="tags text-small">
<strong>{str tag=tags}:</strong> {list_tags owner=$task->owner tags=$task->tags view=$view}
</div>
{/if}
</div>
{/if}
</span>
<div class="task-item {if $task->completed == -1}plan_incomplete{/if} list-group-item">
{if $editing}
<div class="float-right btn-group">
<a class="btn btn-secondary btn-sm" href="{$WWWROOT}artefact/plans/task/edit.php?id={$task->id}{if $view}&view={$view}{/if}" title="{str tag='editthistask' section='artefact.plans' arg1=$task->title}"><span class="icon icon-pencil-alt text-default"></span></a>
<a class="btn btn-secondary btn-sm" href="{$WWWROOT}artefact/plans/task/delete.php?id={$task->id}{if $view}&view={$view}{/if}" title="{str tag='deletethistask' section='artefact.plans' arg1=$task->title}"><span class="icon icon-trash-alt text-danger"></span></a>
</div>
{else}
<div class="task-item list-group-item">
{if $editing}
<div class="float-right btn-group">
<a class="btn btn-secondary btn-sm" href="{$WWWROOT}artefact/plans/task/edit.php?id={$task->id}{if $view}&view={$view}{/if}" title="{str tag='editthistask' section='artefact.plans' arg1=$task->title}"><span class="icon icon-pencil-alt text-default"></span></a>
<a class="btn btn-secondary btn-sm" href="{$WWWROOT}artefact/plans/task/delete.php?id={$task->id}{if $view}&view={$view}{/if}" title="{str tag='deletethistask' section='artefact.plans' arg1=$task->title}"><span class="icon icon-trash-alt text-danger"></span></a>
</div>
{/if}
<span class="complete-task">
{if $task->completed == 1}
{/if}
<span class="{if $task->completed == -1}overdue-task{else}complete-task{/if}">
{if $task->completed == -1}
<span class="icon icon-times text-danger icon-lg left task{$task->id}{if $editing || $canedit} plan-task-icon{/if}" role="presentation" aria-hidden="true" data-task="{$task->id}"></span>
<span class="sr-only">{str tag=overdue section=artefact.plans}</span>
{elseif $task->completed == 1}
<span class="icon icon-regular icon-check-square icon-lg text-success left task{$task->id}{if $editing || $canedit} plan-task-icon{/if}" role="presentation" aria-hidden="true" data-task="{$task->id}"></span>
<span class="sr-only">{str tag=completed section=artefact.plans}</span>
{else}
<span class="icon-regular icon-square icon icon-lg text-midtone left task{$task->id}{if $editing || $canedit} plan-task-icon{/if}" role="presentation" aria-hidden="true" data-task="{$task->id}"></span>
<span class="sr-only">{str tag=incomplete section=artefact.plans}</span>
{/if}
<div class="plan-task-heading">
{if $task->description || $task->tags}
<a class="collapsed" href="#expand-task-{$task->id}{if $block}-{$block}{/if}{if $versioning}-{$versioning->version}{/if}" data-toggle="collapse" aria-expanded="false" aria-controls="expand-task-{$task->id}{if $block}-{$block}{/if}{if $versioning}-{$versioning->version}{/if}">
{/if}
<span class="text-default">{$task->title}</span>
{if $task->description || $task->tags}
<span class="icon icon-chevron-down collapse-indicator float-right" role="presentation" aria-hidden="true"></span>
</a>
{/if}
{if $task->completiondate}
<br />
<span class="text-midtone text-small">
{str tag='completiondate' section='artefact.plans'}: {$task->completiondate}
</span>
{/if}
</div>
</span>
{if $task->description || $task->tags}
<div class="collapse plan-task-detail" id="expand-task-{$task->id}{if $block}-{$block}{/if}{if $versioning}-{$versioning->version}{/if}">
{if $task->description}
{$task->description|clean_html|safe}
<div class="plan-task-heading">
{if $task->description || $task->tags}
<a class="{if !$options.pdfexport}collapsed{/if}" href="#expand-task-{$task->id}{if $block}-{$block}{/if}{if $versioning}-{$versioning->version}{/if}" data-toggle="collapse" aria-expanded="{if !$options.pdfexport}true{else}false{/if}" aria-controls="expand-task-{$task->id}{if $block}-{$block}{/if}{if $versioning}-{$versioning->version}{/if}">
{/if}
{if $task->tags}
<div class="tags text-small">
<strong>{str tag=tags}:</strong> {list_tags owner=$task->owner tags=$task->tags view=$view}
</div>
<span class="{if $task->completed == -1}text-danger{else}text-default{/if}">{$task->title}</span>
{if $task->description || $task->tags}
<span class="icon icon-chevron-down right collapse-indicator float-right" role="presentation" aria-hidden="true"></span>
</a>
{/if}
{if $task->completiondate}
<br />
<span class="text-small text-midtone">
{str tag='completiondate' section='artefact.plans'}: {$task->completiondate}
</span>
{/if}
</div>
</span>
{if $task->description || $task->tags}
<div class="collapse{if $options.pdfexport} show{/if} plan-task-detail" id="expand-task-{$task->id}{if $block}-{$block}{/if}{if $versioning}-{$versioning->version}{/if}">
{if $task->description}
{$task->description|clean_html|safe}
{/if}
{if $task->tags}
<div class="tags text-small">
<strong>{str tag=tags}:</strong> {list_tags owner=$task->owner tags=$task->tags view=$view}
</div>
{/if}
</div>
{/if}
{/foreach}
{/if}
</div>
{/foreach}
\ No newline at end of file
......@@ -4,3 +4,21 @@
white-space: nowrap;
text-align: center;
}
.plan_incomplete {
background: #FEE7E7;
color: #333333;
}
.task-item .complete-task .icon,
.task-item .overdue-task .icon {
margin-left: -8px; // correct alignment
}
.task-item .btn-group {
margin-right: -8px; // correct alignment
a {
font-size: 10px;
padding: 2px 8px;
}
}
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