4require_once
'Modules/Forum/classes/class.ilForumProperties.php';
5require_once
'Services/RTE/classes/class.ilRTE.php';
6require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
7require_once
'Modules/Forum/classes/class.ilForum.php';
43 $this->lng =
$DIC->language();
44 $this->ctrl =
$DIC->ctrl();
45 $this->access =
$DIC->access();
46 $this->
error = $DIC[
'ilErr'];
48 $this->
user = $DIC->user();
49 $this->ilObjDataCache =
$DIC[
'ilObjDataCache'];
52 $this->frm = $forum->Forum;
55 $this->frm->setForumId($forum->getId());
56 $this->frm->setForumRefId($forum->getRefId());
58 $this->lng->loadLanguageModule(
'forum');
60 $this->is_moderator = $this->access->checkAccess(
'moderate_frm',
'', (
int)
$_GET[
'ref_id']);
70 if ((
int) $thread->
getForumId() !== (
int) $forumId) {
71 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
80 $next_class = $this->ctrl->getNextClass($this);
81 $cmd = $this->ctrl->getCmd();
83 switch ($next_class) {
92 if (!$this->access->checkAccess(
'read,visible',
'', (
int)
$_GET[
'ref_id'])) {
93 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
101 $tpl =
new ilTemplate(
'tpl.forums_export_print.html',
true,
true,
'Modules/Forum');
103 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
105 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
108 $this->frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array((
int)
$_GET[
'thr_top_fk']));
109 if (is_array($frmData = $this->frm->getOneTopic())) {
110 $topic =
new ilForumTopic(addslashes(
$_GET[
'print_thread']), $this->is_moderator);
113 $topic->setOrderField(
'frm_posts_tree.rgt');
114 $first_post = $topic->getFirstPostNode();
115 $post_collection = $topic->getPostTree($first_post);
116 $num_posts = count($post_collection);
118 $tpl->setVariable(
'TITLE', $topic->getSubject());
121 $this->lng->txt(
'forum') .
': ' . $frmData[
'top_name'] .
' > ' .
122 $this->lng->txt(
'forums_thread') .
': ' . $topic->getSubject() .
' > ' .
123 $this->lng->txt(
'forums_count_art') .
': ' . $num_posts
127 foreach ($post_collection as
$post) {
136 if (!$this->access->checkAccess(
'read,visible',
'',
$_GET[
'ref_id'])) {
137 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
145 $tpl =
new ilTemplate(
'tpl.forums_export_print.html',
true,
true,
'Modules/Forum');
147 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
149 require_once
'Services/jQuery/classes/class.iljQueryUtil.php';
152 $this->frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array((
int)
$_GET[
'top_pk']));
153 if (is_array($frmData = $this->frm->getOneTopic())) {
157 $tpl->setVariable(
'TITLE',
$post->getThread()->getSubject());
158 $tpl->setVariable(
'HEADLINE', $this->lng->txt(
'forum') .
': ' . $frmData[
'top_name'] .
' > ' . $this->lng->txt(
'forums_thread') .
': ' .
$post->getThread()->getSubject());
170 if (!$this->access->checkAccess(
'read,visible',
'',
$_GET[
'ref_id'])) {
171 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->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 .
'/'));
186 $postIds = (array)
$_POST[
'thread_ids'];
187 array_walk($postIds,
function ($threadId) use (&$threads, $isModerator) {
188 $thread = new \ilForumTopic($threadId, $isModerator);
191 $threads[] = $thread;
195 foreach ($threads as $topic) {
196 $this->frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topic->getForumId()));
197 if (is_array($thread_data = $this->frm->getOneTopic())) {
199 $tpl->setVariable(
'TITLE', $thread_data[
'top_name']);
202 $first_post = $topic->getFirstPostNode();
203 $topic->setOrderField(
'frm_posts_tree.rgt');
204 $post_collection = $topic->getPostTree($first_post);
207 foreach ($post_collection as
$post) {
211 $tpl->setCurrentBlock(
'thread_headline');
212 $tpl->setVariable(
'T_TITLE', $topic->getSubject());
213 if ($this->is_moderator) {
214 $tpl->setVariable(
'T_NUM_POSTS', $topic->countPosts());
216 $tpl->setVariable(
'T_NUM_POSTS', $topic->countActivePosts());
218 $tpl->setVariable(
'T_NUM_VISITS', $topic->getVisits());
219 $tpl->setVariable(
'T_FORUM', $thread_data[
'top_name']);
221 $topic->getThrAuthorId(),
222 $topic->getDisplayUserId(),
223 $topic->getUserAlias(),
224 $topic->getImportName()
226 $tpl->setVariable(
'T_AUTHOR', $authorinfo->getAuthorName());
227 $tpl->setVariable(
'T_TXT_FORUM', $this->lng->txt(
'forum') .
': ');
228 $tpl->setVariable(
'T_TXT_TOPIC', $this->lng->txt(
'forums_thread') .
': ');
229 $tpl->setVariable(
'T_TXT_AUTHOR', $this->lng->txt(
'forums_thread_create_from') .
': ');
230 $tpl->setVariable(
'T_TXT_NUM_POSTS', $this->lng->txt(
'forums_articles') .
': ');
231 $tpl->setVariable(
'T_TXT_NUM_VISITS', $this->lng->txt(
'visits') .
': ');
232 $tpl->parseCurrentBlock();
237 $tpl->setCurrentBlock(
'thread_block');
238 $tpl->parseCurrentBlock();
252 $tpl->setCurrentBlock(
'posts_row');
256 $rowCol =
'ilModeratorPosting';
257 } elseif (
$post->getIsAuthorModerator()) {
258 $rowCol =
'ilModeratorPosting';
266 $tpl->setVariable(
'ROWCOL',
' ' . $rowCol);
268 if (
$post->isCensored()) {
269 $tpl->setVariable(
'TXT_CENSORSHIP_ADVICE', $this->lng->txt(
'post_censored_comment_by_moderator'));
270 $rowCol =
'tblrowmarked';
273 $tpl->setVariable(
'ROWCOL',
' ' . $rowCol);
274 if (!
$post->isActivated() &&
$post->isOwner($this->user->getId())) {
275 $tpl->setVariable(
'POST_NOT_ACTIVATED_YET', $this->lng->txt(
'frm_post_not_activated_yet'));
279 $post->getPosAuthorId(),
280 $post->getDisplayUserId(),
281 $post->getUserAlias(),
282 $post->getImportName()
285 if ($authorinfo->hasSuffix()) {
286 $tpl->setVariable(
'AUTHOR', $authorinfo->getSuffix());
287 $tpl->setVariable(
'USR_NAME',
$post->getUserAlias());
289 $tpl->setVariable(
'AUTHOR', $authorinfo->getAuthorShortName());
290 if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized()) {
291 $tpl->setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
295 if (self::MODE_EXPORT_CLIENT == $mode) {
296 if ($authorinfo->getAuthor()->getPref(
'public_profile') !=
'n') {
297 $tpl->setVariable(
'TXT_REGISTERED', $this->lng->txt(
'registered_since'));
298 $tpl->setVariable(
'REGISTERED_SINCE', $this->frm->convertDate($authorinfo->getAuthor()->getCreateDate()));
301 if (
$post->getDisplayUserId()) {
302 if ($this->is_moderator) {
303 $num_posts = $this->frm->countUserArticles(
$post->getDisplayUserId());
305 $num_posts = $this->frm->countActiveUserArticles(
$post->getDisplayUserId());
307 $tpl->setVariable(
'TXT_NUM_POSTS', $this->lng->txt(
'forums_posts'));
308 $tpl->setVariable(
'NUM_POSTS', $num_posts);
312 $tpl->setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
314 if ($authorinfo->getAuthor()->getGender() ==
'f') {
315 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_f'));
316 } elseif ($authorinfo->getAuthor()->getGender() ==
'm') {
317 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_m'));
318 } elseif ($authorinfo->getAuthor()->getGender() ==
'n') {
319 $tpl->setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_n'));
324 if (
$post->getUpdateUserId() > 0) {
327 $spanClass =
'moderator_small';
332 require_once
'Modules/Forum/classes/class.ilForumAuthorInformation.php';
334 $post->getPosAuthorId(),
335 $post->getDisplayUserId(),
336 $post->getUserAlias(),
340 $tpl->setVariable(
'POST_UPDATE_TXT', $this->lng->txt(
'edited_on') .
': ' . $this->frm->convertDate(
$post->getChangeDate()) .
' - ' . strtolower($this->lng->txt(
'by')));
341 $tpl->setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
342 if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized()) {
343 $tpl->setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
348 $post->setMessage($this->frm->prepareText(
$post->getMessage()));
349 $tpl->setVariable(
'POST_DATE', $this->frm->convertDate(
$post->getCreateDate()));
350 $tpl->setVariable(
'SUBJECT',
$post->getSubject());
352 if (!
$post->isCensored()) {
355 $spanClass =
'moderator';
359 if (
$post->getMessage() == strip_tags(
$post->getMessage())) {
361 $post->setMessage(nl2br(
$post->getMessage()));
364 if ($spanClass !=
"") {
370 $tpl->setVariable(
'POST',
"<span class=\"moderator\">" . nl2br(
$post->getCensorshipComment()) .
"</span>");
373 $tpl->parseCurrentBlock(
'posts_row');
381 include_once
'./Services/MathJax/classes/class.ilMathJax.php';
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
static setUseRelativeDates($a_status)
set use relative dates
Forum export to HTML and Print.
ensureThreadBelongsToForum($objId, \ilForumTopic $thread)
renderPostHtml(ilTemplate $tpl, ilForumPost $post, $counter, $mode)
prepare()
Prepare the export (init MathJax rendering)
static getInstance($a_obj_id=0)
static _isModerator($a_ref_id, $a_usr_id)
checks whether a user is moderator of a given forum object
static getInstance()
Singleton: get instance.
static lookupForumIdByObjId($obj_id)
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...
special template class to simplify handling of ITX/PEAR
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
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)
inits and adds the jQuery JS-File to the global or a passed template