Configurable reports error programming

Configurable reports error programming

by Federico Gomez -
Number of replies: 18

I've a moodle 3.0 in a shared hosting, linux based. i installed de configurable reports but i've problems with the block Action of the module's user. The error said 

"Detected error of codification, must be repair for a programmer: Function get_all_mods() is removed. Use get_fast_modinfo() and get_module_types_names() instead. See phpdocs for details"

Average of ratings: -
In reply to Federico Gomez

Re: Configurable reports error programming

by Chris P. -

Hi all!

I've the same error message today, as I've installed for the first time the Configurable reports block plugin, and I followed the tutorial here (https://docs.moodle.org/30/en/Configurable_reports) and error appears during the 'Adding Columns' :

  • Add a Column called "User module actions".
  • Choose a module from the list, in this example, a forum.
Error message:

Function get_all_mods() is removed. Use get_fast_modinfo() and get_module_types_names() instead. 


Any idea how to solve/avoid this problem??    (Moodle 3.0.3 release)

Regards

In reply to Chris P.

Re: Configurable reports error programming

by Jamie Tinley -
Moodle 3.0.5 - same error. I applied the fix in the tracker to form.php but I too get a blank page now saying: 

 [our site]  is currently unable to handle this request.

I found a link about how to use get_fast_info here but I am not versed enough in php to solve this error. Anyone else able to brainstorm ideas to try that knows php?


Thanks

In reply to Chris P.

Re: Configurable reports error programming

by Jamie Tinley -

Moodle 3.0.5 - same error. I applied the fix in the tracker to form.php but I too get a blank page now saying: 

 [our site]  is currently unable to handle this request.

I found a link about how to use get_fast_info here but I am not versed enough in php to solve this error. Anyone else able to brainstorm ideas to try that knows php?


Thanks


In reply to Jamie Tinley

Re: Configurable reports error programming

by Jamie Tinley -
add actions button

I found a way to prevent the error and to make the dropdown box show up correctly. I am like 50% of the way to a solution - BUT the dropdown is NOT populated. I had to comment out 2 of the 4 lines of the original 'fix' and add the 1st line to make it almost work. can someone please help me understand how to code the php to make the activities dropdown to show up? why do both calls to 'report' fail when defining them?

get_fast_modinfo($this->_customdata['report']->courseid, $mods, $modnames, $modnamesplural, $modnamesused);

   //$mods = get_fast_modinfo($this->_customdata['report'])>get_cms();

   $modnames = get_module_types_names();

   $modnamesplural = get_module_types_names(true);

   //$modnamesused = get_fast_modinfo($this->_customdata['report'])>get_used_module_names();

Thanks!


In reply to Jamie Tinley

Re: Configurable reports error programming

by Jamie Tinley -

SOLVED!!!

also see tracker here

in server drill down deep through these folders /blocks/configurable_reports/components/columns/usermodactions   then use edit form.php 

there comment out the old line below and add in the next 5 lines (4 lines were suggested in tracker BUT crossed out >courseid 2x which I added back into it) I created the first line based on the old line which allowed the dropdown menu to even show up but adding back in the courseid allowed it to populate. Remember to use configurable reports you have to turn editing on in course, add it as a block, and then make sure you are actually in a course when you create a new USER report. mainly use conditions (user profile) and filters (date, users, etc) and you should be good to go!

//JT old was get_all_mods($this->_customdata['report']->courseid, $mods, $modnames, $modnamesplural, $modnamesused);

//JT added first line using example above, next 4 based on'fix' at tracker.

   get_fast_modinfo($this->_customdata['report']->courseid, $mods, $modnames, $modnamesplural, $modnamesused);

   

   $mods = get_fast_modinfo($this->_customdata['report']->courseid)->get_cms();

   $modnames = get_module_types_names();

   $modnamesplural = get_module_types_names(true);

   $modnamesused = get_fast_modinfo($this->_customdata['report']->courseid)->get_used_module_names();


 I hope this helps someone!
In reply to Jamie Tinley

Re: Configurable reports error programming

by Jamie Tinley -

Now, if someone knows how to work the filter date so that it actually filters our all mod events except the day in question that would be great.  I'm trying to use it for attendance and it summarizes how many times they used (clicked) a module called Blackboard Collaborate but it does not make any difference if the filtered date is one day or 2 months - it always returns ALL the times they clicked on the Blackboard Collaborate link as a sum when I really want one day only!  I can train my teachers to look into the log for each day but I'd really like them to have it as a report.

I already tried user report and adminer where this almost gives me the info using sql but not in a nice table like the reports.

Any ideas would be great. This ad-hoc report is so close and so cool with a pie graph and everything but it's not quite there yet! I know I can add a logic type condition but I don't know how to say if user mod action = Blackboard AND it was clicked between the filtered dates chosen. I can do that in mysql adminer like this:


SELECT *

FROM `mdl_logstore_standard_log`

where action LIKE '%Launched%' AND courseid=81

AND timecreated > UNIX_TIMESTAMP('2016-08-01') AND timecreated < UNIX_TIMESTAMP('2016-09-11')

LIMIT 50


In reply to Federico Gomez

Re: Configurable reports error programming

by Emil Heidkamp -

I'm also encountering this.  It seems the plugin uses a deprecated function that needs to be updated to one of the new functions that replaced it.  Hopefully the owner of this plugin will make the fix, because otherwise the plugin is great!

In reply to Emil Heidkamp

Re: Configurable reports error programming

by Ghislain Fabre -

I'm also encountering this error (function get_all_mods() is removed. Use get_fast_modinfo() and get_module_types_names() instead. See phpdocs for details) following the spain report tutorial when doing  Add a Column called "User module actions".

(was with Moodle 3.0.2 & block_configurable_reports_moodle30_2016020101.zip)

In reply to Ghislain Fabre

Re: Configurable reports error programming

by Ghislain Fabre -
This problem is reported here https://tracker.moodle.org/browse/CONTRIB-4600 and a user describe a solution.
In reply to Ghislain Fabre

Re: Configurable reports error programming

by Ghislain Fabre -

I tried to apply the solution, didn't work for me, i had a white page instead of this error message :

Function get_all_mods() is removed. Use get_fast_modinfo() and get_module_types_names() instead. 

If some one have a solution...

In reply to Ghislain Fabre

Re: Configurable reports error programming

by Giancarlo Trezzi -

I tried the solution mentioned above and It works very well for me. BUT I had to modify a little bit the code, this is the correct code:

        $mods = get_fast_modinfo($this->_customdata['report']->courseid)->get_cms();

        $modnames = get_module_types_names();

        $modnamesplural = get_module_types_names(true);

        $modnamesused = get_fast_modinfo($this->_customdata['report']->courseid)->get_used_module_names();


In reply to Giancarlo Trezzi

Re: Configurable reports error programming

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi,

I'll try to apply the fix and release a new version next week.

Juan

In reply to Juan Leyva

Re: Configurable reports error programming

by Jamie Tinley -

Thanks Juan, 

I have it working with the fix I created - was that the right way to fix configurable reports?

My date filter is not doing anything to the data I can change to any date and it  - can you look at my custom sql I created and tell me why the dates are not limiting my output?

  • SELECT U2.firstname, U2.lastname, L2.courseid, C.shortname, L2.action, 
  • FROM_UNIXTIME( C.timecreated, '%m-%d-%Y %r' )
  • FROM `prefix_logstore_standard_log` AS L, prefix_user as U, prefix_course as C 
  • LEFT JOIN prefix_logstore_standard_log AS L2 ON C.id = L2.courseid
  • LEFT JOIN prefix_user as U2 on L2.userid = U2.id
  • WHERE L2.courseid = 21
  • AND L2.action LIKE '%Launched%'
  • AND L2.timecreated > UNIX_TIMESTAMP('2016-08-25') AND L2.timecreated < UNIX_TIMESTAMP('2016-09-26')

result have all same date of 7-20-2016 no matter what I change my search date to like above which should be past 8/25 to 9/26


New at SQL and this is my best after many hours trialing solutions. Thanks.

In reply to Jamie Tinley

Re: Configurable reports error programming

by Jamie Tinley -

ok, solved part of date issue as I pulled it from prefix_course instead of the logstore

I also see I need to join all 3 tables and I'm closer here but still not quite right as I get more users than were there.

  1. SELECT U.firstname, U.lastname, L.courseid, C.shortname, L.action, 
  2. FROM_UNIXTIME( L.timecreated, '%m-%d-%Y %r' )
  3. FROM prefix_logstore_standard_log as L LEFT JOIN prefix_course as C ON L.courseid = C.id LEFT JOIN prefix_user as U on L.userid = U.id
  4. WHERE L.courseid = 21
  5. AND L.action LIKE '%Launched%'
  6. AND L.timecreated > UNIX_TIMESTAMP('2016-09-19') AND L.timecreated < UNIX_TIMESTAMP('2016-09-26')
  7. group by DATE(FROM_UNIXTIME(U.timecreated))
In reply to Jamie Tinley

Re: Configurable reports error programming

by Jamie Tinley -
solved my personal query too! Hopefully this helps anyone else trying to make a report for an event like Blackboard Collaborate, Ultra, or BigBlueButton (in which case change LIKE '%Launched%' to LIKE '%Joined%'

Group by limits your data - grouping by date selected one user from each date, grouping by user selected one date for each user but using a comma lets me group specifically by the day for each user then order by is meant for sorting. I hope this helps someone smile

SELECT U.firstname, U.lastname, L.userid, L.courseid, L.action,

FROM_UNIXTIME( L.timecreated, '%m-%d-%Y' ) as DATE, 

FROM_UNIXTIME( L.timecreated, '%r' ) as TIME

FROM prefix_logstore_standard_log as L

LEFT JOIN prefix_course as C ON L.courseid = C.id left JOIN prefix_user as U on L.userid = U.id

WHERE L.action LIKE '%Launched%'

AND L.courseid = %%COURSEID%%

%%FILTER_STARTTIME:L.timecreated:>%% %%FILTER_ENDTIME:L.timecreated:<%%

group by L.userid, FROM_UNIXTIME( L.timecreated, '%m-%d-%Y' )

order by FROM_UNIXTIME( L.timecreated, '%m-%d-%Y' ), U.firstname


In reply to Juan Leyva

Re: Configurable reports error programming

by Jose Rivas -

Thanks Juan.

I think we'll  all be very grateful if you fix and release a new versión. 

Congrats for your great plugin.

Regards

In reply to Juan Leyva

Re: Configurable reports error programming

by Jamie Tinley -

HI Juan,

do you know if configurable reports can handle things like Declare SET Define as it throws errors for me when I try to use them.  Any way around that?

I need to use it because I have one table that has the needed information but for some reason registers the course as course 0 when they click it in another course (blackboard collaborate for attendance) yet in the column other in prefix_logstore_standard_log I see the course number easily but I can't seem to query it out various ways as the %%course%% for some reason does not work using my sql below: (the ## I tried various ways without success when the course in my example is 108 so    using AND L.other LIKE '%108%'  works great but I'm trying to replace 108 with a variable or query instead to pull it out)

Thanks, Jamie

## DECLARE @CID

##SELECT @CID = D.id from prefix_course as D WHERE D.id = %%COURSEID%%

SELECT   U.firstname as First, U.lastname as Last,L.userid, L.courseid,L.component,

FROM_UNIXTIME( L.timecreated, '%m-%d-%Y' ) as DATE,  

FROM_UNIXTIME( L.timecreated, '%r' ) as TIME


FROM prefix_logstore_standard_log as L 

LEFT JOIN prefix_course as C ON L.courseid = C.id left 

JOIN prefix_user as U on L.userid = U.id



WHERE L.other  like '%loadmeeting%'

AND L.component like '%mod_elluminate%'

## AND L.other LIKE @CID

## AND D.id = %%COURSEID%%

## WHERE L.courseid = %%COURSEID%%

##AND L.other LIKE '%108%'

## AND L.other LIKE Select %%COURSEID%%

## AND L.courseid = %%COURSEID%%

%%FILTER_STARTTIME:L.timecreated:>%%

%%FILTER_ENDTIME:L.timecreated:<%%