]> source.dussan.org Git - nextcloud-server.git/commitdiff
show galleries in search results
authorRobin Appelman <icewind1991@gmail.com>
Sun, 2 Oct 2011 17:33:55 +0000 (19:33 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Sun, 2 Oct 2011 17:33:55 +0000 (19:33 +0200)
apps/gallery/appinfo/app.php

index 39fbd95fd2d5d9383d9c2a727507c79b33d5e3ba..5760bb149d819fafa0831130f050232bdc975ba2 100644 (file)
@@ -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();
 ?>