5 include_once
"./Services/Xml/classes/class.ilXmlWriter.php";
6 include_once
"./Modules/Forum/classes/class.ilFileDataForum.php";
7 include_once
"Services/MediaObjects/classes/class.ilObjMediaObject.php";
8 include_once
"Services/RTE/classes/class.ilRTE.php";
37 parent::__construct();
43 $this->forum_id = $id;
55 $this->target_dir_relative = $a_rel;
56 $this->target_dir_absolute = $a_abs;
65 $query_frm =
'SELECT * FROM frm_settings fs '.
66 'JOIN object_data od ON fs.obj_id = od.obj_id '.
67 'JOIN frm_data ON top_frm_fk = od.obj_id '.
68 'WHERE fs.obj_id = '.$ilDB->quote($this->forum_id,
'integer');
70 $res = $ilDB->query($query_frm);
85 $this->
xmlElement(
"Statistics", null, (
int)
$row->statistics_enabled);
86 $this->
xmlElement(
"ThreadRatings", null, (
int)
$row->thread_rating);
88 $this->
xmlElement(
"MarkModeratorPosts", null, (
int)
$row->mark_mod_posts);
89 $this->
xmlElement(
"PostingActivation", null, (
int)
$row->post_activation);
90 $this->
xmlElement(
"PresetSubject", null, (
int)
$row->preset_subject);
92 $this->
xmlElement(
"NotificationType", null,
$row->notification_type);
93 $this->
xmlElement(
"ForceNotification", null, (
int)
$row->admin_force_noti);
94 $this->
xmlElement(
"ToggleNotification", null, (
int)
$row->user_toggle_noti);
99 $this->
xmlElement(
"FileUpload", null, (
int)
$row->file_upload_allowed);
104 $query_thr =
"SELECT frm_threads.* ".
105 " FROM frm_threads ".
106 " INNER JOIN frm_data ON top_pk = thr_top_fk ".
107 'WHERE top_frm_fk = '.$ilDB->quote($this->forum_id,
'integer');
109 $res = $ilDB->query($query_thr);
111 while(
$row = $ilDB->fetchObject(
$res) )
117 $this->
xmlElement(
"UserId", null, (
int)
$row->thr_display_user_id);
127 $query =
'SELECT frm_posts.*, frm_posts_tree.* 130 ON top_pk = pos_top_fk 131 INNER JOIN frm_posts_tree 133 WHERE pos_thr_fk = '.$ilDB->quote(
$row->thr_pk,
'integer').
' ';
134 $query .=
" ORDER BY frm_posts_tree.lft ASC";
135 $resPosts = $ilDB->query(
$query);
138 while( $rowPost = $ilDB->fetchObject($resPosts) )
151 $this->
xmlElement(
"Id", null, (
int)$rowPost->pos_pk);
152 $this->
xmlElement(
"UserId", null, (
int)$rowPost->pos_display_user_id);
153 $this->
xmlElement(
"AuthorId", null, (
int)$rowPost->pos_author_id);
154 $this->
xmlElement(
"Alias", null, $rowPost->pos_usr_alias);
155 $this->
xmlElement(
"Subject", null, $rowPost->pos_subject);
156 $this->
xmlElement(
"CreateDate", null, $rowPost->pos_date);
157 $this->
xmlElement(
"UpdateDate", null, $rowPost->pos_update);
158 $this->
xmlElement(
"UpdateUserId", null, (
int)$rowPost->update_user);
159 $this->
xmlElement(
"Censorship", null, (
int)$rowPost->pos_cens);
160 $this->
xmlElement(
"CensorshipMessage", null, $rowPost->pos_cens_com);
161 $this->
xmlElement(
"Notification", null, $rowPost->notify);
162 $this->
xmlElement(
"ImportName", null, $rowPost->import_name);
163 $this->
xmlElement(
"Status", null, (
int)$rowPost->pos_status);
166 if($rowPost->is_author_moderator === NULL)
168 $is_moderator_string =
'NULL';
172 $is_moderator_string = (
string)$rowPost->is_author_moderator;
175 $this->
xmlElement(
"isAuthorModerator", null, $is_moderator_string);
177 $media_exists =
false;
179 foreach(
$mobs as $mob)
181 $moblabel =
"il_" . IL_INST_ID .
"_mob_" . $mob;
187 $media_exists =
true;
192 "label" => $moblabel,
193 "uri" => $this->target_dir_relative .
"/objects/" .
"il_" . IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle()
196 $this->
xmlElement(
"MediaObject", $imgattrs, NULL);
197 $mob_obj->exportFiles($this->target_dir_absolute);
205 $this->
xmlElement(
"Lft", null, (
int)$rowPost->lft);
206 $this->
xmlElement(
"Rgt", null, (
int)$rowPost->rgt);
207 $this->
xmlElement(
"Depth", null, (
int)$rowPost->depth);
208 $this->
xmlElement(
"ParentId", null, (
int)$rowPost->parent_pos);
211 $this->forum_id, $rowPost->pos_pk
215 if ( count($tmp_file_obj->getFilesOfPost()) )
217 foreach ($tmp_file_obj->getFilesOfPost() as
$file)
221 copy(
$file[
'path'], $this->target_dir_absolute.
"/".basename(
$file[
'path']));
222 $content = $this->target_dir_relative.
"/".basename(
$file[
'path']);
255 return str_replace(
'',
'', $this->
xmlDumpMem(
false));
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
Add rich text string
The name of the decorator.
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
xmlEndTag($tag)
Writes an endtag.
setFileTargetDirectories($a_rel, $a_abs)
Set file target directories.
Create styles array
The data for the language used.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
This class handles all operations on files for the forum object.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
xmlDumpMem($format=TRUE)
Returns xml document from memory.