Note: You are currently viewing documentation for Moodle 3.9. Up-to-date documentation for the latest stable version of Moodle may be available here: local/Recycle bin.

local/Recycle bin: Difference between revisions

From MoodleDocs
(added page for Recycle bin local plugin)
 
(tidy up)
Line 6: Line 6:
* You must first find the moodle/course folder and locate there the lib.php file that you will need to modify:
* You must first find the moodle/course folder and locate there the lib.php file that you will need to modify:


[[Archivo:lib_php file in a local moodle server.png|600px]]
[[File:lib_php file in a local moodle server.png|600px]]


* You can edit the lib.php file easily with [https://notepad-plus-plus.org/ Notepad ++ for Windows].
* You can edit the lib.php file easily with [https://notepad-plus-plus.org/ Notepad ++ for Windows].


[[Archivo:lib_php original file opened in notepad plus plus.png|600px]]
[[File:lib_php original file opened in notepad plus plus.png|600px]]


* You need to find exactly these lines:
* You need to find exactly these lines:
Line 25: Line 25:
Your modified (hacked file) must look exactly like this lines 658 and 1659 with the added text::
Your modified (hacked file) must look exactly like this lines 658 and 1659 with the added text::


[[Archivo:lib_php modified file opened in notepad plus plus.png|600px]]
[[File:lib_php modified file opened in notepad plus plus.png|600px]]


* You will then have a Recycle bin available inside the Administration block:
* You will then have a Recycle bin available inside the Administration block:


[[Archivo:Recycle bin is available.png|300px]]
[[File:Recycle bin is available.png|300px]]


[[en:local/Recycle bin]]
[[es:local/Recycle bin]]

Revision as of 16:28, 25 August 2015

This plugin adds a "recycle bin" for course modules to Moodle.

It requires a core hack as there is no pre-cm-deleted event, you will need to add a line to '/course/lib.php' (function course_delete_module), right after the first "if()".

  • You must first find the moodle/course folder and locate there the lib.php file that you will need to modify:

lib php file in a local moodle server.png

lib php original file opened in notepad plus plus.png

  • You need to find exactly these lines:
function course_delete_module($cmid) {
         return true;
     }
  • You will be adding exactly these two lines:
   // Notify the recycle bin plugin.
   \local_recyclebin\Observer::pre_cm_delete($cm);

Your modified (hacked file) must look exactly like this lines 658 and 1659 with the added text::

lib php modified file opened in notepad plus plus.png

  • You will then have a Recycle bin available inside the Administration block:

Recycle bin is available.png