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';
45 $this->frm = $forum->Forum;
48 $this->frm->setForumId($forum->getId());
49 $this->frm->setForumRefId($forum->getRefId());
53 $this->access = $ilAccess;
55 $this->lng->loadLanguageModule(
'forum');
57 $this->is_moderator = $this->access->checkAccess(
'moderate_frm',
'', (
int)$_GET[
'ref_id']);
67 if ((
int)$thread->
getForumId() !== (int)$forumId) {
68 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
77 $next_class = $this->ctrl->getNextClass($this);
78 $cmd = $this->ctrl->getCmd();
91 public function printThread()
99 global
$tpl,
$lng, $ilAccess, $ilias;
101 if(!$ilAccess->checkAccess(
'read,visible',
'',
$_GET[
'ref_id']))
103 $ilias->raiseError($lng->txt(
'permission_denied'), $ilias->error_obj->MESSAGE);
111 $tpl =
new ilTemplate(
'tpl.forums_export_print.html',
true,
true,
'Modules/Forum');
113 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
115 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
118 $this->frm->setMDB2WhereCondition(
'top_pk = %s ',
array(
'integer'),
array((
int)
$_GET[
'thr_top_fk']));
119 if(is_array($frmData = $this->frm->getOneTopic()))
121 $topic =
new ilForumTopic(addslashes($_GET[
'print_thread']), $this->is_moderator);
124 $topic->setOrderField(
'frm_posts_tree.rgt');
125 $first_post = $topic->getFirstPostNode();
126 $post_collection = $topic->getPostTree($first_post);
127 $num_posts = count($post_collection);
129 $tpl->setVariable(
'TITLE', $topic->getSubject());
132 $lng->txt(
'forum') .
': ' . $frmData[
'top_name'] .
' > ' .
133 $lng->txt(
'forums_thread') .
': ' . $topic->getSubject() .
' > ' .
134 $lng->txt(
'forums_count_art') .
': ' . $num_posts);
137 foreach($post_collection as $post)
139 $this->renderPostHtml($tpl, $post, $z++, self::MODE_EXPORT_WEB);
148 public function printPost()
156 global
$tpl,
$lng, $ilAccess, $ilias;
158 if(!$ilAccess->checkAccess(
'read,visible',
'',
$_GET[
'ref_id']))
160 $ilias->raiseError($lng->txt(
'permission_denied'), $ilias->error_obj->MESSAGE);
168 $tpl =
new ilTemplate(
'tpl.forums_export_print.html',
true,
true,
'Modules/Forum');
170 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
172 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
175 $this->frm->setMDB2WhereCondition(
'top_pk = %s ',
array(
'integer'),
array((
int)
$_GET[
'top_pk']));
176 if(is_array($frmData = $this->frm->getOneTopic()))
178 $post =
new ilForumPost((
int)$_GET[
'print_post'], $this->is_moderator);
181 $tpl->setVariable(
'TITLE', $post->getThread()->getSubject());
182 $tpl->setVariable(
'HEADLINE', $lng->txt(
'forum').
': '.$frmData[
'top_name'].
' > '. $lng->txt(
'forums_thread').
': '.$post->getThread()->getSubject());
184 $this->renderPostHtml($tpl, $post, 0, self::MODE_EXPORT_WEB);
192 public function exportHTML()
200 global
$lng,
$tpl, $ilAccess, $ilias;
202 if(!$ilAccess->checkAccess(
'read,visible',
'',
$_GET[
'ref_id']))
204 $ilias->raiseError($lng->txt(
'permission_denied'), $ilias->error_obj->MESSAGE);
212 $tpl =
new ilTemplate(
'tpl.forums_export_html.html',
true,
true,
'Modules/Forum');
214 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
215 $tpl->setVariable(
'BASE', (substr(ILIAS_HTTP_PATH, -1) ==
'/' ? ILIAS_HTTP_PATH : ILIAS_HTTP_PATH .
'/'));
220 array_walk($postIds,
function($threadId) use (&$threads, $isModerator) {
221 $thread = new \ilForumTopic($threadId, $isModerator);
224 $threads[] = $thread;
228 foreach ($threads as $topic) {
229 $this->frm->setMDB2WhereCondition(
'top_pk = %s ',
array(
'integer'),
array($topic->getForumId()));
230 if(is_array($thread_data = $this->frm->getOneTopic()))
234 $tpl->setVariable(
'TITLE', $thread_data[
'top_name']);
237 $first_post = $topic->getFirstPostNode();
238 $topic->setOrderField(
'frm_posts_tree.rgt');
239 $post_collection = $topic->getPostTree($first_post);
242 foreach($post_collection as $post)
244 $this->renderPostHtml($tpl, $post, $z++, self::MODE_EXPORT_CLIENT);
247 $tpl->setCurrentBlock(
'thread_headline');
248 $tpl->setVariable(
'T_TITLE', $topic->getSubject());
249 if($this->is_moderator)
251 $tpl->setVariable(
'T_NUM_POSTS', $topic->countPosts());
255 $tpl->setVariable(
'T_NUM_POSTS', $topic->countActivePosts());
257 $tpl->setVariable(
'T_NUM_VISITS', $topic->getVisits());
258 $tpl->setVariable(
'T_FORUM', $thread_data[
'top_name']);
260 $topic->getThrAuthorId(),
261 $topic->getDisplayUserId(),
262 $topic->getUserAlias(),
263 $topic->getImportName()
265 $tpl->setVariable(
'T_AUTHOR', $authorinfo->getAuthorName());
266 $tpl->setVariable(
'T_TXT_FORUM', $lng->txt(
'forum') .
': ');
267 $tpl->setVariable(
'T_TXT_TOPIC', $lng->txt(
'forums_thread') .
': ');
268 $tpl->setVariable(
'T_TXT_AUTHOR', $lng->txt(
'forums_thread_create_from') .
': ');
269 $tpl->setVariable(
'T_TXT_NUM_POSTS', $lng->txt(
'forums_articles') .
': ');
270 $tpl->setVariable(
'T_TXT_NUM_VISITS', $lng->txt(
'visits') .
': ');
271 $tpl->parseCurrentBlock();
276 $tpl->setCurrentBlock(
'thread_block');
277 $tpl->parseCurrentBlock();
280 ilUtil::deliverData($tpl->get(
'DEFAULT',
false,
false,
false,
true,
false,
false),
'forum_html_export_' .
$_GET[
'ref_id'] .
'.html');
297 global
$lng, $rbacreview,
$ilUser, $ilObjDataCache;
305 $rowCol =
'ilModeratorPosting';
309 $rowCol =
'ilModeratorPosting';
327 $tpl->
setVariable(
'TXT_CENSORSHIP_ADVICE', $lng->txt(
'post_censored_comment_by_moderator'));
329 $rowCol =
'tblrowmarked';
337 $tpl->
setVariable(
'POST_NOT_ACTIVATED_YET', $lng->txt(
'frm_post_not_activated_yet'));
347 if($authorinfo->hasSuffix())
349 $tpl->
setVariable(
'AUTHOR', $authorinfo->getSuffix());
354 $tpl->
setVariable(
'AUTHOR', $authorinfo->getAuthorShortName());
355 if($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() )
357 $tpl->
setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
361 if(self::MODE_EXPORT_CLIENT == $mode )
363 if($authorinfo->getAuthor()->getPref(
'public_profile') !=
'n')
365 $tpl->
setVariable(
'TXT_REGISTERED', $lng->txt(
'registered_since'));
366 $tpl->
setVariable(
'REGISTERED_SINCE', $this->frm->convertDate($authorinfo->getAuthor()->getCreateDate()));
371 if($this->is_moderator)
377 $num_posts = $this->frm->countActiveUserArticles($post->
getDisplayUserId());
379 $tpl->
setVariable(
'TXT_NUM_POSTS', $lng->txt(
'forums_posts'));
384 $tpl->
setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
387 if($authorinfo->getAuthor()->getGender() ==
'f')
389 $tpl->
setVariable(
'ROLE', $lng->txt(
'frm_moderator_f'));
391 else if($authorinfo->getAuthor()->getGender() ==
'm')
393 $tpl->
setVariable(
'ROLE', $lng->txt(
'frm_moderator_m'));
403 $posMod = $this->frm->getModeratorFromPost($post->
getId());
405 if(is_array($posMod) && $posMod[
'top_mods'] > 0)
407 $MODS = $rbacreview->assignedUsers($posMod[
'top_mods']);
411 $spanClass =
'moderator_small';
417 if($spanClass ==
'') $spanClass =
'small';
419 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
427 $tpl->
setVariable(
'POST_UPDATE_TXT', $lng->txt(
'edited_on') .
': ' . $this->frm->convertDate($post->
getChangeDate()) .
' - ' . strtolower($lng->txt(
'by')));
428 $tpl->
setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
429 if($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized())
431 $tpl->
setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
443 $modAuthor = $this->frm->getModeratorFromPost($post->
getId());
447 if(is_array($modAuthor) && $modAuthor[
'top_mods'] > 0)
449 $MODS = $rbacreview->assignedUsers($modAuthor[
'top_mods']);
452 $spanClass =
'moderator';
485 include_once
'./Services/MathJax/classes/class.ilMathJax.php';
static _isModerator($a_ref_id, $a_usr_id)
checks whether a user is moderator of a given forum object
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static lookupForumIdByObjId($obj_id)
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
static setUseRelativeDates($a_status)
set use relative dates
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...
static getInstance($a_obj_id=0)
setVariable($variable, $value='')
Sets a variable value.
Forum export to HTML and Print.
special template class to simplify handling of ITX/PEAR
Create styles array
The data for the language used.
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
static getInstance()
Singleton: get instance.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
static initjQuery($a_tpl=null)
Init jQuery.
setChangeDate($a_changedate)
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
prepare()
Prepare the export (init MathJax rendering)