Skip to content

Commit

Permalink
Merge branch 'MDL-46159-wip' of https://github.com/willylee/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Jul 20, 2014
2 parents 8d3a4d7 + 4b07116 commit ce61d62
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
45 changes: 45 additions & 0 deletions course/classes/management_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,51 @@ public function search_listitem_actions(course_in_list $course) {
return html_writer::span(join('', $actions), 'course-item-actions item-actions');
}

/**
* Renders html to display a course search form
*
* @param string $value default value to populate the search field
* @param string $format display format - 'plain' (default), 'short' or 'navbar'
* @return string
*/
public function course_search_form($value = '', $format = 'plain') {
static $count = 0;
$formid = 'coursesearch';
if ((++$count) > 1) {
$formid .= $count;
}

switch ($format) {
case 'navbar' :
$formid = 'coursesearchnavbar';
$inputid = 'navsearchbox';
$inputsize = 20;
break;
case 'short' :
$inputid = 'shortsearchbox';
$inputsize = 12;
break;
default :
$inputid = 'coursesearchbox';
$inputsize = 30;
}

$strsearchcourses = get_string("searchcourses");
$searchurl = new moodle_url('/course/management.php');

$output = html_writer::start_tag('form', array('id' => $formid, 'action' => $searchurl, 'method' => 'get'));
$output .= html_writer::start_tag('fieldset', array('class' => 'coursesearchbox invisiblefieldset'));
$output .= html_writer::tag('label', $strsearchcourses.': ', array('for' => $inputid));
$output .= html_writer::empty_tag('input', array('type' => 'text', 'id' => $inputid,
'size' => $inputsize, 'name' => 'search', 'value' => s($value)));
$output .= html_writer::empty_tag('input', array('type' => 'submit',
'value' => get_string('go')));
$output .= html_writer::end_tag('fieldset');
$output .= html_writer::end_tag('form');

return $output;
}

/**
* Creates access hidden skip to links for the displayed sections.
*
Expand Down
2 changes: 2 additions & 0 deletions course/management.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,4 +508,6 @@

// End of the management form.
echo $renderer->management_form_end();
echo $renderer->course_search_form($search);

echo $renderer->footer();

0 comments on commit ce61d62

Please sign in to comment.