-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9f167d
commit 1532793
Showing
28 changed files
with
1,024 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Background Colour Accessibility Widget # | ||
|
||
Requires [local_accessiblity](https://github.com/ponlawat-w/moodle-local_accessibility) to be installed and enabled. | ||
|
||
This plugin allows user to customise their background colour in a Moodle site. | ||
|
||
## Installing via uploaded ZIP file ## | ||
|
||
1. Log in to your Moodle site as an admin and go to _Site administration > | ||
Plugins > Install plugins_. | ||
2. Upload the ZIP file with the plugin code. You should only be prompted to add | ||
extra details if your plugin type is not automatically detected. | ||
3. Check the plugin validation report and finish the installation. | ||
|
||
## Installing manually ## | ||
|
||
The plugin can be also installed by putting the contents of this directory to | ||
|
||
{your/moodle/dirroot}/local/accessibility/widgets | ||
|
||
Afterwards, log in to your Moodle site as an admin and go to _Site administration > | ||
Notifications_ to complete the installation. | ||
|
||
Alternatively, you can run | ||
|
||
$ php admin/cli/upgrade.php | ||
|
||
to complete the installation from the command line. | ||
|
||
## License ## | ||
|
||
2023 Ponlawat Weerapanpisit <[email protected]> | ||
|
||
This program 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. | ||
|
||
This program 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 | ||
this program. If not, see <https://www.gnu.org/licenses/>. |
65 changes: 65 additions & 0 deletions
65
widgets/backgroundcolour/accessibility_backgroundcolour.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Widget definition | ||
* | ||
* @package accessibility_backgroundcolour | ||
* @copyright 2023 Ponlawat Weerapanpisit <[email protected]> | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace local_accessibility\widgets; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
require_once(__DIR__ . '/../../classes/colourwidget.php'); | ||
|
||
/** | ||
* Background colour accessibility widget definition | ||
*/ | ||
class backgroundcolour extends colourwidget { | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
public function __construct() { | ||
parent::__construct(get_string('pluginname', 'accessibility_backgroundcolour'), 'backgroundcolour'); | ||
} | ||
|
||
/** | ||
* Initialisation | ||
* | ||
* @return void | ||
*/ | ||
public function init() { | ||
global $PAGE; | ||
/** @var \moodle_page $PAGE */ $PAGE; | ||
|
||
$userconfig = $this->getuserconfig(); | ||
if ($userconfig) { | ||
$this->addbodyclass('accessibility-backgroundcolour'); | ||
$PAGE->requires->css('/local/accessibility/widgets/backgroundcolour/styles.php'); | ||
} | ||
|
||
$PAGE->requires->js_call_amd('local_accessibility/colourwidget', 'init', [ | ||
$this->getfullname(), | ||
$this->name, | ||
'background-color', | ||
'accessibility-backgroundcolour', | ||
]); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
widgets/backgroundcolour/lang/en/accessibility_backgroundcolour.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Language strings | ||
* | ||
* @package accessibility_backgroundcolour | ||
* @copyright 2023 Ponlawat Weerapanpisit <[email protected]> | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
$string['pluginname'] = 'Background Colour'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* This will return CSS style text to be added to Moodle page that will overwrite default theme by user configuration | ||
* | ||
* @package accessibility_backgroundcolour | ||
* @copyright 2023 Ponlawat Weerapanpisit <[email protected]> | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
require_once(__DIR__ . '/../../../../config.php'); // @codingStandardsIgnoreLine ignore login check as guest is also allowed. | ||
header('Content-Type: text/css'); | ||
|
||
require_once(__DIR__ . '/../../lib.php'); | ||
require_once(__DIR__ . '/accessibility_backgroundcolour.php'); | ||
|
||
$widget = new local_accessibility\widgets\backgroundcolour(); | ||
|
||
$userconfig = $widget->getuserconfig(); | ||
if (!$userconfig) { | ||
exit; | ||
} | ||
|
||
echo <<<EOL | ||
body.accessibility-backgroundcolour, body.accessibility-backgroundcolour *:not(.mediaplugin, .mediaplugin *) { | ||
background-color: {$userconfig} !important; | ||
} | ||
EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Plugin version and other meta-data are defined here. | ||
* | ||
* @package accessibility_backgroundcolour | ||
* @copyright 2023 Ponlawat Weerapanpisit <[email protected]> | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
$plugin->component = 'accessibility_backgroundcolour'; | ||
$plugin->release = '1.0.2'; | ||
$plugin->version = 2024041600; | ||
$plugin->requires = 2022041900; | ||
$plugin->maturity = MATURITY_STABLE; | ||
$plugin->dependencies = [ | ||
'local_accessibility' => 2023071300, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Font Face Accessibility Widget # | ||
|
||
Requires [local_accessiblity](https://github.com/ponlawat-w/moodle-local_accessibility) to be installed and enabled. | ||
|
||
This plugin allows user to customise their font face family in a Moodle site. | ||
|
||
## Installing via uploaded ZIP file ## | ||
|
||
1. Log in to your Moodle site as an admin and go to _Site administration > | ||
Plugins > Install plugins_. | ||
2. Upload the ZIP file with the plugin code. You should only be prompted to add | ||
extra details if your plugin type is not automatically detected. | ||
3. Check the plugin validation report and finish the installation. | ||
|
||
## Installing manually ## | ||
|
||
The plugin can be also installed by putting the contents of this directory to | ||
|
||
{your/moodle/dirroot}/local/accessibility/widgets | ||
|
||
Afterwards, log in to your Moodle site as an admin and go to _Site administration > | ||
Notifications_ to complete the installation. | ||
|
||
Alternatively, you can run | ||
|
||
$ php admin/cli/upgrade.php | ||
|
||
to complete the installation from the command line. | ||
|
||
## License ## | ||
|
||
2023 Ponlawat Weerapanpisit <[email protected]> | ||
|
||
This program 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. | ||
|
||
This program 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 | ||
this program. If not, see <https://www.gnu.org/licenses/>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Widget definition | ||
* | ||
* @package accessibility_fontface | ||
* @copyright 2023 Ponlawat Weerapanpisit <[email protected]> | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace local_accessibility\widgets; | ||
|
||
/** | ||
* Font face accessibility widget definition | ||
*/ | ||
class fontface extends widgetbase { | ||
/** | ||
* Constructor | ||
*/ | ||
public function __construct() { | ||
parent::__construct(get_string('pluginname', 'accessibility_fontface'), 'fontface'); | ||
} | ||
|
||
/** | ||
* Initialisation | ||
* | ||
* @return void | ||
*/ | ||
public function init() { | ||
global $PAGE; | ||
|
||
$userconfig = $this->getuserconfig(); | ||
if ($userconfig) { | ||
$this->addbodyclass('accessibility-fontface-' . $userconfig); | ||
} | ||
|
||
/** @var \moodle_page $PAGE */ | ||
$PAGE->requires->js_call_amd('accessibility_fontface/script', 'init'); | ||
} | ||
|
||
/** | ||
* Get widget content | ||
* | ||
* @return void | ||
*/ | ||
public function getcontent() { | ||
global $OUTPUT; | ||
/** @var \core_renderer $OUTPUT */ $OUTPUT; | ||
return $OUTPUT->render_from_template('accessibility_fontface/default', []); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.