Merge branch 'MDL-74350-master' of https://github.com/HuongNV13/moodle
[moodle.git] / tag / lib.php
blob2d5e2dddbf90bd24830c618a987ca4cddbde92f9
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.
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/>.
17 /**
18 * Functions for component core_tag
20 * To set or get item tags refer to the class {@link core_tag_tag}
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
27 /**
28 * Return a list of page types
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
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')
44 /**
45 * Implements callback inplace_editable() allowing to edit values in-place
47 * @param string $itemtype
48 * @param int $itemid
49 * @param mixed $newvalue
50 * @return \core\output\inplace_editable
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);