diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 10506329cab..fd0dfb37170 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -650,18 +650,26 @@ class url_select implements renderable { * @var array of component_action */ var $helpicon = null; + /** + * @var string If set, makes button visible with given name for button + */ + var $showbutton = null; /** * Constructor * @param array $urls list of options * @param string $selected selected element * @param array $nothing * @param string $formid + * @param string $showbutton Set to text of button if it should be visible + * or null if it should be hidden (hidden version always has text 'go') */ - public function __construct(array $urls, $selected='', $nothing=array(''=>'choosedots'), $formid=null) { - $this->urls = $urls; - $this->selected = $selected; - $this->nothing = $nothing; - $this->formid = $formid; + public function __construct(array $urls, $selected='', $nothing=array(''=>'choosedots'), + $formid=null, $showbutton=null) { + $this->urls = $urls; + $this->selected = $selected; + $this->nothing = $nothing; + $this->formid = $formid; + $this->showbutton = $showbutton; } /** diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 4948389163c..a188789bdcb 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -1293,11 +1293,14 @@ class core_renderer extends renderer_base { $output .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=>sesskey())); $output .= html_writer::select($urls, 'jump', $selected, $select->nothing, $select->attributes); - $go = html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('go'))); - $output .= html_writer::tag('noscript', html_writer::tag('div', $go), array('style'=>'inline')); - - $nothing = empty($select->nothing) ? false : key($select->nothing); - $output .= $this->page->requires->js_init_call('M.util.init_url_select', array($select->formid, $select->attributes['id'], $nothing)); + if (!$select->showbutton) { + $go = html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('go'))); + $output .= html_writer::tag('noscript', html_writer::tag('div', $go), array('style'=>'inline')); + $nothing = empty($select->nothing) ? false : key($select->nothing); + $output .= $this->page->requires->js_init_call('M.util.init_url_select', array($select->formid, $select->attributes['id'], $nothing)); + } else { + $output .= html_writer::empty_tag('input', array('type'=>'submit', 'value'=>$select->showbutton)); + } // then div wrapper for xhtml strictness $output = html_writer::tag('div', $output); diff --git a/mod/forum/discuss.php b/mod/forum/discuss.php index 147a08191b9..b9b0ffdaa0c 100644 --- a/mod/forum/discuss.php +++ b/mod/forum/discuss.php @@ -232,7 +232,9 @@ } if (!empty($forummenu)) { echo '
'; - $select = new url_select($forummenu, '', array(''=>get_string("movethisdiscussionto", "forum")), 'forummenu'); + $select = new url_select($forummenu, '', + array(''=>get_string("movethisdiscussionto", "forum")), + 'forummenu', get_string('move')); echo $OUTPUT->render($select); echo "
"; }