-
Notifications
You must be signed in to change notification settings - Fork 3
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
0 parents
commit 51fa337
Showing
16 changed files
with
1,007 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,48 @@ | ||
# Moodle atto-sharing plugin | ||
|
||
Moodle Atto Sharing is an atto sub-plugin to easily create and integrate Social Sharing button to Moodle atto editor. | ||
|
||
This library helps you generate Sharing Button in Text editor. Generate buttons based on the given URL. | ||
|
||
<img src="https://i.imgur.com/vIlgSDA.png"> | ||
|
||
## Features | ||
- Easy Social Sharing Button integration in Moodle Atto Editor | ||
- Easy to use | ||
|
||
## Configuration | ||
|
||
You can install this plugin from [Moodle plugins directory](https://moodle.org/plugins) or can download from [Github](https://github.com/eLearning-BS23/). | ||
|
||
## Toolbar Settings | ||
``` | ||
Dashboard -> Site administration -> Plugins -> Text editors -> Atto HTML editor -> Atto toolbar settings | ||
``` | ||
<img src="https://i.imgur.com/jiRzncE.png" alt="toolbar-config-settings"/> | ||
|
||
## usages | ||
> After installing the plugin, you can use the plugin by following: | ||
- Go to Atto HTML editor: | ||
- Click on Sharing icon from Toolbar | ||
- Insert Sharing content | ||
- Checked in which social media you want to share and provide the page url that url you want to share. | ||
- Done! | ||
|
||
<img src="https://i.imgur.com/T9NJf6X.png"> | ||
|
||
|
||
|
||
## License | ||
|
||
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 <http://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,43 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Generate the Sharing. | ||
* | ||
* @package atto_sharing | ||
* @copyright 2021 Brain Station 23 Ltd. <brainstation-23.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* | ||
*/ | ||
|
||
define('AJAX_SCRIPT', true); | ||
|
||
global $CFG,$PAGE; | ||
require_once(__DIR__ . '/../../../../../config.php'); | ||
|
||
$contextid = required_param('contextid', PARAM_INT); | ||
$content = required_param('content', PARAM_RAW); | ||
$courseid = required_param('id', PARAM_RAW); | ||
|
||
list($context, $course, $cm) = get_context_info_array($contextid); | ||
|
||
$PAGE->set_url('/lib/editor/atto/plugins/sharing/ajax.php'); | ||
$PAGE->set_context($context); | ||
|
||
require_login($course, false, $cm); | ||
require_sesskey(); | ||
|
||
|
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,81 @@ | ||
<?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/>. | ||
|
||
/** | ||
* This file contains a class that provides functions for generate a QR code. | ||
* | ||
* @package atto_sharing | ||
* @copyright 2021 Brain Station 23 Ltd. <brainstation-23.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace atto_sharing; | ||
|
||
use Endroid\QrCode\Color\Color; | ||
use Endroid\QrCode\Encoding\Encoding; | ||
use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelLow; | ||
use Endroid\QrCode\QrCode; | ||
use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin; | ||
use Endroid\QrCode\Writer\PngWriter; | ||
use DOMDocument; | ||
use Exception; | ||
use stdClass; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
require_once($CFG->dirroot . '/lib/editor/atto/plugins/sharing/thirdparty/vendor/autoload.php'); | ||
require_once($CFG->dirroot . '/course/lib.php'); | ||
|
||
/** | ||
* Class output_image | ||
* | ||
* Output QR code. | ||
* | ||
* @package atto_sharing | ||
* @copyright 2021 Brain Station 23 Ltd. <brainstation-23.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class output_image | ||
{ | ||
/** | ||
* QR code is saved in this file. | ||
* @var string | ||
*/ | ||
protected $file; | ||
|
||
/** | ||
* Output file type. | ||
* 0 - png, 1 - svg | ||
* @var int | ||
*/ | ||
protected $format; | ||
|
||
/** | ||
* Course for which the sharing is created. | ||
* @var stdClass | ||
*/ | ||
protected $context; | ||
|
||
/** | ||
* @param $context | ||
*/ | ||
public function __construct($context) | ||
{ | ||
$this->format = 2; | ||
$this->context = $context; | ||
} | ||
|
||
} |
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,40 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Privacy Subsystem implementation for atto_sharing. | ||
* | ||
* @package atto_sharing | ||
* @copyright 2021 Brain Station 23 Ltd. <brainstation-23.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
namespace atto_sharing\privacy; | ||
|
||
use core_privacy\local\metadata\null_provider; | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
class provider implements null_provider | ||
{ | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function get_reason(): string | ||
{ | ||
return 'privacy:metadata'; | ||
} | ||
} |
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 - 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/>. | ||
|
||
/** | ||
* Language file for atto_sharing. | ||
* | ||
* @package atto_sharing | ||
* @copyright 2021 Brain Station 23 Ltd. <brainstation-23.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* | ||
*/ | ||
|
||
$string["pluginname"] = 'Sharing'; | ||
$string["sharing_settings"] = 'Sharing settings'; | ||
$string["sharing_size"] = 'Size'; | ||
$string["sharing_size_desc"] = 'Height and width of Sharing'; | ||
$string["sharing_margin"] = 'Margin'; | ||
$string["sharing_margin_desc"] = 'Margin for Sharing'; | ||
$string["sharingcontent"] = 'QR code content'; | ||
$string["insertsharing"] = 'Insert Sharing Button'; | ||
$string["backgroundcolor"] = 'Background color (RGBA)'; | ||
$string["forgroungcolor"] = 'Foreground color (RGBA)'; | ||
|
||
|
||
$string["facebook"] = 'Facebook Share'; | ||
$string["linkedin"] = 'Linkedin Share'; | ||
$string["twiter"] = 'Twiter Share'; | ||
$string["googleplus_share"] = 'Gooele Plus Share'; | ||
$string["url"] = 'Sharing URL'; |
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,73 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Atto Sharing library function. | ||
* | ||
* @package atto_sharing | ||
* @copyright 2021 Brain Station 23 Ltd. <brainstation-23.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
/** | ||
* Set params for this plugin. | ||
* @param string $elementid | ||
* @param stdClass $options | ||
* @param stdClass $fpoptions | ||
* @return array | ||
* @throws coding_exception | ||
* @throws dml_exception | ||
*/ | ||
function atto_sharing_params_for_js($elementid, $options, $fpoptions) { | ||
global $USER; | ||
|
||
// Disabled if: | ||
// - Not logged in or guest. | ||
$disabled = !isloggedin() || isguestuser() ; | ||
|
||
$context = $options['context']; | ||
if (!$context) { | ||
$context = context_system::instance(); | ||
} | ||
|
||
return array( | ||
'disabled' => $disabled, | ||
'contextid' => $context->id | ||
); | ||
|
||
} | ||
|
||
/** | ||
* Initialise the js strings required for this module. | ||
*/ | ||
function atto_sharing_strings_for_js() { | ||
global $PAGE; | ||
|
||
$PAGE->requires->strings_for_js( | ||
array( | ||
'pluginname', | ||
'facebook', | ||
'twiter', | ||
'linkedin', | ||
'insertsharing', | ||
'url', | ||
), | ||
'atto_sharing' | ||
); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,31 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Moodle global Settings file for atto_sharing. | ||
* | ||
* @package atto_sharing | ||
* @copyright 2021 Brain Station 23 Ltd. <brainstation-23.com> | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
* | ||
*/ | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
|
||
$ADMIN->add('editoratto', new admin_category('atto_sharing', new lang_string('sharing_settings', 'atto_sharing'))); | ||
|
||
if ($ADMIN->fulltree) { | ||
} |
Oops, something went wrong.