Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-40061

Replace add_to_log with an event trigger - mod_data

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.5, 2.7
    • 2.7
    • Events API, Logging
    • MOODLE_25_STABLE, MOODLE_27_STABLE
    • MOODLE_27_STABLE
    • MDL-40061_master
    • Hide
      Test 1
      1. Run the phpunit tests mod/data/tests/events_test.php
      Test 2
      1. Open up <yoursite>/report/log/index.php in another tab and use this page to check that there is a log when asked.
      2. Create a database module in a course.
      3. Click on the database module, you will be redirected to the 'Fields' tab. Choose from the drop down 'Create a new field' and select 'Date'.
      4. Enter any field name and click 'Add' and check that there is a 'data fields add' log.
      5. Click on the 'View list' tab and ensure there is a 'data view' log.
      6. Visit <yoursite>/mod/data/index.php?id=<courseid> and check that there is a 'data view all' log.
      7. Click on the 'fields' tab.
      8. Click to edit the entry you created earlier.
      9. Click on 'Save changes' and check that there is a 'data fields update' log.
      10. Delete the field and check that there is a 'data fields delete' log.
      11. Create another field.
      12. Click on the 'Templates' tab and check that there is a 'data templates view' log.
      13. Scroll down and click on 'Save template' and check that there is a 'data templates saved' log.
      14. Click on the tab 'Add entry', then click on 'Save and view' and check that there is a 'data add' and a 'data view' log entry.
      15. Click to edit the field and then click on 'Save and view' and check that there is a 'data update' log.
      16. Delete the field and check that there is a 'data record delete' log.
      Show
      Test 1 Run the phpunit tests mod/data/tests/events_test.php Test 2 Open up <yoursite>/report/log/index.php in another tab and use this page to check that there is a log when asked. Create a database module in a course. Click on the database module, you will be redirected to the 'Fields' tab. Choose from the drop down 'Create a new field' and select 'Date'. Enter any field name and click 'Add' and check that there is a 'data fields add' log. Click on the 'View list' tab and ensure there is a 'data view' log. Visit <yoursite>/mod/data/index.php?id=<courseid> and check that there is a 'data view all' log. Click on the 'fields' tab. Click to edit the entry you created earlier. Click on 'Save changes' and check that there is a 'data fields update' log. Delete the field and check that there is a 'data fields delete' log. Create another field. Click on the 'Templates' tab and check that there is a 'data templates view' log. Scroll down and click on 'Save template' and check that there is a 'data templates saved' log. Click on the tab 'Add entry', then click on 'Save and view' and check that there is a 'data add' and a 'data view' log entry. Click to edit the field and then click on 'Save and view' and check that there is a 'data update' log. Delete the field and check that there is a 'data record delete' log.
    • 40
    • BACKEND Sprint 10

    Description

      Replace the add_to_log calls for the following area, with a call to the get_legacy_logdata function in the event class.

      mod/data (9 calls)
      /mod/data/templates.php:76: add_to_log($course->id, 'data', 'templates view', "templates.php?id=$cm->id&d=$data->id", $data->id, $cm->id);
      /mod/data/templates.php:141: add_to_log($course->id, 'data', 'templates saved', "templates.php?id=$cm->id&d=$data->id", $data->id, $cm->id);
      /mod/data/index.php:42: add_to_log($course->id, "data", "view all", "index.php?id=$course->id", "");
      /mod/data/field.php:124: add_to_log($course->id, 'data', 'fields add',
      /mod/data/field.php:166: add_to_log($course->id, 'data', 'fields update',
      /mod/data/field.php:197: add_to_log($course->id, 'data', 'fields delete',
      /mod/data/edit.php:189: add_to_log($course->id, 'data', 'update', "view.php?d=$data->id&rid=$rid", $data->id, $cm->id);
      /mod/data/edit.php:239: add_to_log($course->id, 'data', 'add', "view.php?d=$data->id&rid=$recordid", $data->id, $cm->id);
      /mod/data/view.php:255: add_to_log($course->id, 'data', 'view', "view.php?id=$cm->id", $data->id, $cm->id);
      /mod/data/view.php:377: add_to_log($course->id, 'data', 'record delete', "view.php?id=$cm->id", $data->id, $cm->id);

      Please also check /mod/data/lib.php data_delete_record() add_to_log call (if MDL-40871 is integrated)
      add_to_log($courseid, 'data', 'record delete', "view.php?id=$cmid", $data->id, $cmid);

      Attachments

        Issue Links

          Activity

            People

              markn Mark Nelson
              abgreeve Adrian Greeve
              Dan Poltawski Dan Poltawski
              Damyon Wiese Damyon Wiese
              David Monllaó David Monllaó
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona), Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                12/May/14