Non-core contributed modules

New reports for Category Activity for submission to plugins database

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.3
  • Fix Version/s: None
  • Labels:
    None
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_19_STABLE

Description

I have written the following reports, which I would like to submit for the plugins database. They are properly integrated and will appear in the Reports menu and give a page with their own drop-down to chose from the two types of reports.

Some changes are needed to moodle.php and statslib.php

Activity

Hide
Helen Foster added a comment -

Red, thanks for sharing your reports. Reassigning to Anthony as contributed code coordinator.

Please see http://docs.moodle.org/en/Development:Guidelines_for_contributed_code for an overview of our process of contributing code.

Show
Helen Foster added a comment - Red, thanks for sharing your reports. Reassigning to Anthony as contributed code coordinator. Please see http://docs.moodle.org/en/Development:Guidelines_for_contributed_code for an overview of our process of contributing code.
Hide
Anthony Borrow added a comment -

Thanks Helen for bringing this to my attention and moving it over to CONTRIB. Peace - Anthony

Show
Anthony Borrow added a comment - Thanks Helen for bringing this to my attention and moving it over to CONTRIB. Peace - Anthony
Hide
Anthony Borrow added a comment -

Red - I'll not have a chance to look at the code tonight but hope to get to this tomorrow and will let you know if I have any questions, comments, etc. Let me start by saying thank you for sharing your time, talent, and code with the Moodle community. I look forward to seeing the fruits of your labors and creativity. Peace - Anthony

Show
Anthony Borrow added a comment - Red - I'll not have a chance to look at the code tonight but hope to get to this tomorrow and will let you know if I have any questions, comments, etc. Let me start by saying thank you for sharing your time, talent, and code with the Moodle community. I look forward to seeing the fruits of your labors and creativity. Peace - Anthony
Hide
Red Morris added a comment -

Thanks Anthony - I've corrected the admin_externalpage_setup at line 9 since uploading, but I won't worry about uploading it again until after your comments.

Show
Red Morris added a comment - Thanks Anthony - I've corrected the admin_externalpage_setup at line 9 since uploading, but I won't worry about uploading it again until after your comments.
Hide
Anthony Borrow added a comment -

Red - I've taken a quick look at the files. Currently, since it requires modifications to core it is a patch. I'm wondering if we might be able to work to make it a true plugin. I'm running off to the dentist now but when I come back I'll give it a closer look and see what we might be able to do. Peace - Anthony

Show
Anthony Borrow added a comment - Red - I've taken a quick look at the files. Currently, since it requires modifications to core it is a patch. I'm wondering if we might be able to work to make it a true plugin. I'm running off to the dentist now but when I come back I'll give it a closer look and see what we might be able to do. Peace - Anthony
Hide
Anthony Borrow added a comment -

Red - I'm looking further into the patched files and here is what I am wondering. Would it be possible to define the statsreport15 and statsreport16 language strings in the report's language file. I would think it is just a matter of changing the get_string to specify the report file - something like: get_string('statsreport15','report_categoryactivity.php'). As for the changes in statslib, I would like to see if we could get those somehow to work by creating a report's lib.php and define the desired functions that would include the define statements. I'm not sure if this second part is practical or even possible (especially without some modification to core). I will want to look at this more closely but wanted to give you a head's up. Peace - Anthony

Show
Anthony Borrow added a comment - Red - I'm looking further into the patched files and here is what I am wondering. Would it be possible to define the statsreport15 and statsreport16 language strings in the report's language file. I would think it is just a matter of changing the get_string to specify the report file - something like: get_string('statsreport15','report_categoryactivity.php'). As for the changes in statslib, I would like to see if we could get those somehow to work by creating a report's lib.php and define the desired functions that would include the define statements. I'm not sure if this second part is practical or even possible (especially without some modification to core). I will want to look at this more closely but wanted to give you a head's up. Peace - Anthony
Hide
Anthony Borrow added a comment -

Red - I'm attaching a proper statslib.php diff file. I also came across a PHP notice:

Catchable fatal error: Object of class admin_root could not be converted to string in /home/arborrow/Moodle/code/19stable/admin/pagelib.php on line 149

I'm not sure what you were trying to do with the adminroot variable so I commented out:

// $adminroot = admin_get_root();
// admin_externalpage_setup('reportcourseoverview', $adminroot);
// admin_externalpage_print_header($adminroot);

and later the footer:

// admin_externalpage_print_footer($adminroot);

and replaced those with

admin_externalpage_setup('reportcourseoverview');
admin_externalpage_print_header();

and later the footer:

admin_externalpage_print_footer();

I think we should also explain when and how the collection of these stats will begin. After install I am presuming it will start gathering the data. Is there a way to go back and have it populate the stats prior to installation? Again, I've not looked at the details of what is being calculated and where the results are being stored but figured I would raise the question.

Peace - Anthony

Show
Anthony Borrow added a comment - Red - I'm attaching a proper statslib.php diff file. I also came across a PHP notice: Catchable fatal error: Object of class admin_root could not be converted to string in /home/arborrow/Moodle/code/19stable/admin/pagelib.php on line 149 I'm not sure what you were trying to do with the adminroot variable so I commented out: // $adminroot = admin_get_root(); // admin_externalpage_setup('reportcourseoverview', $adminroot); // admin_externalpage_print_header($adminroot); and later the footer: // admin_externalpage_print_footer($adminroot); and replaced those with admin_externalpage_setup('reportcourseoverview'); admin_externalpage_print_header(); and later the footer: admin_externalpage_print_footer(); I think we should also explain when and how the collection of these stats will begin. After install I am presuming it will start gathering the data. Is there a way to go back and have it populate the stats prior to installation? Again, I've not looked at the details of what is being calculated and where the results are being stored but figured I would raise the question. Peace - Anthony
Hide
Red Morris added a comment -

Hi Anthony, I've relocated the strings I've defined to the report_categoryactivity.php which already existed to supply the report name in the menu. I agree with you that it makes it cleaner and tidier, which means more people are likely to use the report.

I've also made the $adminroot changes you recommended. These were just a left-over from the courseoverview report I copied as my starting point. I didn't know what they did, so I left them in place. They're gone now though and I'm uploading a new zip with these changes, and others I've made, included.

So you know, these reports don't do any storing of data. They show and complie data from the available stats and stats_user tables data. I am writing another add-in of miscellaneous reports though, and that may need 2 new views, but it's still not adding anything to the database.

I agree that it would be great to have reports installable, much like blocks are, but that will require large changes to the core. Where do we go next?

Show
Red Morris added a comment - Hi Anthony, I've relocated the strings I've defined to the report_categoryactivity.php which already existed to supply the report name in the menu. I agree with you that it makes it cleaner and tidier, which means more people are likely to use the report. I've also made the $adminroot changes you recommended. These were just a left-over from the courseoverview report I copied as my starting point. I didn't know what they did, so I left them in place. They're gone now though and I'm uploading a new zip with these changes, and others I've made, included. So you know, these reports don't do any storing of data. They show and complie data from the available stats and stats_user tables data. I am writing another add-in of miscellaneous reports though, and that may need 2 new views, but it's still not adding anything to the database. I agree that it would be great to have reports installable, much like blocks are, but that will require large changes to the core. Where do we go next?
Hide
Red Morris added a comment -

Version 2. Includes changes to language string locations and removal of adminroot references

Show
Red Morris added a comment - Version 2. Includes changes to language string locations and removal of adminroot references
Hide
Red Morris added a comment -

Version 3 is now on the table, with a few tweeks to add in a proper header and other small things. I'll hold off on it until I hear from Anthony. There may be more changes ahead once he sees version 2!!

Show
Red Morris added a comment - Version 3 is now on the table, with a few tweeks to add in a proper header and other small things. I'll hold off on it until I hear from Anthony. There may be more changes ahead once he sees version 2!!
Hide
Anthony Borrow added a comment -

Red - Thanks for the latest version and your work on incorporating some of my suggestions. I went ahead and made this its own complete plugin with no patches required by creating the lib.php file and making two special functions based off of the ones you were modifying in /lib/statslib.php. I appended category_activity to the beginning of the function names and called these new functions. The disadvantage to this technique is that if those functions get modified in core you will have to check and make sure those changes get merged into your customized functions. So I have gone ahead and committed the code to contrib/plugins/admin/report/categoryactivity. I have created a component in the tracker called Admin report: Category activity and made you the component lead. I have bumped your privileges in the tracker so that you can manage issues related to the Category activity admin report. The next thing I need for you to do is to apply for CVS write access for the contrib/plugins/admin/report/categoryactivity directory. Then you can maintain the code as you see fit. I would encourage you to review [[Development:Guidelines_for_contributed_code]] to make sure you have followed the various steps like adding an entry to the Modules and Plugins database, creating a documentation page in Moodle Docs, etc. Let me know if you have any questions about any of the various details. For example, the link to download the latest version of the code will be http://download.moodle.org/download.php/plugins/admin/report/categoryactivity.zip. Let me know if there is anything else you need. Peace - Anthony

Show
Anthony Borrow added a comment - Red - Thanks for the latest version and your work on incorporating some of my suggestions. I went ahead and made this its own complete plugin with no patches required by creating the lib.php file and making two special functions based off of the ones you were modifying in /lib/statslib.php. I appended category_activity to the beginning of the function names and called these new functions. The disadvantage to this technique is that if those functions get modified in core you will have to check and make sure those changes get merged into your customized functions. So I have gone ahead and committed the code to contrib/plugins/admin/report/categoryactivity. I have created a component in the tracker called Admin report: Category activity and made you the component lead. I have bumped your privileges in the tracker so that you can manage issues related to the Category activity admin report. The next thing I need for you to do is to apply for CVS write access for the contrib/plugins/admin/report/categoryactivity directory. Then you can maintain the code as you see fit. I would encourage you to review [[Development:Guidelines_for_contributed_code]] to make sure you have followed the various steps like adding an entry to the Modules and Plugins database, creating a documentation page in Moodle Docs, etc. Let me know if you have any questions about any of the various details. For example, the link to download the latest version of the code will be http://download.moodle.org/download.php/plugins/admin/report/categoryactivity.zip. Let me know if there is anything else you need. Peace - Anthony
Hide
Anthony Borrow added a comment -

moving to component Admin report: Category activity

Show
Anthony Borrow added a comment - moving to component Admin report: Category activity
Hide
Anthony Borrow added a comment -

Code added to CVS, component created in tracker and tracker privileges bumped, awaiting CVS write request, M&P entry, and documentation.

Show
Anthony Borrow added a comment - Code added to CVS, component created in tracker and tracker privileges bumped, awaiting CVS write request, M&P entry, and documentation.
Hide
Anthony Borrow added a comment -

Closing all of my resolved issues. Peace - Anthony

Show
Anthony Borrow added a comment - Closing all of my resolved issues. Peace - Anthony

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: