Skip to content
Snippets Groups Projects
Commit 11f69f17 authored by John Hoopes's avatar John Hoopes
Browse files

updating the course overview block to include a configurable news field, plus...

updating the course overview block to include a configurable news field, plus adding of a "create new course" link
parent 7b511b00
No related branches found
No related tags found
No related merge requests found
......@@ -94,6 +94,13 @@ class block_course_overview_uwmoodle extends block_base {
$msgcount = message_count_unread_messages();
$this->content->text = $renderer->welcome_area($msgcount);
}
// next render the news section if there is any content
if(!empty($config->news)){
$this->content->text .= $renderer->render_news($config->news);
}
// Finally render the legend
$this->content->text .= $renderer->render_create_course_and_legend();
$usephp = optional_param('usephp', '', PARAM_ALPHA);
IF(empty($usephp)){ // set up course blocks, but then let ajax load courses
......
......@@ -59,3 +59,7 @@ $string['youhavemessages'] = 'You have {$a} unread ';
$string['youhavenomessages'] = 'You have no unread ';
$string['nojavascript'] = 'Javascript is not enabled on this page. Click this link to load the block';
$string['news'] = 'News';
$string['news_desc'] = 'Configurable text that will show above the courses section but below the welcome area';
$string['create_course'] = 'Click here to create a new course';
......@@ -288,14 +288,59 @@ class block_course_overview_uwmoodle_renderer extends plugin_renderer_base {
$output .= $this->output->box('', 'flush');
$output .= $this->output->box_end();
$output .= html_writer::start_tag('div', array('class'=>'legend'));
$output .= html_writer::tag('div', get_string('moodle_legend', 'block_my_course_links'), array('class'=>'Moodle-icon'));
$output .= html_writer::tag('div', get_string('d2l_legend', 'block_my_course_links'), array('class'=>'D2L-icon'));
$output .= html_writer::end_tag('div');
return $output;
}
/**
* Renders the news
*
* @param string $news
* @return string HTML of the news section
*/
public function render_news($news){
$output = $this->output->box_start('news_area');
$output .= $news;
$output .= $this->output->box_end();
return $output;
}
/**
* Renders legend section
*
* @return string HTML of the legend
*/
public function render_create_course_and_legend(){
global $CFG;
$output = '';
$output .= html_writer::start_tag('div', array('class', 'course_overview_info'));
if(file_exists($CFG->dirroot . '/enrol/wisc/accesslib.php')){
require_once($CFG->dirroot . '/enrol/wisc/accesslib.php');
}
if(function_exists('wisc_can_create_course')){
if(wisc_can_create_course()){
$createcourselink = new moodle_url('/enrol/wisc/create.php');
$output .= html_writer::start_tag('div', array('class'=>'createcourse'));
$output .= html_writer::link($createcourselink,
get_string('create_course', 'block_course_overview_uwmoodle'));
$output .= html_writer::end_tag('div');
}
}
$output .= html_writer::start_tag('div', array('class'=>'legend'));
$output .= html_writer::tag('div', get_string('moodle_legend', 'block_my_course_links'), array('class'=>'Moodle-icon'));
$output .= html_writer::tag('div', get_string('d2l_legend', 'block_my_course_links'), array('class'=>'D2L-icon'));
$output .= html_writer::end_tag('div');
$output .= html_writer::end_tag('div');
return $output;
}
/**
* The course block as it renders when using the AJAX functionality
*
......
......@@ -17,8 +17,9 @@
/**
* course_overview block settings
*
* @package block_course_overview
* @package block_course_overview_uwmoodle
* @copyright 2012 Adam Olley <adam.olley@netspot.com.au>
* @copyright 2014 Univrsity of Wisconsin System - Board of Regents
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
......@@ -26,4 +27,12 @@ defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configcheckbox('block_course_overview_uwmoodle/showwelcomearea', new lang_string('showwelcomearea', 'block_course_overview_uwmoodle'),
new lang_string('showwelcomeareadesc', 'block_course_overview_uwmoodle'), 1));
// my page news setting.
$name = 'block_course_overview_uwmoodle/news';
$title = get_string('news', 'block_course_overview_uwmoodle');
$description = get_string('news_desc', 'block_course_overview_uwmoodle');
$default = '';
$setting = new admin_setting_confightmleditor($name, $title, $description, $default);
$settings->add($setting);
}
......@@ -311,8 +311,9 @@
.block_course_overview_uwmoodle .legend{
content: "";
width: 100%;
margin-bottom: 10px;
display: inline-block;
float: right;
}
.block_course_overview_uwmoodle .legend div{
......@@ -323,3 +324,15 @@
.block_course_overview_uwmoodle .course_title a.dimmed{
color: #999;
}
.block_course_overview_uwmoodle .createcourse{
display: inline-block;
margin-bottom: 10px;
}
.block_course_overview_uwmoodle .news_area{
border: 1px solid;
padding: 5px;
margin-bottom: 10px;
background-color: white;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment