summaryrefslogtreecommitdiffstats
path: root/apps/gallery/appinfo
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-10-02 19:33:55 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-10-02 19:33:55 +0200
commit7bcc0efd6a3688b04bcdda94f7cc920a044e442f (patch)
treede8448a368a81984b349bdcc6e69326974a02d15 /apps/gallery/appinfo
parent39c4d9b2ca8c9f3b1b824b543de929e983eee10d (diff)
downloadnextcloud-server-7bcc0efd6a3688b04bcdda94f7cc920a044e442f.tar.gz
nextcloud-server-7bcc0efd6a3688b04bcdda94f7cc920a044e442f.zip
show galleries in search results
Diffstat (limited to 'apps/gallery/appinfo')
-rw-r--r--apps/gallery/appinfo/app.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/gallery/appinfo/app.php b/apps/gallery/appinfo/app.php
index 39fbd95fd2d..5760bb149d8 100644
--- a/apps/gallery/appinfo/app.php
+++ b/apps/gallery/appinfo/app.php
@@ -10,4 +10,18 @@ OC_App::addNavigationEntry( array(
'href' => OC_Helper::linkTo('gallery', 'index.php'),
'icon' => OC_Helper::linkTo('', 'core/img/filetypes/image.png'),
'name' => 'Gallery'));
+
+ class OC_GallerySearchProvider extends OC_Search_Provider{
+ function search($query){
+ $stmt = OC_DB::prepare('SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ? AND album_name LIKE ?');
+ $result = $stmt->execute(array(OC_User::getUser(),'%'.$query.'%'));
+ $results=array();
+ while($row=$result->fetchRow()){
+ $results[]=new OC_Search_Result($row['album_name'],'',OC_Helper::linkTo( 'apps/gallery', 'index.php?view='.$row['album_name']),'Galleries');
+ }
+ return $results;
+ }
+}
+
+new OC_GallerySearchProvider();
?>