Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

   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  defined('MOODLE_INTERNAL') || die();
  18  
  19  /**
  20   * Form for editing profile block settings
  21   *
  22   * @package    block_myprofile
  23   * @copyright  2010 Remote-Learner.net
  24   * @author     Olav Jordan <olav.jordan@remote-learner.ca>
  25   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  26   */
  27  class block_myprofile_edit_form extends block_edit_form {
  28      protected function specific_definition($mform) {
  29          global $CFG;
  30          $mform->addElement('header', 'configheader', get_string('myprofile_settings', 'block_myprofile'));
  31  
  32          $mform->addElement('selectyesno', 'config_display_picture', get_string('display_picture', 'block_myprofile'));
  33          if (isset($this->block->config->display_picture)) {
  34              $mform->setDefault('config_display_picture', $this->block->config->display_picture);
  35          } else {
  36              $mform->setDefault('config_display_picture', '1');
  37          }
  38  
  39          $mform->addElement('selectyesno', 'config_display_country', get_string('display_country', 'block_myprofile'));
  40          if (isset($this->block->config->display_country)) {
  41              $mform->setDefault('config_display_country', $this->block->config->display_country);
  42          } else {
  43              $mform->setDefault('config_display_country', '1');
  44          }
  45  
  46          $mform->addElement('selectyesno', 'config_display_city', get_string('display_city', 'block_myprofile'));
  47          if (isset($this->block->config->display_city)) {
  48              $mform->setDefault('config_display_city', $this->block->config->display_city);
  49          } else {
  50              $mform->setDefault('config_display_city', '1');
  51          }
  52  
  53          $mform->addElement('selectyesno', 'config_display_email', get_string('display_email', 'block_myprofile'));
  54          if (isset($this->block->config->display_email)) {
  55              $mform->setDefault('config_display_email', $this->block->config->display_email);
  56          } else {
  57              $mform->setDefault('config_display_email', '1');
  58          }
  59  
  60          $mform->addElement('selectyesno', 'config_display_phone1', get_string('display_phone1', 'block_myprofile'));
  61          if (isset($this->block->config->display_phone1)) {
  62              $mform->setDefault('config_display_phone1', $this->block->config->display_phone1);
  63          } else {
  64              $mform->setDefault('config_display_phone1', '0');
  65          }
  66  
  67          $mform->addElement('selectyesno', 'config_display_phone2', get_string('display_phone2', 'block_myprofile'));
  68          if (isset($this->block->config->display_phone2)) {
  69              $mform->setDefault('config_display_phone2', $this->block->config->display_phone2);
  70          } else {
  71              $mform->setDefault('config_display_phone2', '0');
  72          }
  73  
  74          $mform->addElement('selectyesno', 'config_display_institution', get_string('display_institution', 'block_myprofile'));
  75          if (isset($this->block->config->display_institution)) {
  76              $mform->setDefault('config_display_institution', $this->block->config->display_institution);
  77          } else {
  78              $mform->setDefault('config_display_institution', '0');
  79          }
  80  
  81          $mform->addElement('selectyesno', 'config_display_address', get_string('display_address', 'block_myprofile'));
  82          if (isset($this->block->config->display_address)) {
  83              $mform->setDefault('config_display_address', $this->block->config->display_address);
  84          } else {
  85              $mform->setDefault('config_display_address', '0');
  86          }
  87  
  88          $mform->addElement('selectyesno', 'config_display_firstaccess', get_string('display_firstaccess', 'block_myprofile'));
  89          if (isset($this->block->config->display_firstaccess)) {
  90              $mform->setDefault('config_display_firstaccess', $this->block->config->display_firstaccess);
  91          } else {
  92              $mform->setDefault('config_display_firstaccess', '0');
  93          }
  94  
  95          $mform->addElement('selectyesno', 'config_display_lastaccess', get_string('display_lastaccess', 'block_myprofile'));
  96          if (isset($this->block->config->display_lastaccess)) {
  97              $mform->setDefault('config_display_lastaccess', $this->block->config->display_lastaccess);
  98          } else {
  99              $mform->setDefault('config_display_lastaccess', '0');
 100          }
 101  
 102          $mform->addElement('selectyesno', 'config_display_currentlogin', get_string('display_currentlogin', 'block_myprofile'));
 103          if (isset($this->block->config->display_currentlogin)) {
 104              $mform->setDefault('config_display_currentlogin', $this->block->config->display_currentlogin);
 105          } else {
 106              $mform->setDefault('config_display_currentlogin', '0');
 107          }
 108  
 109          $mform->addElement('selectyesno', 'config_display_lastip', get_string('display_lastip', 'block_myprofile'));
 110          if (isset($this->block->config->display_lastip)) {
 111              $mform->setDefault('config_display_lastip', $this->block->config->display_lastip);
 112          } else {
 113              $mform->setDefault('config_display_lastip', '0');
 114          }
 115      }
 116  }