Permalink
Browse files

FIXED issue causing a fatal error in moodle 1.9

  • Loading branch information...
1 parent 0d67dde commit 02e4faff7d1a090b712a325fadd681cf545fe99d @nigeldaley nigeldaley committed Dec 5, 2011
Showing with 32 additions and 8 deletions.
  1. +6 −2 block_ilp.php
  2. +8 −3 classes/ilp_cron.class.php
  3. +11 −0 classes/ilp_settings.class.php
  4. +2 −2 db/ilp_db.php
  5. +5 −1 version.php
View
@@ -27,7 +27,7 @@ function init() {
$this->title = get_string('blockname', 'block_ilp');
$this->version = $ilpsettings->version();
- $this->cron = 86400; //run the cron at minimum once every 24 hours
+ $this->cron = $ilpsettings->cron();
}
/**
@@ -519,10 +519,14 @@ function instance_config_save($data) {
function cron() {
global $CFG;
-
+
require_once($CFG->dirroot."/blocks/ilp/classes/ilp_cron.class.php");
+
$cron = new ilp_cron();
+
+ mtrace('yep');
+
$cron->run();
}
View
@@ -6,6 +6,8 @@ class ilp_cron {
function __construct() {
+ global $CFG;
+
// include the assmgr db
require_once($CFG->dirroot.'/blocks/ilp/db/ilp_db.php');
@@ -29,12 +31,15 @@ function run() {
$reportentries = $this->get_list($lowertimestamp,$uppertimestamp);
mtrace( "running cron" );
- mtrace( $reportentries);
+
+
+
foreach ($reportentries as $r) {
+ mtrace( $r->name);
- $user = $this->dbc->get_user($r->user_id);
-
+ $user = $this->dbc->get_user_by_id($r->user_id);
+ mtrace( $user->firstname);
$email = new stdClass();
$email->reportname = $r->name;
$email->firsttname = $user->firstname;
@@ -18,13 +18,15 @@ class ilp_settings {
*/
private $version;
+ private $cron;
/*
* constructor class sets the values of all settings used
*/
function __construct() {
$this->version = "2011101103";
+ $this->cron = 86400; //run the cron at minimum once every 24 hours
}
@@ -38,6 +40,15 @@ function version() {
return $this->version;
}
+ /**
+ * Returns the current version number of the block
+ *
+ * @return the current version number of the ilp
+ */
+ function cron() {
+ return $this->cron;
+ }
+
}
View
@@ -795,7 +795,7 @@ function has_report_permission($report_id,$role_id,$capability_id) {
//check for the ilpviewall capability at site level this gives the user rights to view all
$ilpadmin = has_capability('block/ilp:ilpviewall',$sitecontext);
- $is_admin = (is_siteadmin($USER) || $ilpadmin) ? true : false;
+ $is_admin = (is_siteadmin($USER->id) || $ilpadmin) ? true : false;
//if permissions where returned from then the role (or one of the roles given) has the permission in the course
@@ -1447,7 +1447,7 @@ public function get_reports_in_period($ltimestamp,$utimestamp) {
{block_ilp_report} AS r,
{block_ilp_plu_ste_ent} AS stent
WHERE stitems.passfail = 0
- AND ddl.value > {$ltimestamp}
+ AND ddl.value >= {$ltimestamp}
AND ddl.value < {$utimestamp}
AND stent.parent_id = stitems.id
AND e.id = ddl.entry_id
View
@@ -18,4 +18,8 @@
$ilpsettings = new ilp_settings();
//get the current version number of the ilp
-$plugin->version = $ilpsettings->version();
+$plugin->version = $ilpsettings->version();
+
+
+//get the time setting for the ilp cron
+$plugin->cron = $ilpsettings->cron();

0 comments on commit 02e4faf

Please sign in to comment.