diff --git a/CHANGES.md b/CHANGES.md index ba39284cd619b8ff1af778f7e859580c9389d478..d967dbbfae37c511a97940447f669755d0dab266 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2018-03-06 - pix_url() is deprecated in Moodle 3.3, change to pix_icon() and fontawesome icons. * 2017-12-12 - Prepare compatibility for Moodle 3.3, no functionality change. ### v3.2-r6 diff --git a/block_course_overview_campus.php b/block_course_overview_campus.php index 804a8dddeb103abab3895ded15ef322540860670..d040c816e34e234b229993d1e63c10743d163b75 100644 --- a/block_course_overview_campus.php +++ b/block_course_overview_campus.php @@ -1213,23 +1213,15 @@ class block_course_overview_campus extends block_base { // If course news are hidden. if ($c->hidenews == false) { echo '<div class="hidenewsicon"> - <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidenews' => $c->id, 'coc-shownews' => '')).'" id="coc-hidenewsicon-'.$c->id.'" title="'.get_string('hidenews', 'block_course_overview_campus').'"> - <img src="'.$OUTPUT->pix_url('t/expanded').'" alt="'.get_string('hidenews', 'block_course_overview_campus').'" /> - </a> - <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidenews' => '', 'coc-shownews' => $c->id)).'" id="coc-shownewsicon-'.$c->id.'" class="coc-hidden" title="'.get_string('shownews', 'block_course_overview_campus').'"> - <img src="'.$OUTPUT->pix_url('t/collapsed').'" alt="'.get_string('shownews', 'block_course_overview_campus').'" /> - </a> + <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidenews' => $c->id, 'coc-shownews' => '')).'" id="coc-hidenewsicon-'.$c->id.'" title="'.get_string('hidenews', 'block_course_overview_campus').'">'.$OUTPUT->pix_icon('expanded', get_string('hidenews', 'block_course_overview_campus'), 'block_course_overview_campus').'</a> + <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidenews' => '', 'coc-shownews' => $c->id)).'" id="coc-shownewsicon-'.$c->id.'" class="coc-hidden" title="'.get_string('shownews', 'block_course_overview_campus').'">'.$OUTPUT->pix_icon('collapsed', get_string('shownews', 'block_course_overview_campus'), 'block_course_overview_campus').'</a> </div>'; } // If course news are visible. else { echo '<div class="hidenewsicon"> - <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidenews' => $c->id, 'coc-shownews' => '')).'" id="coc-hidenewsicon-'.$c->id.'" class="coc-hidden" title="'.get_string('hidenews', 'block_course_overview_campus').'"> - <img src="'.$OUTPUT->pix_url('t/expanded').'" alt="'.get_string('hidenews', 'block_course_overview_campus').'" /> - </a> - <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidenews' => '', 'coc-shownews' => $c->id)).'" id="coc-shownewsicon-'.$c->id.'" title="'.get_string('shownews', 'block_course_overview_campus').'"> - <img src="'.$OUTPUT->pix_url('t/collapsed').'" alt="'.get_string('shownews', 'block_course_overview_campus').'" /> - </a> + <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidenews' => $c->id, 'coc-shownews' => '')).'" id="coc-hidenewsicon-'.$c->id.'" class="coc-hidden" title="'.get_string('hidenews', 'block_course_overview_campus').'">'.$OUTPUT->pix_icon('expanded', get_string('hidenews', 'block_course_overview_campus'), 'block_course_overview_campus').'</a> + <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidenews' => '', 'coc-shownews' => $c->id)).'" id="coc-shownewsicon-'.$c->id.'" title="'.get_string('shownews', 'block_course_overview_campus').'">'.$OUTPUT->pix_icon('collapsed', get_string('shownews', 'block_course_overview_campus'), 'block_course_overview_campus').'</a> </div>'; } } @@ -1240,23 +1232,15 @@ class block_course_overview_campus extends block_base { // If course is hidden. if (block_course_overview_campus_course_hidden_by_hidecourses($c, 0) == false) { // We can't rely on $c->hidecourse here because otherwise the icon would always be t/show. echo '<div class="hidecourseicon"> - <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidecourse' => $c->id, 'coc-showcourse' => '')).'" id="coc-hidecourseicon-'.$c->id.'" title="'.get_string('hidecourse', 'block_course_overview_campus').'"> - <img src="'.$OUTPUT->pix_url('t/hide').'" class="icon" alt="'.get_string('hidecourse', 'block_course_overview_campus').'" /> - </a> - <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidecourse' => '', 'coc-showcourse' => $c->id)).'" id="coc-showcourseicon-'.$c->id.'" class="coc-hidden" title="'.get_string('showcourse', 'block_course_overview_campus').'"> - <img src="'.$OUTPUT->pix_url('t/show').'" class="icon" alt="'.get_string('showcourse', 'block_course_overview_campus').'" /> - </a> + <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidecourse' => $c->id, 'coc-showcourse' => '')).'" id="coc-hidecourseicon-'.$c->id.'" title="'.get_string('hidecourse', 'block_course_overview_campus').'">'.$OUTPUT->pix_icon('hide', get_string('hidecourse', 'block_course_overview_campus'), 'block_course_overview_campus').'</a> + <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidecourse' => '', 'coc-showcourse' => $c->id)).'" id="coc-showcourseicon-'.$c->id.'" class="coc-hidden" title="'.get_string('showcourse', 'block_course_overview_campus').'">'.$OUTPUT->pix_icon('show', get_string('showcourse', 'block_course_overview_campus'), 'block_course_overview_campus').'</a> </div>'; } // If course is visible. else { echo '<div class="hidecourseicon"> - <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidecourse' => $c->id, 'coc-showcourse' => '')).'" id="coc-hidecourseicon-'.$c->id.'" class="coc-hidden" title="'.get_string('hidecourse', 'block_course_overview_campus').'"> - <img src="'.$OUTPUT->pix_url('t/hide').'" class="icon" alt="'.get_string('hidecourse', 'block_course_overview_campus').'" /> - </a> - <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidecourse' => '', 'coc-showcourse' => $c->id)).'" id="coc-showcourseicon-'.$c->id.'" title="'.get_string('showcourse', 'block_course_overview_campus').'"> - <img src="'.$OUTPUT->pix_url('t/show').'" class="icon" alt="'.get_string('showcourse', 'block_course_overview_campus').'" /> - </a> + <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidecourse' => $c->id, 'coc-showcourse' => '')).'" id="coc-hidecourseicon-'.$c->id.'" class="coc-hidden" title="'.get_string('hidecourse', 'block_course_overview_campus').'">'.$OUTPUT->pix_icon('hide', get_string('hidecourse', 'block_course_overview_campus'), 'block_course_overview_campus').'</a> + <a href="'.$CFG->wwwroot.$PAGE->url->out_as_local_url(true, array('coc-manage' => $param_manage, 'coc-hidecourse' => '', 'coc-showcourse' => $c->id)).'" id="coc-showcourseicon-'.$c->id.'" title="'.get_string('showcourse', 'block_course_overview_campus').'">'.$OUTPUT->pix_icon('show', get_string('showcourse', 'block_course_overview_campus'), 'block_course_overview_campus').'</a> </div>'; } } diff --git a/lib.php b/lib.php new file mode 100644 index 0000000000000000000000000000000000000000..cd4a0727635c274154a01f5cd5fafebb8a365edd --- /dev/null +++ b/lib.php @@ -0,0 +1,37 @@ +<?php +// This file is part of Moodle - http://moodle.org/ +// +// Moodle is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Moodle is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see <http://www.gnu.org/licenses/>. + +/** + * Block "course overview (campus)" - library + * + * @package block_course_overview_campus + * @copyright 2013 Alexander Bias, Ulm University <alexander.bias@uni-ulm.de> + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +/** + * Get icon mapping for font-awesome. + */ +function block_course_overview_campus_get_fontawesome_icon_map() { + return [ + 'block_course_overview_campus:expanded' => 'fa-minus-square', + 'block_course_overview_campus:collapsed' => 'fa-plus-square', + 'block_course_overview_campus:hide' => 'fa-toggle-on fa-lg', + 'block_course_overview_campus:show' => 'fa-toggle-off fa-lg', + ]; +} diff --git a/pix/collapsed.png b/pix/collapsed.png new file mode 100644 index 0000000000000000000000000000000000000000..d971d4f15af2ddada7254e9128915bbdebe7a636 Binary files /dev/null and b/pix/collapsed.png differ diff --git a/pix/collapsed.svg b/pix/collapsed.svg new file mode 100644 index 0000000000000000000000000000000000000000..77c429504e6758136f85e3e8f52d4ba8322ed84a --- /dev/null +++ b/pix/collapsed.svg @@ -0,0 +1,3 @@ +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ + <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/"> +]><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="-5 -2.1 16 16" preserveAspectRatio="xMinYMid meet" overflow="visible"><path d="M.7.2C.3-.2 0 0 0 .5v10.8c0 .5.3.7.7.3l5-5c.4-.4.4-1 0-1.4l-5-5z" fill="#999"/></svg> \ No newline at end of file diff --git a/pix/expanded.png b/pix/expanded.png new file mode 100644 index 0000000000000000000000000000000000000000..fb0550a6632d6c80e4c86edef4852d271120bd65 Binary files /dev/null and b/pix/expanded.png differ diff --git a/pix/expanded.svg b/pix/expanded.svg new file mode 100644 index 0000000000000000000000000000000000000000..2f7e463403dce21393d97034b8f0c790aed3d53f --- /dev/null +++ b/pix/expanded.svg @@ -0,0 +1,3 @@ +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ + <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/"> +]><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="-2.1 -5 16 16" preserveAspectRatio="xMinYMid meet" overflow="visible"><path d="M.5 0C0 0-.2.3.2.7l5 5c.4.4 1 .4 1.4 0l5-5c.4-.4.3-.7-.3-.7H.5z" fill="#999"/></svg> \ No newline at end of file diff --git a/pix/hide.png b/pix/hide.png new file mode 100644 index 0000000000000000000000000000000000000000..290685e8a2f0a18f3dba5e5dec7be434d97bae1e Binary files /dev/null and b/pix/hide.png differ diff --git a/pix/hide.svg b/pix/hide.svg new file mode 100644 index 0000000000000000000000000000000000000000..1b717f76b160372ee85fc018ca2f3208a797fd9e --- /dev/null +++ b/pix/hide.svg @@ -0,0 +1,3 @@ +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ + <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/"> +]><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 -1.8 12 12" preserveAspectRatio="xMinYMid meet" overflow="visible"><path d="M6 0C2.8 0 0 2.6 0 4.2s2.8 4.2 6 4.2 6-2.6 6-4.2S9.2 0 6 0zM2 4.2c.2-.4 1.4-1.6 3-2-.8.3-1.3 1.1-1.3 2 0 .9.5 1.7 1.3 2.1-1.6-.4-2.8-1.6-3-2.1zm3.1-.1c-.4 0-.8-.3-.8-.8s.3-.8.8-.8.8.3.8.8-.4.8-.8.8zM7 6.3c.8-.4 1.3-1.2 1.3-2.1 0-.9-.5-1.7-1.3-2.1 1.6.5 2.8 1.7 3 2.1-.2.5-1.4 1.7-3 2.1z" fill="#999"/></svg> \ No newline at end of file diff --git a/pix/show.png b/pix/show.png new file mode 100644 index 0000000000000000000000000000000000000000..ed3fb4bb02b3443307203bf87d73636b1207ac64 Binary files /dev/null and b/pix/show.png differ diff --git a/pix/show.svg b/pix/show.svg new file mode 100644 index 0000000000000000000000000000000000000000..c794d6715e7930ea8212f69d5d19a413f9b128d6 --- /dev/null +++ b/pix/show.svg @@ -0,0 +1,3 @@ +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ + <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/"> +]><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" preserveAspectRatio="xMinYMid meet" overflow="visible"><path d="M11.5 4.7c.3.5.5.9.5 1.3 0 1.6-2.8 4.2-6 4.2l5.5-5.5zM12 0v2.8L2.8 12H0l2.7-2.7C1.1 8.4 0 7 0 6c0-1.6 2.8-4.2 6-4.2 1.2 0 2.3.4 3.3.9L12 0zM7.1 3.9c.2.1.4.3.5.5l.2-.2c-.2-.1-.5-.2-.7-.3zm-2 .4c-.4 0-.8.3-.8.8s.3.8.8.8.8-.3.8-.8-.4-.8-.8-.8zm-.9 3.5l.2-.2c-.5-.4-.7-1-.7-1.6 0-.9.5-1.7 1.3-2.1-1.6.4-2.8 1.6-3 2.1.2.4 1 1.3 2.2 1.8z" fill="#999"/></svg> \ No newline at end of file diff --git a/styles.css b/styles.css index f2c74627a5d9597401ee267de8a7f46db88d4186..f1dc8f3c4e088e3b242aa5c133069a968041e242 100644 --- a/styles.css +++ b/styles.css @@ -8,6 +8,10 @@ float: left; } +.block_course_overview_campus a:first-of-type > .icon { + margin-left: inherit; /* Get rid of a unneeded Moodle core behaviour here */ +} + /* Used for hiding courses and news in courselist */ .coc-hidden { @@ -40,7 +44,7 @@ /* Course list appearance */ #coc-courselist .coursebox h3 { margin: 0; /* Remove standard margin from h3 heading*/ - padding: 0 0 0 20px; /* Add left padding to place the course news icon there */ + padding: 0 0 0 30px; /* Add left padding to place the course news icon there */ } #coc-courselist .coc-metainfo { @@ -53,7 +57,7 @@ /* Course news appearance */ #coc-courselist .coc-coursenews { border-left: 1px dashed lightgrey; - margin: 10px 0 0 30px; + margin: 10px 0 0 40px; padding: 0 0 0 10px; } diff --git a/version.php b/version.php index 2a34afb3e228bd59584b087fa0085103e7ea333f..1cf97eb7c915ee5d2812b4c4722c9758b25c854f 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'block_course_overview_campus'; -$plugin->version = 2017063000; +$plugin->version = 2018030600; $plugin->release = 'v3.2-r6'; $plugin->requires = 2017051500; $plugin->maturity = MATURITY_STABLE;