Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added new config setting, added language strings, changed lib.php to … #40

Open
wants to merge 3 commits into
base: MOODLE_38_STABLE
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ To help developers debug problems, please include the following in all issues:
- Database software and versions.
- Any other environmental information available.

Developers will triage issues and deal with more serious problems first. We will try to address all issues but cannot guarantee when your issue will be addressed.
Developers will triage issues and deal with more serious problems first. We will try to address all issues but cannot guarantee when your issue will be addressed.

## What is different in this branch (Madhu Avasarala)
- This branch is customized to add a config setting to include hidden courses. If selected, hidden courses will also be searched for ungraded items.
- The db/tasks.php file has been edited to set the update time for 30m every hour and reset every day at 03:15
6 changes: 4 additions & 2 deletions db/tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Every day 1t 03:15 server time, a reset is done
* Every hour of every day at 30m intervals, the cache is updated with grade activities due
* @package block_grade_me
* @copyright 2017 Derek Henderson {@link http://www.remote-learner.net}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Expand All @@ -25,7 +27,7 @@
array(
'classname' => 'block_grade_me\task\cache_grade_data',
'blocking' => 0,
'minute' => '*/15',
'minute' => '*/30',
'hour' => '*',
'day' => '*',
'dayofweek' => '*',
Expand All @@ -35,7 +37,7 @@
'classname' => 'block_grade_me\task\reset_block',
'blocking' => 0,
'minute' => '15',
'hour' => '1',
'hour' => '3',
'day' => '*',
'dayofweek' => '*',
'month' => '*'
Expand Down
2 changes: 2 additions & 0 deletions lang/en/block_grade_me.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
$string['settings_configmaxcourses'] = 'Set the maximum number of ungraded courses to show. Setting this too high may impact performance.';
$string['settings_adminviewall'] = 'Admins View All';
$string['settings_configadminviewall'] = 'Enable to give administrators the rights to see all ungraded work — not just for courses where they have a grader role.';
$string['settings_hiddencourses'] = 'Hidden courses also to be searched for ungraded work';
$string['settings_confighiddencourses'] = 'Include hidden courses also to be searched for ungraded work';
$string['settings_enablepre'] = 'Show';
$string['settings_configenablepre'] = 'Should Grade Me show unrated activity from the "{$a->plugin_name}" module?';

Expand Down
14 changes: 11 additions & 3 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,18 +248,26 @@ function block_grade_me_cache_grade_data() {
or b.pagetypepattern = ?)";
$systemblock = $DB->get_record_sql($sqlsystem, $paramsystem);
$systemcount = $systemblock->bcount;
// Get the list of all active courses in the database.
// Get the list of all courses in the database depending on config vivible setting
if ($CFG->block_grade_me_includehiddencourses)
{
$show = '0';
}
else
{
$show = '1';
}
$paramscourse = array();
if ($systemcount > '0') {
$sqlactive = "SELECT c.id, c.timemodified
FROM {course} c
WHERE c.visible = '1'";
WHERE (c.visible = '1' or c.visible = $show)";
} else {
$sqlactive = "SELECT c.id, c.timemodified
FROM {course} c
JOIN {context} x ON c.id = x.instanceid
JOIN {block_instances} b ON b.parentcontextid = x.id
WHERE b.blockname = 'grade_me' and c.visible = '1'";
WHERE b.blockname = 'grade_me' and (c.visible = '1' or c.visible = $show)";
}
$courselist = $DB->get_recordset_sql($sqlactive, $paramscourse);
foreach ($courselist as $actcourse) {
Expand Down
4 changes: 4 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

$settings->add(new admin_setting_configcheckbox('block_grade_me_enableadminviewall',
get_string('settings_adminviewall', 'block_grade_me'), get_string('settings_configadminviewall', 'block_grade_me'), 0));

// new setting added to include hidden courses to also be searched for gradeable activities
$settings->add(new admin_setting_configcheckbox('block_grade_me_includehiddencourses',
get_string('settings_hiddencourses', 'block_grade_me'), get_string('settings_confighiddencourses', 'block_grade_me'), 0));

$settings->add(new admin_setting_configtext('block_grade_me_maxcourses', get_string('settings_maxcourses', 'block_grade_me'),
get_string('settings_configmaxcourses', 'block_grade_me'), 10, PARAM_INT));
Expand Down