ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Notes\Export\NotesHtmlExport Class Reference

This exports the whole. More...

+ Collaboration diagram for ILIAS\Notes\Export\NotesHtmlExport:

Public Member Functions

 __construct (int $type, int $user_id, array $author_ids)
 
 exportHTML ($page_content)
 Export HTML. More...
 
 zipPackage ()
 
 exportPage (string $content)
 Export page. More...
 

Protected Member Functions

 initDirectories ()
 
 exportUserImages ()
 
 getInitialisedTemplate ()
 Get initialised template. More...
 
 writeExportFile (string $a_file, \ilGlobalPageTemplate $a_tpl, string $a_content)
 Write HTML to file. More...
 

Protected Attributes

ilLanguage $lng
 
int $user_id
 
int $type
 
array $author_ids
 
string $export_dir
 
string $sub_dir
 
string $target_dir
 
ILIAS GlobalScreen Services $global_screen
 
ILIAS components Export HTML Util $export_util
 

Static Protected Attributes

static $export_key_set = false
 

Detailed Description

This exports the whole.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 29 of file class.NotesHtmlExport.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Notes\Export\NotesHtmlExport::__construct ( int  $type,
int  $user_id,
array  $author_ids 
)

Definition at line 45 of file class.NotesHtmlExport.php.

49 {
50 global $DIC;
51
52 $this->type = $type;
53 $this->author_ids = $author_ids;
54 $this->user_id = $user_id;
55 $this->lng = $DIC->language();
56
57 \ilExport::_createExportDirectory($user_id, "html_notes", "usr");
58 $exp_dir = \ilExport::_getExportDirectory($user_id, "html_notes", "usr");
59 $sub_dir = "user_notes";
60
61 $this->export_dir = $exp_dir;
62 $this->sub_dir = $sub_dir;
63 $this->target_dir = $exp_dir . "/" . $sub_dir;
64
65 $this->global_screen = $DIC->globalScreen();
66 $this->export_util = new \ILIAS\components\Export\HTML\Util($exp_dir, $sub_dir);
67 if (!self::$export_key_set) {
68 self::$export_key_set = true;
69 $this->global_screen->tool()->context()->current()->addAdditionalData(
71 true
72 );
73 }
74 }
static _createExportDirectory(int $a_obj_id, string $a_export_type="xml", string $a_obj_type="")
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
@depricated Get export directory for an repository object
global $DIC
Definition: shib_login.php:26

References ILIAS\Notes\Export\NotesHtmlExport\$author_ids, $DIC, ILIAS\Notes\Export\NotesHtmlExport\$sub_dir, ILIAS\Notes\Export\NotesHtmlExport\$type, ILIAS\Notes\Export\NotesHtmlExport\$user_id, ilExport\_createExportDirectory(), ilExport\_getExportDirectory(), ilHTMLExportViewLayoutProvider\HTML_EXPORT_RENDERING, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ exportHTML()

ILIAS\Notes\Export\NotesHtmlExport::exportHTML (   $page_content)

Export HTML.

Exceptions

ILIAS\UI\NotImplementedException

Exceptions

ilTemplateException

Definition at line 88 of file class.NotesHtmlExport.php.

88 : void
89 {
90 $this->initDirectories();
91 $this->export_util->exportSystemStyle();
92
93 $this->exportPage($page_content);
94
95 // export comments user images
96 $this->exportUserImages();
97 $zip = $this->zipPackage();
98 \ilFileDelivery::deliverFileLegacy($zip, "user_notes.zip");
99 }
exportPage(string $content)
Export page.
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)

References ilFileDelivery\deliverFileLegacy(), ILIAS\Notes\Export\NotesHtmlExport\exportPage(), ILIAS\Notes\Export\NotesHtmlExport\exportUserImages(), ILIAS\Notes\Export\NotesHtmlExport\initDirectories(), and ILIAS\Notes\Export\NotesHtmlExport\zipPackage().

+ Here is the call graph for this function:

◆ exportPage()

ILIAS\Notes\Export\NotesHtmlExport::exportPage ( string  $content)

Export page.

Exceptions

ILIAS\UI\NotImplementedException

Exceptions

ilTemplateException

Definition at line 121 of file class.NotesHtmlExport.php.

123 : void {
124 $tpl = $this->getInitialisedTemplate();
125
126 $tpl->setTitle(($this->type === Note::PRIVATE)
127 ? $this->lng->txt("notes")
128 : $this->lng->txt("notes_comments"));
129
130 $this->writeExportFile("index.html", $tpl, $content);
131 }
writeExportFile(string $a_file, \ilGlobalPageTemplate $a_tpl, string $a_content)
Write HTML to file.
getInitialisedTemplate()
Get initialised template.

Referenced by ILIAS\Notes\Export\NotesHtmlExport\exportHTML().

+ Here is the caller graph for this function:

◆ exportUserImages()

ILIAS\Notes\Export\NotesHtmlExport::exportUserImages ( )
protected

Definition at line 101 of file class.NotesHtmlExport.php.

101 : void
102 {
103 $user_export = new \ILIAS\Notes\Export\UserImageExporter();
104 $user_export->exportUserImages($this->target_dir, $this->author_ids);
105 }

Referenced by ILIAS\Notes\Export\NotesHtmlExport\exportHTML().

+ Here is the caller graph for this function:

◆ getInitialisedTemplate()

ILIAS\Notes\Export\NotesHtmlExport::getInitialisedTemplate ( )
protected

Get initialised template.

Definition at line 136 of file class.NotesHtmlExport.php.

137 {
138 global $DIC;
139
140 $this->global_screen->layout()->meta()->reset();
141
142 $location_stylesheet = \ilUtil::getStyleSheetLocation();
143 $this->global_screen->layout()->meta()->addCss($location_stylesheet);
144
145 $tabs = $DIC->tabs();
146 $tabs->clearTargets();
147 $tabs->clearSubTabs();
148
149 $toolbar = $DIC->toolbar();
150 $toolbar->setItems([]);
151
152 return new \ilGlobalPageTemplate($DIC->globalScreen(), $DIC->ui(), $DIC->http());
153 }
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user

References $DIC, and ilUtil\getStyleSheetLocation().

+ Here is the call graph for this function:

◆ initDirectories()

ILIAS\Notes\Export\NotesHtmlExport::initDirectories ( )
protected

Definition at line 76 of file class.NotesHtmlExport.php.

76 : void
77 {
78 // initialize temporary target directory
79 ilFileUtils::delDir($this->target_dir);
80 ilFileUtils::makeDir($this->target_dir);
81 }
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively

References ilFileUtils\delDir(), and ilFileUtils\makeDir().

Referenced by ILIAS\Notes\Export\NotesHtmlExport\exportHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeExportFile()

ILIAS\Notes\Export\NotesHtmlExport::writeExportFile ( string  $a_file,
\ilGlobalPageTemplate  $a_tpl,
string  $a_content 
)
protected

Write HTML to file.

Definition at line 159 of file class.NotesHtmlExport.php.

163 : string {
164 $file = $this->target_dir . "/" . $a_file;
165 if (is_file($file)) {
166 return "";
167 }
168 $a_tpl->setContent($a_content);
169 $content = $a_tpl->printToString();
170
171 // open file
172 file_put_contents($file, $content);
173 return $file;
174 }

◆ zipPackage()

ILIAS\Notes\Export\NotesHtmlExport::zipPackage ( )

Definition at line 107 of file class.NotesHtmlExport.php.

107 : string
108 {
109 $zip_file = \ilExport::_getExportDirectory($this->user_id, "html_notes", "usr") .
110 "/user_notes.zip";
111 ilFileUtils::zip($this->target_dir, $zip_file);
112 ilFileUtils::delDir($this->target_dir);
113 return $zip_file;
114 }
static zip(string $a_dir, string $a_file, bool $compress_content=false)

References ilExport\_getExportDirectory(), ilFileUtils\delDir(), and ilFileUtils\zip().

Referenced by ILIAS\Notes\Export\NotesHtmlExport\exportHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $author_ids

array ILIAS\Notes\Export\NotesHtmlExport::$author_ids
protected

◆ $export_dir

string ILIAS\Notes\Export\NotesHtmlExport::$export_dir
protected

Definition at line 39 of file class.NotesHtmlExport.php.

◆ $export_key_set

ILIAS\Notes\Export\NotesHtmlExport::$export_key_set = false
staticprotected

Definition at line 31 of file class.NotesHtmlExport.php.

◆ $export_util

ILIAS components Export HTML Util ILIAS\Notes\Export\NotesHtmlExport::$export_util
protected

Definition at line 43 of file class.NotesHtmlExport.php.

◆ $global_screen

ILIAS GlobalScreen Services ILIAS\Notes\Export\NotesHtmlExport::$global_screen
protected

Definition at line 42 of file class.NotesHtmlExport.php.

◆ $lng

ilLanguage ILIAS\Notes\Export\NotesHtmlExport::$lng
protected

Definition at line 32 of file class.NotesHtmlExport.php.

◆ $sub_dir

string ILIAS\Notes\Export\NotesHtmlExport::$sub_dir
protected

◆ $target_dir

string ILIAS\Notes\Export\NotesHtmlExport::$target_dir
protected

Definition at line 41 of file class.NotesHtmlExport.php.

◆ $type

int ILIAS\Notes\Export\NotesHtmlExport::$type
protected

◆ $user_id

int ILIAS\Notes\Export\NotesHtmlExport::$user_id
protected

The documentation for this class was generated from the following file: