38 $this->lng = $DIC->language();
39 $this->ctrl = $DIC->ctrl();
40 $this->access = $DIC->access();
41 $this->error = $DIC[
'ilErr'];
43 $this->
user = $DIC->user();
44 $this->ilObjDataCache = $DIC[
'ilObjDataCache'];
47 $this->frm = $forum->Forum;
50 $this->frm->setForumId($forum->getId());
51 $this->frm->setForumRefId($forum->getRefId());
53 $this->lng->loadLanguageModule(
'forum');
55 $this->is_moderator = $this->access->checkAccess(
'moderate_frm',
'', (
int) $_GET[
'ref_id']);
65 if ((
int) $thread->
getForumId() !== (int) $forumId) {
66 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
75 $next_class = $this->ctrl->getNextClass($this);
76 $cmd = $this->ctrl->getCmd();
78 switch ($next_class) {
87 if (!$this->access->checkAccess(
'read,visible',
'', (
int)
$_GET[
'ref_id'])) {
88 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
96 $tpl =
new ilTemplate(
'tpl.forums_export_print.html',
true,
true,
'Modules/Forum');
98 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
103 $this->frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array((
int) $_GET[
'thr_top_fk']));
104 if (is_array($frmData = $this->frm->getOneTopic())) {
105 $topic =
new ilForumTopic(addslashes($_GET[
'print_thread']), $this->is_moderator);
108 $topic->setOrderField(
'frm_posts_tree.rgt');
109 $first_post = $topic->getFirstPostNode();
110 $post_collection = $topic->getPostTree($first_post);
111 $num_posts = count($post_collection);
113 $tpl->setVariable(
'TITLE', $topic->getSubject());
116 $this->lng->txt(
'forum') .
': ' . $frmData[
'top_name'] .
' > ' .
117 $this->lng->txt(
'forums_thread') .
': ' . $topic->getSubject() .
' > ' .
118 $this->lng->txt(
'forums_count_art') .
': ' . $num_posts
122 foreach ($post_collection as
$post) {
131 if (!$this->access->checkAccess(
'read,visible',
'',
$_GET[
'ref_id'])) {
132 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
140 $tpl =
new ilTemplate(
'tpl.forums_export_print.html',
true,
true,
'Modules/Forum');
142 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
147 $this->frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array((
int)
$_GET[
'top_pk']));
148 if (is_array($frmData = $this->frm->getOneTopic())) {
152 $tpl->setVariable(
'TITLE',
$post->getThread()->getSubject());
153 $tpl->setVariable(
'HEADLINE', $this->lng->txt(
'forum') .
': ' . $frmData[
'top_name'] .
' > ' . $this->lng->txt(
'forums_thread') .
': ' .
$post->getThread()->getSubject());
165 if (!$this->access->checkAccess(
'read,visible',
'',
$_GET[
'ref_id'])) {
166 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
174 $tpl =
new ilTemplate(
'tpl.forums_export_html.html',
true,
true,
'Modules/Forum');
176 $tpl->setVariable(
'LOCATION_STYLESHEET', $location_stylesheet);
177 $tpl->setVariable(
'BASE', (substr(ILIAS_HTTP_PATH, -1) ==
'/' ? ILIAS_HTTP_PATH : ILIAS_HTTP_PATH .
'/'));
181 $postIds = (array)
$_POST[
'thread_ids'];
182 array_walk($postIds,
function ($threadId) use (&$threads, $isModerator) {
183 $thread = new \ilForumTopic($threadId, $isModerator);
186 $threads[] = $thread;
190 foreach ($threads as $topic) {
191 $this->frm->setMDB2WhereCondition(
'top_pk = %s ', array(
'integer'), array($topic->getForumId()));
192 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) {
206 $tpl->setCurrentBlock(
'thread_headline');
207 $tpl->setVariable(
'T_TITLE', $topic->getSubject());
208 if ($this->is_moderator) {
209 $tpl->setVariable(
'T_NUM_POSTS', $topic->countPosts(
true));
211 $tpl->setVariable(
'T_NUM_POSTS', $topic->countActivePosts(
true));
213 $tpl->setVariable(
'T_NUM_VISITS', $topic->getVisits());
214 $tpl->setVariable(
'T_FORUM', $thread_data[
'top_name']);
216 $topic->getThrAuthorId(),
217 $topic->getDisplayUserId(),
218 $topic->getUserAlias(),
219 $topic->getImportName()
221 $tpl->setVariable(
'T_AUTHOR', $authorinfo->getAuthorName());
222 $tpl->setVariable(
'T_TXT_FORUM', $this->lng->txt(
'forum') .
': ');
223 $tpl->setVariable(
'T_TXT_TOPIC', $this->lng->txt(
'forums_thread') .
': ');
224 $tpl->setVariable(
'T_TXT_AUTHOR', $this->lng->txt(
'forums_thread_create_from') .
': ');
225 $tpl->setVariable(
'T_TXT_NUM_POSTS', $this->lng->txt(
'forums_articles') .
': ');
226 $tpl->setVariable(
'T_TXT_NUM_VISITS', $this->lng->txt(
'visits') .
': ');
227 $tpl->parseCurrentBlock();
232 $tpl->setCurrentBlock(
'thread_block');
233 $tpl->parseCurrentBlock();
251 $rowCol =
'ilModeratorPosting';
253 $rowCol =
'ilModeratorPosting';
264 $tpl->
setVariable(
'TXT_CENSORSHIP_ADVICE', $this->lng->txt(
'post_censored_comment_by_moderator'));
265 $rowCol =
'tblrowmarked';
270 $tpl->
setVariable(
'POST_NOT_ACTIVATED_YET', $this->lng->txt(
'frm_post_not_activated_yet'));
280 if ($authorinfo->hasSuffix()) {
281 if (!$authorinfo->isDeleted()) {
282 $tpl->
setVariable(
'USR_NAME', $authorinfo->getAlias());
284 $tpl->
setVariable(
'AUTHOR', $authorinfo->getSuffix());
286 if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized()) {
287 $tpl->
setVariable(
'USR_NAME', $authorinfo->getAuthorName(
true));
289 $tpl->
setVariable(
'AUTHOR', $authorinfo->getAuthorShortName());
292 if (self::MODE_EXPORT_CLIENT == $mode) {
293 if ($authorinfo->getAuthor()->getPref(
'public_profile') !=
'n') {
294 $tpl->
setVariable(
'TXT_REGISTERED', $this->lng->txt(
'registered_since'));
295 $tpl->
setVariable(
'REGISTERED_SINCE', $this->frm->convertDate($authorinfo->getAuthor()->getCreateDate()));
299 if ($this->is_moderator) {
302 $num_posts = $this->frm->countActiveUserArticles($post->
getDisplayUserId());
304 $tpl->
setVariable(
'TXT_NUM_POSTS', $this->lng->txt(
'forums_posts'));
309 $tpl->
setVariable(
'USR_IMAGE', $authorinfo->getProfilePicture());
311 if ($authorinfo->getAuthor()->getGender() ==
'f') {
312 $tpl->
setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_f'));
313 } elseif ($authorinfo->getAuthor()->getGender() ==
'm') {
314 $tpl->
setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_m'));
315 } elseif ($authorinfo->getAuthor()->getGender() ==
'n') {
316 $tpl->
setVariable(
'ROLE', $this->lng->txt(
'frm_moderator_n'));
324 $spanClass =
'moderator_small';
336 $tpl->
setVariable(
'POST_UPDATE_TXT', $this->lng->txt(
'edited_on') .
': ' . $this->frm->convertDate($post->
getChangeDate()) .
' - ' . strtolower($this->lng->txt(
'by')));
337 $tpl->
setVariable(
'UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName());
338 if ($authorinfo->getAuthorName(
true) && !$this->objProperties->isAnonymized()) {
339 $tpl->
setVariable(
'UPDATE_USR_NAME', $authorinfo->getAuthorName(
true));
351 $spanClass =
'moderator';
360 if ($spanClass !=
"") {
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
static setUseRelativeDates($a_status)
set use relative dates
renderPostHtml(\ilTemplate $tpl, ilForumPost $post, $counter, $mode)
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...
ensureThreadBelongsToForum(int $objId, \ilForumTopic $thread)
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 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)
inits and adds the jQuery JS-File to the global or a passed template
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)