[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [14643] more on bookingfrontend
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [14643] more on bookingfrontend |
Date: |
Wed, 13 Jan 2016 19:50:21 +0000 |
Revision: 14643
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14643
Author: sigurdne
Date: 2016-01-13 19:50:20 +0000 (Wed, 13 Jan 2016)
Log Message:
-----------
more on bookingfrontend
Modified Paths:
--------------
branches/dev-syncromind/booking/inc/class.soactivity.inc.php
branches/dev-syncromind/booking/inc/class.soresource.inc.php
branches/dev-syncromind/bookingfrontend/inc/class.bosearch.inc.php
branches/dev-syncromind/bookingfrontend/inc/class.uisearch.inc.php
branches/dev-syncromind/bookingfrontend/js/bookingfrontend/search.js
Modified: branches/dev-syncromind/booking/inc/class.soactivity.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.soactivity.inc.php
2016-01-13 15:06:02 UTC (rev 14642)
+++ branches/dev-syncromind/booking/inc/class.soactivity.inc.php
2016-01-13 19:50:20 UTC (rev 14643)
@@ -76,8 +76,12 @@
return $values;
}
- public function get_children($parent, $level = 0)
+ public function get_children($parent, $level = 0, $reset =
false)
{
+ if($reset)
+ {
+ $this->activity_tree = array();
+ }
$parent = (int)$parent;
$db = clone($this->db);
$sql = "SELECT * FROM bb_activity WHERE parent_id
= {$parent} ORDER BY name ASC";
Modified: branches/dev-syncromind/booking/inc/class.soresource.inc.php
===================================================================
--- branches/dev-syncromind/booking/inc/class.soresource.inc.php
2016-01-13 15:06:02 UTC (rev 14642)
+++ branches/dev-syncromind/booking/inc/class.soresource.inc.php
2016-01-13 19:50:20 UTC (rev 14643)
@@ -97,27 +97,30 @@
static $custom_fields_arr = array();
$activity_ids = array();
$soactivity =
createObject('booking.soactivity');
- if(isset($filters['activity_id']) &&
$filters['activity_id'])
- {
- // children =
$soactivity->get_children($filters['activity_id']);
- // $activity_ids =
array_merge(array($filters['activity_id']), $children);
- // $filters['activity_id'] = $activity_ids;
- }
+
$conditions = parent::_get_conditions($query, $filters);
$custom_condition_arr = array();
+ $custom_fields_criteria = array();
+ if(isset($filters['filter_top_level']) &&
is_array($filters['filter_top_level']))
+ {
+ foreach($filters['filter_top_level'] as
$activity_top_level)
+ {
+
if(!isset($activity_ids[$activity_top_level]))
+ {
+
$activity_ids[$activity_top_level] = array_merge(array($activity_top_level),
$soactivity->get_children($activity_top_level, 0, true));
+ }
+ }
+ unset($activity_top_level);
+ }
+// _debug_array($activity_ids);
if(isset($filters['custom_fields_criteria']) &&
is_array($filters['custom_fields_criteria']))
{
//
_debug_array($filters['custom_fields_criteria']);
- $custom_fields_criteria = array();
foreach($filters['custom_fields_criteria'] as
$activity_top_level => $_custom_fields_criteria)
{
-
if(!isset($activity_ids[$activity_top_level]))
+
if(isset($_custom_fields_criteria['choice']) &&
isset($activity_ids[$activity_top_level]))
{
-
$activity_ids[$activity_top_level] = array_merge(array($activity_top_level),
$soactivity->get_children($activity_top_level));
- }
-
if(isset($_custom_fields_criteria['choice']))
- {
$custom_fields_criteria =
array_merge($custom_fields_criteria, $_custom_fields_criteria['choice']);
}
}
@@ -169,6 +172,11 @@
{
foreach($filters['custom_fields_criteria'] as
$activity_top_level => $_custom_fields_criteria)
{
+
if(!isset($activity_ids[$activity_top_level]))
+ {
+ continue;
+ }
+
if(isset($custom_condition_arr[$activity_top_level]))
{
$_conditions[] = '('
.$conditions . ' AND (activity_id IN ('. implode(',',
$activity_ids[$activity_top_level]) . ') AND' . implode(' OR ',
$custom_condition_arr[$activity_top_level]) . '))';
@@ -177,22 +185,28 @@
{
$_conditions[] = '(' .
$conditions . ' AND activity_id IN ('. implode(',',
$activity_ids[$activity_top_level]) . '))';
}
+ $activity_ids[$activity_top_level] =
array();
}
+ unset($activity_top_level);
+
}
+ $__activity_ids = array();
+ foreach($activity_ids as $activity_top_level =>
$_activity_ids)
+ {
+ $__activity_ids =
array_merge($__activity_ids,$_activity_ids);
+ }
+
+ if($__activity_ids)
+ {
+ $_conditions[] = '(' . $conditions . ' AND
activity_id IN ('. implode(',', $__activity_ids) . '))';
+ }
else
{
- $_conditions[] = $conditions;
+
+ // $_conditions[] = $conditions;
+
}
-
-// if($custom_condition_arr)
-// {
-// foreach ($custom_condition_arr as
$activity_top_level => $custom_condition)
-// {
-// $_conditions[] = $conditions . ' AND '
. implode(' OR ', $custom_condition);
-// }
-// $conditions = $conditions . ' OR ' . implode('
OR ', $_conditions);
-// }
$conditions = implode(' OR ', $_conditions);
// _debug_array($conditions);
return $conditions;
Modified: branches/dev-syncromind/bookingfrontend/inc/class.bosearch.inc.php
===================================================================
--- branches/dev-syncromind/bookingfrontend/inc/class.bosearch.inc.php
2016-01-13 15:06:02 UTC (rev 14642)
+++ branches/dev-syncromind/bookingfrontend/inc/class.bosearch.inc.php
2016-01-13 19:50:20 UTC (rev 14643)
@@ -16,6 +16,7 @@
function search($searchterm, $building_id,
$filter_part_of_town, $filter_top_level, $activity_criteria = array())
{
$building_filter = array(-1);
+ $filter_top_level = $filter_top_level ?
$filter_top_level : array(-1);
$_filter_search_type = explode(',',
phpgw::get_var('filter_search_type', 'string'));
$types = array();
foreach($_filter_search_type as $key => $value)
@@ -101,10 +102,10 @@
{
$_filter_resource = array("active" => "1");
-// if($filter_top_level)
-// {
-// $_filter_resource['activity_id'] =
$filter_top_level;
-// }
+ if($filter_top_level)
+ {
+ $_filter_resource['filter_top_level'] =
$filter_top_level;
+ }
if($building_filter)
{
Modified: branches/dev-syncromind/bookingfrontend/inc/class.uisearch.inc.php
===================================================================
--- branches/dev-syncromind/bookingfrontend/inc/class.uisearch.inc.php
2016-01-13 15:06:02 UTC (rev 14642)
+++ branches/dev-syncromind/bookingfrontend/inc/class.uisearch.inc.php
2016-01-13 19:50:20 UTC (rev 14643)
@@ -156,10 +156,18 @@
$activity_criteria = array();
foreach($criteria as $entry)
{
+ if(isset($entry['activity_top_level']) &&
!in_array($entry['activity_top_level'],$filter_top_level))
+ {
+ continue;
+ }
if(isset($entry['activity_top_level']) &&
$entry['activity_top_level'])
{
$activity_criteria[$entry['activity_top_level']]['activity_top_level'] =
$entry['activity_top_level'];
}
+ if(isset($entry['cat_id']) &&
!in_array($entry['cat_id'],$filter_top_level))
+ {
+ continue;
+ }
if(isset($entry['choice_id']) &&
isset($entry['cat_id']))
{
$activity_criteria[$entry['cat_id']]['activity_top_level'] = $entry['cat_id'];
Modified: branches/dev-syncromind/bookingfrontend/js/bookingfrontend/search.js
===================================================================
--- branches/dev-syncromind/bookingfrontend/js/bookingfrontend/search.js
2016-01-13 15:06:02 UTC (rev 14642)
+++ branches/dev-syncromind/bookingfrontend/js/bookingfrontend/search.js
2016-01-13 19:50:20 UTC (rev 14643)
@@ -93,14 +93,14 @@
// activity_top_level =
top_node.a_attr.activity_top_level;
}
}
- else
- {
- if (level < 2)
- {
- activity_location =
data.node.original.activity_location;
- $("#" + activity_location).prop( "checked",
false );
- }
- }
+// else
+// {
+// if (level < 2)
+// {
+// activity_location =
data.node.original.activity_location;
+// $("#" + activity_location).prop( "checked",
false );
+// }
+// }
// $('#activity_top_level').val(activity_top_level);
// var href = data.node.a_attr.href;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [14643] more on bookingfrontend,
Sigurd Nes <=