diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2009-07-23 22:08:29 -0700 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2009-07-23 22:08:29 -0700 |
| commit | 50d6cc0150b930d79d3e8b90956ffa9655fcc9c5 (patch) | |
| tree | d2a90c14bb7d5e807037909b6005f4b7a9aeab73 /modules/tag/controllers | |
| parent | 5c8a2a750ccc16b5e8b0dd97ff21dbfb9860d856 (diff) | |
| parent | 078c77a62b623322956457bfd7bfbdaf56203b00 (diff) | |
Merge branch 'master' of git@github.com:/gallery/gallery3
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); + } } |
