Diferencia entre revisiones de «admin/setting/local recyclebin»

De MoodleDocs
(tidy up)
(tidy up)
Línea 3: Línea 3:
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()".
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 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]]
[[Archivo:lib_php original file opened in notepad plus plus.png|600px]]


Look at the hacked lib.php file contents around line 1654:
* 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::


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

Revisión del 15:50 25 ago 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()".

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