| 1 | efrain | 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 |  * Helper class locally used.
 | 
        
           |  |  | 19 |  *
 | 
        
           |  |  | 20 |  * @package    logstore_database
 | 
        
           |  |  | 21 |  * @copyright  2014 onwards Ankit Agarwal
 | 
        
           |  |  | 22 |  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 | 
        
           |  |  | 23 |  */
 | 
        
           |  |  | 24 |   | 
        
           |  |  | 25 | namespace logstore_database;
 | 
        
           |  |  | 26 | defined('MOODLE_INTERNAL') || die();
 | 
        
           |  |  | 27 |   | 
        
           |  |  | 28 |   | 
        
           |  |  | 29 | /**
 | 
        
           |  |  | 30 |  * Helper class locally used.
 | 
        
           |  |  | 31 |  *
 | 
        
           |  |  | 32 |  * @copyright  2014 onwards Ankit Agarwal
 | 
        
           |  |  | 33 |  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 | 
        
           |  |  | 34 |  */
 | 
        
           |  |  | 35 | class helper {
 | 
        
           |  |  | 36 |     /**
 | 
        
           |  |  | 37 |      * Returns list of fully working database drivers present in system.
 | 
        
           |  |  | 38 |      * @return array
 | 
        
           |  |  | 39 |      */
 | 
        
           |  |  | 40 |     public static function get_drivers() {
 | 
        
           |  |  | 41 |         return array(
 | 
        
           |  |  | 42 |             ''               => get_string('choosedots'),
 | 
        
           |  |  | 43 |             'native/mysqli'  => \moodle_database::get_driver_instance('mysqli', 'native')->get_name(),
 | 
        
           |  |  | 44 |             'native/mariadb' => \moodle_database::get_driver_instance('mariadb', 'native')->get_name(),
 | 
        
           |  |  | 45 |             'native/pgsql'   => \moodle_database::get_driver_instance('pgsql', 'native')->get_name(),
 | 
        
           |  |  | 46 |             'native/sqlsrv'  => \moodle_database::get_driver_instance('sqlsrv', 'native')->get_name()
 | 
        
           |  |  | 47 |         );
 | 
        
           |  |  | 48 |     }
 | 
        
           |  |  | 49 |   | 
        
           |  |  | 50 |     /**
 | 
        
           |  |  | 51 |      * Get a list of edu levels.
 | 
        
           |  |  | 52 |      *
 | 
        
           |  |  | 53 |      * @return array
 | 
        
           |  |  | 54 |      */
 | 
        
           |  |  | 55 |     public static function get_level_options() {
 | 
        
           |  |  | 56 |         return array(
 | 
        
           |  |  | 57 |             \core\event\base::LEVEL_TEACHING      => get_string('teaching', 'logstore_database'),
 | 
        
           |  |  | 58 |             \core\event\base::LEVEL_PARTICIPATING => get_string('participating', 'logstore_database'),
 | 
        
           |  |  | 59 |             \core\event\base::LEVEL_OTHER         => get_string('other', 'logstore_database'),
 | 
        
           |  |  | 60 |         );
 | 
        
           |  |  | 61 |     }
 | 
        
           |  |  | 62 |   | 
        
           |  |  | 63 |     /**
 | 
        
           |  |  | 64 |      * Get a list of database actions.
 | 
        
           |  |  | 65 |      *
 | 
        
           |  |  | 66 |      * @return array
 | 
        
           |  |  | 67 |      */
 | 
        
           |  |  | 68 |     public static function get_action_options() {
 | 
        
           |  |  | 69 |         return array(
 | 
        
           |  |  | 70 |             'c' => get_string('create', 'logstore_database'),
 | 
        
           |  |  | 71 |             'r' => get_string('read', 'logstore_database'),
 | 
        
           |  |  | 72 |             'u' => get_string('update', 'logstore_database'),
 | 
        
           |  |  | 73 |             'd' => get_string('delete')
 | 
        
           |  |  | 74 |         );
 | 
        
           |  |  | 75 |     }
 | 
        
           |  |  | 76 | }
 |