Merge branch 'wip-MDL-40351-master' of https://github.com/marinaglancy/moodle

This commit is contained in:
Sam Hemelryk
2014-10-08 11:36:01 +13:00
5 changed files with 46 additions and 0 deletions
@@ -34,6 +34,7 @@ $string['defaultmaxcoursesdesc'] = 'Maximum courses which should be displayed on
$string['expandall'] = 'Expand all course lists';
$string['forcedefaultmaxcourses'] = 'Force maximum courses';
$string['forcedefaultmaxcoursesdesc'] = 'If set then user will not be able to change his/her personal setting';
$string['fullpath'] = 'Full path';
$string['hiddencoursecount'] = 'You have {$a} hidden course';
$string['hiddencoursecountplural'] = 'You have {$a} hidden courses';
$string['hiddencoursecountwithshowall'] = 'You have {$a->coursecount} hidden course ({$a->showalllink})';
@@ -45,13 +46,17 @@ $string['movecoursehere'] = 'Move course here';
$string['movetofirst'] = 'Move {$a} course to top';
$string['moveafterhere'] = 'Move {$a->movingcoursename} course after {$a->currentcoursename}';
$string['movingcourse'] = 'You are moving: {$a->fullname} ({$a->cancellink})';
$string['none'] = 'None';
$string['numtodisplay'] = 'Number of courses to display: ';
$string['onlyparentname'] = 'Only parent name';
$string['otherexpanded'] = 'Other courses expanded';
$string['pluginname'] = 'Course overview';
$string['preservestates'] = 'Preserve expanded states';
$string['shortnameprefix'] = 'Includes {$a}';
$string['shortnamesufixsingular'] = ' (and {$a} other)';
$string['shortnamesufixprural'] = ' (and {$a} others)';
$string['showcategories'] = 'Show categories';
$string['showcategoriesdesc'] = 'Should categories be displayed for each course boxes?';
$string['showchildren'] = 'Show children';
$string['showchildrendesc'] = 'Should child courses be listed underneath the main course title?';
$string['showwelcomearea'] = 'Show welcome area';
+4
View File
@@ -22,6 +22,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_NONE', '0');
define('BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_ONLY_PARENT_NAME', '1');
define('BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_FULL_PATH', '2');
/**
* Display overview for courses
*
+22
View File
@@ -41,6 +41,10 @@ class block_course_overview_renderer extends plugin_renderer_base {
public function course_overview($courses, $overviews) {
$html = '';
$config = get_config('block_course_overview');
if ($config->showcategories != BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_NONE) {
global $CFG;
require_once($CFG->libdir.'/coursecatlib.php');
}
$ismovingcourse = false;
$courseordernumber = 0;
$maxcourses = count($courses);
@@ -128,6 +132,24 @@ class block_course_overview_renderer extends plugin_renderer_base {
$html .= $this->activity_display($course->id, $overviews[$course->id]);
}
if ($config->showcategories != BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_NONE) {
// List category parent or categories path here.
$currentcategory = coursecat::get($course->category, IGNORE_MISSING);
if ($currentcategory !== null) {
$html .= html_writer::start_tag('div', array('class' => 'categorypath'));
if ($config->showcategories == BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_FULL_PATH) {
foreach ($currentcategory->get_parents() as $categoryid) {
$category = coursecat::get($categoryid, IGNORE_MISSING);
if ($category !== null) {
$html .= $category->get_formatted_name().' / ';
}
}
}
$html .= $currentcategory->get_formatted_name();
$html .= html_writer::end_tag('div');
}
}
$html .= $this->output->box('', 'flush');
$html .= $this->output->box_end();
$courseordernumber++;
+7
View File
@@ -32,4 +32,11 @@ if ($ADMIN->fulltree) {
new lang_string('showchildrendesc', 'block_course_overview'), 1, PARAM_INT));
$settings->add(new admin_setting_configcheckbox('block_course_overview/showwelcomearea', new lang_string('showwelcomearea', 'block_course_overview'),
new lang_string('showwelcomeareadesc', 'block_course_overview'), 1, PARAM_INT));
$showcategories = array(
BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_NONE => new lang_string('none', 'block_course_overview'),
BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_ONLY_PARENT_NAME => new lang_string('onlyparentname', 'block_course_overview'),
BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_FULL_PATH => new lang_string('fullpath', 'block_course_overview')
);
$settings->add(new admin_setting_configselect('block_course_overview/showcategories', new lang_string('showcategories', 'block_course_overview'),
new lang_string('showcategoriesdesc', 'block_course_overview'), BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_NONE, $showcategories));
}
+8
View File
@@ -3,6 +3,14 @@
font-style: italic;
}
.block_course_overview .categorypath{
text-align: right;
}
.dir-rtl .block_course_overview .categorypath{
text-align: left;
}
.block_course_overview .content {
margin: 0 20px;
}