Пример #1
0
 /**
  * constructor.  overrides the parent class
  * to set up smarty and the attachment directory
  */
 public function __construct(User $user, $views, $artefacts, $progresscallback = null)
 {
     global $THEME;
     parent::__construct($user, $views, $artefacts, $progresscallback);
     $this->rootdir = 'portfolio-for-' . self::text_to_filename($user->get('username'));
     // Create basic required directories
     foreach (array('files', 'views', 'static', 'static/smilies', 'static/profileicons') as $directory) {
         $directory = "{$this->exportdir}/{$this->rootdir}/{$directory}/";
         if (!check_dir_exists($directory)) {
             throw new SystemException("Couldn't create the temporary export directory {$directory}");
         }
     }
     $this->zipfile = 'mahara-export-html-user' . $this->get('user')->get('id') . '-' . $this->exporttime . '.zip';
     // Find what stylesheets need to be included
     $themedirs = $THEME->get_path('', true, 'export/html');
     $stylesheets = array('style.css', 'jquery.rating.css');
     foreach ($themedirs as $theme => $themedir) {
         foreach ($stylesheets as $stylesheet) {
             if (is_readable($themedir . 'style/' . $stylesheet)) {
                 array_unshift($this->stylesheets[''], 'theme/' . $theme . '/style/' . $stylesheet);
             }
         }
     }
     // Don't export the dashboard
     foreach (array_keys($this->views) as $i) {
         if ($this->views[$i]->get('type') == 'dashboard') {
             unset($this->views[$i]);
         }
     }
     $this->exportingoneview = $this->viewexportmode == PluginExport::EXPORT_LIST_OF_VIEWS && $this->artefactexportmode == PluginExport::EXPORT_ARTEFACTS_FOR_VIEWS && count($this->views) == 1;
     $this->notify_progress_callback(15, get_string('setupcomplete', 'export'));
 }
Пример #2
0
 /**
  * constructor.  overrides the parent class
  * to set up smarty and the attachment directory
  */
 public function __construct(User $user, $views, $artefacts, $progresshandler = null)
 {
     parent::__construct($user, $views, $artefacts, $progresshandler);
     $this->smarty = smarty_core();
     if (!check_dir_exists($this->exportdir . '/' . $this->filedir)) {
         throw new SystemException("Couldn't create the temporary export directory {$this->exportdir}");
     }
     $this->zipfile = 'mahara-export-leap-user' . $this->get('user')->get('id') . '-' . $this->exporttime . '.zip';
     // some plugins might want to do their own special thing
     foreach (plugins_installed('artefact', true) as $plugin) {
         $plugin = $plugin->name;
         if (safe_require('export', 'leap/' . $plugin, 'lib.php', 'require_once', true)) {
             $classname = 'LeapExport' . ucfirst($plugin);
             if (class_exists($classname) && call_static_method($classname, 'override_entire_export')) {
                 $this->specialcases[$plugin] = array();
             }
         }
     }
     $outputfilter = LeapExportOutputFilter::singleton();
     $outputfilter->set_artefactids(array_keys($this->artefacts));
     $this->notify_progress_callback(5, get_string('setupcomplete', 'export'));
 }