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

Replace add_to_log with an event trigger - mod_lesson

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Test 1
      1. Run "vendor/bin/phpunit mod/lesson/tests/events_test.php" and ensure it works as expected.
      Test 2
      1. Open one tab on the page <yoursite>/report/log/index.php?id=1, use this tab whenever a step requires you to view a log.
      2. On another tab create a course with at least one enrolled student.
      3. Create a lesson with a couple of questions, once done go back to the course and then click to view the lesson.
      4. Check that there is a 'lesson view' log, the action link directs you to the lesson view.php page, the name of the user was recorded and the username link takes you to their profile.
      5. Visit <yoursite>/mod/lesson/index.php?id=<courseid> where the course id is the id of the course you created the lesson module in.
      6. Check that there is a 'lesson view all' log, the action link directs you back to the index.php page, the name of the user was recorded and the username link takes you to their profile.
      7. Open another browser and log in as a student enrolled in that course and click on the lesson link.
      8. Check that there is a 'lesson start' log, the action link directs you back to the lesson view.php page, the name of the user who started the lesson was recorded and the username link takes you to their profile.
      9. Complete the lesson as the user.
      10. Check that there is a 'lesson end' log, the action link directs you back to the lesson view.php page, the name of the user who finished the lesson was recorded and the username link takes you to their profile.
      11. As an administrator/teacher/whatever view the lesson, select 'Grade essays' and click on an essay.
      12. Check that there is a 'lesson view grade' log, the action link directs you back to the list of essays, the name of the user who viewed the essays was recorded and the username link takes you to their profile.
      13. Click on the essay link and provide a comment and grade.
      14. Check that there is a 'lesson update grade' log, the action link directs you back to the list of essays, the name of the user who viewed the essays was recorded and the username link takes you to their profile.
      Show
      Test 1 Run "vendor/bin/phpunit mod/lesson/tests/events_test.php" and ensure it works as expected. Test 2 Open one tab on the page <yoursite>/report/log/index.php?id=1, use this tab whenever a step requires you to view a log. On another tab create a course with at least one enrolled student. Create a lesson with a couple of questions, once done go back to the course and then click to view the lesson. Check that there is a 'lesson view' log, the action link directs you to the lesson view.php page, the name of the user was recorded and the username link takes you to their profile. Visit <yoursite>/mod/lesson/index.php?id=<courseid> where the course id is the id of the course you created the lesson module in. Check that there is a 'lesson view all' log, the action link directs you back to the index.php page, the name of the user was recorded and the username link takes you to their profile. Open another browser and log in as a student enrolled in that course and click on the lesson link. Check that there is a 'lesson start' log, the action link directs you back to the lesson view.php page, the name of the user who started the lesson was recorded and the username link takes you to their profile. Complete the lesson as the user. Check that there is a 'lesson end' log, the action link directs you back to the lesson view.php page, the name of the user who finished the lesson was recorded and the username link takes you to their profile. As an administrator/teacher/whatever view the lesson, select 'Grade essays' and click on an essay. Check that there is a 'lesson view grade' log, the action link directs you back to the list of essays, the name of the user who viewed the essays was recorded and the username link takes you to their profile. Click on the essay link and provide a comment and grade. Check that there is a 'lesson update grade' log, the action link directs you back to the list of essays, the name of the user who viewed the essays was recorded and the username link takes you to their profile.
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull Master Branch:
      MDL-40054_master
    • Story Points:
      40
    • Sprint:
      BACKEND Sprint 8

      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/lesson (9 calls)
      /mod/lesson/index.php:42: add_to_log($course->id, "lesson", "view all", "index.php?id=$course->id", "");
      /mod/lesson/essay.php:133: add_to_log($course->id, 'lesson', 'update grade', "essay.php?id=$cm->id", $lesson->name, $cm->id);
      /mod/lesson/essay.php:247: add_to_log($course->id, 'lesson', 'update email essay grade', "essay.php?id=$cm->id", format_string($pages[$attempt->pageid]>title,true).': '.fullname($users[$attempt->userid]), $cm>id);
      /mod/lesson/essay.php:303: add_to_log($course->id, 'lesson', 'view grade', "essay.php?id=$cm->id", get_string('manualgrading', 'lesson'), $cm->id);
      /mod/lesson/highscores.php:149: add_to_log($course->id, 'lesson', 'update highscores', "highscores.php?id=$cm->id", $name, $cm->id);
      /mod/lesson/highscores.php:160: add_to_log($course->id, 'lesson', 'view highscores', "highscores.php?id=$cm->id", $lesson->name, $cm->id);
      /mod/lesson/view.php:182: add_to_log($course->id, 'lesson', 'start', 'view.php?id='. $cm->id, $lesson->id, $cm->id);
      /mod/lesson/view.php:286: add_to_log($PAGE->course->id, 'lesson', 'view', 'view.php?id='. $PAGE->cm->id, $page->id, $PAGE->cm->id);
      /mod/lesson/view.php:417: add_to_log($course->id, "lesson", "end", "view.php?id=".$PAGE->cm->id, "$lesson->id", $PAGE->cm->id);

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/May/14