community block MDL-23040 display licence on course listing

This commit is contained in:
jerome mouneyrac 2010-07-12 07:30:08 +00:00
parent e1d4da0507
commit 437c2b858c
2 changed files with 14 additions and 3 deletions

View File

@ -29,7 +29,7 @@ $string['add'] = 'Add';
$string['addtocommunityblock'] = 'Add to community block';
$string['addcommunitycourse'] = 'Add community course';
$string['additionalcoursedesc'] = '{$a->lang} Creator: {$a->creatorname} - Publisher: {$a->publishername} - Subject: {$a->subject}
- Audience: {$a->audience} - Educational level: {$a->educationallevel}';
- Audience: {$a->audience} - Educational level: {$a->educationallevel} - License: {$a->license}';
$string['addcourse'] = 'Search';
$string['audience'] = 'Designed for';
$string['audience_help'] = 'What kind of course are you looking for? As well as traditional courses intended for students, you might search for communities of Educators or Moodle Administrators';

View File

@ -126,16 +126,27 @@ class block_community_renderer extends plugin_renderer_base {
$additionaldesc .= ' - ';
}
//retrieve language string
//construct languages array
if (!empty($course->language)) {
$languages = get_string_manager()->get_list_of_languages();
$course->lang = get_string('langdesc', 'block_community', $languages[$course->language]);
} else {
$course->lang = '';
}
//licence
require_once($CFG->dirroot . "/lib/licenselib.php");
$licensemanager = new license_manager();
$licenses = $licensemanager->get_licenses();
foreach ($licenses as $license) {
if ($license->shortname == $course->licenceshortname) {
$course->license = $license->fullname;
}
}
$additionaldesc .= get_string('additionalcoursedesc', 'block_community', $course);
$deschtml .= html_writer::tag('span', $additionaldesc, array('class' => 'additionaldesc'));
//add content to the course description
if (!empty($course->contents)) {