From 022f3f07fa8d3f167bd01a30c1e3179101fcbeb5 Mon Sep 17 00:00:00 2001 From: Ankit Agarwal Date: Tue, 30 May 2017 13:07:48 +0530 Subject: [PATCH] MDL-59079 core_analytics: Refactor community of inquiry indicators Refactor code to introduce a new base class per activity. This would help in sharing apis between cognitive and social classes which is heavily required for level 2 and onwards. Part of MDL-57791 epic. --- .../indicator/activity_cognitive_depth.php | 116 ------------- .../indicator/activity_social_breadth.php | 67 ------- .../local/indicator/assign/activity_base.php | 45 +++++ .../indicator/assign/cognitive_depth.php | 10 +- .../local/indicator/assign/social_breadth.php | 10 +- .../local/indicator/book/activity_base.php | 45 +++++ .../local/indicator/book/cognitive_depth.php | 10 +- .../local/indicator/book/social_breadth.php | 10 +- .../local/indicator/chat/activity_base.php | 45 +++++ .../local/indicator/chat/cognitive_depth.php | 10 +- .../local/indicator/chat/social_breadth.php | 10 +- .../local/indicator/choice/activity_base.php | 45 +++++ .../indicator/choice/cognitive_depth.php | 10 +- .../local/indicator/choice/social_breadth.php | 10 +- .../community_of_inquiry_activity.php | 164 ++++++++++++++++++ .../local/indicator/data/activity_base.php | 45 +++++ .../local/indicator/data/cognitive_depth.php | 10 +- .../local/indicator/data/social_breadth.php | 10 +- .../indicator/feedback/activity_base.php | 45 +++++ .../indicator/feedback/cognitive_depth.php | 10 +- .../indicator/feedback/social_breadth.php | 10 +- .../local/indicator/folder/activity_base.php | 45 +++++ .../indicator/folder/cognitive_depth.php | 9 +- .../local/indicator/folder/social_breadth.php | 10 +- .../local/indicator/forum/activity_base.php | 45 +++++ .../local/indicator/forum/cognitive_depth.php | 10 +- .../local/indicator/forum/social_breadth.php | 10 +- .../indicator/glossary/activity_base.php | 45 +++++ .../indicator/glossary/cognitive_depth.php | 10 +- .../indicator/glossary/social_breadth.php | 10 +- .../local/indicator/imscp/activity_base.php | 45 +++++ .../local/indicator/imscp/cognitive_depth.php | 10 +- .../local/indicator/imscp/social_breadth.php | 10 +- .../local/indicator/label/activity_base.php | 45 +++++ .../local/indicator/label/cognitive_depth.php | 10 +- .../local/indicator/label/social_breadth.php | 10 +- .../local/indicator/lesson/activity_base.php | 45 +++++ .../indicator/lesson/cognitive_depth.php | 10 +- .../local/indicator/lesson/social_breadth.php | 10 +- .../local/indicator/lti/activity_base.php | 45 +++++ .../local/indicator/lti/cognitive_depth.php | 10 +- .../local/indicator/lti/social_breadth.php | 10 +- .../local/indicator/page/activity_base.php | 45 +++++ .../local/indicator/page/cognitive_depth.php | 10 +- .../local/indicator/page/social_breadth.php | 10 +- .../local/indicator/quiz/activity_base.php | 45 +++++ .../local/indicator/quiz/cognitive_depth.php | 10 +- .../local/indicator/quiz/social_breadth.php | 10 +- .../indicator/resource/activity_base.php | 45 +++++ .../indicator/resource/cognitive_depth.php | 10 +- .../indicator/resource/social_breadth.php | 10 +- .../local/indicator/scorm/activity_base.php | 45 +++++ .../local/indicator/scorm/cognitive_depth.php | 10 +- .../local/indicator/scorm/social_breadth.php | 10 +- .../local/indicator/survey/activity_base.php | 45 +++++ .../indicator/survey/cognitive_depth.php | 10 +- .../local/indicator/survey/social_breadth.php | 10 +- .../local/indicator/url/activity_base.php | 45 +++++ .../local/indicator/url/cognitive_depth.php | 10 +- .../local/indicator/url/social_breadth.php | 10 +- .../local/indicator/wiki/activity_base.php | 45 +++++ .../local/indicator/wiki/cognitive_depth.php | 10 +- .../local/indicator/wiki/social_breadth.php | 10 +- .../indicator/workshop/activity_base.php | 45 +++++ .../indicator/workshop/cognitive_depth.php | 10 +- .../indicator/workshop/social_breadth.php | 10 +- 66 files changed, 1235 insertions(+), 476 deletions(-) delete mode 100644 analytics/classes/local/indicator/activity_cognitive_depth.php delete mode 100644 analytics/classes/local/indicator/activity_social_breadth.php create mode 100644 analytics/classes/local/indicator/assign/activity_base.php create mode 100644 analytics/classes/local/indicator/book/activity_base.php create mode 100644 analytics/classes/local/indicator/chat/activity_base.php create mode 100644 analytics/classes/local/indicator/choice/activity_base.php create mode 100644 analytics/classes/local/indicator/data/activity_base.php create mode 100644 analytics/classes/local/indicator/feedback/activity_base.php create mode 100644 analytics/classes/local/indicator/folder/activity_base.php create mode 100644 analytics/classes/local/indicator/forum/activity_base.php create mode 100644 analytics/classes/local/indicator/glossary/activity_base.php create mode 100644 analytics/classes/local/indicator/imscp/activity_base.php create mode 100644 analytics/classes/local/indicator/label/activity_base.php create mode 100644 analytics/classes/local/indicator/lesson/activity_base.php create mode 100644 analytics/classes/local/indicator/lti/activity_base.php create mode 100644 analytics/classes/local/indicator/page/activity_base.php create mode 100644 analytics/classes/local/indicator/quiz/activity_base.php create mode 100644 analytics/classes/local/indicator/resource/activity_base.php create mode 100644 analytics/classes/local/indicator/scorm/activity_base.php create mode 100644 analytics/classes/local/indicator/survey/activity_base.php create mode 100644 analytics/classes/local/indicator/url/activity_base.php create mode 100644 analytics/classes/local/indicator/wiki/activity_base.php create mode 100644 analytics/classes/local/indicator/workshop/activity_base.php diff --git a/analytics/classes/local/indicator/activity_cognitive_depth.php b/analytics/classes/local/indicator/activity_cognitive_depth.php deleted file mode 100644 index ccd6b8bb11d..00000000000 --- a/analytics/classes/local/indicator/activity_cognitive_depth.php +++ /dev/null @@ -1,116 +0,0 @@ -. - -/** - * Cognitive depth abstract indicator. - * - * @package core_analytics - * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -namespace core_analytics\local\indicator; - -defined('MOODLE_INTERNAL') || die(); - -/** - * Cognitive depth abstract indicator. - * - * @package core_analytics - * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -abstract class activity_cognitive_depth extends community_of_inquiry_activity { - - public function calculate_sample($sampleid, $tablename, $starttime = false, $endtime = false) { - - // May not be available. - $user = $this->retrieve('user', $sampleid); - - if (!$useractivities = $this->get_student_activities($sampleid, $tablename, $starttime, $endtime)) { - // Null if no activities. - return null; - } - - $scoreperactivity = (self::get_max_value() - self::get_min_value()) / count($useractivities); - - $score = self::get_min_value(); - - // Iterate through the module activities/resources which due date is part of this time range. - foreach ($useractivities as $contextid => $cm) { - - $potentiallevel = $this->get_cognitive_depth_level($cm); - if (!is_int($potentiallevel) || $potentiallevel > 5 || $potentiallevel < 1) { - throw new \coding_exception('Activities\' potential level of engagement possible values go from 1 to 5.'); - } - $scoreperlevel = $scoreperactivity / $potentiallevel; - - switch ($potentiallevel) { - case 5: - // Cognitive level 4 is to comment on feedback. - if ($this->any_feedback('submitted', $cm, $contextid, $user)) { - $score += $scoreperlevel * 5; - break; - } - // The user didn't reach the activity max cognitive depth, continue with level 2. - - case 4: - // Cognitive level 4 is to comment on feedback. - if ($this->any_feedback('replied', $cm, $contextid, $user)) { - $score += $scoreperlevel * 4; - break; - } - // The user didn't reach the activity max cognitive depth, continue with level 2. - - case 3: - // Cognitive level 3 is to view feedback. - - if ($this->any_feedback('viewed', $cm, $contextid, $user)) { - // Max score for level 3. - $score += $scoreperlevel * 3; - break; - } - // The user didn't reach the activity max cognitive depth, continue with level 2. - - case 2: - // Cognitive depth level 2 is to submit content. - - if ($this->any_write_log($contextid, $user)) { - $score += $scoreperlevel * 2; - break; - } - // The user didn't reach the activity max cognitive depth, continue with level 1. - - case 1: - // Cognitive depth level 1 is just accessing the activity. - - if ($this->any_log($contextid, $user)) { - $score += $scoreperlevel; - } - - default: - } - } - - // To avoid decimal problems. - if ($score > self::MAX_VALUE) { - return self::MAX_VALUE; - } else if ($score < self::MIN_VALUE) { - return self::MIN_VALUE; - } - return $score; - } -} diff --git a/analytics/classes/local/indicator/activity_social_breadth.php b/analytics/classes/local/indicator/activity_social_breadth.php deleted file mode 100644 index 11295e597cd..00000000000 --- a/analytics/classes/local/indicator/activity_social_breadth.php +++ /dev/null @@ -1,67 +0,0 @@ -. - -/** - * Social breadth abstract indicator. - * - * @package core_analytics - * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -namespace core_analytics\local\indicator; - -defined('MOODLE_INTERNAL') || die(); - -/** - * Social breadth abstract indicator. - * - * @package core_analytics - * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -abstract class activity_social_breadth extends community_of_inquiry_activity { - - public function calculate_sample($sampleid, $tablename, $starttime = false, $endtime = false) { - - // May not be available. - $user = $this->retrieve('user', $sampleid); - - if (!$useractivities = $this->get_student_activities($sampleid, $tablename, $starttime, $endtime)) { - // Null if no activities. - return null; - } - - $scoreperactivity = (self::get_max_value() - self::get_min_value()) / count($useractivities); - - $score = self::get_min_value(); - - foreach ($useractivities as $contextid => $cm) { - // TODO Add support for other levels than 1. - if ($this->any_log($contextid, $user)) { - $score += $scoreperactivity; - } - } - - // To avoid decimal problems. - if ($score > self::MAX_VALUE) { - return self::MAX_VALUE; - } else if ($score < self::MIN_VALUE) { - return self::MIN_VALUE; - } - return $score; - } -} diff --git a/analytics/classes/local/indicator/assign/activity_base.php b/analytics/classes/local/indicator/assign/activity_base.php new file mode 100644 index 00000000000..51deb074a5e --- /dev/null +++ b/analytics/classes/local/indicator/assign/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\assign; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthassign', 'analytics'); + } + + protected function get_activity_type() { + return 'assign'; + } +} diff --git a/analytics/classes/local/indicator/assign/cognitive_depth.php b/analytics/classes/local/indicator/assign/cognitive_depth.php index 1744c3e884e..546dd90935c 100644 --- a/analytics/classes/local/indicator/assign/cognitive_depth.php +++ b/analytics/classes/local/indicator/assign/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthassign', 'analytics'); - } - - protected function get_activity_type() { - return 'assign'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } protected function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/assign/social_breadth.php b/analytics/classes/local/indicator/assign/social_breadth.php index db580db753a..e233e701b0d 100644 --- a/analytics/classes/local/indicator/assign/social_breadth.php +++ b/analytics/classes/local/indicator/assign/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthassign', 'analytics'); - } - - protected function get_activity_type() { - return 'assign'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/book/activity_base.php b/analytics/classes/local/indicator/book/activity_base.php new file mode 100644 index 00000000000..156e64133f3 --- /dev/null +++ b/analytics/classes/local/indicator/book/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\book; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthbook', 'analytics'); + } + + protected function get_activity_type() { + return 'book'; + } +} diff --git a/analytics/classes/local/indicator/book/cognitive_depth.php b/analytics/classes/local/indicator/book/cognitive_depth.php index 2b4d73568a7..ec300c73073 100644 --- a/analytics/classes/local/indicator/book/cognitive_depth.php +++ b/analytics/classes/local/indicator/book/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthbook', 'analytics'); - } - - protected function get_activity_type() { - return 'book'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } protected function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/book/social_breadth.php b/analytics/classes/local/indicator/book/social_breadth.php index f28312cdcd1..808958232a9 100644 --- a/analytics/classes/local/indicator/book/social_breadth.php +++ b/analytics/classes/local/indicator/book/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthbook', 'analytics'); - } - - protected function get_activity_type() { - return 'book'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/chat/activity_base.php b/analytics/classes/local/indicator/chat/activity_base.php new file mode 100644 index 00000000000..3ac0f4bf117 --- /dev/null +++ b/analytics/classes/local/indicator/chat/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\chat; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthchat', 'analytics'); + } + + protected function get_activity_type() { + return 'chat'; + } +} diff --git a/analytics/classes/local/indicator/chat/cognitive_depth.php b/analytics/classes/local/indicator/chat/cognitive_depth.php index 1d48cf5ddaa..780c4a28efb 100644 --- a/analytics/classes/local/indicator/chat/cognitive_depth.php +++ b/analytics/classes/local/indicator/chat/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthchat', 'analytics'); - } - - protected function get_activity_type() { - return 'chat'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } public function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/chat/social_breadth.php b/analytics/classes/local/indicator/chat/social_breadth.php index 1fdafd0e956..459b55ee280 100644 --- a/analytics/classes/local/indicator/chat/social_breadth.php +++ b/analytics/classes/local/indicator/chat/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthchat', 'analytics'); - } - - protected function get_activity_type() { - return 'chat'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/choice/activity_base.php b/analytics/classes/local/indicator/choice/activity_base.php new file mode 100644 index 00000000000..7591f6877ad --- /dev/null +++ b/analytics/classes/local/indicator/choice/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\choice; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthchoice', 'analytics'); + } + + protected function get_activity_type() { + return 'choice'; + } +} diff --git a/analytics/classes/local/indicator/choice/cognitive_depth.php b/analytics/classes/local/indicator/choice/cognitive_depth.php index b1c5324c196..268d03b80b0 100644 --- a/analytics/classes/local/indicator/choice/cognitive_depth.php +++ b/analytics/classes/local/indicator/choice/cognitive_depth.php @@ -33,16 +33,12 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { protected $choicedata = array(); - public static function get_name() { - return get_string('indicator:cognitivedepthchoice', 'analytics'); - } - - protected function get_activity_type() { - return 'choice'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } protected function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/choice/social_breadth.php b/analytics/classes/local/indicator/choice/social_breadth.php index 001f9dbbbdb..0ee5812527f 100644 --- a/analytics/classes/local/indicator/choice/social_breadth.php +++ b/analytics/classes/local/indicator/choice/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthchoice', 'analytics'); - } - - protected function get_activity_type() { - return 'choice'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/community_of_inquiry_activity.php b/analytics/classes/local/indicator/community_of_inquiry_activity.php index 83b83c234ca..45f963fa290 100644 --- a/analytics/classes/local/indicator/community_of_inquiry_activity.php +++ b/analytics/classes/local/indicator/community_of_inquiry_activity.php @@ -48,6 +48,16 @@ abstract class community_of_inquiry_activity extends linear { */ protected $grades = null; + /** + * @const Constant cognitive indicator type. + */ + const INDICATOR_COGNITIVE = "cognitve"; + + /** + * @const Constant social indicator type. + */ + const INDICATOR_SOCIAL = "social"; + /** * TODO Automate this when merging into core. * @var string The activity name (e.g. assign or quiz) @@ -331,4 +341,158 @@ abstract class community_of_inquiry_activity extends linear { protected function feedback_check_grades() { return true; } + + /** + * cognitive_calculate_sample + * + * @param $sampleid + * @param $tablename + * @param bool $starttime + * @param bool $endtime + * @return float|int|null + * @throws \coding_exception + */ + protected function cognitive_calculate_sample($sampleid, $tablename, $starttime = false, $endtime = false) { + + // May not be available. + $user = $this->retrieve('user', $sampleid); + + if (!$useractivities = $this->get_student_activities($sampleid, $tablename, $starttime, $endtime)) { + // Null if no activities. + return null; + } + + $scoreperactivity = (self::get_max_value() - self::get_min_value()) / count($useractivities); + + $score = self::get_min_value(); + + // Iterate through the module activities/resources which due date is part of this time range. + foreach ($useractivities as $contextid => $cm) { + + $potentiallevel = $this->get_cognitive_depth_level($cm); + if (!is_int($potentiallevel) || $potentiallevel > 5 || $potentiallevel < 1) { + throw new \coding_exception('Activities\' potential level of engagement possible values go from 1 to 5.'); + } + $scoreperlevel = $scoreperactivity / $potentiallevel; + + switch ($potentiallevel) { + case 5: + // Cognitive level 4 is to comment on feedback. + if ($this->any_feedback('submitted', $cm, $contextid, $user)) { + $score += $scoreperlevel * 5; + break; + } + // The user didn't reach the activity max cognitive depth, continue with level 2. + + case 4: + // Cognitive level 4 is to comment on feedback. + if ($this->any_feedback('replied', $cm, $contextid, $user)) { + $score += $scoreperlevel * 4; + break; + } + // The user didn't reach the activity max cognitive depth, continue with level 2. + + case 3: + // Cognitive level 3 is to view feedback. + + if ($this->any_feedback('viewed', $cm, $contextid, $user)) { + // Max score for level 3. + $score += $scoreperlevel * 3; + break; + } + // The user didn't reach the activity max cognitive depth, continue with level 2. + + case 2: + // Cognitive depth level 2 is to submit content. + + if ($this->any_write_log($contextid, $user)) { + $score += $scoreperlevel * 2; + break; + } + // The user didn't reach the activity max cognitive depth, continue with level 1. + + case 1: + // Cognitive depth level 1 is just accessing the activity. + + if ($this->any_log($contextid, $user)) { + $score += $scoreperlevel; + } + + default: + } + } + + // To avoid decimal problems. + if ($score > self::MAX_VALUE) { + return self::MAX_VALUE; + } else if ($score < self::MIN_VALUE) { + return self::MIN_VALUE; + } + return $score; + } + + /** + * social_calculate_sample + * + * @param $sampleid + * @param $tablename + * @param bool $starttime + * @param bool $endtime + * @return float|int|null + */ + protected function social_calculate_sample($sampleid, $tablename, $starttime = false, $endtime = false) { + + // May not be available. + $user = $this->retrieve('user', $sampleid); + + if (!$useractivities = $this->get_student_activities($sampleid, $tablename, $starttime, $endtime)) { + // Null if no activities. + return null; + } + + $scoreperactivity = (self::get_max_value() - self::get_min_value()) / count($useractivities); + + $score = self::get_min_value(); + + foreach ($useractivities as $contextid => $cm) { + // TODO Add support for other levels than 1. + if ($this->any_log($contextid, $user)) { + $score += $scoreperactivity; + } + } + + // To avoid decimal problems. + if ($score > self::MAX_VALUE) { + return self::MAX_VALUE; + } else if ($score < self::MIN_VALUE) { + return self::MIN_VALUE; + } + return $score; + } + + /** + * calculate_sample + * + * @param int $sampleid + * @param string $tablename + * @param bool $starttime + * @param bool $endtime + * @return float|int|null + * @throws \coding_exception + */ + public function calculate_sample($sampleid, $tablename, $starttime = false, $endtime = false) { + if ($this->get_indicator_type() == self::INDICATOR_COGNITIVE) { + return $this->cognitive_calculate_sample($sampleid, $tablename, $starttime, $endtime); + } else if ($this->get_indicator_type() == self::INDICATOR_SOCIAL) { + return $this->social_calculate_sample($sampleid, $tablename, $starttime, $endtime); + } + throw new \coding_exception("Indicator type is invalid."); + } + + /** + * Defines indicator type. + * + * @return mixed + */ + abstract protected function get_indicator_type(); } diff --git a/analytics/classes/local/indicator/data/activity_base.php b/analytics/classes/local/indicator/data/activity_base.php new file mode 100644 index 00000000000..9263bca64d7 --- /dev/null +++ b/analytics/classes/local/indicator/data/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\data; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthdata', 'analytics'); + } + + protected function get_activity_type() { + return 'data'; + } +} diff --git a/analytics/classes/local/indicator/data/cognitive_depth.php b/analytics/classes/local/indicator/data/cognitive_depth.php index a9c593ccb69..80258e11ea6 100644 --- a/analytics/classes/local/indicator/data/cognitive_depth.php +++ b/analytics/classes/local/indicator/data/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthdata', 'analytics'); - } - - protected function get_activity_type() { - return 'data'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } public function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/data/social_breadth.php b/analytics/classes/local/indicator/data/social_breadth.php index c3d617b145e..0c0275eb7be 100644 --- a/analytics/classes/local/indicator/data/social_breadth.php +++ b/analytics/classes/local/indicator/data/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthdata', 'analytics'); - } - - protected function get_activity_type() { - return 'data'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/feedback/activity_base.php b/analytics/classes/local/indicator/feedback/activity_base.php new file mode 100644 index 00000000000..a14c08224b5 --- /dev/null +++ b/analytics/classes/local/indicator/feedback/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\feedback; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthfeedback', 'analytics'); + } + + protected function get_activity_type() { + return 'feedback'; + } +} diff --git a/analytics/classes/local/indicator/feedback/cognitive_depth.php b/analytics/classes/local/indicator/feedback/cognitive_depth.php index 526e8fe1a9b..a5145adf956 100644 --- a/analytics/classes/local/indicator/feedback/cognitive_depth.php +++ b/analytics/classes/local/indicator/feedback/cognitive_depth.php @@ -33,19 +33,15 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { /** * @var int[] Tiny cache to hold feedback instance - publish_stats field relation. */ protected $publishstats = array(); - public static function get_name() { - return get_string('indicator:cognitivedepthfeedback', 'analytics'); - } - - protected function get_activity_type() { - return 'feedback'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } protected function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/feedback/social_breadth.php b/analytics/classes/local/indicator/feedback/social_breadth.php index c9dac7d3fda..b41538a1c0e 100644 --- a/analytics/classes/local/indicator/feedback/social_breadth.php +++ b/analytics/classes/local/indicator/feedback/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthfeedback', 'analytics'); - } - - protected function get_activity_type() { - return 'feedback'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/folder/activity_base.php b/analytics/classes/local/indicator/folder/activity_base.php new file mode 100644 index 00000000000..2ebbf8812b9 --- /dev/null +++ b/analytics/classes/local/indicator/folder/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\folder; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthfolder', 'analytics'); + } + + protected function get_activity_type() { + return 'folder'; + } +} diff --git a/analytics/classes/local/indicator/folder/cognitive_depth.php b/analytics/classes/local/indicator/folder/cognitive_depth.php index d9e96797b81..7ddd1a27b75 100644 --- a/analytics/classes/local/indicator/folder/cognitive_depth.php +++ b/analytics/classes/local/indicator/folder/cognitive_depth.php @@ -33,15 +33,12 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthfolder', 'analytics'); + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } - protected function get_activity_type() { - return 'folder'; - } protected function get_cognitive_depth_level(\cm_info $cm) { return 1; } diff --git a/analytics/classes/local/indicator/folder/social_breadth.php b/analytics/classes/local/indicator/folder/social_breadth.php index 1911fcb8bbc..2f9dad81cb7 100644 --- a/analytics/classes/local/indicator/folder/social_breadth.php +++ b/analytics/classes/local/indicator/folder/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthfolder', 'analytics'); - } - - protected function get_activity_type() { - return 'folder'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/forum/activity_base.php b/analytics/classes/local/indicator/forum/activity_base.php new file mode 100644 index 00000000000..da3b9e13a97 --- /dev/null +++ b/analytics/classes/local/indicator/forum/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\forum; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthforum', 'core_analytics'); + } + + protected function get_activity_type() { + return 'forum'; + } +} diff --git a/analytics/classes/local/indicator/forum/cognitive_depth.php b/analytics/classes/local/indicator/forum/cognitive_depth.php index 3ff2996f828..eb36b643330 100644 --- a/analytics/classes/local/indicator/forum/cognitive_depth.php +++ b/analytics/classes/local/indicator/forum/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthforum', 'analytics'); - } - - protected function get_activity_type() { - return 'forum'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } public function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/forum/social_breadth.php b/analytics/classes/local/indicator/forum/social_breadth.php index ae6ebf09fdd..2600ac73951 100644 --- a/analytics/classes/local/indicator/forum/social_breadth.php +++ b/analytics/classes/local/indicator/forum/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthforum', 'analytics'); - } - - protected function get_activity_type() { - return 'forum'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/glossary/activity_base.php b/analytics/classes/local/indicator/glossary/activity_base.php new file mode 100644 index 00000000000..aae6912d6f7 --- /dev/null +++ b/analytics/classes/local/indicator/glossary/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\glossary; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthglossary', 'analytics'); + } + + protected function get_activity_type() { + return 'glossary'; + } +} diff --git a/analytics/classes/local/indicator/glossary/cognitive_depth.php b/analytics/classes/local/indicator/glossary/cognitive_depth.php index 6231b4e6b27..eec3b6ab1a0 100644 --- a/analytics/classes/local/indicator/glossary/cognitive_depth.php +++ b/analytics/classes/local/indicator/glossary/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthglossary', 'analytics'); - } - - protected function get_activity_type() { - return 'glossary'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } public function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/glossary/social_breadth.php b/analytics/classes/local/indicator/glossary/social_breadth.php index 594fce10083..fa5293bf2cf 100644 --- a/analytics/classes/local/indicator/glossary/social_breadth.php +++ b/analytics/classes/local/indicator/glossary/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthglossary', 'analytics'); - } - - protected function get_activity_type() { - return 'glossary'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/imscp/activity_base.php b/analytics/classes/local/indicator/imscp/activity_base.php new file mode 100644 index 00000000000..96bbfdd807f --- /dev/null +++ b/analytics/classes/local/indicator/imscp/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\imscp; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthimscp', 'analytics'); + } + + protected function get_activity_type() { + return 'imscp'; + } +} diff --git a/analytics/classes/local/indicator/imscp/cognitive_depth.php b/analytics/classes/local/indicator/imscp/cognitive_depth.php index 99359cff933..9364b784bf1 100644 --- a/analytics/classes/local/indicator/imscp/cognitive_depth.php +++ b/analytics/classes/local/indicator/imscp/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthimscp', 'analytics'); - } - - protected function get_activity_type() { - return 'imscp'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } protected function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/imscp/social_breadth.php b/analytics/classes/local/indicator/imscp/social_breadth.php index d8dd7ec37b9..810d6c9434b 100644 --- a/analytics/classes/local/indicator/imscp/social_breadth.php +++ b/analytics/classes/local/indicator/imscp/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthimscp', 'analytics'); - } - - protected function get_activity_type() { - return 'imscp'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/label/activity_base.php b/analytics/classes/local/indicator/label/activity_base.php new file mode 100644 index 00000000000..ba8ab2046e4 --- /dev/null +++ b/analytics/classes/local/indicator/label/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\label; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthlabel', 'analytics'); + } + + protected function get_activity_type() { + return 'label'; + } +} diff --git a/analytics/classes/local/indicator/label/cognitive_depth.php b/analytics/classes/local/indicator/label/cognitive_depth.php index 5a2066a3362..b8b9b7a9c17 100644 --- a/analytics/classes/local/indicator/label/cognitive_depth.php +++ b/analytics/classes/local/indicator/label/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthlabel', 'analytics'); - } - - protected function get_activity_type() { - return 'label'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } protected function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/label/social_breadth.php b/analytics/classes/local/indicator/label/social_breadth.php index 7c9ac5c2e0d..dff40d69c58 100644 --- a/analytics/classes/local/indicator/label/social_breadth.php +++ b/analytics/classes/local/indicator/label/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthlabel', 'analytics'); - } - - protected function get_activity_type() { - return 'label'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/lesson/activity_base.php b/analytics/classes/local/indicator/lesson/activity_base.php new file mode 100644 index 00000000000..ca40088ce31 --- /dev/null +++ b/analytics/classes/local/indicator/lesson/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\lesson; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthlesson', 'analytics'); + } + + protected function get_activity_type() { + return 'lesson'; + } +} diff --git a/analytics/classes/local/indicator/lesson/cognitive_depth.php b/analytics/classes/local/indicator/lesson/cognitive_depth.php index 172a6c091ea..62f9571e191 100644 --- a/analytics/classes/local/indicator/lesson/cognitive_depth.php +++ b/analytics/classes/local/indicator/lesson/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthlesson', 'analytics'); - } - - protected function get_activity_type() { - return 'lesson'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } protected function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/lesson/social_breadth.php b/analytics/classes/local/indicator/lesson/social_breadth.php index 6eb4d94eb0a..1b8eb4417c9 100644 --- a/analytics/classes/local/indicator/lesson/social_breadth.php +++ b/analytics/classes/local/indicator/lesson/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthlesson', 'analytics'); - } - - protected function get_activity_type() { - return 'lesson'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/lti/activity_base.php b/analytics/classes/local/indicator/lti/activity_base.php new file mode 100644 index 00000000000..45e69d88457 --- /dev/null +++ b/analytics/classes/local/indicator/lti/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\lti; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthlti', 'analytics'); + } + + protected function get_activity_type() { + return 'lti'; + } +} diff --git a/analytics/classes/local/indicator/lti/cognitive_depth.php b/analytics/classes/local/indicator/lti/cognitive_depth.php index ed57db45385..c1c34176a5f 100644 --- a/analytics/classes/local/indicator/lti/cognitive_depth.php +++ b/analytics/classes/local/indicator/lti/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthlti', 'analytics'); - } - - protected function get_activity_type() { - return 'lti'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } public function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/lti/social_breadth.php b/analytics/classes/local/indicator/lti/social_breadth.php index 4304bd3beb7..3c4c2451ef1 100644 --- a/analytics/classes/local/indicator/lti/social_breadth.php +++ b/analytics/classes/local/indicator/lti/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthlti', 'analytics'); - } - - protected function get_activity_type() { - return 'lti'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/page/activity_base.php b/analytics/classes/local/indicator/page/activity_base.php new file mode 100644 index 00000000000..49fb17ae2a5 --- /dev/null +++ b/analytics/classes/local/indicator/page/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\page; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthpage', 'analytics'); + } + + protected function get_activity_type() { + return 'page'; + } +} diff --git a/analytics/classes/local/indicator/page/cognitive_depth.php b/analytics/classes/local/indicator/page/cognitive_depth.php index f6318ff7dd3..aab0c233c48 100644 --- a/analytics/classes/local/indicator/page/cognitive_depth.php +++ b/analytics/classes/local/indicator/page/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthpage', 'analytics'); - } - - protected function get_activity_type() { - return 'page'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } protected function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/page/social_breadth.php b/analytics/classes/local/indicator/page/social_breadth.php index 2333aa96c8c..f2268d48374 100644 --- a/analytics/classes/local/indicator/page/social_breadth.php +++ b/analytics/classes/local/indicator/page/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthpage', 'analytics'); - } - - protected function get_activity_type() { - return 'page'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/quiz/activity_base.php b/analytics/classes/local/indicator/quiz/activity_base.php new file mode 100644 index 00000000000..919492e7c2b --- /dev/null +++ b/analytics/classes/local/indicator/quiz/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\quiz; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthquiz', 'analytics'); + } + + protected function get_activity_type() { + return 'quiz'; + } +} diff --git a/analytics/classes/local/indicator/quiz/cognitive_depth.php b/analytics/classes/local/indicator/quiz/cognitive_depth.php index 22ea141d8da..5ad1908f8f5 100644 --- a/analytics/classes/local/indicator/quiz/cognitive_depth.php +++ b/analytics/classes/local/indicator/quiz/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthquiz', 'analytics'); - } - - protected function get_activity_type() { - return 'quiz'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } public function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/quiz/social_breadth.php b/analytics/classes/local/indicator/quiz/social_breadth.php index 604d9d90114..b0e03314a74 100644 --- a/analytics/classes/local/indicator/quiz/social_breadth.php +++ b/analytics/classes/local/indicator/quiz/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthquiz', 'analytics'); - } - - protected function get_activity_type() { - return 'quiz'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/resource/activity_base.php b/analytics/classes/local/indicator/resource/activity_base.php new file mode 100644 index 00000000000..06bdd1f637b --- /dev/null +++ b/analytics/classes/local/indicator/resource/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\resource; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthresource', 'analytics'); + } + + protected function get_activity_type() { + return 'resource'; + } +} diff --git a/analytics/classes/local/indicator/resource/cognitive_depth.php b/analytics/classes/local/indicator/resource/cognitive_depth.php index 7ba0eaab165..f70d4328849 100644 --- a/analytics/classes/local/indicator/resource/cognitive_depth.php +++ b/analytics/classes/local/indicator/resource/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthresource', 'analytics'); - } - - protected function get_activity_type() { - return 'resource'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } protected function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/resource/social_breadth.php b/analytics/classes/local/indicator/resource/social_breadth.php index 5aea5c968c0..02717f36de6 100644 --- a/analytics/classes/local/indicator/resource/social_breadth.php +++ b/analytics/classes/local/indicator/resource/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthresource', 'analytics'); - } - - protected function get_activity_type() { - return 'resource'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/scorm/activity_base.php b/analytics/classes/local/indicator/scorm/activity_base.php new file mode 100644 index 00000000000..f1535bbae53 --- /dev/null +++ b/analytics/classes/local/indicator/scorm/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\scorm; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthscorm', 'analytics'); + } + + protected function get_activity_type() { + return 'scorm'; + } +} diff --git a/analytics/classes/local/indicator/scorm/cognitive_depth.php b/analytics/classes/local/indicator/scorm/cognitive_depth.php index bef36e790f7..cfd599ba1ae 100644 --- a/analytics/classes/local/indicator/scorm/cognitive_depth.php +++ b/analytics/classes/local/indicator/scorm/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthscorm', 'analytics'); - } - - protected function get_activity_type() { - return 'scorm'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } public function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/scorm/social_breadth.php b/analytics/classes/local/indicator/scorm/social_breadth.php index 8e1da06c6b7..77bce590021 100644 --- a/analytics/classes/local/indicator/scorm/social_breadth.php +++ b/analytics/classes/local/indicator/scorm/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthscorm', 'analytics'); - } - - protected function get_activity_type() { - return 'scorm'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/survey/activity_base.php b/analytics/classes/local/indicator/survey/activity_base.php new file mode 100644 index 00000000000..41a28872702 --- /dev/null +++ b/analytics/classes/local/indicator/survey/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\survey; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthsurvey', 'analytics'); + } + + protected function get_activity_type() { + return 'survey'; + } +} diff --git a/analytics/classes/local/indicator/survey/cognitive_depth.php b/analytics/classes/local/indicator/survey/cognitive_depth.php index 686bfa675d8..410b3f3c0f4 100644 --- a/analytics/classes/local/indicator/survey/cognitive_depth.php +++ b/analytics/classes/local/indicator/survey/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthsurvey', 'analytics'); - } - - protected function get_activity_type() { - return 'survey'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } protected function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/survey/social_breadth.php b/analytics/classes/local/indicator/survey/social_breadth.php index 21099bcc03b..7f817e28922 100644 --- a/analytics/classes/local/indicator/survey/social_breadth.php +++ b/analytics/classes/local/indicator/survey/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthsurvey', 'analytics'); - } - - protected function get_activity_type() { - return 'survey'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/url/activity_base.php b/analytics/classes/local/indicator/url/activity_base.php new file mode 100644 index 00000000000..24915ce2ba5 --- /dev/null +++ b/analytics/classes/local/indicator/url/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\url; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthurl', 'analytics'); + } + + protected function get_activity_type() { + return 'url'; + } +} diff --git a/analytics/classes/local/indicator/url/cognitive_depth.php b/analytics/classes/local/indicator/url/cognitive_depth.php index 9cf32d952fd..f900e63bf62 100644 --- a/analytics/classes/local/indicator/url/cognitive_depth.php +++ b/analytics/classes/local/indicator/url/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthurl', 'analytics'); - } - - protected function get_activity_type() { - return 'url'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } protected function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/url/social_breadth.php b/analytics/classes/local/indicator/url/social_breadth.php index c0641469307..f57a7097d51 100644 --- a/analytics/classes/local/indicator/url/social_breadth.php +++ b/analytics/classes/local/indicator/url/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthurl', 'analytics'); - } - - protected function get_activity_type() { - return 'url'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/wiki/activity_base.php b/analytics/classes/local/indicator/wiki/activity_base.php new file mode 100644 index 00000000000..1baa519eaa9 --- /dev/null +++ b/analytics/classes/local/indicator/wiki/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\wiki; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthwiki', 'analytics'); + } + + protected function get_activity_type() { + return 'wiki'; + } +} diff --git a/analytics/classes/local/indicator/wiki/cognitive_depth.php b/analytics/classes/local/indicator/wiki/cognitive_depth.php index b02da88be45..461cdde487e 100644 --- a/analytics/classes/local/indicator/wiki/cognitive_depth.php +++ b/analytics/classes/local/indicator/wiki/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthwiki', 'analytics'); - } - - protected function get_activity_type() { - return 'wiki'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } public function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/wiki/social_breadth.php b/analytics/classes/local/indicator/wiki/social_breadth.php index 4323b918013..b03e14c33ca 100644 --- a/analytics/classes/local/indicator/wiki/social_breadth.php +++ b/analytics/classes/local/indicator/wiki/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthwiki', 'analytics'); - } - - protected function get_activity_type() { - return 'wiki'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } } diff --git a/analytics/classes/local/indicator/workshop/activity_base.php b/analytics/classes/local/indicator/workshop/activity_base.php new file mode 100644 index 00000000000..edc96f8ff7d --- /dev/null +++ b/analytics/classes/local/indicator/workshop/activity_base.php @@ -0,0 +1,45 @@ +. + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_analytics\local\indicator\workshop; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Activity base class. + * + * @package core_analytics + * @copyright 2017 onwards Ankit Agarwal + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +abstract class activity_base extends \core_analytics\local\indicator\community_of_inquiry_activity { + + public static function get_name() { + return get_string('indicator:cognitivedepthworkshop', 'analytics'); + } + + protected function get_activity_type() { + return 'workshop'; + } +} diff --git a/analytics/classes/local/indicator/workshop/cognitive_depth.php b/analytics/classes/local/indicator/workshop/cognitive_depth.php index 556b93c6652..079b13d09b0 100644 --- a/analytics/classes/local/indicator/workshop/cognitive_depth.php +++ b/analytics/classes/local/indicator/workshop/cognitive_depth.php @@ -33,14 +33,10 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cognitive_depth extends \core_analytics\local\indicator\activity_cognitive_depth { +class cognitive_depth extends activity_base { - public static function get_name() { - return get_string('indicator:cognitivedepthworkshop', 'analytics'); - } - - protected function get_activity_type() { - return 'workshop'; + protected function get_indicator_type() { + return self::INDICATOR_COGNITIVE; } public function get_cognitive_depth_level(\cm_info $cm) { diff --git a/analytics/classes/local/indicator/workshop/social_breadth.php b/analytics/classes/local/indicator/workshop/social_breadth.php index 6e3c462c805..abf0877746e 100644 --- a/analytics/classes/local/indicator/workshop/social_breadth.php +++ b/analytics/classes/local/indicator/workshop/social_breadth.php @@ -33,13 +33,9 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2017 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class social_breadth extends \core_analytics\local\indicator\activity_social_breadth { +class social_breadth extends activity_base { - public static function get_name() { - return get_string('indicator:socialbreadthworkshop', 'analytics'); - } - - protected function get_activity_type() { - return 'workshop'; + protected function get_indicator_type() { + return self::INDICATOR_SOCIAL; } }