[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [13249] more on controller integration
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [13249] more on controller integration |
Date: |
Thu, 21 May 2015 09:38:43 +0000 |
Revision: 13249
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13249
Author: sigurdne
Date: 2015-05-21 09:38:42 +0000 (Thu, 21 May 2015)
Log Message:
-----------
more on controller integration
Modified Paths:
--------------
trunk/controller/inc/class.uicomponent.inc.php
trunk/property/inc/class.soentity.inc.php
Modified: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php 2015-05-20 23:08:42 UTC
(rev 13248)
+++ trunk/controller/inc/class.uicomponent.inc.php 2015-05-21 09:38:42 UTC
(rev 13249)
@@ -346,8 +346,6 @@
public function query()
{
- static $_location_name = array();
- static $cache_component_descr = array();
$entity_group_id = phpgw::get_var('entity_group_id',
'int');
$location_id = phpgw::get_var('location_id', 'int');
$control_area = phpgw::get_var('control_area', 'int');
@@ -423,27 +421,9 @@
$component_id = $_component['id'];
$all_components[$component_id] = $_component;
- $short_desc_arr =
execMethod('property.soentity.get_short_description', array(
- 'location_id' => $location_id, 'id' =>
$component_id));
+ $short_description =
$_component['short_description'];
+ $short_description .= ' [' .
$_component['location_name']. ']';
-
$cache_component_descr[$location_id][$component_id] = $short_desc_arr;
-
-
if(!isset($_location_name[$_component['location_code']]))
- {
- $_location =
execMethod('property.solocation.read_single', $_component['location_code']);
- $location_arr = explode('-',
$_component['location_code']);
- $i = 1;
- $name_arr = array();
- foreach($location_arr as $_dummy)
- {
- $name_arr[] =
$_location["loc{$i}_name"];
- $i++;
- }
-
-
$_location_name[$_component['location_code']] = implode('::', $name_arr);
- }
- $short_desc_arr .= ' [' .
$_location_name[$_component['location_code']] . ']';
-
if ($all_items && !$_component['has_control'])
{
continue;
@@ -468,7 +448,7 @@
// COMPONENTS: Process
aggregated values for controls with repeat type day or week
foreach($components_for_control_array as $component)
{
-
$component->set_xml_short_desc("
{$location_type_name[$location_id]}</br>{$short_desc_arr}");
+
$component->set_xml_short_desc("
{$location_type_name[$location_id]}</br>{$short_description}");
$repeat_type
= $control->get_repeat_type();
$component_with_check_lists =
$this->so->get_check_lists_for_control_and_component($control_id,
$component->get_location_id(), $component->get_id(), $from_date_ts,
$to_date_ts, $repeat_type);
@@ -495,7 +475,7 @@
{
foreach($components_for_control_array as $component)
{
-
$component->set_xml_short_desc("
{$location_type_name[$location_id]}</br>{$short_desc_arr}");
+
$component->set_xml_short_desc("
{$location_type_name[$location_id]}</br>{$short_description}");
$repeat_type
= $control->get_repeat_type();
$component_with_check_lists =
$this->so->get_check_lists_for_control_and_component($control_id,
$component->get_location_id(), $component->get_id(), $from_date_ts,
$to_date_ts, $repeat_type);// ,$user_id);
@@ -635,27 +615,10 @@
'active_tab' => 'controller'
);
- $short_desc_arr =
$cache_component_descr[$location_id][$component['id']];//execMethod('property.soentity.get_short_description',
array(
- //'location_id' =>
$location_id, 'id' => $component['id'], 'entity_id' =>$component['entity_id'],
'cat_id' => $component['cat_id']));
+ $short_description =
$component['short_description'];
+ $short_description .= "[
{$component['location_name']} ]";
-
if(!isset($_location_name[$component['location_code']]))
- {
- $_location =
execMethod('property.solocation.read_single', $component['location_code']);
- $location_arr = explode('-',
$component['location_code']);
- $i
= 1;
- $name_arr =
array();
- foreach($location_arr as
$_dummy)
- {
- $name_arr[] =
$_location["loc{$i}_name"];
- $i++;
- }
-
-
$_location_name[$component['location_code']] = implode('::', $name_arr);
- }
-
- $short_desc_arr .= "[
{$_location_name[$component['location_code']]} ]";
-
- $data['component_id'] = '<a
href="'.$GLOBALS['phpgw']->link('/index.php',$component_link_data)."\"
target='_blank'>{$component_id}
{$location_type_name[$location_id]}</br>{$short_desc_arr}</a>";
+ $data['component_id'] = '<a
href="'.$GLOBALS['phpgw']->link('/index.php',$component_link_data)."\"
target='_blank'>{$component_id}
{$location_type_name[$location_id]}</br>{$short_description}</a>";
$data['missing_control'] = true;
$values[] = $data;
@@ -799,24 +762,6 @@
}
else
{
-/*
- $menuaction =
'controller.uicalendar.view_calendar_year_for_locations';
- if($param['info']['repeat_type'] < 2)
- {
- $menuaction =
'controller.uicalendar.view_calendar_month_for_locations';
- }
-
- $control_link_data = array
- (
- 'menuaction' => $menuaction,
- 'control_id' =>
$param['info']['control_id'],
- 'location_id' =>
$param['info']['location_id'],
- 'component_id' =>
$param['info']['component_id'],
- 'serie_id' =>
$param['info']['serie_id'],
- 'year' => $year,
- 'month' => $month
- );
-*/
$menuaction =
'controller.uicheck_list.add_check_list';
$control_link_data = array
(
@@ -828,9 +773,6 @@
'deadline_ts' => mktime(23, 59, 00,
$month, date('t', $month), $year),
'type' =>
$param['info']['component_id'] ? 'component' : ''
);
-
-
-
}
$link = "<a
href=\"".$GLOBALS['phpgw']->link('/index.php',$control_link_data)."\"
target=\"_blank\">{$img}</a>";
Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php 2015-05-20 23:08:42 UTC (rev
13248)
+++ trunk/property/inc/class.soentity.inc.php 2015-05-21 09:38:42 UTC (rev
13249)
@@ -753,11 +753,13 @@
$sql_cnt_control_fields = '';
}
+ $sql_custom_field = '';
+
if($check_for_control && !$control_registered)
{
$sql .= "{$this->left_join} {$join_control}";
- $sql_check_control_field = ',count(control_id)
AS has_control';
+ $sql_custom_field .= ',count(control_id) AS
has_control';
$this->uicols['input_type'][] =
'hidden';
$this->uicols['name'][]
= 'has_control';
$this->uicols['descr'][]
= '';
@@ -775,6 +777,22 @@
$sql .= "{$this->join} fm_location1 ON
(fm_bim_item.loc1 = fm_location1.loc1)";
$sql .= "{$this->join} fm_part_of_town ON
(fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id)";
$sql .= "{$this->join} fm_owner ON
(fm_location1.owner_id = fm_owner.id)";
+ $sql .= "{$this->join} fm_locations ON
(fm_bim_item.location_code = fm_locations.location_code)";
+
+ $sql_custom_field .= ',fm_locations.name AS
location_name';
+ $sql_custom_group = ',fm_locations.name';
+
+ $this->uicols['input_type'][] =
'hidden';
+ $this->uicols['name'][]
= 'location_name';
+ $this->uicols['descr'][]
= '';
+ $this->uicols['statustext'][] = '';
+ $this->uicols['align'][]
= '';
+ $this->uicols['datatype'][]
= '';
+ $this->uicols['sortable'][]
= true;
+ $this->uicols['exchange'][]
= false;
+ $this->uicols['formatter'][] = '';
+ $this->uicols['classname'][] = '';
+
}
$_joinmethod_datatype =
array_merge($_joinmethod_datatype, $_joinmethod_datatype_custom);
@@ -861,13 +879,20 @@
$sql = str_replace('__XML-ORDER__', $xml_order, $sql);
- if($sql_check_control_field)
+ if($sql_custom_field)
{
- $sql = str_replace("SELECT fm_bim_item.*",
"SELECT fm_bim_item.* {$sql_check_control_field}", $sql);
- $sql .= 'GROUP BY
fm_bim_item.location_id,fm_bim_item.id,fm_bim_item.type';
+ $sql = str_replace("SELECT fm_bim_item.*",
"SELECT fm_bim_item.* {$sql_custom_field}", $sql);
+ $sql .= "GROUP BY
fm_bim_item.location_id,fm_bim_item.id,fm_bim_item.type{$sql_custom_group}";
}
//_debug_array($sql);
+ static $cache_attributes = array();
+ if(!isset($cache_attributes[$location_id]))
+ {
+ $filters = array("short_description" => "IS NOT
NULL");
+ $cache_attributes[$location_id] =
$GLOBALS['phpgw']->custom_fields->find2($location_id, 0, '', 'ASC',
'short_description', true, true,$filters);
+ }
+
if(!$allrows)
{
$this->db->limit_query($sql . $ordermethod,
$start,__LINE__,__FILE__,$results);
@@ -909,6 +934,36 @@
}
+ //Start: get short descripion - if any
+ $_short_description = array();
+
+ foreach ($cache_attributes[$location_id] as
$key => $attribute)
+ {
+ $description_value =
$xml->getElementsByTagName($attribute['name'])->item(0)->nodeValue;
+
+
if(isset($cache_attributes[$location_id][$key]['choice']) &&
$cache_attributes[$location_id][$key]['choice'])
+ {
+ $choice =
$cache_attributes[$location_id][$key]['choice'];
+ foreach($choice as
$choice_value)
+ {
+ if ($choice_value['id']
== $description_value)
+ {
+
$description_value = $choice_value['value'];
+ break;
+ }
+ }
+ }
+
+ if($description_value)
+ {
+ $_short_description[] =
"{$attribute['input_text']}: {$description_value}";
+ }
+ }
+
+ $dataset[$j]['short_description']['value'] =
implode(', ', $_short_description);
+
+ //END: get short descripion
+
$dataset[$j]['num']['value'] =
$dataset[$j]['id']['value'];
$dataset[$j]['location_id'] = array
@@ -1918,11 +1973,11 @@
if($description_value)
{
- $short_description[] =
"{$attribute['input_text']}: {$description_value}";
+ $_short_description[] =
"{$attribute['input_text']}: {$description_value}";
}
}
- $short_description = implode(', ', $short_description);
+ $short_description = implode(', ', $_short_description);
return $short_description;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [13249] more on controller integration,
Sigurd Nes <=