Пример #1
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;
 }
Пример #2
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;
 }