fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [13385] bookingfrontent: limit search to buildings an


From: Sigurd Nes
Subject: [Fmsystem-commits] [13385] bookingfrontent: limit search to buildings and resources
Date: Mon, 08 Jun 2015 14:36:27 +0000

Revision: 13385
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13385
Author:   sigurdne
Date:     2015-06-08 14:36:26 +0000 (Mon, 08 Jun 2015)
Log Message:
-----------
bookingfrontent: limit search to buildings and resources

Modified Paths:
--------------
    trunk/bookingfrontend/inc/class.bosearch.inc.php

Modified: trunk/bookingfrontend/inc/class.bosearch.inc.php
===================================================================
--- trunk/bookingfrontend/inc/class.bosearch.inc.php    2015-06-08 13:32:55 UTC 
(rev 13384)
+++ trunk/bookingfrontend/inc/class.bosearch.inc.php    2015-06-08 14:36:26 UTC 
(rev 13385)
@@ -14,10 +14,19 @@
                
                function search($searchterm)
                {
-                       $type = phpgw::get_var('type', 'GET');
-            $bui_result = $org_result = $res_result = array();
+                       if($type = phpgw::get_var('type', 'GET'))
+                       {
+                               $types = array($type);
+                       }
+                       else
+                       {
+                               $types = array('building','resource'); //default
+                       }
 
-            if (!$type || $type == "building") {
+                       $bui_result = $org_result = $res_result = $event_result 
= array();
+
+                       if(in_array('building', $types))
+                       {
                 $bui_result = 
$this->sobuilding->read(array("query"=>$searchterm, "sort"  => "name", "dir" => 
"asc",  "filters" => array("active" => "1")));
                 foreach($bui_result['results'] as &$bui)
                 {
@@ -31,7 +40,9 @@
                                        }
                 }
             }
-            if (!$type || $type == "organization") {
+
+                       if(in_array('organization', $types))
+                       {
                 $org_result = 
$this->soorganization->read(array("query"=>$searchterm, "sort"  => "name", 
"dir" => "asc", "filters" => array("active" => "1")));
                 foreach($org_result['results'] as &$org)
                 {
@@ -44,7 +55,9 @@
                                        }
                 }
             }
-            if(!$type || $type == "resource") {
+
+                       if(in_array('resource', $types))
+                       {
                 $res_result = 
$this->soresource->read(array("query"=>$searchterm, "sort"  => "name", "dir" => 
"asc",  "filters" => array("active" => "1")));
                 foreach($res_result['results'] as &$res)
                 {
@@ -56,7 +69,8 @@
                 }
             }
 
-            if(!$type || $type == "event") {
+                       if(in_array('event', $types))
+                       {
                                $now = date('Y-m-d');
                                $expired_conditions = "(bb_event.active != 0 
AND bb_event.completed = 0 AND bb_event.from_ > '{$now}' AND 
bb_event.description != '')";
                 $event_result = 
$this->soevent->read(array("query"=>$searchterm, "sort"  => "name", "dir" => 
"asc",  "filters" => array('where' => $expired_conditions)));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]