MDL-19235 Basic phpdocs and copyright statements for core_tag subsystem
[moodle.git] / tag / tag_autocomplete.php
CommitLineData
333abbf1 1<?php
c933a060 2
000ebd5c
DM
3// This file is part of Moodle - http://moodle.org/
4//
5// Moodle is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// Moodle is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17
18/**
19 * @package core
20 * @subpackage tag
21 * @copyright 2007 Luiz Cruz <luiz.laydner@gmail.com>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
9c9d3076 25require_once('../config.php');
c933a060 26require_once('lib.php');
27
9c9d3076 28require_login();
29
30if (empty($CFG->usetags)) {
294ce987 31 print_error('tagsaredisabled', 'tag');
c933a060 32}
33
6f5e0852 34$query = optional_param('query', '', PARAM_RAW);
c933a060 35
db32b054 36if ($similar_tags = tag_autocomplete($query)) {
16803c57 37 foreach ($similar_tags as $tag) {
e7134583 38 echo $tag->name . "\t" . tag_display_name($tag) . "\n";
9c9d3076 39 }
c933a060 40}