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   * Administration settings definitions for mlbackend_python.
  19   *
  20   * @package   mlbackend_python
  21   * @copyright 2019 David MonllaĆ³
  22   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  defined('MOODLE_INTERNAL') || die();
  26  
  27  if ($ADMIN->fulltree) {
  28  
  29      $info = $OUTPUT->notification(get_string('serversettingsinfo', 'mlbackend_python'), 'info');
  30      $settings->add(new admin_setting_heading('mlbackend_python/serversettingsinfo', '', $info));
  31  
  32      $settings->add(new admin_setting_configcheckbox('mlbackend_python/useserver', get_string('useserver', 'mlbackend_python'),
  33                         get_string('useserverdesc', 'mlbackend_python'), 0));
  34  
  35      $settings->add(new admin_setting_configtext('mlbackend_python/host', get_string('host', 'mlbackend_python'),
  36                         get_string('host', 'mlbackend_python'), '', PARAM_HOST));
  37      $settings->hide_if('mlbackend_python/host', 'mlbackend_python/useserver', 'neq', '1');
  38  
  39      $settings->add(new admin_setting_configtext('mlbackend_python/port', get_string('port', 'mlbackend_python'),
  40                         get_string('port', 'mlbackend_python'), '', PARAM_INT));
  41      $settings->hide_if('mlbackend_python/port', 'mlbackend_python/useserver', 'neq', '1');
  42  
  43      $settings->add(new admin_setting_configcheckbox('mlbackend_python/secure', get_string('secure', 'mlbackend_python'),
  44                         get_string('securedesc', 'mlbackend_python'), 0));
  45      $settings->hide_if('mlbackend_python/secure', 'mlbackend_python/useserver', 'neq', '1');
  46  
  47      $settings->add(new admin_setting_configtext('mlbackend_python/username', get_string('username', 'mlbackend_python'),
  48                         get_string('usernamedesc', 'mlbackend_python'), 'default', PARAM_ALPHANUMEXT));
  49      $settings->hide_if('mlbackend_python/username', 'mlbackend_python/useserver', 'neq', '1');
  50  
  51      $settings->add(new admin_setting_configtext('mlbackend_python/password', get_string('password', 'mlbackend_python'),
  52                         get_string('passworddesc', 'mlbackend_python'), '', PARAM_ALPHANUMEXT));
  53      $settings->hide_if('mlbackend_python/password', 'mlbackend_python/useserver', 'neq', '1');
  54  }