[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/competency/classes/external/ -> competency_framework_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 competency_framework 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 core_competency\api;
  28  use renderer_base;
  29  
  30  /**
  31   * Class for exporting competency_framework data.
  32   *
  33   * @copyright  2015 Damyon Wiese
  34   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  35   */
  36  class competency_framework_exporter extends persistent_exporter {
  37  
  38      /**
  39       * Define the name of persistent class.
  40       *
  41       * @return string
  42       */
  43      protected static function define_class() {
  44          return 'core_competency\\competency_framework';
  45      }
  46  
  47      /**
  48       * Get other values that do not belong to the basic persisent.
  49       *
  50       * @param renderer_base $output
  51       * @return Array
  52       */
  53      protected function get_other_values(renderer_base $output) {
  54          $filters = array('competencyframeworkid' => $this->persistent->get_id());
  55          $context = $this->persistent->get_context();
  56          return array(
  57              'canmanage' => has_capability('moodle/competency:competencymanage', $context),
  58              'competenciescount' => api::count_competencies($filters),
  59              'contextname' => $context->get_context_name(),
  60              'contextnamenoprefix' => $context->get_context_name(false)
  61          );
  62      }
  63  
  64      /**
  65       * Define other properties that do not belong to the basic persisent.
  66       *
  67       * @return Array
  68       */
  69      protected static function define_other_properties() {
  70          return array(
  71              'canmanage' => array(
  72                  'type' => PARAM_BOOL
  73              ),
  74              'competenciescount' => array(
  75                  'type' => PARAM_INT
  76              ),
  77              'contextname' => array(
  78                  'type' => PARAM_TEXT
  79              ),
  80              'contextnamenoprefix' => array(
  81                  'type' => PARAM_TEXT
  82              )
  83          );
  84      }
  85  
  86  }


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