public function get_summary() { $smarty = $this->exporter->get_smarty(); $milestones = array(); foreach ($this->exporter->get('artefacts') as $artefact) { if ($artefact instanceof ArtefactTypeMilestone) { $milestones[] = array('link' => 'files/milestones/' . PluginExportHtml::text_to_URLpath(PluginExportHtml::text_to_filename($artefact->get('title'))) . '/index.html', 'title' => $artefact->get('title')); } } $smarty->assign('milestones', $milestones); return array('title' => get_string('milestones', 'artefact.milestones'), 'description' => $smarty->fetch('export:html/milestones:summary.tpl')); }
public function get_summary() { $smarty = $this->exporter->get_smarty(); $blogs = array(); foreach ($this->exporter->get('artefacts') as $artefact) { if ($artefact->get('artefacttype') == 'blog') { $blogs[] = array('link' => 'files/blog/' . PluginExportHtml::text_to_URLpath(PluginExportHtml::text_to_filename($artefact->get('title'))) . '/index.html', 'title' => $artefact->get('title')); } } if ($blogs) { $smarty->assign('blogs', $blogs); $stryouhaveblogs = count($blogs) == 1 ? get_string('youhaveoneblog', 'artefact.blog') : get_string('youhaveblogs', 'artefact.blog', count($blogs)); } else { $stryouhaveblogs = get_string('youhavenoblogs', 'artefact.blog'); } $smarty->assign('stryouhaveblogs', $stryouhaveblogs); return array('title' => get_string('blogs', 'artefact.blog'), 'description' => $smarty->fetch('export:html/blog:summary.tpl')); }
/** * Callback to replace links to artefact to point to the correct location * in the HTML export */ private function replace_artefact_link($matches) { $artefactid = $matches[2]; try { $artefact = artefact_instance_from_id($artefactid); } catch (ArtefactNotFoundException $e) { return $matches[5]; } $artefacttype = $artefact->get('artefacttype'); switch ($artefacttype) { case 'blog': case 'plan': $dir = $artefacttype == 'plan' ? 'plans' : $artefacttype; $offset = $matches[4] ? intval(substr($matches[4], strlen('&offset='))) : 0; $offset = $offset == 0 ? 'index' : $offset; return '<a href="' . $this->basepath . "/files/{$dir}/" . PluginExportHtml::text_to_URLpath(PluginExportHtml::text_to_filename($artefact->get('title'))) . '/' . $offset . '.html">' . $matches[5] . '</a>'; case 'file': case 'folder': case 'image': case 'profileicon': case 'archive': case 'video': case 'audio': return '<a href="' . $this->get_export_path_for_file($artefact, array()) . '">' . $matches[5] . '</a>'; default: return $matches[5]; } }