/** * Common code for all actions: set default layout and page title. * * @param type $action * @param type $args */ function before_filter(&$action, &$args) { $this->validate_args($args, array('option', 'option')); parent::before_filter($action, $args); // set correct encoding if this is an ajax-call if (Request::isAjax()) { header('Content-Type: text/html; charset=Windows-1252'); } $this->flash = Trails_Flash::instance(); // set default layout $layout = $GLOBALS['template_factory']->open('layouts/base'); $this->set_layout($layout); // Set help keyword for Stud.IP's user-documentation and page title PageLayout::setHelpKeyword('Basis.Forum'); PageLayout::setTitle($_SESSION['SessSemName']['header_line'] . ' - ' . _('Forum')); $this->AVAILABLE_DESIGNS = array('web20', 'studip'); if ($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'] && $GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'] != '/') { $this->picturepath = $GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'] . '/' . $this->dispatcher->trails_root . '/img'; } else { $this->picturepath = '/' . $this->dispatcher->trails_root . '/img'; } // we want to display the dates in german setlocale(LC_TIME, 'de_DE@euro', 'de_DE', 'de', 'ge'); // the default for displaying timestamps $this->time_format_string = "%a %d. %B %Y, %H:%M"; $this->time_format_string_short = "%d.%m.%Y, %H:%M"; $this->template_factory = new Flexi_TemplateFactory(dirname(__FILE__) . '/../templates'); //$this->check_token(); ForumVisit::setVisit($this->getId()); if (Request::int('page')) { ForumHelpers::setPage(Request::int('page')); } $this->seminar_id = $this->getId(); }
function getIconNavigation($course_id, $last_visit, $user_id = null) { if (!$this->isActivated($course_id)) { return; } $this->setupAutoload(); if ($GLOBALS['perm']->have_studip_perm('user', $course_id)) { $num_entries = ForumVisit::getCount($course_id, ForumVisit::getVisit($course_id)); $text = ForumHelpers::getVisitText($num_entries, $course_id); } else { $num_entries = 0; $text = 'Forum'; } $navigation = new Navigation('forum', PluginEngine::getURL($this, array(), 'index/enter_seminar')); $navigation->setBadgeNumber($num_entries); if ($num_entries > 0) { $navigation->setImage(Icon::create('forum+new', 'attention', ["title" => $text])); } else { $navigation->setImage(Icon::create('forum', 'inactive', ["title" => $text])); } return $navigation; }
/** * set the current page * * @param int $page_num the page */ static function setPage($page_num) { self::$page = $page_num; }
echo Icon::create('lock-locked', 'clickable', ['title' => _('Thema schließen')])->asImg(16); ?> </a> <? else : ?> <a href="<?php echo PluginEngine::getURL('coreforum/index/open_thread/' . $entry['topic_id'] . '/' . $constraint['topic_id'] . '/' . ForumHelpers::getPage()); ?> " onclick="STUDIP.Forum.openThreadFromOverview('<?php echo $entry['topic_id']; ?> ', '<?php echo $constraint['topic_id']; ?> ', <?php echo ForumHelpers::getPage(); ?> ); return false;" id="closeButton-<?php echo $entry['topic_id']; ?> "> <?php echo Icon::create('lock-unlocked', 'clickable', ['title' => _('Thema öffnen')])->asImg(16); ?> </a> <? endif ?> <? endif ?> <? if (ForumPerm::has('make_sticky', $seminar_id) && $constraint['depth'] >= 1) : ?> <? if ($entry['sticky'] == 0) : ?>
echo $picturepath; ?> /anfasser_48.png" class="handle js" id="tutorMoveArea"> <? endif ?> <a href="<?php echo PluginEngine::getLink('coreforum/index/index/' . $jump_to_topic_id . '#' . $jump_to_topic_id); ?> "> <? if ($entry['chdate'] >= $visitdate && $entry['user_id'] != $GLOBALS['user']->id): ?> <?php echo Icon::create('forum+new', 'attention', ['title' => _('Dieser Eintrag ist neu!')])->asImg(16, ["id" => 'tutorNotificationIcon', "style" => 'margin-bottom: 15px;']); ?> <? else : ?> <? $num_postings = ForumVisit::getCount($entry['topic_id'], $visitdate) ?> <? $text = ForumHelpers::getVisitText($num_postings, $entry['topic_id'], $constraint['depth']) ?> <? if ($num_postings > 0) : ?> <?php echo Icon::create('forum', 'attention', ['title' => $text])->asImg(16, ["id" => 'tutorNotificationIcon', "style" => 'margin-bottom: 15px;']); ?> <? else : ?> <?php echo Icon::create('forum', 'info', ['title' => $text])->asImg(16, ["id" => 'tutorNotificationIcon', "style" => 'margin-bottom: 15px;']); ?> <? endif ?> <? endif ?> </a> </td> <td class="areaentry"> <div style="position: relative;<?php echo Request::get('edit_area') == $entry['topic_id'] ? 'height: auto;' : '';
/** ** returns a list of postings for the passed search-term * * @param string $parent_id the area to search in (can be a whole seminar) * @param string $_searchfor the term to search for * @param array $options filter-options: search_title, search_content, search_author * @return array array('list' => ..., 'count' => ...); */ static function getSearchResults($parent_id, $_searchfor, $options) { $start = (ForumHelpers::getPage() - 1) * ForumEntry::POSTINGS_PER_PAGE; // if there are quoted parts, they should not be separated $suchmuster = '/".*"/U'; preg_match_all($suchmuster, $_searchfor, $treffer); array_walk($treffer[0], function (&$value) { $value = trim($value, '"'); }); // remove the quoted parts from $_searchfor $_searchfor = trim(preg_replace($suchmuster, '', $_searchfor)); // split the searchstring $_searchfor at every space $parts = explode(' ', $_searchfor); foreach ($parts as $key => $val) { if ($val == '') { unset($parts[$key]); } } if (!empty($parts)) { $_searchfor = array_merge($parts, $treffer[0]); } else { $_searchfor = $treffer[0]; } // make an SQL-statement out of the searchstring $search_string = array(); foreach ($_searchfor as $key => $val) { if (!$val) { unset($_searchfor[$key]); } else { $search_word = '%' . $val . '%'; $zw_search_string = array(); if ($options['search_title']) { $zw_search_string[] .= "name LIKE " . DBManager::get()->quote($search_word); } if ($options['search_content']) { $zw_search_string[] .= "content LIKE " . DBManager::get()->quote($search_word); } if ($options['search_author']) { $zw_search_string[] .= "author LIKE " . DBManager::get()->quote($search_word); } if (!empty($zw_search_string)) { $search_string[] = '(' . implode(' OR ', $zw_search_string) . ')'; } } } if (!empty($search_string)) { $add = "AND (" . implode(' AND ', $search_string) . ")"; return array_merge(array('highlight' => $_searchfor), ForumEntry::getEntries($parent_id, ForumEntry::WITH_CHILDS, $add, 'DESC', $start)); } return array('num_postings' => 0, 'list' => array()); }
<? endif ?> <? if ($constraint['depth'] > 1 && ($constraint['closed'] == 1)) : ?> <?php echo Studip\LinkButton::create($button_face, PluginEngine::getLink('coreforum/index/new_entry/' . $topic_id), array('onClick' => 'STUDIP.Forum.answerEntry(); return false;', 'class' => 'hideWhenClosed', 'style' => 'display:none;')); ?> <? endif ?> <? if (ForumPerm::has('close_thread', $seminar_id) && $constraint['depth'] > 1) : ?> <? if ($constraint['closed'] == 0): ?> <?php echo Studip\LinkButton::create(_('Thema schließen'), PluginEngine::getLink('coreforum/index/close_thread/' . $topic_id . '/' . $topic_id . '/' . ForumHelpers::getPage()), array('onClick' => 'STUDIP.Forum.closeThreadFromThread("' . $topic_id . '"); return false;', 'class' => 'closeButtons')); ?> <? else: ?> <?php echo Studip\LinkButton::create(_('Thema öffnen'), PluginEngine::getLink('coreforum/index/open_thread/' . $topic_id . '/' . $topic_id . '/' . ForumHelpers::getPage()), array('onClick' => 'STUDIP.Forum.openThreadFromThread("' . $topic_id . '"); return false;', 'class' => 'closeButtons')); ?> <? endif ?> <? endif ?> <? if ($constraint['depth'] > 0 && ForumPerm::has('abo', $seminar_id)) : ?> <span id="abolink"> <?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'));
<?php echo ForumHelpers::replace(Studip\LinkButton::createCancel(_('Abbrechen'), "javascript:STUDIP.Forum.cancelEditCategoryName('%%%- category_id ###')")); ?> </span> </script> <script type="text/template" class="edit_area"> <span class="edit_area"> <input type="text" name="name" size="20" maxlength="255" style="width: 100%;" value="<%- name %>" onClick="jQuery(this).focus()"><br> <textarea name="content" style="height: 3em;" onClick="jQuery(this).focus()"><%- content %></textarea> <?php echo ForumHelpers::replace(Studip\LinkButton::createAccept(_('Speichern'), "javascript:STUDIP.Forum.saveArea('%%%- area_id ###');")); ?> <?php echo ForumHelpers::replace(Studip\LinkButton::createCancel(_('Abbrechen'), "javascript:STUDIP.Forum.cancelEditArea('%%%- area_id ###');")); ?> </span> </script> <script type="text/template" class="add_area"> <tr class="new_area"> <td class="areaentry"></td> <td class="areaentry"> <form class="add_area_form"> <?php echo CSRFProtection::tokenTag(); ?> <input type="hidden" name="category_id" value="<%- category_id %>"> <input type="text" name="name" size="50" maxlength="255" style="width: 99%;" placeholder="<?php echo _('Name des neuen Bereiches');
/** * Generate a pdf-export for the whole forum or the passed subtree * * @param string $parent_id */ function pdfexport_action($parent_id = null) { ForumPerm::check('pdfexport', $this->getId(), $parent_id); ForumHelpers::createPDF($this->getId(), $parent_id); }
"> <span class="username" data-profile="<?php echo $post['topic_id']; ?> "> <?php echo htmlReady(get_fullname($post['user_id'])); ?> </span> </a> <? endif ?> </dt> <dd> <?php echo ForumHelpers::translate_perm($GLOBALS['perm']->get_studip_perm($constraint['seminar_id'], $post['user_id'])); ?> </dd> <? if ($post['user_id']) : ?> <dd> Beiträge: <?php echo ForumEntry::countUserEntries($post['user_id']); ?> <br> <?php echo _('Erhaltene "Gefällt mir!":'); ?> <?php echo ForumLike::receivedForUser($post['user_id']); ?>