Esempio n. 1
0
 /**
  * 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);
 }