public function get_summary() { $smarty = $this->exporter->get_smarty(); $ilps = array(); foreach ($this->exporter->get('artefacts') as $artefact) { if ($artefact instanceof ArtefactTypeilp) { $ilps[] = array('link' => 'files/ilps/' . PluginExportHtml::text_to_path($artefact->get('title')) . '/index.html', 'title' => $artefact->get('title')); } } $smarty->assign('ilps', $ilps); return array('title' => get_string('ilps', 'artefact.ilps'), 'description' => $smarty->fetch('export:html/ilps: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_path($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]; $artefact = artefact_instance_from_id($artefactid); $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_path($artefact->get('title')) . '/' . $offset . '.html">' . $matches[5] . '</a>'; case 'file': case 'folder': case 'image': case 'archive': $folderpath = $this->get_folder_path_for_file($artefact); return '<a href="' . $this->basepath . '/files/file/' . $folderpath . PluginExportHtml::sanitise_path($artefact->get('title')) . '">' . $matches[5] . '</a>'; default: return $matches[5]; } }
/** * 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]; $artefact = artefact_instance_from_id($artefactid); switch ($artefact->get('artefacttype')) { case 'blog': $page = $matches[4] ? intval(substr($matches[4], strlen('&page='))) : 1; $page = $page == 1 ? 'index' : $page; return '<a href="' . $this->basepath . '/files/blog/' . PluginExportHtml::text_to_path($artefact->get('title')) . '/' . $page . '.html">' . $matches[5] . '</a>'; case 'file': case 'image': $folderpath = $this->get_folder_path_for_file($artefact); return '<a href="' . $this->basepath . '/files/file/' . $folderpath . PluginExportHtml::sanitise_path($artefact->get('title')) . '">' . $matches[5] . '</a>'; default: return $matches[5]; } }