public function display($discussion) { if (is_a($discussion, 'mod_forumng_discussion')) { return parent::get_button($discussion, get_string('export', 'forumngfeature_export'), 'feature/export/export.php', false, array(), '', false, true); } else { return forumngfeature_discussion_list::get_button($discussion, get_string('export', 'forumngfeature_export'), 'feature/export/exportall.php', false, $_GET, '', 'forumng-dselectorbutton', '', ''); } }
public function display($forum) { $params = $forum->get_link_params_array(); if ($forum->get_group_mode()) { $params['group'] = mod_forumng::get_activity_group($forum->get_course_module()); } return parent::get_button($forum, get_string('markallread', 'forumngfeature_markallread'), 'markread.php', true, $params); }
public function display($forum) { if (has_capability('forumngfeature/userposts:view', $forum->get_context())) { $name = get_string('viewpostsbyuser', 'forumngfeature_userposts'); $script = 'feature/userposts/list.php'; return parent::get_button($forum, $name, $script); } else { $name = get_string('viewownposts', 'forumngfeature_userposts'); $script = 'feature/userposts/user.php'; return parent::get_button($forum, $name, $script, false, array('user' => mod_forumng_utils::get_real_userid())); } }
public function display($forum) { $out = mod_forumng_utils::get_renderer(); // Work out current status $manualmark = !mod_forumng::mark_read_automatically(); $current = get_string($manualmark ? 'manualmark_manual' : 'manualmark_auto', 'forumngfeature_manualmark'); // Make a help button $change = get_string('manualmark_change', 'forumngfeature_manualmark'); $helpbutton = $out->help_icon('manualmark_change', 'forumngfeature_manualmark'); // Get the button form $params = $forum->get_link_params_array(); return parent::get_button($forum, $change, 'feature/manualmark/change.php', true, $params, $helpbutton, 'forumng-manualmark', $current . ' ', 'forumng-button-to-link'); }
public function display($discussion) { global $PAGE; if ($PAGE->pagetype == 'mod-forumng-discuss') { if (!$discussion->is_locked()) { $button = parent::get_button($discussion, get_string('lock', 'forumngfeature_lock'), 'editpost.php', false, array('lock' => 1)); } else { $button = parent::get_button($discussion, get_string('unlock', 'forumngfeature_lock'), 'feature/lock/unlock.php'); } } else { // Main page lock button. $params['exclude'] = 'forumng-deleted,forumng-locked'; $lock_get = array_merge($params, $_GET); $button = forumngfeature_discussion_list::get_button($discussion, get_string('lockdis', 'forumngfeature_lock'), 'feature/lock/lockall.php', false, $lock_get, '', 'forumng-dselectorbutton'); } return $button; }
public function display($forum) { $params = array(); $params['sticky'] = 100; $params['normal'] = 0; $params['exclude'] = 'forumng-deleted,forumng-sticky'; $sticky_get = array_merge($params, $_GET); $stickyonbutton = parent::get_button($forum, get_string('sticky_on', 'forumngfeature_sticky'), 'feature/sticky/sticky.php', false, $sticky_get, '', 'forumng-dselectorbutton'); unset($params); $params['sticky'] = 0; $params['normal'] = 200; $params['include'] = 'forumng-sticky'; $params['exclude'] = 'forumng-deleted'; $normal_get = array_merge($params, $_GET); $stickyoffbutton = parent::get_button($forum, get_string('sticky_off', 'forumngfeature_sticky'), 'feature/sticky/sticky.php', false, $normal_get, '', 'forumng-dselectorbutton'); return $stickyonbutton . $stickyoffbutton; }
public function display($discussion) { global $USER; if (is_a($discussion, 'mod_forumng')) { $script = 'feature/edittags/managetags.php'; $name = get_string('settags', 'forumngfeature_edittags'); return forumngfeature_discussion_list::get_button($discussion, $name, $script, false, array()); } else { // It is a discussion so need slightly different set up. $script = 'feature/edittags/edittags.php'; $name = get_string('edittags', 'forumngfeature_edittags'); $tagout = ''; $tags = $discussion->get_tags(); if ($tags) { $tagout = html_writer::start_tag('div', array('class' => 'forum-feature-edittags')); $tagout .= html_writer::start_tag('strong'); $tagout .= html_writer::tag('span', get_string('discussiontags', 'forumng') . ': '); $tagout .= html_writer::end_tag('strong'); $i = 1; foreach ($tags as $key => $value) { if (count($tags) != $i) { $tagout .= $value . ', '; } else { $tagout .= $value . ' '; } $i++; } if ($this->can_edit_tags($discussion)) { $tagout .= parent::get_button($discussion, $name, $script, false, array('d' => $discussion->get_id())); } $tagout .= html_writer::end_tag('div'); } else { if ($this->can_edit_tags($discussion)) { $tagout = html_writer::start_tag('div', array('class' => 'forum-feature-edittags')); $tagout .= html_writer::start_tag('strong'); $tagout .= html_writer::tag('span', get_string('nodiscussionset', 'forumngfeature_edittags')); $tagout .= html_writer::end_tag('strong'); $tagout .= parent::get_button($discussion, $name, $script, false, array('d' => $discussion->get_id())); $tagout .= html_writer::end_tag('div'); } } return $tagout; } }
public function display($forum) { $name = get_string('viewdeleted', 'forumngfeature_deletedposts'); $script = 'feature/deletedposts/list.php'; return parent::get_button($forum, $name, $script); }
/** * Displays discussion list features for this forum. Features are the * plugins in the 'feature' subfolder - basically a row of buttons along * the bottom. * @param int $groupid Group ID * @return string HTML code for discussion list features */ public function display_forumngfeature_discussion_lists($groupid) { // Print discussion list feature buttons (userposts button) $features = ''; foreach (forumngfeature_discussion_list::get_all() as $feature) { if ($feature->should_display($this, $groupid)) { $features .= $feature->display($this, $groupid); } } if ($features) { return '<div id="forumng-features">' . $features . '</div>'; } else { return ''; } }
public function display($forum) { $name = get_string('button', 'forumngfeature_usage'); $script = 'feature/usage/usage.php'; return parent::get_button($forum, $name, $script); }
public function display($discussion) { require_once dirname(__FILE__) . '/lib.php'; if (is_a($discussion, 'mod_forumng_discussion')) { // Obtain list of other forums in this course where the user has the // 'move discussion' feature. $course = $discussion->get_forum()->get_course(); $modinfo = get_fast_modinfo($course); $results = array(); foreach ($modinfo->instances['forumng'] as $other) { // Don't let user move discussion to its current forum. if ($other->instance == $discussion->get_forum()->get_id() || $other->id == $discussion->get_forum()->get_course_module_id()) { continue; } $othercontext = context_module::instance($other->id); if (has_capability('mod/forumng:movediscussions', $othercontext)) { $results[$other->id] = $other->name; } } if (count($results) == 0) { return ''; } // Make list alphabetical. uasort($results, 'sort_ignore_case'); // Build select using the list. $out = mod_forumng_utils::get_renderer(); $select = html_writer::select($results, 'target', '', array('' => get_string('movethisdiscussionto', 'forumngfeature_move'))); return '<form method="post" action="feature/move/move.php"><div>' . $discussion->get_link_params(mod_forumng::PARAM_FORM) . $select . '<input class="forumng-zero-disable" ' . 'type="submit" value="' . get_string('move') . '" /></div></form>'; } else { // Display button. $params['exclude'] = 'forumng-deleted'; $excludedget = array_merge($params, $_GET); if (is_a($discussion, 'mod_forumng')) { return forumngfeature_discussion_list::get_button($discussion, get_string('move', 'forumngfeature_move'), 'feature/move/moveall.php', false, $excludedget, '', 'forumng-dselectorbutton', '', ''); } } }