[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/competency/classes/external/ -> user_competency_plan_exporter.php (source)

   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   * Class for exporting plan competency data.
  19   *
  20   * @package    core_competency
  21   * @copyright  2015 Damyon Wiese
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  namespace core_competency\external;
  25  defined('MOODLE_INTERNAL') || die();
  26  
  27  use renderer_base;
  28  use stdClass;
  29  
  30  /**
  31   * Class for exporting plan competency data.
  32   *
  33   * @copyright  2015 Damyon Wiese
  34   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  35   */
  36  class user_competency_plan_exporter extends persistent_exporter {
  37  
  38      protected static function define_class() {
  39          return 'core_competency\\user_competency_plan';
  40      }
  41  
  42      protected static function define_related() {
  43          // We cache the scale so it does not need to be retrieved from the framework every time.
  44          return array('scale' => 'grade_scale');
  45      }
  46  
  47      protected function get_other_values(renderer_base $output) {
  48          $result = new stdClass();
  49  
  50          if ($this->persistent->get_grade() === null) {
  51              $gradename = '-';
  52          } else {
  53              $gradename = $this->related['scale']->scale_items[$this->persistent->get_grade() - 1];
  54          }
  55          $result->gradename = $gradename;
  56  
  57          if ($this->persistent->get_proficiency() === null) {
  58              $proficiencyname = get_string('no');
  59          } else {
  60              $proficiencyname = get_string($this->persistent->get_proficiency() ? 'yes' : 'no');
  61          }
  62          $result->proficiencyname = $proficiencyname;
  63  
  64          return (array) $result;
  65      }
  66  
  67      protected static function define_other_properties() {
  68          return array(
  69              'gradename' => array(
  70                  'type' => PARAM_TEXT
  71              ),
  72              'proficiencyname' => array(
  73                  'type' => PARAM_RAW
  74              ),
  75          );
  76      }
  77  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1