4 require_once
'Modules/Forum/classes/class.ilForumProperties.php';
5 require_once
'Services/RTE/classes/class.ilRTE.php';
6 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
7 require_once
'Modules/Forum/classes/class.ilForum.php';
40 $this->frm = $forum->Forum;
41 $this->frm->setForumId($forum->getId());
42 $this->frm->setForumRefId($forum->getRefId());
45 $lng->loadLanguageModule(
'forum');
47 $this->is_moderator = $ilAccess->checkAccess(
'moderate_frm',
'', $_GET[
'ref_id']);
55 $next_class = $this->ctrl->getNextClass($this);
56 $cmd = $this->ctrl->getCmd();
69 public function printThread()
77 global
$tpl,
$lng, $ilAccess, $ilias;
79 if(!$ilAccess->checkAccess(
'read,visible',
'',
$_GET[
'ref_id']))
81 $ilias->raiseError($lng->txt(
'permission_denied'), $ilias->error_obj->MESSAGE);
86 $tpl =
new ilTemplate(
'tpl.forums_export_print.html',
true,
true,
'Modules/Forum');
88 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
90 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
93 $this->frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array((
int)
$_GET[
'thr_top_fk']));
94 if(is_array($frmData = $this->frm->getOneTopic()))
96 $topic =
new ilForumTopic(addslashes($_GET[
'print_thread']), $this->is_moderator);
98 $topic->setOrderField(
'frm_posts_tree.rgt');
99 $first_post = $topic->getFirstPostNode();
100 $post_collection = $topic->getPostTree($first_post);
101 $num_posts = count($post_collection);
103 $tpl->setVariable(
'TITLE', $topic->getSubject());
106 $lng->txt(
'forum') .
': ' . $frmData[
'top_name'] .
' > ' .
107 $lng->txt(
'forums_thread') .
': ' . $topic->getSubject() .
' > ' .
108 $lng->txt(
'forums_count_art') .
': ' . $num_posts);
111 foreach($post_collection as $post)
113 $this->renderPostHtml($tpl, $post, $z++, self::MODE_EXPORT_WEB);
122 public function printPost()
130 global
$tpl,
$lng, $ilAccess, $ilias;
132 if(!$ilAccess->checkAccess(
'read,visible',
'', $_GET[
'ref_id']))
134 $ilias->raiseError($lng->txt(
'permission_denied'), $ilias->error_obj->MESSAGE);
139 $tpl =
new ilTemplate(
'tpl.forums_export_print.html',
true,
true,
'Modules/Forum');
141 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
143 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
146 $this->frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array((
int)$_GET[
'top_pk']));
147 if(is_array($frmData = $this->frm->getOneTopic()))
149 $post =
new ilForumPost((
int)$_GET[
'print_post'], $this->is_moderator);
151 $tpl->setVariable(
'TITLE', $post->getThread()->getSubject());
152 $tpl->setVariable(
'HEADLINE', $lng->txt(
'forum').
': '.$frmData[
'top_name'].
' > '. $lng->txt(
'forums_thread').
': '.$post->getThread()->getSubject());
154 $this->renderPostHtml($tpl, $post, 0, self::MODE_EXPORT_WEB);
162 public function exportHTML()
170 global
$lng,
$tpl, $ilAccess, $ilias;
172 if(!$ilAccess->checkAccess(
'read,visible',
'', $_GET[
'ref_id']))
174 $ilias->raiseError($lng->txt(
'permission_denied'), $ilias->error_obj->MESSAGE);
179 $tpl =
new ilTemplate(
'tpl.forums_export_html.html',
true,
true,
'Modules/Forum');
181 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
182 $tpl->setVariable(
'BASE', (substr(ILIAS_HTTP_PATH, -1) ==
'/' ? ILIAS_HTTP_PATH : ILIAS_HTTP_PATH .
'/'));
184 $num_threads = count((array)
$_POST[
'thread_ids']);
185 for($j = 0; $j < $num_threads; $j++)
189 $this->frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topic->getForumId()));
190 if(is_array($thread_data = $this->frm->getOneTopic()))
194 $tpl->setVariable(
'TITLE', $thread_data[
'top_name']);
197 $first_post = $topic->getFirstPostNode();
198 $topic->setOrderField(
'frm_posts_tree.rgt');
199 $post_collection = $topic->getPostTree($first_post);
202 foreach($post_collection as $post)
204 $this->renderPostHtml($tpl, $post, $z++, self::MODE_EXPORT_CLIENT);
207 $tpl->setCurrentBlock(
'thread_headline');
208 $tpl->setVariable(
'T_TITLE', $topic->getSubject());
209 if($this->is_moderator)
211 $tpl->setVariable(
'T_NUM_POSTS', $topic->countPosts());
215 $tpl->setVariable(
'T_NUM_POSTS', $topic->countActivePosts());
217 $tpl->setVariable(
'T_NUM_VISITS', $topic->getVisits());
218 $tpl->setVariable(
'T_FORUM', $thread_data[
'top_name']);
221 $topic->getUserAlias(),
222 $topic->getImportName()
224 $tpl->setVariable(
'T_AUTHOR', $authorinfo->getAuthorName());
225 $tpl->setVariable(
'T_TXT_FORUM', $lng->txt(
'forum') .
': ');
226 $tpl->setVariable(
'T_TXT_TOPIC', $lng->txt(
'forums_thread') .
': ');
227 $tpl->setVariable(
'T_TXT_AUTHOR', $lng->txt(
'forums_thread_create_from') .
': ');
228 $tpl->setVariable(
'T_TXT_NUM_POSTS', $lng->txt(
'forums_articles') .
': ');
229 $tpl->setVariable(
'T_TXT_NUM_VISITS', $lng->txt(
'visits') .
': ');
230 $tpl->parseCurrentBlock();
233 $tpl->setCurrentBlock(
'thread_block');
234 $tpl->parseCurrentBlock();
237 ilUtil::deliverData($tpl->get(
'DEFAULT',
false,
false,
false,
true,
false,
false),
'forum_html_export_' . $_GET[
'ref_id'] .
'.html');
254 global
$lng, $rbacreview,
$ilUser, $ilObjDataCache;
263 $rowCol =
'ilHighlighted';
281 $tpl->
setVariable(
'TXT_CENSORSHIP_ADVICE', $lng->txt(
'post_censored_comment_by_moderator'));
283 $rowCol =
'tblrowmarked';
291 $tpl->
setVariable(
'POST_NOT_ACTIVATED_YET', $lng->txt(
'frm_post_not_activated_yet'));
300 $tpl->
setVariable(
'AUTHOR', $authorinfo->getAuthorShortName());
301 if($authorinfo->getAuthorName(
true))
303 $tpl->
setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
306 if(self::MODE_EXPORT_CLIENT == $mode )
308 if($authorinfo->getAuthor()->getPref(
'public_profile') !=
'n')
310 $tpl->
setVariable(
'TXT_REGISTERED', $lng->txt(
'registered_since'));
311 $tpl->
setVariable(
'REGISTERED_SINCE', $this->frm->convertDate($authorinfo->getAuthor()->getCreateDate()));
316 if($this->is_moderator)
318 $num_posts = $this->frm->countUserArticles($post->
getUserId());
322 $num_posts = $this->frm->countActiveUserArticles($post->
getUserId());
324 $tpl->
setVariable(
'TXT_NUM_POSTS', $lng->txt(
'forums_posts'));
329 $tpl->
setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
330 if($authorinfo->getAuthor()->getId() &&
ilForum::_isModerator((
int)$_GET[
'ref_id'], $authorinfo->getAuthor()->getId()))
332 if($authorinfo->getAuthor()->getGender() ==
'f')
334 $tpl->
setVariable(
'ROLE', $lng->txt(
'frm_moderator_f'));
336 else if($authorinfo->getAuthor()->getGender() ==
'm')
338 $tpl->
setVariable(
'ROLE', $lng->txt(
'frm_moderator_m'));
348 $posMod = $this->frm->getModeratorFromPost($post->
getId());
350 if(is_array($posMod) && $posMod[
'top_mods'] > 0)
352 $MODS = $rbacreview->assignedUsers($posMod[
'top_mods']);
356 $spanClass =
'moderator_small';
362 if($spanClass ==
'') $spanClass =
'small';
364 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
371 $tpl->
setVariable(
'POST_UPDATE_TXT', $lng->txt(
'edited_on') .
': ' . $this->frm->convertDate($post->
getChangeDate()) .
' - ' . strtolower($lng->txt(
'by')));
372 $tpl->
setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
373 if($authorinfo->getAuthorName(
true))
375 $tpl->
setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
387 $modAuthor = $this->frm->getModeratorFromPost($post->
getId());
391 if(is_array($modAuthor) && $modAuthor[
'top_mods'] > 0)
393 $MODS = $rbacreview->assignedUsers($modAuthor[
'top_mods']);
394 if(is_array($MODS) && in_array($post->
getUserId(), $MODS))
396 $spanClass =
'moderator';