/** * show the administration page for mass-editing forum-entries */ function index_action() { ForumPerm::check('admin', $this->getId()); $nav = Navigation::getItem('course/forum2'); $nav->setImage(Icon::create('forum', 'info')); Navigation::activateItem('course/forum2/admin'); $list = ForumEntry::getList('flat', $this->getId()); // sort by cat $new_list = array(); // iterate over all categories and add the belonging areas to them foreach ($categories = ForumCat::getListWithAreas($this->getId(), false) as $category) { if ($category['topic_id']) { $new_list[$category['category_id']][$category['topic_id']] = $list['list'][$category['topic_id']]; unset($list['list'][$category['topic_id']]); } else { if (ForumPerm::has('add_area', $this->seminar_id)) { $new_list[$category['category_id']] = array(); } } $this->categories[$category['category_id']] = $category['entry_name']; } if (!empty($list['list'])) { // append the remaining entries to the standard category $new_list[$this->getId()] = array_merge((array) $new_list[$this->getId()], $list['list']); } $this->list = $new_list; }
/** * Delete an entry * * @delete /forum_entry/:entry_id */ public function deleteForumEntry($entry_id) { $entry = $this->findEntry($entry_id); $cid = $parent['course_id']; if (!\ForumPerm::hasEditPerms($entry_id) || !\ForumPerm::has('remove_entry', $cid)) { $this->error(401); } \ForumEntry::delete($entry_id); $this->status(204); }
?> " alt="<?php echo $infotext; ?> " title="<?php echo $infotext; ?> "> <?php echo Icon::create('link-intern', 'clickable', ['title' => $infotext = _("Direkt zum Beitrag..."), 'id' => 'tutorLatestAnswer'])->asImg(); ?> </a> <? else: ?> <br> <?php echo _('keine Antworten'); ?> <? endif; ?> <? endif; ?> </td> <td class="icon" style="text-align: right; padding-right: 2px;"> <? if (ForumPerm::has('sort_area', $seminar_id)) : ?> <img src="<?php echo $picturepath; ?> /anfasser_48.png" class="handle js" id="tutorMoveArea"> <? endif ?> </td> </tr>
<? if (!ForumPerm::has('fav_entry', $seminar_id)) return; ?> <!-- set/unset favorite --> <? if (!$favorite) : ?> <a href="<?php echo PluginEngine::getLink('coreforum/index/set_favorite/' . $topic_id); ?> " onClick="STUDIP.Forum.setFavorite('<?php echo $topic_id; ?> ');return false;"> <?php echo Icon::create('exclaim', 'clickable', ['title' => _('Beitrag merken')])->asImg(); ?> </a> <? else : ?> <a href="<?php echo PluginEngine::getLink('coreforum/index/unset_favorite/' . $topic_id); ?> " onClick="STUDIP.Forum.unsetFavorite('<?php echo $topic_id; ?> ');return false;"> <?php echo Icon::create('exclaim', 'attention', ['title' => _('Beitrag nicht mehr merken')])->asImg(); ?> </a> <? endif ?>
<?php echo $this->render_partial('index/_abo_link', compact('constraint')); ?> </span> <? endif ?> <? if (ForumPerm::has('pdfexport', $seminar_id)) : ?> <?php echo Studip\LinkButton::create(_('Beiträge als PDF exportieren'), PluginEngine::getLink('coreforum/index/pdfexport/' . $topic_id), array('target' => '_blank')); ?> <? endif ?> </div> </div> </div> <? endif ?> <? endif ?> <? if (ForumPerm::has('add_entry', $seminar_id)): ?> <?php echo $this->render_partial('index/_new_entry'); ?> <? endif ?> </div> <!-- Mail-Notifikationen verschicken (soweit am Ende der Seite wie möglich!) --> <? if ($flash['notify']) : ForumAbo::notify($flash['notify']); endif ?>
/** * Show new-entry-form for submitted topic * * @param string $topic_id hte id of the entry to add to */ function new_entry_action($topic_id) { ForumPerm::check('add_entry', $this->getId(), $topic_id); if (ForumEntry::isClosed($topic_id) && !ForumPerm::has('edit_closed')) { throw new AccessDeniedException(_('Sie dürfen keinen Beitrag in einem geschlossenen Thema erstellen!')); } $this->flash['edit_entry'] = true; $this->redirect(PluginEngine::getLink('coreforum/index/index/' . $topic_id . '#create')); }
/** * Check if the current user is allowed to edit the topic * denoted by the passed id * * @staticvar array $perms * * @param string $topic_id the id for the topic to check for * * @return bool true if the user has the necessary perms, false otherwise */ static function hasEditPerms($topic_id) { static $perms = array(); if (!$perms[$topic_id]) { // find out if the posting is the last in the thread $constraints = ForumEntry::getConstraints($topic_id); $stmt = DBManager::get()->prepare("SELECT user_id, seminar_id\n FROM forum_entries WHERE topic_id = ?"); $stmt->execute(array($topic_id)); $data = $stmt->fetch(); $closed = ForumEntry::isClosed($topic_id); $perms[$topic_id] = ($GLOBALS['user']->id == $data['user_id'] && $GLOBALS['user']->id != 'nobody' || ForumPerm::has('edit_entry', $constraints['seminar_id'])) && (!$closed || $closed && ForumPerm::has('edit_closed', $constraints['seminar_id'])); } return $perms[$topic_id]; }
<? if ($category_id && ForumPerm::has('add_area', $seminar_id) && Request::get('add_area') == $category_id) : ?> <?php echo $this->render_partial('area/_add_area_form'); ?> <? endif ?> <? if (!$entries): ?> <!-- this row allows dropping on otherwise empty categories --> <tr class="sort-disabled"> <td class="areaborder" style="height: 5px; padding: 0px; margin: 0px"colspan="7"> </td> </tr> <? endif; ?> </tbody> <tfoot> <? if ($category_id && ForumPerm::has('add_area', $seminar_id)) : ?> <? if (Request::get('add_area') != $category_id) : ?> <tr class="add_area"> <td colspan="5" onClick="STUDIP.Forum.addArea('<?php echo $category_id; ?> '); return false;" class="add_area"> <a href="<?php echo PluginEngine::getLink('coreforum/index/index/?add_area=' . $category_id); ?> #cat_<?php echo $category_id; ?> " title="<?php echo _('Neuen Bereich zu dieser Kategorie hinzufügen.'); ?>
function getNotificationObjects($course_id, $since, $user_id) { $this->setupAutoload(); if (ForumPerm::has('view', $course_id, $user_id)) { $postings = ForumEntry::getLatestSince($course_id, $since); $contents = array(); foreach ($postings as $post) { $obj = get_object_name($course_id, 'sem'); $summary = sprintf(_('%s hat im Forum der Veranstaltung "%s" einen Forenbeitrag verfasst.'), get_fullname($post['user_id']), $obj['name']); $contents[] = new ContentElement(_('Forum: ') . $obj['name'], $summary, formatReady($post['content']), $post['user_id'], $post['author'], PluginEngine::getURL($this, array(), 'index/index/' . $post['topic_id'] . '?cid=' . $course_id . '#' . $post['topic_id']), $post['mkdate']); } } return $contents; }
<? $confirmLinkApproved = PluginEngine::getURL('coreforum/index/delete_entry/' . $post['topic_id'] . '?approve_delete=1') ?> <? if ($constraint['depth'] == $post['depth']) : /* this is not only a posting, but a thread */ ?> <? $confirmText = _('Wenn Sie diesen Beitrag löschen wird ebenfalls das gesamte Thema gelöscht. Sind Sie sicher, dass Sie das tun möchten?') ?> <?php echo Studip\LinkButton::create(_('Thema löschen'), $confirmLink, array('onClick' => "STUDIP.Forum.showDialog('{$confirmText}', '{$confirmLinkApproved}'); return false;")); ?> <? else : ?> <? $confirmText = _('Möchten Sie diesen Beitrag wirklich löschen?') ?> <?php echo Studip\LinkButton::create(_('Beitrag löschen'), $confirmLink, array('onClick' => "STUDIP.Forum.showDialog('{$confirmText}', '{$confirmLinkApproved}'); return false;")); ?> <? endif ?> </span> <? endif ?> <? if (ForumPerm::has('forward_entry', $seminar_id)) : ?> <?php echo Studip\LinkButton::create(_('Beitrag weiterleiten'), "javascript:STUDIP.Forum.forwardEntry('" . $post['topic_id'] . "')", array('class' => 'js')); ?> <? endif ?> </span> </div> </div> </div> <? if ($perms['edit']) : ?> <span data-edit-topic="<?php echo $post['topic_id']; ?> " <?php