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;
43 $this->frm->setForumId($forum->getId());
44 $this->frm->setForumRefId($forum->getRefId());
47 $lng->loadLanguageModule(
'forum');
49 $this->is_moderator = $ilAccess->checkAccess(
'moderate_frm',
'', $_GET[
'ref_id']);
57 $next_class = $this->ctrl->getNextClass($this);
58 $cmd = $this->ctrl->getCmd();
71 public function printThread()
79 global
$tpl,
$lng, $ilAccess, $ilias;
81 if(!$ilAccess->checkAccess(
'read,visible',
'',
$_GET[
'ref_id']))
83 $ilias->raiseError($lng->txt(
'permission_denied'), $ilias->error_obj->MESSAGE);
88 $tpl =
new ilTemplate(
'tpl.forums_export_print.html',
true,
true,
'Modules/Forum');
90 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
92 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
95 $this->frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array((
int)
$_GET[
'thr_top_fk']));
96 if(is_array($frmData = $this->frm->getOneTopic()))
98 $topic =
new ilForumTopic(addslashes($_GET[
'print_thread']), $this->is_moderator);
100 $topic->setOrderField(
'frm_posts_tree.rgt');
101 $first_post = $topic->getFirstPostNode();
102 $post_collection = $topic->getPostTree($first_post);
103 $num_posts = count($post_collection);
105 $tpl->setVariable(
'TITLE', $topic->getSubject());
108 $lng->txt(
'forum') .
': ' . $frmData[
'top_name'] .
' > ' .
109 $lng->txt(
'forums_thread') .
': ' . $topic->getSubject() .
' > ' .
110 $lng->txt(
'forums_count_art') .
': ' . $num_posts);
113 foreach($post_collection as $post)
115 $this->renderPostHtml($tpl, $post, $z++, self::MODE_EXPORT_WEB);
124 public function printPost()
132 global
$tpl,
$lng, $ilAccess, $ilias;
134 if(!$ilAccess->checkAccess(
'read,visible',
'',
$_GET[
'ref_id']))
136 $ilias->raiseError($lng->txt(
'permission_denied'), $ilias->error_obj->MESSAGE);
141 $tpl =
new ilTemplate(
'tpl.forums_export_print.html',
true,
true,
'Modules/Forum');
143 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
145 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
148 $this->frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array((
int)
$_GET[
'top_pk']));
149 if(is_array($frmData = $this->frm->getOneTopic()))
151 $post =
new ilForumPost((
int)$_GET[
'print_post'], $this->is_moderator);
153 $tpl->setVariable(
'TITLE', $post->getThread()->getSubject());
154 $tpl->setVariable(
'HEADLINE', $lng->txt(
'forum').
': '.$frmData[
'top_name'].
' > '. $lng->txt(
'forums_thread').
': '.$post->getThread()->getSubject());
156 $this->renderPostHtml($tpl, $post, 0, self::MODE_EXPORT_WEB);
164 public function exportHTML()
172 global
$lng,
$tpl, $ilAccess, $ilias;
174 if(!$ilAccess->checkAccess(
'read,visible',
'',
$_GET[
'ref_id']))
176 $ilias->raiseError($lng->txt(
'permission_denied'), $ilias->error_obj->MESSAGE);
181 $tpl =
new ilTemplate(
'tpl.forums_export_html.html',
true,
true,
'Modules/Forum');
183 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
184 $tpl->setVariable(
'BASE', (substr(ILIAS_HTTP_PATH, -1) ==
'/' ? ILIAS_HTTP_PATH : ILIAS_HTTP_PATH .
'/'));
186 $num_threads = count((array)
$_POST[
'thread_ids']);
187 for($j = 0; $j < $num_threads; $j++)
189 $topic =
new ilForumTopic((
int)$_POST[
'thread_ids'][$j], $this->is_moderator);
191 $this->frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topic->getForumId()));
192 if(is_array($thread_data = $this->frm->getOneTopic()))
196 $tpl->setVariable(
'TITLE', $thread_data[
'top_name']);
199 $first_post = $topic->getFirstPostNode();
200 $topic->setOrderField(
'frm_posts_tree.rgt');
201 $post_collection = $topic->getPostTree($first_post);
204 foreach($post_collection as $post)
206 $this->renderPostHtml($tpl, $post, $z++, self::MODE_EXPORT_CLIENT);
209 $tpl->setCurrentBlock(
'thread_headline');
210 $tpl->setVariable(
'T_TITLE', $topic->getSubject());
211 if($this->is_moderator)
213 $tpl->setVariable(
'T_NUM_POSTS', $topic->countPosts());
217 $tpl->setVariable(
'T_NUM_POSTS', $topic->countActivePosts());
219 $tpl->setVariable(
'T_NUM_VISITS', $topic->getVisits());
220 $tpl->setVariable(
'T_FORUM', $thread_data[
'top_name']);
222 $topic->getThrAuthorId(),
223 $topic->getDisplayUserId(),
224 $topic->getUserAlias(),
225 $topic->getImportName()
227 $tpl->setVariable(
'T_AUTHOR', $authorinfo->getAuthorName());
228 $tpl->setVariable(
'T_TXT_FORUM', $lng->txt(
'forum') .
': ');
229 $tpl->setVariable(
'T_TXT_TOPIC', $lng->txt(
'forums_thread') .
': ');
230 $tpl->setVariable(
'T_TXT_AUTHOR', $lng->txt(
'forums_thread_create_from') .
': ');
231 $tpl->setVariable(
'T_TXT_NUM_POSTS', $lng->txt(
'forums_articles') .
': ');
232 $tpl->setVariable(
'T_TXT_NUM_VISITS', $lng->txt(
'visits') .
': ');
233 $tpl->parseCurrentBlock();
236 $tpl->setCurrentBlock(
'thread_block');
237 $tpl->parseCurrentBlock();
240 ilUtil::deliverData($tpl->get(
'DEFAULT',
false,
false,
false,
true,
false,
false),
'forum_html_export_' .
$_GET[
'ref_id'] .
'.html');
257 global
$lng, $rbacreview,
$ilUser, $ilObjDataCache;
265 $rowCol =
'ilModeratorPosting';
269 $rowCol =
'ilModeratorPosting';
287 $tpl->
setVariable(
'TXT_CENSORSHIP_ADVICE', $lng->txt(
'post_censored_comment_by_moderator'));
289 $rowCol =
'tblrowmarked';
297 $tpl->
setVariable(
'POST_NOT_ACTIVATED_YET', $lng->txt(
'frm_post_not_activated_yet'));
307 if($authorinfo->hasSuffix())
309 $tpl->
setVariable(
'AUTHOR', $authorinfo->getSuffix());
314 $tpl->
setVariable(
'AUTHOR', $authorinfo->getAuthorShortName());
315 if($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized() )
317 $tpl->
setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
321 if(self::MODE_EXPORT_CLIENT == $mode )
323 if($authorinfo->getAuthor()->getPref(
'public_profile') !=
'n')
325 $tpl->
setVariable(
'TXT_REGISTERED', $lng->txt(
'registered_since'));
326 $tpl->
setVariable(
'REGISTERED_SINCE', $this->frm->convertDate($authorinfo->getAuthor()->getCreateDate()));
331 if($this->is_moderator)
337 $num_posts = $this->frm->countActiveUserArticles($post->
getDisplayUserId());
339 $tpl->
setVariable(
'TXT_NUM_POSTS', $lng->txt(
'forums_posts'));
344 $tpl->
setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
347 if($authorinfo->getAuthor()->getGender() ==
'f')
349 $tpl->
setVariable(
'ROLE', $lng->txt(
'frm_moderator_f'));
351 else if($authorinfo->getAuthor()->getGender() ==
'm')
353 $tpl->
setVariable(
'ROLE', $lng->txt(
'frm_moderator_m'));
363 $posMod = $this->frm->getModeratorFromPost($post->
getId());
365 if(is_array($posMod) && $posMod[
'top_mods'] > 0)
367 $MODS = $rbacreview->assignedUsers($posMod[
'top_mods']);
371 $spanClass =
'moderator_small';
377 if($spanClass ==
'') $spanClass =
'small';
379 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
387 $tpl->
setVariable(
'POST_UPDATE_TXT', $lng->txt(
'edited_on') .
': ' . $this->frm->convertDate($post->
getChangeDate()) .
' - ' . strtolower($lng->txt(
'by')));
388 $tpl->
setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
389 if($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized())
391 $tpl->
setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
403 $modAuthor = $this->frm->getModeratorFromPost($post->
getId());
407 if(is_array($modAuthor) && $modAuthor[
'top_mods'] > 0)
409 $MODS = $rbacreview->assignedUsers($modAuthor[
'top_mods']);
412 $spanClass =
'moderator';
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 getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
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
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
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...