diff --git a/Free Learning/CHANGEDB.php b/Free Learning/CHANGEDB.php index e481ae5..cea53db 100644 --- a/Free Learning/CHANGEDB.php +++ b/Free Learning/CHANGEDB.php @@ -2255,3 +2255,8 @@ ++$count; $sql[$count][0] = '5.22.04'; $sql[$count][1] = ""; + +//v5.22.05 +++$count; +$sql[$count][0] = '5.22.05'; +$sql[$count][1] = ""; diff --git a/Free Learning/CHANGELOG.txt b/Free Learning/CHANGELOG.txt index cb00290..2d7172d 100644 --- a/Free Learning/CHANGELOG.txt +++ b/Free Learning/CHANGELOG.txt @@ -1,5 +1,9 @@ CHANGELOG ========= +v5.22.05 +-------- +Improved Learning Activity graphing + v5.22.04 -------- Learning Area filter fix diff --git a/Free Learning/manifest.php b/Free Learning/manifest.php index 0944078..3cdc7a2 100644 --- a/Free Learning/manifest.php +++ b/Free Learning/manifest.php @@ -25,7 +25,7 @@ $entryURL = 'units_browse.php'; $type = 'Additional'; $category = 'Learn'; -$version = '5.22.04'; +$version = '5.22.05'; $author = 'Ross Parker'; $url = 'http://rossparker.org/free-learning'; diff --git a/Free Learning/report_learningActivity.php b/Free Learning/report_learningActivity.php index 0aeea6c..3700056 100755 --- a/Free Learning/report_learningActivity.php +++ b/Free Learning/report_learningActivity.php @@ -67,12 +67,16 @@ echo __('Report Data'); echo ''; + echo '

'; + echo __m('Figures for Complete - Pending, Complete - Approved and Evidence Not Yet Approved are calculated from only those units joined within the specified time period. Due to the possibility of multiple submissions for any given unit, a single unit joined may result in multiple other statuses.'); + echo '

'; + try { $data = array(); if ($timePeriod == "Last 30 Days" OR $timePeriod == "Last 60 Days") { - $sql = 'SELECT timestampJoined, timestampCompleteApproved, status FROM freeLearningUnitStudent WHERE timestampCompleteApproved>=DATE_SUB(NOW(), INTERVAL '.$timePeriodLookup[$timePeriod].' DAY) OR timestampJoined>=DATE_SUB(NOW(), INTERVAL '.$timePeriodLookup[$timePeriod].' DAY)'; + $sql = 'SELECT freeLearningUnitStudentID, timestampJoined, GROUP_CONCAT(timestamp) AS timestamps, GROUP_CONCAT(type) AS types FROM freeLearningUnitStudent LEFT JOIN gibbonDiscussion ON (gibbonDiscussion.foreignTableID=freeLearningUnitStudent.freeLearningUnitStudentID AND foreignTable=\'freeLearningUnitStudent\') WHERE timestampJoined>=DATE_SUB(NOW(), INTERVAL '.$timePeriodLookup[$timePeriod].' DAY) GROUP BY freeLearningUnitStudentID'; } else if ($timePeriod == "Last 12 Months") { - $sql = 'SELECT timestampJoined, timestampCompleteApproved, status FROM freeLearningUnitStudent WHERE timestampCompleteApproved>=DATE_SUB(NOW(), INTERVAL '.$timePeriodLookup[$timePeriod].' MONTH) OR timestampJoined>=DATE_SUB(NOW(), INTERVAL '.$timePeriodLookup[$timePeriod].' MONTH)'; + $sql = 'SELECT freeLearningUnitStudentID, timestampJoined, GROUP_CONCAT(timestamp) AS timestamps, GROUP_CONCAT(type) AS types FROM freeLearningUnitStudent LEFT JOIN gibbonDiscussion ON (gibbonDiscussion.foreignTableID=freeLearningUnitStudent.freeLearningUnitStudentID AND foreignTable=\'freeLearningUnitStudent\') WHERE timestampJoined>=DATE_SUB(NOW(), INTERVAL '.$timePeriodLookup[$timePeriod].' MONTH) GROUP BY freeLearningUnitStudentID'; } $result = $connection2->prepare($sql); $result->execute($data); @@ -80,7 +84,7 @@ echo "
".$e->getMessage().'
'; } - if ($result->rowCount() < 1) { + if ($result->rowCount() < 1) { echo "
"; echo __('There are no records to display.'); echo '
'; @@ -102,28 +106,54 @@ '(Today) '.$d.'/'.$m, 1 => $countJoined, 2 => $countApproved)); + array_unshift($days, array(0 => '(Today) '.$d.'/'.$m, 1 => $countJoined, 2 => $countApproved, 3 => $countNYA, 4 => $countSubmitted)); } else { - array_unshift($days, array(0 => $d.'/'.$m, 1 => $countJoined, 2 => $countApproved)); + array_unshift($days, array(0 => $d.'/'.$m, 1 => $countJoined, 2 => $countApproved, 3 => $countNYA, 4 => $countSubmitted)); } } $labels = ''; @@ -136,22 +166,45 @@ for($i = 0; $i < $timePeriodLookup[$timePeriod]; $i++) { $countJoined = 0; $countApproved = 0 ; + $countNYA = 0 ; + $countSubmitted = 0 ; $m = date("m", strtotime('-'. $i .' months')); $Y = date("Y", strtotime('-'. $i .' months')); foreach ($rows as $row) { if (is_numeric(strpos($row['timestampJoined'], $Y."-".$m))) { $countJoined++ ; } - if (is_numeric(strpos($row['timestampCompleteApproved'], $Y."-".$m)) && $row['status'] == 'Complete - Approved') { - $countApproved++ ; - } + + $count = 0; + $timestamps = explode(',', $row['timestamps']); + $types = explode(',', $row['types']); + + foreach ($timestamps as $timestamp) { + $type = $types[$count]; + + if (is_numeric(strpos($timestamp, $m."-".$d)) && $type == 'Complete - Approved') { + $countApproved++ ; + } + if (is_numeric(strpos($timestamp, $m."-".$d)) && $type == 'Evidence Not Yet Approved') { + $countNYA++ ; + } + if (is_numeric(strpos($timestamp, $m."-".$d)) && $type == 'Complete - Pending') { + $countSubmitted++ ; + } + + $count ++; + } } + $countJoinedTotal += $countJoined; $countApprovedTotal += $countApproved; + $countNYATotal += $countNYA; + $countSubmittedTotal += $countSubmitted; + if ($i == 0) { - array_unshift($months, array(0 => '(Today) '.$m.'/'.$Y, 1 => $countJoined, 2 => $countApproved)); + array_unshift($months, array(0 => '(Today) '.$m.'/'.$Y, 1 => $countJoined, 2 => $countApproved, 3 => $countNYA, 4 => $countSubmitted)); } else { - array_unshift($months, array(0 => $m.'/'.$Y, 1 => $countJoined, 2 => $countApproved)); + array_unshift($months, array(0 => $m.'/'.$Y, 1 => $countJoined, 2 => $countApproved, 3 => $countNYA, 4 => $countSubmitted)); } } $labels = ''; @@ -166,12 +219,12 @@ datasets : [ { label: "", - backgroundColor : "rgba(253, 226, 255, 0.5)", - borderColor : "rgba(169, 60, 179,1)", - hoverBorderColor : "rgba(169, 60, 179,1)", - pointColor : "rgba(169, 60, 179,1)", - pointBorderColor : "rgba(169, 60, 179,1)", - pointBackgroundColor : "rgba(169, 60, 179,1)", + backgroundColor : "rgba(186, 230, 253, 0.5)", + borderColor : "rgba(2, 132, 199, 1)", + hoverBorderColor : "rgba(2, 132, 199, 1)", + pointColor : "rgba(2, 132, 199, 1)", + pointBorderColor : "rgba(2, 132, 199, 1)", + pointBackgroundColor : "rgba(2, 132, 199, 1)", lineTension: 0.3, data : [ ", - backgroundColor : "rgba(198, 246, 213,0.5", - borderColor : "rgba(47, 133, 90,1)", - hoverBorderColor : "rgba(47, 133, 90,1)", - pointColor : "rgba(47, 133, 90,1)", - pointBorderColor : "rgba(47, 133, 90,1)", - pointBackgroundColor : "rgba(47, 133, 90,1)", + label: "", + backgroundColor : "rgb(220, 197, 244, 0.5)", + borderColor : "rgb(99, 63, 134)", + hoverBorderColor : "rgb(99, 63, 134)", + pointColor : "rgb(99, 63, 134)", + pointBorderColor : "rgb(99, 63, 134)", + pointBackgroundColor : "rgb(99, 63, 134)", + lineTension: 0.3, + data : [ + + ] + }, + { + label: "", + backgroundColor : "rgba(198, 246, 213, 0.5)", + borderColor : "rgb(47, 133, 90)", + hoverBorderColor : "rgb(47, 133, 90)", + pointColor : "rgb(47, 133, 90)", + pointBorderColor : "rgb(47, 133, 90)", + pointBackgroundColor : "rgb(47, 133, 90)", lineTension: 0.3, data : [ ] + }, + { + label: "", + backgroundColor : "rgba(255, 210, 168, 0.5)", + borderColor : "rgb(212, 86, 2)", + hoverBorderColor : "rgb(212, 86, 2)", + pointColor : "rgb(212, 86, 2)", + pointBorderColor : "rgb(212, 86, 2)", + pointBackgroundColor : "rgb(212, 86, 2)", + lineTension: 0.3, + data : [ + + ] } ] } diff --git a/Free Learning/version.php b/Free Learning/version.php index 39938e3..3a0e116 100755 --- a/Free Learning/version.php +++ b/Free Learning/version.php @@ -20,5 +20,5 @@ /** * Sets version information. */ -$moduleVersion = '5.22.04'; +$moduleVersion = '5.22.05'; $coreVersion = '24.0.00';