Non-core contributed modules

Utilitse spare status reports

Details

  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

There are some unused status for targets and concerns that can be utilised to provide additional reports. Longer term this could be configurable for number of reports and potentially infinite.

Activity

Hide
Geoffrey Rowland added a comment -

Here are a few tweaks to allow the for the new 4th report type from latest version (created from CVS) downloaded on 4 October 2009

/mod/ilpconcern/view_students.php

Starting at line 467

if($CFG->ilpconcern_report4 == 1){ $report3total = count_records_sql('SELECT COUNT(*) FROM '.$CFG->prefix.'ilpconcern_posts WHERE setforuserid = '.$auser->id.' AND status = 3' ); $report3text = '<a href="concerns_view.php'.$link_values.'&userid='.$auser->id.'&status=3">'.$report3total.' '.get_string('report4plural', 'ilpconcern').'</a>'; $row[] .= $report4text; }

should read

if($CFG->ilpconcern_report4 == 1){ $report4total = count_records_sql('SELECT COUNT(*) FROM '.$CFG->prefix.'ilpconcern_posts WHERE setforuserid = '.$auser->id.' AND status = 3' ); $report4text = '<a href="concerns_view.php'.$link_values.'&userid='.$auser->id.'&status=3">'.$report4total.' '.get_string('report4plural', 'ilpconcern').'</a>'; $row[] .= $report4text; }

Show
Geoffrey Rowland added a comment - Here are a few tweaks to allow the for the new 4th report type from latest version (created from CVS) downloaded on 4 October 2009 /mod/ilpconcern/view_students.php Starting at line 467 if($CFG->ilpconcern_report4 == 1){ $report3total = count_records_sql('SELECT COUNT(*) FROM '.$CFG->prefix.'ilpconcern_posts WHERE setforuserid = '.$auser->id.' AND status = 3' ); $report3text = '<a href="concerns_view.php'.$link_values.'&userid='.$auser->id.'&status=3">'.$report3total.' '.get_string('report4plural', 'ilpconcern').'</a>'; $row[] .= $report4text; } should read if($CFG->ilpconcern_report4 == 1){ $report4total = count_records_sql('SELECT COUNT(*) FROM '.$CFG->prefix.'ilpconcern_posts WHERE setforuserid = '.$auser->id.' AND status = 3' ); $report4text = '<a href="concerns_view.php'.$link_values.'&userid='.$auser->id.'&status=3">'.$report4total.' '.get_string('report4plural', 'ilpconcern').'</a>'; $row[] .= $report4text; }
Hide
Geoffrey Rowland added a comment -

...and also

/blocks/ilp/reports.php

line 115

'report3' => 'Report 3 Total'

should read

'report3' => 'Report 3 Total',
'report4' => 'Report 4 Total'

line 185
$report['report3'] = count_records_sql('SELECT COUNT FROM '.$CFG->prefix.'ilpconcern_posts WHERE setforuserid = '.$user->id.' AND status = "2"' );

should read

$report['report3'] = count_records_sql('SELECT COUNT FROM '.$CFG->prefix.'ilpconcern_posts WHERE setforuserid = '.$user->id.' AND status = "2"' );

$report['report4'] = count_records_sql('SELECT COUNT FROM '.$CFG->prefix.'ilpconcern_posts WHERE setforuserid = '.$user->id.' AND status = "3"' );

line 210

'report3' => 'Report 3 Total'

should read

'report3' => 'Report 3 Total',
'report4' => 'Report 4 Total'

line 262

$report['report3'] = count_records_sql('SELECT COUNT FROM '.$CFG->prefix.'ilpconcern_posts WHERE course = '.$course->id.' AND status = "2"' );

should read

$report['report3'] = count_records_sql('SELECT COUNT FROM '.$CFG->prefix.'ilpconcern_posts WHERE course = '.$course->id.' AND status = "2"' );

$report['report4'] = count_records_sql('SELECT COUNT FROM '.$CFG->prefix.'ilpconcern_posts WHERE course = '.$course->id.' AND status = "3"' );

Show
Geoffrey Rowland added a comment - ...and also /blocks/ilp/reports.php line 115 'report3' => 'Report 3 Total' should read 'report3' => 'Report 3 Total', 'report4' => 'Report 4 Total' line 185 $report['report3'] = count_records_sql('SELECT COUNT FROM '.$CFG->prefix.'ilpconcern_posts WHERE setforuserid = '.$user->id.' AND status = "2"' ); should read $report['report3'] = count_records_sql('SELECT COUNT FROM '.$CFG->prefix.'ilpconcern_posts WHERE setforuserid = '.$user->id.' AND status = "2"' ); $report['report4'] = count_records_sql('SELECT COUNT FROM '.$CFG->prefix.'ilpconcern_posts WHERE setforuserid = '.$user->id.' AND status = "3"' ); line 210 'report3' => 'Report 3 Total' should read 'report3' => 'Report 3 Total', 'report4' => 'Report 4 Total' line 262 $report['report3'] = count_records_sql('SELECT COUNT FROM '.$CFG->prefix.'ilpconcern_posts WHERE course = '.$course->id.' AND status = "2"' ); should read $report['report3'] = count_records_sql('SELECT COUNT FROM '.$CFG->prefix.'ilpconcern_posts WHERE course = '.$course->id.' AND status = "2"' ); $report['report4'] = count_records_sql('SELECT COUNT FROM '.$CFG->prefix.'ilpconcern_posts WHERE course = '.$course->id.' AND status = "3"' );
Hide
James Ballard added a comment -

Thanks Geoffrey, Added to CVS now

Show
James Ballard added a comment - Thanks Geoffrey, Added to CVS now
Hide
Geoffrey Rowland added a comment -

The if statements that handle the [Cancel] functionality (in ilpconcerns/concerns_view, ilpconcerns/concerns_comments, ilptarget/target_view and ilptarget/target_comments ) are empty:

e.g.

if ($mform->is_cancelled()){
}

So I have added the following redirects to our setup. Seems to work!

ilpconcerns/concerns_view:

if ($mform->is_cancelled()){
redirect("concerns_view.php?courseid=$courseid&userid=$userid&status=$status");
}

ilpconcerns/concerns_comments:

if ($mform->is_cancelled()){
redirect("concerns_comments.php?courseid=$courseid&userid=$userid&concernspost=$concernspost");
}

ilptarget/target_view:

if ($mform->is_cancelled()){
redirect("target_view.php?courseid=$courseid&userid=$userid&status=$status");
}

ilptarget/target_comments:

if ($mform->is_cancelled()){
redirect("target_comments.php?courseid=$courseid&userid=$userid&targetpost=$targetpost");
}

Show
Geoffrey Rowland added a comment - The if statements that handle the [Cancel] functionality (in ilpconcerns/concerns_view, ilpconcerns/concerns_comments, ilptarget/target_view and ilptarget/target_comments ) are empty: e.g. if ($mform->is_cancelled()){ } So I have added the following redirects to our setup. Seems to work! ilpconcerns/concerns_view: if ($mform->is_cancelled()){ redirect("concerns_view.php?courseid=$courseid&userid=$userid&status=$status"); } ilpconcerns/concerns_comments: if ($mform->is_cancelled()){ redirect("concerns_comments.php?courseid=$courseid&userid=$userid&concernspost=$concernspost"); } ilptarget/target_view: if ($mform->is_cancelled()){ redirect("target_view.php?courseid=$courseid&userid=$userid&status=$status"); } ilptarget/target_comments: if ($mform->is_cancelled()){ redirect("target_comments.php?courseid=$courseid&userid=$userid&targetpost=$targetpost"); }
Hide
James Ballard added a comment -

Should be fixed now - redirects aren't necessary as it is already on that page. I have rearranged the check for cancelled form.

Show
James Ballard added a comment - Should be fixed now - redirects aren't necessary as it is already on that page. I have rearranged the check for cancelled form.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: