Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Default list of bulk actions to reuse across different targets as presets. 19 * 20 * @package core_analytics 21 * @copyright 2019 David Monllao {@link http://www.davidmonllao.com} 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace core_analytics; 26 27 defined('MOODLE_INTERNAL') || die(); 28 29 /** 30 * Default list of bulk actions to reuse across different targets as presets. 31 * 32 * @package core_analytics 33 * @copyright 2019 David Monllao {@link http://www.davidmonllao.com} 34 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 35 */ 36 class default_bulk_actions { 37 38 /** 39 * Accepted prediction. 40 * 41 * @return \core_analytics\bulk_action 42 */ 43 public static function accept() { 44 $attrs = [ 45 'data-bulk-actionname' => prediction::ACTION_FIXED 46 ] + self::bulk_action_base_attrs(); 47 48 return new bulk_action(prediction::ACTION_FIXED, 49 new \moodle_url(''), new \pix_icon('t/check', get_string('fixedack', 'analytics')), 50 get_string('fixedack', 'analytics'), false, $attrs, action::TYPE_POSITIVE); 51 } 52 53 /** 54 * The prediction is not applicable for this same (e.g. This student was unenrolled in the uni SIS). 55 * 56 * @return \core_analytics\bulk_action 57 */ 58 public static function not_applicable() { 59 $attrs = [ 60 'data-bulk-actionname' => prediction::ACTION_NOT_APPLICABLE 61 ] + self::bulk_action_base_attrs(); 62 63 return new bulk_action(prediction::ACTION_NOT_APPLICABLE, 64 new \moodle_url(''), new \pix_icon('fp/cross', get_string('notapplicable', 'analytics'), 'theme'), 65 get_string('notapplicable', 'analytics'), false, $attrs, action::TYPE_NEUTRAL); 66 } 67 68 /** 69 * Incorrectly flagged prediction, useful for models based on data. 70 * 71 * @return \core_analytics\bulk_action 72 */ 73 public static function incorrectly_flagged() { 74 $attrs = [ 75 'data-bulk-actionname' => prediction::ACTION_INCORRECTLY_FLAGGED 76 ] + self::bulk_action_base_attrs(); 77 78 return new bulk_action(prediction::ACTION_INCORRECTLY_FLAGGED, 79 new \moodle_url(''), new \pix_icon('i/incorrect', get_string('incorrectlyflagged', 'analytics')), 80 get_string('incorrectlyflagged', 'analytics'), false, $attrs, action::TYPE_NEGATIVE); 81 } 82 83 /** 84 * Useful prediction. 85 * 86 * @return \core_analytics\bulk_action 87 */ 88 public static function useful() { 89 $attrs = [ 90 'data-bulk-actionname' => prediction::ACTION_USEFUL 91 ] + self::bulk_action_base_attrs(); 92 93 return new bulk_action(prediction::ACTION_USEFUL, 94 new \moodle_url(''), new \pix_icon('t/check', get_string('useful', 'analytics')), 95 get_string('useful', 'analytics'), false, $attrs, action::TYPE_POSITIVE); 96 97 } 98 99 /** 100 * Not useful prediction. 101 * 102 * @return \core_analytics\bulk_action 103 */ 104 public static function not_useful() { 105 $attrs = [ 106 'data-bulk-actionname' => prediction::ACTION_NOT_USEFUL 107 ] + self::bulk_action_base_attrs(); 108 109 return new bulk_action(prediction::ACTION_NOT_USEFUL, 110 new \moodle_url(''), new \pix_icon('t/delete', get_string('notuseful', 'analytics')), 111 get_string('notuseful', 'analytics'), false, $attrs, action::TYPE_NEGATIVE); 112 } 113 114 /** 115 * Common attributes for all the action renderables. 116 * 117 * @return array 118 */ 119 private static final function bulk_action_base_attrs() { 120 return [ 121 'disabled' => 'disabled', 122 'data-toggle' => 'action', 123 'data-action' => 'toggle', 124 ]; 125 } 126 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body