Example #1
0
 public function assign_smarty_vars()
 {
     $user = $this->get('exporter')->get('user');
     $userid = $user->get('id');
     $updated = get_record_sql('select ' . db_format_tsfield('max(mtime)', 'mtime') . ' from {artefact} a join {artefact_installed_type} t on a.artefacttype = t.name where t.plugin = \'internal\'');
     $this->smarty->assign('artefacttype', 'internal');
     $this->smarty->assign('artefactplugin', 'internal');
     $this->smarty->assign('title', display_name($user, $user));
     $this->smarty->assign('updated', PluginExportLeap::format_rfc3339_date($updated->mtime));
     // If this ID is changed, you'll have to change it in author.tpl too
     $this->smarty->assign('id', 'portfolio:artefactinternal');
     $this->smarty->assign('leaptype', $this->get_leap_type());
     $persondata = array();
     $spacialdata = array();
     usort($this->artefacts, array($this, 'artefact_sort'));
     foreach ($this->artefacts as $a) {
         if (!($data = $this->data_mapping($a))) {
             if ($a->get('artefacttype') == 'introduction') {
                 $this->smarty->assign('contenttype', 'html');
                 $this->smarty->assign('content', clean_html($a->get('title')));
             }
             continue;
         }
         $value = $a->render_self(array());
         $value = $value['html'];
         // TODO fix this when we non-js stuff
         $data = array_merge(array('value' => $value, 'artefacttype' => $a->get('artefacttype'), 'artefactplugin' => 'internal'), $data);
         if (array_key_exists('spacial', $data)) {
             $spacialdata[] = (object) $data;
         } else {
             $label = get_string($a->get('artefacttype'), 'artefact.internal');
             if ($a->get('artefacttype') == 'socialprofile') {
                 $label = $a->get('description');
             }
             $data = array_merge($data, array('label' => $label));
             $persondata[] = (object) $data;
         }
     }
     if ($extras = $this->exporter->get('extrapersondata')) {
         $persondata = array_merge($persondata, $extras);
     }
     $this->smarty->assign('persondata', $persondata);
     $this->smarty->assign('spacialdata', $spacialdata);
     // Grab profile icons and link to them, making sure the default is first
     if ($icons = get_column_sql("SELECT id\n            FROM {artefact}\n            WHERE artefacttype = 'profileicon'\n            AND \"owner\" = ?\n            ORDER BY id = (\n                SELECT profileicon FROM {usr} WHERE id = ?\n            ) DESC, id", array($userid, $userid))) {
         foreach ($icons as $icon) {
             $icon = artefact_instance_from_id($icon);
             $this->add_artefact_link($icon, 'related');
         }
         $this->smarty->assign('links', $this->links);
     }
     if (!($categories = $this->get_categories())) {
         $categories = array();
     }
     $this->smarty->assign('categories', $categories);
 }
 /**
  * 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(create_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);
 }
Example #3
0
 private function format_persondata($key, $value)
 {
     $basics = array('artefactplugin' => 'resume', 'artefacttype' => 'personalinformation/' . $key, 'field' => $key, 'label' => get_string($key, 'artefact.resume'), 'value' => $value);
     switch ($key) {
         case 'dateofbirth':
             return array_merge($basics, array('field' => 'dob', 'value' => PluginExportLeap::format_rfc3339_date($value)));
         case 'gender':
             return array_merge($basics, array('value' => $key == 'male' ? 1 : 2));
         default:
             return array_merge($basics, array('mahara' => true));
     }
 }
Example #4
0
 /**
  * assign the smarty vars used in this template
  */
 public function assign_smarty_vars()
 {
     $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();
     $this->smarty->assign('content', $this->get_content());
     $this->smarty->assign('contenttype', $this->get_content_type());
     $this->smarty->assign('leaptype', $this->get_leap_type());
     $this->smarty->assign('author', $this->get_entry_author());
     if ($tags = $this->artefact->get('tags')) {
         $tags = array_map(create_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 record_to_entrydata($record)
 {
     return array('end' => $record->date, 'title' => $record->title, 'myrole' => $record->contribution, 'content' => $record->description, 'updated' => PluginExportLeap::format_rfc3339_date($record->mtime));
 }