diff options
| author | Romain LE DISEZ <romain.git@ledisez.net> | 2009-07-25 13:59:04 +0200 |
|---|---|---|
| committer | Romain LE DISEZ <romain.git@ledisez.net> | 2009-07-25 13:59:04 +0200 |
| commit | 0aa3ec3ae90a101b2bfc1b395a1749551da22287 (patch) | |
| tree | 02702942bc27e0e4e7b634a56cd35b71cb35fecc /modules/tag/controllers | |
| parent | b181707c1651af8737c2e6ff550fd20f480b781b (diff) | |
| parent | 50d6cc0150b930d79d3e8b90956ffa9655fcc9c5 (diff) | |
Merge commit 'upstream/master'
Diffstat (limited to 'modules/tag/controllers')
| -rw-r--r-- | modules/tag/controllers/tags.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index 5dd07935..a600ea1a 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -78,4 +78,21 @@ class Tags_Controller extends REST_Controller { return tag::get_add_form($item); } + + public function autocomplete() { + $tags = array(); + $tag_parts = preg_split("#[,\s;]+# ", $this->input->get("q")); + $limit = $this->input->get("limit"); + $tag_part = end($tag_parts); + $tag_list = ORM::factory("tag") + ->like("name", "{$tag_part}%", false) + ->orderby("name", "ASC") + ->limit($limit) + ->find_all(); + foreach ($tag_list as $tag) { + $tags[] = $tag->name; + } + + print implode("\n", $tags); + } } |
