General plugins (Local): Resource notification

local_resourcenotif
Maintained by Picture of Guillaume Allègre Guillaume Allègre
This Moodle plugin allows a teacher to notify course students by internal messaging when a new resource/activity is created or modified into a course.
160 sites
243 downloads
27 fans

 Purpose
This Moodle plugin allows a teacher to notify course students by messaging when a new resource/activity is created or modified into a course.

The notification is activated by an action performed by the teacher.
This new action is shown in a new entry at the end of the Edit dropdown menu, available for each resource or activity, on a course page.

The notification message contains two links by default, one to the resource, and the other to the course.
The Moodle admin can modify this default setting.
The teacher can change the text to send.                                                                                       

The teacher can control who the message is sent to, by default all the users enrolled into the course and allowed to view the resource.
The notification conforms to resource access restrictions such as course groups.

Requirements
Moodle 3.0 is required.

Installation

  • Unpack or `git clone` under `local/`.
  • Install the plugin into Moodle with either by typing `php admin/cli/upgrade.php` (CLI) or by visiting '/admin/index.php' (web).
  • If you want additional translations (for example french), you may want to upgrade your language pack (doc).


Credits
This plugin was developped by Silecs and initially sponsored by Université Paris 1 Panthéon-Sorbonne, France in 2013.
Additional enhancements and migration to Moodle 3.0 were sponsored by Xi’an Jiaotong-Liverpool University (XJTLU), China in 2016, then in 2018 by IFMS Valenciennes (France) for the Boost upgrade.

Portuguese translations are contributed by Dinis Medeiros.


Screenshots

Screenshot #0
Screenshot #1
Screenshot #2

Contributors

Picture of Guillaume Allègre
Guillaume Allègre (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Diego Racero
    Wed, 10 May 2017, 7:05 AM
    Hi, I jus installed de plugin but I was not able to see the icon in the Edit drop down menu. I checked the folder and the plugin is in the right folder, I was able to see the configuration in local plugin pane but nothing happened in the drop down edit menu. ¿Could you give some advice in order to solved this problem?
  • Picture of Benoît Lathière
    Thu, 25 May 2017, 1:41 AM
    Hello,
    I just fixed Javascript lines in the 'lib.php' to be reflecting the Moodle 3.2 html menu elements.
    Guillaume, do You want the patch to publish a 3.2 version of your module?
    Thanks for your work.
    Regards,
  • Picture of Pak Guru
    Mon, 17 Jul 2017, 9:41 AM
    Hi Beniot, can you show us what did you do to lib.php in order to make it compatible in Moodle 3.2? thank before.
  • Picture of Arkadiusz Malkowski
    Fri, 28 Jul 2017, 9:11 AM
    Hi
    Here, my patch lib.php to be see element in edit menu on theme Boots
    Copy, paste to file lib.php
    <?php
    /**
    * @package local_resourcenotif
    * @copyright 2012-2016 Silecs {@link http://www.silecs.info/societe}
    * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
    */

    function local_resourcenotif_extend_navigation_course() {
    global $OUTPUT, $PAGE;

    $html =''
    . $OUTPUT->pix_icon('t/email', get_string("notifications"), 'moodle', array('class' => 'iconsmall', 'title' => ''))
    . '' . htmlspecialchars(get_string("notifications")) . ''
    . '
    ';
    $enc = json_encode($html);

    $PAGE->requires->js_init_code(<< var activities = document.querySelectorAll('div[role="menu"]');
    if (activities) {
    for (var i = 0; i < activities.length; i++) {
    var ul = activities[i];
    var owner = ul.parentNode.parentNode.parentNode.getAttribute('data-owner');
    if (owner) {
    var id = owner.replace(/^#module-/, '');
    ul.insertAdjacentHTML('beforeend', $enc.replace('123XYZ321', id));
    }
    }
    }
    EOJS
    , true);
    }
  • Picture of Yezi Yang
    Thu, 3 Aug 2017, 1:57 PM
    Hi,

    Our institution is using the resource notification plugin since the last academic year. It is very welcomed by teachers and students. However, I found the plugin cannot be visible under Boost theme in Moodle 3.3.1. But Boost theme is the core theme in Moodle 3.3. now. Could you fix the problem soon, please?
  • Picture of Benoît Lathière
    Wed, 4 Oct 2017, 10:50 PM
    Hi, the Arkadiusz solution is good.
    You can try another approach for Moodle 3.3, the offical method to call JS (passed in 3.2, not testes in 3.3) :

    [file lib.php] <?php
    /**
    * @package local_resourcenotif
    * @copyright 2012-2016 Silecs {@link http://www.silecs.info/societe}
    * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
    */
    function local_resourcenotif_extend_navigation_course($settingsnav, $context) {
    global $OUTPUT, $PAGE;
    $html = " . "href='" . htmlspecialchars(new moodle_url('/local/resourcenotif/resourcenotif.php', array('id' => '123XYZ321')))."' "
    . "title='" . htmlspecialchars(get_string("notifications")) . "'>"
    . $OUTPUT->pix_icon('t/email', get_string("notifications"), 'moodle', array('class' => 'iconsmall', 'title' => ''))
    . "" . htmlspecialchars(get_string("notifications")) . ""
    . "";
    $PAGE->requires->js_call_amd('local_resourcenotif/script', 'init', array($html));
    }

    [file amd/src/script.js]
    // Put this file in path/to/plugin/amd/src
    // You can call it anything you like
    /* eslint no-unused-vars: "off", max-len: "off", no-tabs:"off"*/
    define(['jquery', 'jqueryui'], function($) {
    return {
    init: function(html) {
    var activities = $('.section-cm-edit-actions div[role="menu"]');
    if (activities) {
    for (var i = 0; i < activities.length; i++) {
    var ul = activities[i];
    var owner = ul.parentNode.parentNode.parentNode.getAttribute('data-owner');
    if(owner) {
    var id = owner.replace(/^#module-/, '');
    ul.innerHTML += html.replace('123XYZ321', id);
    }
    }
    }
    }
    };
    });

    [file amd/build/script.min.js]
    define(["jquery","jqueryui"],function(a){return{init:function(b){var c=a('.section-cm-edit-actions div[role="menu"]');if(c)for(var d=0;d


    Best regards,
    Benoit.

  • Picture of tamas erdelyi
    Mon, 11 Dec 2017, 7:51 PM
    Hey, would like to apply the patch in Moodle 3.3, but there is no lib.php, should I paste this into lib_resourcenotif.php? By the way I have german language in Moodle. Thanks!!
  • Picture of Benoît Lathière
    Mon, 11 Dec 2017, 10:03 PM
    Hello!
    There is a 'lib.php' file in the original Silecs's version (downloadable from this page). The function need to be fixed for Moodle 3.2 (and maybe above).
    cheers. My code is more simple than the original one, and works well on Moodle 3.2.
  • Picture of tamas erdelyi
    Mon, 11 Dec 2017, 10:36 PM
    Sorry I don´t understand, I just put a file named lib.php into /local/resourcenotif with the script content above, nothing changed, did I forgot something? thanks tom
  • Picture of Benoît Lathière
    Mon, 11 Dec 2017, 11:07 PM
    I don't understand your message. There is already a 'lib.php' in the zip available this page.
    I can't help You more sad
  • Picture of tamas erdelyi
    Mon, 11 Dec 2017, 11:50 PM
    now I get it sorry, I always tried with github, thanks a lot!!!
  • Picture of tamas erdelyi
    Mon, 11 Dec 2017, 11:59 PM
    tried it, not working with 3.3, may have to wait, thanks anyway!
  • Picture of Radoslav Bielik
    Wed, 14 Mar 2018, 5:39 AM
    I've set this up successfully on a Moodle 3.4 site today after a bit of testing - this is an older site still using the "Clean" theme. Version 2016081801of the plugin worked out of the box, although the rendering of the menu item was a few pixels off to the left. This can be fixed by editing lib.php and dropping the "iconsmall" style - deleting the following snippet of code (if anyone is facing the same issue):
    'class' => 'iconsmall',

    It doesn't work with the "Boost" theme, at least on Moodle 3.4, but the newer GitHub fork by Vertmo works with that one (but not with the "Clean" theme - so pick the one you need). It can be cloned from here: https://github.com/Vertmo/moodle-local-resourcenotif

    This is essentially the same version that Benoît posted above on Oct 4, 2017 (there are some minor differences, but the version pasted in the comment above didn't work for me - it seems one line of code is missing).

    Hopefully this will help someone. Ideally, the plugin will be upgraded at some point by the author - it's a very useful one so let's hope! smile
  • Picture of Ejiro Ekpogbe
    Thu, 29 Mar 2018, 7:18 PM
    Hello Benoit,
    I have followed your instructions but still wasn't successful. I am using the Boost theme Fordson, Moodle 3.2.
    Could you please guide me on how to make the resource notification plugin work for our moodle site?

    Thanks
  • Picture of Guillaume Allègre
    Fri, 30 Mar 2018, 4:42 AM
    A new version (3.1.0) is now available, handling both Clean and Boost - and their derivatives.
1 2
Please login to post comments