Commit 5846c72c authored by Ankit Agarwal's avatar Ankit Agarwal Committed by David Monllaó
Browse files

MDL-59117 core_analytics: Move all indicators to respective modules

Part of MDL-57791 epic.
parent ebd55f66
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Activity base class.
*
* @package core_analytics
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @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 <ankit.agrr@gmail.com>
* @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';
}
}
......@@ -59,10 +59,19 @@ abstract class community_of_inquiry_activity extends linear {
const INDICATOR_SOCIAL = "social";
/**
* TODO Automate this when merging into core.
* Returns the activity type. No point in changing this class in children classes.
*
* @var string The activity name (e.g. assign or quiz)
*/
abstract protected function get_activity_type();
final protected function get_activity_type() {
$class = get_class($this);
$package = stristr($class, "\\", true);
$type = str_replace("mod_", "", $package);
if ($type === $package) {
throw new \coding_exception("$class does not belong to any module specific namespace");
}
return $type;
}
protected function get_cognitive_depth_level(\cm_info $cm) {
throw new \coding_exception('Overwrite get_cognitive_depth_level method to set your activity potential cognitive ' .
......
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Activity base class.
*
* @package core_analytics
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @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 <ankit.agrr@gmail.com>
* @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';
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Activity base class.
*
* @package core_analytics
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @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 <ankit.agrr@gmail.com>
* @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';
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Activity base class.
*
* @package core_analytics
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @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 <ankit.agrr@gmail.com>
* @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';
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Activity base class.
*
* @package core_analytics
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @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 <ankit.agrr@gmail.com>
* @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';
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Activity base class.
*
* @package core_analytics
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @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 <ankit.agrr@gmail.com>
* @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';
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Activity base class.
*
* @package core_analytics
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @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 <ankit.agrr@gmail.com>
* @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';
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Activity base class.
*
* @package core_analytics
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @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 <ankit.agrr@gmail.com>
* @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';
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Activity base class.
*
* @package core_analytics
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @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 <ankit.agrr@gmail.com>
* @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';
}
}
......@@ -47,53 +47,9 @@ $string['eventactionclicked'] = 'Prediction action clicked';
$string['indicator:accessesafterend'] = 'Accesses after the end date';
$string['indicator:accessesbeforestart'] = 'Accesses before the start date';
$string['indicator:anywrite'] = 'Any write action';
$string['indicator:cognitivedepthassign'] = 'Assignment cognitive';
$string['indicator:cognitivedepthbook'] = 'Book cognitive';
$string['indicator:cognitivedepthchat'] = 'Chat cognitive';
$string['indicator:cognitivedepthchoice'] = 'Choice cognitive';
$string['indicator:cognitivedepthdata'] = 'Database cognitive';
$string['indicator:cognitivedepthfeedback'] = 'Feedback cognitive';
$string['indicator:cognitivedepthfolder'] = 'Folder cognitive';
$string['indicator:cognitivedepthforum'] = 'Forum cognitive';
$string['indicator:cognitivedepthglossary'] = 'Glossary cognitive';
$string['indicator:cognitivedepthimscp'] = 'IMS content packages\' cognitive';
$string['indicator:cognitivedepthlabel'] = 'Label cognitive';
$string['indicator:cognitivedepthlesson'] = 'Lesson cognitive';
$string['indicator:cognitivedepthlti'] = 'LTI cognitive';
$string['indicator:cognitivedepthpage'] = 'Page cognitive';
$string['indicator:cognitivedepthquiz'] = 'Quiz cognitive';
$string['indicator:cognitivedepthresource'] = 'File cognitive';
$string['indicator:cognitivedepthscorm'] = 'SCORM cognitive';
$string['indicator:cognitivedepthsurvey'] = 'Survey cognitive';
$string['indicator:cognitivedepthurl'] = 'URL cognitive';
$string['indicator:cognitivedepthwiki'] = 'Wiki cognitive';
$string['indicator:cognitivedepthworkshop'] = 'Workshop cognitive';
$string['indicator:socialbreadthassign'] = 'Assignment social';
$string['indicator:socialbreadthbook'] = 'Book social';
$string['indicator:socialbreadthchat'] = 'Chat social';
$string['indicator:socialbreadthchoice'] = 'Choice social';
$string['indicator:socialbreadthdata'] = 'Database social';
$string['indicator:socialbreadthfeedback'] = 'Feedback social';
$string['indicator:socialbreadthfolder'] = 'Folder social';
$string['indicator:socialbreadthforum'] = 'Forum social';
$string['indicator:socialbreadthglossary'] = 'Glossary social';
$string['indicator:socialbreadthimscp'] = 'IMS content packages\' social';
$string['indicator:socialbreadthlabel'] = 'Label social';
$string['indicator:socialbreadthlesson'] = 'Lesson social';
$string['indicator:socialbreadthlti'] = 'LTI social';
$string['indicator:socialbreadthpage'] = 'Page social';
$string['indicator:socialbreadthquiz'] = 'Quiz social';
$string['indicator:socialbreadthresource'] = 'File social';
$string['indicator:socialbreadthscorm'] = 'SCORM social';
$string['indicator:socialbreadthsurvey'] = 'Survey social';
$string['indicator:socialbreadthurl'] = 'URL social';
$string['indicator:socialbreadthwiki'] = 'Wiki social';
$string['indicator:socialbreadthworkshop'] = 'Workshop social';
$string['indicator:readactions'] = 'Read actions amount';
$string['indicator:completeduserprofile'] = 'User profile is completed';
$string['indicator:userforumstracking'] = 'User is tracking forums';
$string['insightmessagesubject'] = 'New insight for "{$a->contextname}": {$a->insightname}';
$string['insightinfo'] = '{$a->insightname} - {$a->contextname}';
$string['insightinfomessage'] = 'There are some insights you may find useful. Check out {$a}';
......
......@@ -17,32 +17,24 @@
/**
* Activity base class.
*
* @package core_analytics
* @package mod_assign
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_analytics\local\indicator\assign;
namespace mod_assign\analytics\indicator;
defined('MOODLE_INTERNAL') || die();
/**
* Activity base class.
*
* @package core_analytics
* @package mod_assign
* @copyright 2017 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @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';
}
protected function feedback_viewed_events() {
return array('\mod_assign\event\feedback_viewed');
}
......
......@@ -17,24 +17,28 @@
/**
* Cognitive depth indicator - assign.
*
* @package core_analytics
* @package mod_assign
* @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\assign;
namespace mod_assign\analytics\indicator;
defined('MOODLE_INTERNAL') || die();
/**
* Cognitive depth indicator - assign.
*
* @package core_analytics
* @package mod_assign
* @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 activity_base {
public static function get_name() {
return get_string('indicator:cognitivedepthassign', 'mod_assign');
}
protected function get_indicator_type() {
return self::INDICATOR_COGNITIVE;
}
......
......@@ -17,24 +17,28 @@
/**
* Social breadth indicator - assign.
*
* @package core_analytics
* @package mod_assign
* @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\assign;
namespace mod_assign\analytics\indicator;
defined('MOODLE_INTERNAL') || die();
/**
* Social breadth indicator - assign.
*
* @package core_analytics
* @package mod_assign
* @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 activity_base {
public static function get_name() {
return get_string('indicator:socialbreadthassign', 'mod_assign');
}
protected function get_indicator_type() {
return self::INDICATOR_SOCIAL;
}
......
......@@ -264,6 +264,8 @@ $string['groupsnone'] = 'There are no groups in this course';
$string['hideshow'] = 'Hide/Show';
$string['hiddenuser'] = 'Participant ';
$string['inactiveoverridehelp'] = '* Student does not have the correct group or role to attempt the assignment';
$string['indicator:cognitivedepthassign'] = 'Assignment cognitive';
$string['indicator:socialbreadthassign'] = 'Assignment social';
$string['instructionfiles'] = 'Instruction files';
$string['introattachments'] = 'Additional files';
$string['introattachments_help'] = 'Additional files for use in the assignment, such as answer templates, may be added. Download links for the files will then be displayed on the assignment page under the description.';
......