Esempio n. 1
0
 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'));
 }
Esempio n. 2
0
 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'));
 }
Esempio n. 3
0
 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'));
 }
Esempio n. 4
0
 public function get_summary()
 {
     $smarty = $this->exporter->get_smarty();
     $outputfilter = new HtmlExportOutputFilter('.', $this->exporter);
     $smarty->assign('introduction', $outputfilter->filter(get_profile_field($this->exporter->get('user')->get('id'), 'introduction')));
     $smarty->assign('profileviewexported', $this->profileviewexported);
     $iconid = $this->exporter->get('user')->get('profileicon');
     if ($iconid) {
         $icon = artefact_instance_from_id($iconid);
         $smarty->assign('icon', '<img src="static/profileicons/200px-' . PluginExportHtml::sanitise_path($icon->get('title')) . '" alt="Profile Picture">');
     }
     return array('description' => $smarty->fetch('export:html/internal:summary.tpl'));
 }
Esempio n. 5
0
 /**
  * Helper to convert artefacts into smarty-friendly data
  *
  * @param int $parent   The ID of the parent folder for the artefact to 
  *                      convert
  * @param bool $folders True to get folders, false to get everything but 
  *                      folders
  */
 private function prepare_artefacts_for_smarty($parent, $folders)
 {
     $data = array();
     $equality = $folders ? '==' : '!=';
     $parent = is_null($parent) ? 'null' : intval($parent);
     $artefacts = array_filter($this->artefactdata, create_function('$a', 'return $a->get("parent") == ' . $parent . ' && $a->get("artefacttype") ' . $equality . ' "folder";'));
     foreach ($artefacts as $artefact) {
         $size = '';
         if ($artefact->get('artefacttype') != 'folder') {
             $size = $artefact->get('size');
             $size = $size ? display_size($size) : '';
         }
         $data[] = array('icon' => '', 'title' => $artefact->get('title'), 'path' => PluginExportHtml::sanitise_path($artefact->get('title')), 'description' => $artefact->get('description'), 'size' => $size, 'date' => strftime(get_string('strftimedaydatetime'), $artefact->get('ctime')));
     }
     return $data;
 }
Esempio n. 6
0
 /**
  * Generates a path, relative to the root of the export, that the given
  * file will appear in the export.
  *
  * If the file is a thumbnail, the copy proxy is informed about it so that
  * the image can later be copied in to place.
  *
  * @param ArtefactTypeFileBase $file The file to get the exported path for
  * @param array $options             Options from the URL that was linking
  *                                   to the image - most importantly, size
  *                                   related options about how the image
  *                                   was thumbnailed, if it was.
  * @param string $basefolder         What folder in the export to dump the
  *                                   file in
  * @return string                    The relative path to where the file
  *                                   will be placed
  */
 private function get_export_path_for_file(ArtefactTypeFileBase $file, array $options, $basefolder = null)
 {
     if (is_null($basefolder)) {
         if ($file->get('owner') == $this->owner) {
             $basefolder = '/files/file/' . $this->get_folder_path_for_file($file);
         } else {
             $basefolder = '/files/extra/';
         }
     }
     unset($options['view']);
     $prefix = '';
     $title = PluginExportHtml::sanitise_path($file->get('title'));
     if ($options) {
         list($size, $prefix) = $this->get_size_from_options($options);
         $from = $file->get_path($size);
         $to = $basefolder . $file->get('id') . '-' . $prefix . $title;
         $this->htmlexportcopyproxy->add($from, $to);
     } else {
         if ($basefolder == '/files/extra/') {
             $title = $file->get('id') . '-' . $title;
         }
         $to = $basefolder . $title;
     }
     return $this->basepath . $to;
 }
Esempio n. 7
0
 /**
  * Generates a path, relative to the root of the export, that the given 
  * file will appear in the export.
  *
  * If the file is a thumbnail, the copy proxy is informed about it so that 
  * the image can later be copied in to place.
  *
  * @param ArtefactTypeFileBase $file The file to get the exported path for
  * @param array $options             Options from the URL that was linking 
  *                                   to the image - most importantly, size 
  *                                   related options about how the image 
  *                                   was thumbnailed, if it was.
  * @param string $basefolder         What folder in the export to dump the 
  *                                   file in
  * @return string                    The relative path to where the file 
  *                                   will be placed
  */
 private function get_export_path_for_file(ArtefactTypeFileBase $file, array $options, $basefolder)
 {
     unset($options['view']);
     $prefix = '';
     if ($options) {
         list($size, $prefix) = $this->get_size_from_options($options);
         $from = $file->get_path($size);
         $to = $basefolder . $file->get('id') . '-' . $prefix . PluginExportHtml::sanitise_path($file->get('title'));
         $this->htmlexportcopyproxy->add($from, $to);
     } else {
         $to = $basefolder . PluginExportHtml::sanitise_path($file->get('title'));
     }
     return $this->basepath . $to;
 }