/** * Block initialization */ public function init() { $this->title = get_string('pluginname', 'block_course_overview_lite'); // Transition old user hidden course preferences. if (is_null(get_user_preferences('block_course_overview_lite_courses_hidden')) && !is_null($userpref = get_user_preferences('eclass_course_overview_courses_hidden'))) { $hiddencourses = unserialize($userpref); block_course_overview_lite_update_courses_hidden($hiddencourses); } else { if (is_null(get_user_preferences('block_course_overview_lite_courses_hidden')) && !is_null($userpref = get_user_preferences('course_overview_lite_courses_hidden'))) { block_course_overview_lite_update_courses_hidden(unserialize($userpref)); } } // Transition old user course order preference. if (is_null(get_user_preferences('block_course_overview_lite_course_order')) && !is_null($userpref = get_user_preferences('course_overview_lite_course_order'))) { set_user_preference('block_course_overview_lite_course_order', json_encode(unserialize($userpref))); } // Transition old user course order preference. if (is_null(get_user_preferences('block_course_overview_lite_number_of_courses')) && !is_null($userpref = get_user_preferences('course_overview_lite_number_of_courses'))) { set_user_preference('block_course_overview_lite_number_of_courses', $userpref); } }
// 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/>. /** * @package block_course_overview_lite * @author Josh Stagg * @copyright 2014 Josh Stagg <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once dirname(__FILE__) . '/../../config.php'; require_once dirname(__FILE__) . '/locallib.php'; require_sesskey(); require_login(); $togglecourse = required_param('toggle_hidden', PARAM_INT); $hiddencourses = block_course_overview_lite_get_courses_hidden(); if (array_key_exists($togglecourse, $hiddencourses) && $hiddencourses[$togglecourse] == true) { unset($hiddencourses[$togglecourse]); } else { $hiddencourses[$togglecourse] = true; } block_course_overview_lite_update_courses_hidden($hiddencourses);