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');
99 $style = $this->content_style_domain->styleForObjId((
int) $row->obj_id);
100 if ($style->getEffectiveStyleId() > 0) {
101 $attributes[
'Style'] = $style->getEffectiveStyleId();
106 $this->
xmlElement(
'Id',
null, (
int) $row->top_pk);
107 $this->
xmlElement(
'ObjId',
null, (
int) $row->obj_id);
108 $this->
xmlElement(
'Title',
null, $row->title);
109 $this->
xmlElement(
'Description',
null, $row->description);
110 $this->
xmlElement(
'DefaultView',
null, (
int) $row->default_view);
111 $this->
xmlElement(
'Pseudonyms',
null, (
int) $row->anonymized);
112 $this->
xmlElement(
'Statistics',
null, (
int) $row->statistics_enabled);
113 $this->
xmlElement(
'ThreadRatings',
null, (
int) $row->thread_rating);
114 $this->
xmlElement(
'MarkModeratorPosts',
null, (
int) $row->mark_mod_posts);
115 $this->
xmlElement(
'PostingActivation',
null, (
int) $row->post_activation);
116 $this->
xmlElement(
'PresetSubject',
null, (
int) $row->preset_subject);
117 $this->
xmlElement(
'PresetRe',
null, (
int) $row->add_re_subject);
118 $this->
xmlElement(
'NotificationType',
null, $row->notification_type);
119 $this->
xmlElement(
'NotificationEvents',
null, (
int) $row->interested_events);
120 $this->
xmlElement(
'ForceNotification',
null, (
int) $row->admin_force_noti);
121 $this->
xmlElement(
'ToggleNotification',
null, (
int) $row->user_toggle_noti);
122 $this->
xmlElement(
'LastPost',
null, $row->top_last_post);
123 $this->
xmlElement(
'Moderator',
null, (
int) $row->top_mods);
124 $this->
xmlElement(
'CreateDate',
null, $row->top_date);
125 $this->
xmlElement(
'UpdateDate',
null, $row->top_update);
126 $this->
xmlElement(
'FileUpload',
null, (
int) $row->file_upload_allowed);
127 $this->
xmlElement(
'UpdateUserId',
null, $row->update_user);
128 $this->
xmlElement(
'UserId',
null, (
int) $row->top_usr_id);
130 $query_thr =
'SELECT frm_threads.* ' .
131 ' FROM frm_threads ' .
132 ' INNER JOIN frm_data ON top_pk = thr_top_fk ' .
133 'WHERE top_frm_fk = ' .
$ilDB->quote($this->forum_id,
'integer');
137 while ($row =
$ilDB->fetchObject(
$res)) {
140 $this->
xmlElement(
'Id',
null, (
int) $row->thr_pk);
141 $this->
xmlElement(
'Subject',
null, $row->thr_subject);
142 $this->
xmlElement(
'UserId',
null, (
int) $row->thr_display_user_id);
143 $this->
xmlElement(
'AuthorId',
null, (
int) $row->thr_author_id);
144 $this->
xmlElement(
'Alias',
null, $row->thr_usr_alias);
145 $this->
xmlElement(
'LastPost',
null, $row->thr_last_post);
146 $this->
xmlElement(
'CreateDate',
null, $row->thr_date);
147 $this->
xmlElement(
'UpdateDate',
null, $row->thr_date);
148 $this->
xmlElement(
'ImportName',
null, $row->import_name);
149 $this->
xmlElement(
'Sticky',
null, (
int) $row->is_sticky);
150 $this->
xmlElement(
'Closed',
null, (
int) $row->is_closed);
152 $query =
'SELECT frm_posts.*, frm_posts_tree.*
155 ON top_pk = pos_top_fk
156 INNER JOIN frm_posts_tree
158 WHERE pos_thr_fk = ' .
$ilDB->quote($row->thr_pk,
'integer') .
' ';
159 $query .=
' ORDER BY frm_posts_tree.lft ASC';
160 $resPosts =
$ilDB->query($query);
162 while ($rowPost =
$ilDB->fetchObject($resPosts)) {
164 $this->
xmlElement(
'Id',
null, (
int) $rowPost->pos_pk);
165 $this->
xmlElement(
'UserId',
null, (
int) $rowPost->pos_display_user_id);
166 $this->
xmlElement(
'AuthorId',
null, (
int) $rowPost->pos_author_id);
167 $this->
xmlElement(
'Alias',
null, $rowPost->pos_usr_alias);
168 $this->
xmlElement(
'Subject',
null, $rowPost->pos_subject);
169 $this->
xmlElement(
'CreateDate',
null, $rowPost->pos_date);
170 $this->
xmlElement(
'UpdateDate',
null, $rowPost->pos_update);
171 $this->
xmlElement(
'UpdateUserId',
null, (
int) $rowPost->update_user);
172 $this->
xmlElement(
'Censorship',
null, (
int) $rowPost->pos_cens);
173 $this->
xmlElement(
'CensorshipMessage',
null, $rowPost->pos_cens_com);
174 $this->
xmlElement(
'Notification',
null, $rowPost->notify);
175 $this->
xmlElement(
'ImportName',
null, $rowPost->import_name);
176 $this->
xmlElement(
'Status',
null, (
int) $rowPost->pos_status);
179 if ($rowPost->is_author_moderator ===
null) {
180 $is_moderator_string =
'NULL';
182 $is_moderator_string = (string) $rowPost->is_author_moderator;
185 $this->
xmlElement(
'isAuthorModerator',
null, $is_moderator_string);
187 $media_exists =
false;
189 foreach ($mobs as $mob) {
190 $moblabel =
'il_' .
IL_INST_ID .
'_mob_' . $mob;
192 if (!$media_exists) {
194 $media_exists =
true;
199 'label' => $moblabel,
200 'uri' => $this->relative_component_path .
'/' . self::LEGACY_RESOURCE_SUB_DIRECTORY .
'/objects/' .
'il_' .
IL_INST_ID .
'_mob_' . $mob .
'/' . $mob_obj->getTitle()
203 $this->
xmlElement(
'MediaObject', $imgattrs,
null);
204 $mob_obj->exportFiles($this->
getComponentPath() .
'/' . self::LEGACY_RESOURCE_SUB_DIRECTORY);
211 $this->
xmlElement(
'Lft',
null, (
int) $rowPost->lft);
212 $this->
xmlElement(
'Rgt',
null, (
int) $rowPost->rgt);
213 $this->
xmlElement(
'Depth',
null, (
int) $rowPost->depth);
214 $this->
xmlElement(
'ParentId',
null, (
int) $rowPost->parent_pos);
217 (
int) $this->forum_id,
218 (
int) $rowPost->pos_pk
221 foreach ($tmp_file_obj->getFilesOfPost() as $file) {
223 copy($file[
'path'], $this->
getComponentPath() .
'/' . self::LEGACY_RESOURCE_SUB_DIRECTORY .
'/' . basename($file[
'name']));
224 $relative_path = $this->relative_component_path .
'/' . self::LEGACY_RESOURCE_SUB_DIRECTORY .
'/' . basename($file[
'name']);
225 $this->
xmlElement(
'Content',
null, $relative_path);
242 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