Commit 4518b57a authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge "Adding comment display to pdf artefact (Bug #1037531)"

parents 6343d5f2 25b4f5f1
...@@ -33,18 +33,30 @@ class PluginBlocktypePdf extends PluginBlocktype { ...@@ -33,18 +33,30 @@ class PluginBlocktypePdf extends PluginBlocktype {
$configdata = $instance->get('configdata'); // this will make sure to unserialize it for us $configdata = $instance->get('configdata'); // this will make sure to unserialize it for us
$configdata['viewid'] = $instance->get('view'); $configdata['viewid'] = $instance->get('view');
if (isset($configdata['artefactid'])) { $result = '';
$pdf = $instance->get_artefact_instance($configdata['artefactid']); $artefactid = isset($configdata['artefactid']) ? $configdata['artefactid'] : null;
if ($artefactid) {
$artefact = $instance->get_artefact_instance($configdata['artefactid']);
if (!file_exists($pdf->get_path())) { if (!file_exists($artefact->get_path())) {
return ''; return '';
} }
return '<iframe src="' . get_config('wwwroot') . 'artefact/file/blocktype/pdf/viewer.php?file=' . $configdata['artefactid'] . '&view=' . $instance->get('view') $result = '<iframe src="' . get_config('wwwroot') . 'artefact/file/blocktype/pdf/viewer.php?file=' . $artefactid . '&view=' . $instance->get('view')
. '" width="100%" height="500" frameborder="0"></iframe>'; . '" width="100%" height="500" frameborder="0"></iframe>';
}
return ''; require_once(get_config('docroot') . 'artefact/comment/lib.php');
require_once(get_config('docroot') . 'lib/view.php');
$view = new View($configdata['viewid']);
list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'));
}
$smarty = smarty_core();
if ($artefactid) {
$smarty->assign('commentcount', $commentcount);
$smarty->assign('comments', $comments);
}
$smarty->assign('html', $result);
return $smarty->fetch('blocktype:pdf:pdfrender.tpl');
} }
public static function has_instance_config() { public static function has_instance_config() {
......
{$html|safe}
{if $commentcount || $commentcount === 0}
{$comments|safe}
{/if}
Supports Markdown
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