function url_for($to = '', $params = array()) { if($to === '') { $to = substr(strtolower(get_class($this)), 0, -10) . '/' . $this->current_action; } $url = PluginEngine::getUrl($this->plugin, $params, $to); return $url; }
function __construct() { parent::__construct(); if (is_object($GLOBALS['perm']) && $GLOBALS['perm']->have_perm('admin')) { $navigation = new Navigation(_("Veranstaltungs-Vervielfältiger"), PluginEngine::getUrl($this, array(), 'index')); Navigation::insertItem('/start/replicator', $navigation, 'search'); } }
/** * This method dispatches and displays all actions. It uses the template * method design pattern, so you may want to implement the methods #route * and/or #display to adapt to your needs. * * @param string the part of the dispatch path, that were not consumed yet * * @return void */ function perform($unconsumed_path) { if (!$unconsumed_path) { header("Location: " . PluginEngine::getUrl($this), 302); return false; } $trails_root = $this->getPluginPath(); $dispatcher = new Trails_Dispatcher($trails_root, null, 'show'); $dispatcher->current_plugin = $this; $dispatcher->dispatch($unconsumed_path); }
<? $js = "STUDIP.Forum.loadAction('#abolink', '" . (ForumAbo::has($constraint['topic_id']) ? 'remove_' : '') . 'abo/'. $constraint['topic_id'] ."'); return false;"; $url = PluginEngine::getUrl('coreforum/index/' . (ForumAbo::has($constraint['topic_id']) ? 'remove_' : '') . 'abo/'. $constraint['topic_id']); ?> <? $text = $constraint['area'] ? _('Diesen Bereich abonnieren') : _('Dieses Thema abonnieren') ?> <? if ($constraint['depth'] == 0) : $text = _('Komplettes Forum abonnieren'); endif ?> <? if (!ForumAbo::has($constraint['topic_id'])) : ?> <?php echo Studip\LinkButton::create($text, $url, array('title' => _('Wenn sie diesen Bereich abonnieren, erhalten Sie eine ' . 'Stud.IP-interne Nachricht sobald in diesem Bereich ' . 'ein neuer Beitrag erstellt wurde.'), 'onClick' => $js)); ?> <? else : ?> <?php echo Studip\LinkButton::create(_('Nicht mehr abonnieren'), $url, array('onClick' => $js)); ?> <? endif; ?>
/** * Delete the submitted entry. * * @param string $topic_id the entry to delete */ function delete_entry_action($topic_id) { // get the page of the posting to be able to jump there again $page = ForumEntry::getPostingPage($topic_id); URLHelper::addLinkParam('page', $page); if (ForumPerm::hasEditPerms($topic_id) || ForumPerm::check('remove_entry', $this->getId(), $topic_id)) { $path = ForumEntry::getPathToPosting($topic_id); $topic = array_pop($path); $parent = array_pop($path); if ($topic_id != $this->getId()) { // only delete directly if passed by ajax, otherwise ask for confirmation if (Request::isXhr() || Request::get('approve_delete')) { ForumEntry::delete($topic_id); $this->flash['messages'] = array('success' => sprintf(_('Der Eintrag %s wurde gelöscht!'), $topic['name'])); } else { $this->flash['messages'] = array('info_html' => sprintf(_('Sind sie sicher dass Sie den Eintrag %s löschen möchten?'), $topic['name']) . '<br>' . \Studip\LinkButton::createAccept(_('Ja'), PluginEngine::getUrl('coreforum/index/delete_entry/' . $topic_id . '?approve_delete=1')) . \Studip\LinkButton::createCancel(_('Nein'), PluginEngine::getUrl('coreforum/index/index/' . ForumEntry::getParentTopicId($topic_id) . '/' . $page))); } } else { $this->flash['messages'] = array('success' => _('Sie können nicht die gesamte Veranstaltung löschen!')); } } if (Request::isXhr()) { $this->render_template('messages'); $this->flash['messages'] = null; } else { $this->redirect(PluginEngine::getLink('coreforum/index/index/' . $parent['id'] . '/' . $page)); } }
" <?php echo $edit_posting != $post['topic_id'] ? '' : 'style="display: none;"'; ?> > <!-- Aktions-Buttons für diesen Beitrag --> <? if (ForumPerm::has('add_entry', $constraint['seminar_id'])) : ?> <?php echo Studip\LinkButton::create(_('Beitrag zitieren'), PluginEngine::getLink('coreforum/index/cite/' . $post['topic_id']), array('onClick' => "javascript:STUDIP.Forum.citeEntry('" . $post['topic_id'] . "'); return false;", 'class' => !$perms['edit_closed'] ? 'hideWhenClosed' : '', 'style' => !$can_edit_closed ? 'display: none' : '')); ?> <? endif ?> <? if ($section == 'index' && $perms['edit']) : ?> <?php echo Studip\LinkButton::create(_('Beitrag bearbeiten'), PluginEngine::getUrl('coreforum/index/index/' . $post['topic_id'] . '/?edit_posting=' . $post['topic_id']), array('onClick' => "STUDIP.Forum.editEntry('" . $post['topic_id'] . "'); return false;", 'class' => !$perms['edit_closed'] ? 'hideWhenClosed' : '', 'style' => !$can_edit_closed ? 'display: none' : '')); ?> <? endif ?> <? if ($section == 'index') : ?> <span <?php echo !$perms['edit_close'] && !$perms['remove_entry'] ? 'class="hideWhenClosed"' : ''; ?> <?php echo !$perms['edit'] && !$perms['remove_entry'] ? 'style="display: none"' : ''; ?> > <? $confirmLink = PluginEngine::getURL('coreforum/index/delete_entry/' . $post['topic_id']) ?> <? $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?') ?>