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.
/tag/ -> lib.php (source)

Differences Between: [Versions 311 and 402] [Versions 311 and 403]

   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   * Functions for component core_tag
  19   *
  20   * To set or get item tags refer to the class {@link core_tag_tag}
  21   *
  22   * @package    core_tag
  23   * @copyright  2007 Luiz Cruz <luiz.laydner@gmail.com>
  24   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  25   */
  26  
  27  /**
  28   * Return a list of page types
  29   *
  30   * @package core_tag
  31   * @param   string   $pagetype       current page type
  32   * @param   stdClass $parentcontext  Block's parent context
  33   * @param   stdClass $currentcontext Current context of block
  34   */
  35  function tag_page_type_list($pagetype, $parentcontext, $currentcontext) {
  36      return array(
  37          'tag-*'=>get_string('page-tag-x', 'tag'),
  38          'tag-index'=>get_string('page-tag-index', 'tag'),
  39          'tag-search'=>get_string('page-tag-search', 'tag'),
  40          'tag-manage'=>get_string('page-tag-manage', 'tag')
  41      );
  42  }
  43  
  44  /**
  45   * Implements callback inplace_editable() allowing to edit values in-place
  46   *
  47   * @param string $itemtype
  48   * @param int $itemid
  49   * @param mixed $newvalue
  50   * @return \core\output\inplace_editable
  51   */
  52  function core_tag_inplace_editable($itemtype, $itemid, $newvalue) {
  53      \external_api::validate_context(context_system::instance());
  54      if ($itemtype === 'tagname') {
  55          return \core_tag\output\tagname::update($itemid, $newvalue);
  56      } else if ($itemtype === 'tagareaenable') {
  57          return \core_tag\output\tagareaenabled::update($itemid, $newvalue);
  58      } else if ($itemtype === 'tagareacollection') {
  59          return \core_tag\output\tagareacollection::update($itemid, $newvalue);
  60      } else if ($itemtype === 'tagareashowstandard') {
  61          return \core_tag\output\tagareashowstandard::update($itemid, $newvalue);
  62      } else if ($itemtype === 'tagcollname') {
  63          return \core_tag\output\tagcollname::update($itemid, $newvalue);
  64      } else if ($itemtype === 'tagcollsearchable') {
  65          return \core_tag\output\tagcollsearchable::update($itemid, $newvalue);
  66      } else if ($itemtype === 'tagflag') {
  67          return \core_tag\output\tagflag::update($itemid, $newvalue);
  68      } else if ($itemtype === 'tagisstandard') {
  69          return \core_tag\output\tagisstandard::update($itemid, $newvalue);
  70      }
  71  }