19declare(strict_types=1);
50 $this->content_style_domain =
$DIC
57 $this->forum_id =
$id;
62 $path = str_replace(
'\\',
'/', $a_rel);
63 $segments = explode(
'/',
$path);
64 array_shift($segments);
65 $a_rel = implode(
'/', $segments);
67 $this->relative_component_path = $a_rel;
68 $this->absolute_root_export_path = rtrim($a_abs,
'/');
89 ON top_frm_fk = od.obj_id
90 LEFT JOIN frm_settings fs
91 ON fs.obj_id = od.obj_id
92 WHERE od.obj_id = ' .
$ilDB->quote($this->forum_id,
'integer');
97 $style = $this->content_style_domain->styleForObjId((
int) $row->obj_id);
99 'Style' => $style->getStyleId()
104 $this->
xmlElement(
'Id',
null, (
int) $row->top_pk);
105 $this->
xmlElement(
'ObjId',
null, (
int) $row->obj_id);
106 $this->
xmlElement(
'Title',
null, $row->title);
107 $this->
xmlElement(
'Description',
null, $row->description);
108 $this->
xmlElement(
'DefaultView',
null, (
int) $row->default_view);
109 $this->
xmlElement(
'Pseudonyms',
null, (
int) $row->anonymized);
110 $this->
xmlElement(
'Statistics',
null, (
int) $row->statistics_enabled);
111 $this->
xmlElement(
'ThreadRatings',
null, (
int) $row->thread_rating);
112 $this->
xmlElement(
'MarkModeratorPosts',
null, (
int) $row->mark_mod_posts);
113 $this->
xmlElement(
'PostingActivation',
null, (
int) $row->post_activation);
114 $this->
xmlElement(
'PresetSubject',
null, (
int) $row->preset_subject);
115 $this->
xmlElement(
'PresetRe',
null, (
int) $row->add_re_subject);
116 $this->
xmlElement(
'NotificationType',
null, $row->notification_type);
117 $this->
xmlElement(
'NotificationEvents',
null, (
int) $row->interested_events);
118 $this->
xmlElement(
'ForceNotification',
null, (
int) $row->admin_force_noti);
119 $this->
xmlElement(
'ToggleNotification',
null, (
int) $row->user_toggle_noti);
120 $this->
xmlElement(
'LastPost',
null, $row->top_last_post);
121 $this->
xmlElement(
'Moderator',
null, (
int) $row->top_mods);
122 $this->
xmlElement(
'CreateDate',
null, $row->top_date);
123 $this->
xmlElement(
'UpdateDate',
null, $row->top_update);
124 $this->
xmlElement(
'FileUpload',
null, (
int) $row->file_upload_allowed);
125 $this->
xmlElement(
'UpdateUserId',
null, $row->update_user);
126 $this->
xmlElement(
'UserId',
null, (
int) $row->top_usr_id);
128 $query_thr =
'SELECT frm_threads.* ' .
129 ' FROM frm_threads ' .
130 ' INNER JOIN frm_data ON top_pk = thr_top_fk ' .
131 'WHERE top_frm_fk = ' .
$ilDB->quote($this->forum_id,
'integer');
135 while ($row =
$ilDB->fetchObject(
$res)) {
138 $this->
xmlElement(
'Id',
null, (
int) $row->thr_pk);
139 $this->
xmlElement(
'Subject',
null, $row->thr_subject);
140 $this->
xmlElement(
'UserId',
null, (
int) $row->thr_display_user_id);
141 $this->
xmlElement(
'AuthorId',
null, (
int) $row->thr_author_id);
142 $this->
xmlElement(
'Alias',
null, $row->thr_usr_alias);
143 $this->
xmlElement(
'LastPost',
null, $row->thr_last_post);
144 $this->
xmlElement(
'CreateDate',
null, $row->thr_date);
145 $this->
xmlElement(
'UpdateDate',
null, $row->thr_date);
146 $this->
xmlElement(
'ImportName',
null, $row->import_name);
147 $this->
xmlElement(
'Sticky',
null, (
int) $row->is_sticky);
148 $this->
xmlElement(
'Closed',
null, (
int) $row->is_closed);
150 $query =
'SELECT frm_posts.*, frm_posts_tree.*
153 ON top_pk = pos_top_fk
154 INNER JOIN frm_posts_tree
156 WHERE pos_thr_fk = ' .
$ilDB->quote($row->thr_pk,
'integer') .
' ';
157 $query .=
' ORDER BY frm_posts_tree.lft ASC';
158 $resPosts =
$ilDB->query($query);
160 while ($rowPost =
$ilDB->fetchObject($resPosts)) {
162 $this->
xmlElement(
'Id',
null, (
int) $rowPost->pos_pk);
163 $this->
xmlElement(
'UserId',
null, (
int) $rowPost->pos_display_user_id);
164 $this->
xmlElement(
'AuthorId',
null, (
int) $rowPost->pos_author_id);
165 $this->
xmlElement(
'Alias',
null, $rowPost->pos_usr_alias);
166 $this->
xmlElement(
'Subject',
null, $rowPost->pos_subject);
167 $this->
xmlElement(
'CreateDate',
null, $rowPost->pos_date);
168 $this->
xmlElement(
'UpdateDate',
null, $rowPost->pos_update);
169 $this->
xmlElement(
'UpdateUserId',
null, (
int) $rowPost->update_user);
170 $this->
xmlElement(
'Censorship',
null, (
int) $rowPost->pos_cens);
171 $this->
xmlElement(
'CensorshipMessage',
null, $rowPost->pos_cens_com);
172 $this->
xmlElement(
'Notification',
null, $rowPost->notify);
173 $this->
xmlElement(
'ImportName',
null, $rowPost->import_name);
174 $this->
xmlElement(
'Status',
null, (
int) $rowPost->pos_status);
177 if ($rowPost->is_author_moderator ===
null) {
178 $is_moderator_string =
'NULL';
180 $is_moderator_string = (string) $rowPost->is_author_moderator;
183 $this->
xmlElement(
'isAuthorModerator',
null, $is_moderator_string);
185 $media_exists =
false;
187 foreach ($mobs as $mob) {
188 $moblabel =
'il_' .
IL_INST_ID .
'_mob_' . $mob;
190 if (!$media_exists) {
192 $media_exists =
true;
197 'label' => $moblabel,
198 'uri' => $this->relative_component_path .
'/' . self::LEGACY_RESOURCE_SUB_DIRECTORY .
'/objects/' .
'il_' .
IL_INST_ID .
'_mob_' . $mob .
'/' . $mob_obj->getTitle()
201 $this->
xmlElement(
'MediaObject', $imgattrs,
null);
202 $mob_obj->exportFiles($this->
getComponentPath() .
'/' . self::LEGACY_RESOURCE_SUB_DIRECTORY);
209 $this->
xmlElement(
'Lft',
null, (
int) $rowPost->lft);
210 $this->
xmlElement(
'Rgt',
null, (
int) $rowPost->rgt);
211 $this->
xmlElement(
'Depth',
null, (
int) $rowPost->depth);
212 $this->
xmlElement(
'ParentId',
null, (
int) $rowPost->parent_pos);
215 (
int) $this->forum_id,
216 (
int) $rowPost->pos_pk
219 foreach ($tmp_file_obj->getFilesOfPost() as $file) {
221 copy($file[
'path'], $this->
getComponentPath() .
'/' . self::LEGACY_RESOURCE_SUB_DIRECTORY .
'/' . basename($file[
'name']));
222 $relative_path = $this->relative_component_path .
'/' . self::LEGACY_RESOURCE_SUB_DIRECTORY .
'/' . basename($file[
'name']);
223 $this->
xmlElement(
'Content',
null, $relative_path);
240 return str_replace(
'',
'', $this->
xmlDumpMem(
false));
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
XML writer class Class to simplify manual writing of xml documents.
readonly ILIAS Style Content DomainService $content_style_domain
setFileTargetDirectories(string $a_rel, string $a_abs)
const string LEGACY_RESOURCE_SUB_DIRECTORY
__construct(string $version='1.0', string $outEnc='utf-8', string $inEnc='utf-8')
string $absolute_root_export_path
string $relative_component_path
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlDumpMem(bool $format=true)
Returns xml document from memory.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc