Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.
   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/oci'     => \moodle_database::get_driver_instance('oci', 'native')->get_name(),
  47              'native/sqlsrv'  => \moodle_database::get_driver_instance('sqlsrv', 'native')->get_name()
  48          );
  49      }
  50  
  51      /**
  52       * Get a list of edu levels.
  53       *
  54       * @return array
  55       */
  56      public static function get_level_options() {
  57          return array(
  58              \core\event\base::LEVEL_TEACHING      => get_string('teaching', 'logstore_database'),
  59              \core\event\base::LEVEL_PARTICIPATING => get_string('participating', 'logstore_database'),
  60              \core\event\base::LEVEL_OTHER         => get_string('other', 'logstore_database'),
  61          );
  62      }
  63  
  64      /**
  65       * Get a list of database actions.
  66       *
  67       * @return array
  68       */
  69      public static function get_action_options() {
  70          return array(
  71              'c' => get_string('create', 'logstore_database'),
  72              'r' => get_string('read', 'logstore_database'),
  73              'u' => get_string('update', 'logstore_database'),
  74              'd' => get_string('delete')
  75          );
  76      }
  77  }