mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Merge branch 'MDL-29719-master' of git://github.com/sammarshallou/moodle
This commit is contained in:
commit
a598a8d4b1
@ -118,8 +118,11 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// coursecontact is the person responsible for course - usually manages enrolments, receives notification, etc.
|
||||
$temp = new admin_settingpage('coursecontact', get_string('coursecontact', 'admin'));
|
||||
$temp = new admin_settingpage('coursecontact', get_string('courses'));
|
||||
$temp->add(new admin_setting_special_coursecontact());
|
||||
$temp->add(new admin_setting_configcheckbox('courselistshortnames',
|
||||
get_string('courselistshortnames', 'admin'),
|
||||
get_string('courselistshortnames_desc', 'admin'), 0));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
$temp = new admin_settingpage('ajax', get_string('ajaxuse'));
|
||||
|
@ -314,7 +314,8 @@
|
||||
|
||||
$linkcss = $acourse->visible ? '' : ' class="dimmed" ';
|
||||
echo '<tr>';
|
||||
echo '<td><a '.$linkcss.' href="view.php?id='.$acourse->id.'">'. format_string($acourse->fullname) .'</a></td>';
|
||||
$coursename = get_course_display_name_for_list($course);
|
||||
echo '<td><a '.$linkcss.' href="view.php?id='.$acourse->id.'">'. format_string($coursename) .'</a></td>';
|
||||
if ($editingon) {
|
||||
echo '<td>';
|
||||
if (has_capability('moodle/course:update', $coursecontext)) {
|
||||
|
@ -2173,6 +2173,22 @@ function make_categories_options() {
|
||||
return $cats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of a course to be displayed when showing a list of courses.
|
||||
* By default this is just $course->fullname but user can configure it. The
|
||||
* result of this function should be passed through print_string.
|
||||
* @param object $course Moodle course object
|
||||
* @return string Display name of course (either fullname or short + fullname)
|
||||
*/
|
||||
function get_course_display_name_for_list($course) {
|
||||
global $CFG;
|
||||
if (!empty($CFG->courselistshortnames)) {
|
||||
return $course->shortname . ' ' .$course->fullname;
|
||||
} else {
|
||||
return $course->fullname;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the category info in indented fashion
|
||||
* This function is only used by print_whole_category_list() above
|
||||
@ -2231,7 +2247,8 @@ function print_category_info($category, $depth=0, $showcourses = false) {
|
||||
$linkcss = array('class'=>'dimmed');
|
||||
}
|
||||
|
||||
$courselink = html_writer::link(new moodle_url('/course/view.php', array('id'=>$course->id)), format_string($course->fullname), $linkcss);
|
||||
$coursename = get_course_display_name_for_list($course);
|
||||
$courselink = html_writer::link(new moodle_url('/course/view.php', array('id'=>$course->id)), format_string($coursename), $linkcss);
|
||||
|
||||
// print enrol info
|
||||
$courseicon = '';
|
||||
@ -2423,7 +2440,9 @@ function print_course($course, $highlightterms = '') {
|
||||
echo html_writer::start_tag('h3', array('class'=>'name'));
|
||||
|
||||
$linkhref = new moodle_url('/course/view.php', array('id'=>$course->id));
|
||||
$linktext = highlight($highlightterms, format_string($course->fullname));
|
||||
|
||||
$coursename = get_course_display_name_for_list($course);
|
||||
$linktext = highlight($highlightterms, format_string($coursename));
|
||||
$linkparams = array('title'=>get_string('entercourse'));
|
||||
if (empty($course->visible)) {
|
||||
$linkparams['class'] = 'dimmed';
|
||||
|
@ -113,4 +113,24 @@ class courselib_test extends UnitTestCase {
|
||||
$this->assertEqual(25, next($newsections_flipped));
|
||||
$this->assertEqual(21, next($newsections_flipped));
|
||||
}
|
||||
|
||||
function test_get_course_display_name_for_list() {
|
||||
global $CFG;
|
||||
|
||||
$course = (object)array('shortname' => 'FROG101',
|
||||
'fullname' => 'Introduction to pond life');
|
||||
|
||||
// Store config value in case other tests rely on it
|
||||
$oldcfg = $CFG->courselistshortnames;
|
||||
|
||||
$CFG->courselistshortnames = 0;
|
||||
$this->assertEqual('Introduction to pond life',
|
||||
get_course_display_name_for_list($course));
|
||||
|
||||
$CFG->courselistshortnames = 1;
|
||||
$this->assertEqual('FROG101 Introduction to pond life',
|
||||
get_course_display_name_for_list($course));
|
||||
|
||||
$CFG->courselistshortnames = $oldcfg;
|
||||
}
|
||||
}
|
||||
|
@ -351,6 +351,8 @@ $string['cookiesecure'] = 'Secure cookies only';
|
||||
$string['country'] = 'Default country';
|
||||
$string['coursecontact'] = 'Course contacts';
|
||||
$string['coursecontact_desc'] = 'This setting allows you to control who appears on the course description. Users need to have at least one of these roles in a course to be shown on the course description for that course.';
|
||||
$string['courselistshortnames'] = 'Display short names';
|
||||
$string['courselistshortnames_desc'] = 'Show short name as well as full name when displaying lists of courses.';
|
||||
$string['coursemgmt'] = 'Add/edit courses';
|
||||
$string['courseoverview'] = 'Course overview';
|
||||
$string['courserequestnotify'] = 'Course request notification';
|
||||
|
Loading…
x
Reference in New Issue
Block a user