Commit 5d1f6511 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Adding comment display to embedded media artefact (Bug #1037531)

Change-Id: I50a5cd56ca87b9625dcf59462db822c222fc0a24
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 25b4f5f1
......@@ -37,13 +37,14 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
public static function render_instance(BlockInstance $instance, $editing=false) {
$configdata = $instance->get('configdata');
if (empty($configdata['artefactid'])) {
$viewid = $instance->get('view');
$artefactid = isset($configdata['artefactid']) ? $configdata['artefactid'] : null;
if (empty($artefactid)) {
return '';
}
$result = self::get_js_source();
require_once(get_config('docroot') . 'artefact/lib.php');
$artefact = $instance->get_artefact_instance($configdata['artefactid']);
$artefact = $instance->get_artefact_instance($artefactid);
$defaultwidth = get_config_plugin('blocktype', 'internalmedia', 'width') ?
get_config_plugin('blocktype', 'internalmedia', 'width') : 300;
$defaultheight = get_config_plugin('blocktype', 'internalmedia', 'height') ?
......@@ -57,7 +58,20 @@ class PluginBlocktypeInternalmedia extends PluginBlocktype {
}
$callbacks = self::get_all_filetype_players();
$result .= '<div class="mediaplayer-container center"><div class="mediaplayer">' . call_static_method('PluginBlocktypeInternalmedia', $callbacks[$mimetypefiletypes[$mimetype]], $artefact, $instance, $width, $height) . '</div></div>';
return $result;
if ($artefactid) {
require_once(get_config('docroot') . 'artefact/comment/lib.php');
require_once(get_config('docroot') . 'lib/view.php');
$view = new View($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:internalmedia:internalmedia.tpl');
}
public static function has_instance_config() {
......
{$html|safe}
{if $commentcount || $commentcount === 0}
{$comments|safe}
{/if}
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