public function add_links() { parent::add_links(); // add on attachments if (!($attachments = $this->artefact->attachment_id_list())) { return; } foreach ($attachments as $attachment) { $f = artefact_instance_from_id($attachment); $this->add_artefact_link($f, 'has_attachment'); } }
/** * Export the artefacts */ private function export_artefacts() { $progressstart = 50; $progressend = 80; $artefacts = $this->get('artefacts'); $artefactcount = count($artefacts); $i = 0; foreach ($artefacts as $artefact) { if ($i++ % 3 == 0) { $percent = intval($progressstart + $i / $artefactcount * ($progressend - $progressstart)); $this->notify_progress_callback($percent, get_string('exportingartefactsprogress', 'export', $i, $artefactcount)); } $element = null; // go see if we have to do anything special for this artefact type. if (safe_require('export', 'leap/' . $artefact->get_plugin_name(), 'lib.php', 'require_once', true)) { $classname = 'LeapExportElement' . ucfirst($artefact->get('artefacttype')); if (class_exists($classname)) { $element = new $classname($artefact, $this); } if (is_null($element)) { $element = new LeapExportElement($artefact, $this); } if (array_key_exists($artefact->get_plugin_name(), $this->specialcases) && !$element->override_plugin_specialcase()) { $this->specialcases[$artefact->get_plugin_name()][] = $artefact; continue; } if (!$element->is_leap()) { continue; } $element->add_attachments(); $element->assign_smarty_vars(); $this->xml .= $element->get_export_xml(); } } }
public function assign_smarty_vars() { parent::assign_smarty_vars(); $this->smarty->assign('title', ucfirst($this->artefact->get('artefacttype'))); }
/** * Export the artefacts */ private function export_artefacts() { $progressstart = 30; $progressend = 70; $artefacts = $this->get('artefacts'); $artefactcount = count($artefacts); $i = 0; foreach ($artefacts as $artefact) { if ($i++ % 10 == 1) { $percent = intval($progressstart + $i / $artefactcount * ($progressend - $progressstart)); $this->notify_progress_callback($percent, "Exporting artefacts: {$i}/{$artefactcount}"); } $element = null; // go see if we have to do anything special for this artefact type. try { safe_require('export', 'leap/' . $artefact->get_plugin_name()); $classname = 'LeapExportElement' . ucfirst($artefact->get('artefacttype')); if (class_exists($classname)) { $element = new $classname($artefact, $this); } } catch (Exception $e) { } // overriding this is not required. if (is_null($element)) { $element = new LeapExportElement($artefact, $this); } if (array_key_exists($artefact->get_plugin_name(), $this->specialcases) && !$element->override_plugin_specialcase()) { $this->specialcases[$artefact->get_plugin_name()][] = $artefact; continue; } if (!$element->is_leap()) { continue; } $element->add_attachments(); $element->assign_smarty_vars(); $this->xml .= $element->get_export_xml(); } }
public function assign_smarty_vars() { parent::assign_smarty_vars(); $this->smarty->assign('summary', $this->artefact->get('description')); $this->smarty->assign('contentsrc', $this->exporter->get('filedir') . $this->filename); }
public function __construct(LeapExporter $exporter, ArtefactTypeResumeComposite $parentartefact, $child) { $this->originalrecord = $child; $this->entrydata = $this->record_to_entrydata($child); $this->parentartefact = $parentartefact; parent::__construct(null, $exporter); $this->assign_smarty_vars(); }
public function assign_smarty_vars() { parent::assign_smarty_vars(); $this->smarty->assign('summary', $this->artefact->get('description')); }
/** * assign the smarty vars used in this template */ public function assign_smarty_vars() { if (!$this->artefact instanceof ArtefactType) { // If you're seeing this error, this means you have subclassed // LeapExportElement and are using it to represent something more // than just one artefact. In this case, you must override this // method. throw new ExportException($this, "LeapExportElement::assign_smarty_vars was called with null artefact. " . "If you are using LeapExportElement as a dummy class for exporting more than one artefact, " . "you must override assign_smarty_vars yourself."); } $this->smarty->assign('artefacttype', $this->artefact->get('artefacttype')); $this->smarty->assign('artefactplugin', $this->artefact->get_plugin_name()); $this->smarty->assign('title', $this->artefact->get('title')); $this->smarty->assign('id', 'portfolio:artefact' . $this->artefact->get('id')); $this->smarty->assign('updated', PluginExportLeap::format_rfc3339_date($this->artefact->get('mtime'))); $this->smarty->assign('created', PluginExportLeap::format_rfc3339_date($this->artefact->get('ctime'))); // these are the ones we really need to override $this->add_links(); $content = $this->get_content(); // try to coerce it to xhtml if ($this->get_content_type() != 'text' && ($newcontent = PluginExportLeap::parse_xhtmlish_content($content))) { $this->smarty->assign('contenttype', 'xhtml'); $this->smarty->assign('content', $newcontent); } else { $this->smarty->assign('contenttype', 'text'); $this->smarty->assign('content', $content); } $this->smarty->assign('leaptype', $this->get_leap_type()); $this->smarty->assign('author', $this->get_entry_author()); $this->smarty->assign('dates', $this->get_dates()); if ($tags = $this->artefact->get('tags')) { $tags = array_map(function ($a) { return array('term' => LeapExportElement::normalise_tag($a), 'label' => $a); }, $tags); } if (!($categories = $this->get_categories())) { $categories = array(); } $this->smarty->assign('categories', array_merge($tags, $categories)); $this->smarty->assign('links', $this->links); }
public function __construct(ArtefactTypeResumeComposite $parentartefact, PluginExportLeap $exporter, $child) { $this->originalrecord = $child; $this->entrydata = $this->record_to_entrydata($child); $this->parentartefact = $parentartefact; // We pass 'null' as the artefact ID, as this class represents // composite children that aren't really artefacts. The field // 'parentartefact' holds a reference to the parent. parent::__construct(null, $exporter); $this->assign_smarty_vars(); }