[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10845] Moved function get_buildings-on-property to c
From: |
Torstein |
Subject: |
[Fmsystem-commits] [10845] Moved function get_buildings-on-property to class location_finder and moved functions view open /closed cases to uicase |
Date: |
Fri, 15 Feb 2013 11:34:05 +0000 |
Revision: 10845
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10845
Author: vator
Date: 2013-02-15 11:34:05 +0000 (Fri, 15 Feb 2013)
Log Message:
-----------
Moved function get_buildings-on-property to class location_finder and moved
functions view open/closed cases to uicase
Modified Paths:
--------------
trunk/controller/inc/class.uicalendar.inc.php
trunk/controller/inc/class.uicase.inc.php
trunk/controller/inc/class.uicheck_list.inc.php
trunk/controller/inc/helper/class.location_finder.inc.php
Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php 2013-02-15 11:29:52 UTC
(rev 10844)
+++ trunk/controller/inc/class.uicalendar.inc.php 2013-02-15 11:34:05 UTC
(rev 10845)
@@ -56,6 +56,7 @@
private $so_control_item;
private $so_check_list;
private $so_check_item;
+ private $location_finder;
public $public_functions = array
(
'view_calendar_for_month' => true,
@@ -83,6 +84,8 @@
$this->so_check_list =
CreateObject('controller.socheck_list');
$this->so_check_item =
CreateObject('controller.socheck_item');
+ $this->location_finder =
CreateObject('controller.helper.location_finder');
+
self::set_active_menu('controller::location_check_list');
}
@@ -122,7 +125,7 @@
$user_role = true;
// Fetches buildings on property
- $buildings_on_property =
$this->get_buildings_on_property($user_role, $location_code, $level);
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
// Fetches controls for location within
specified time period
$controls_for_location_array =
$this->so_control->get_controls_by_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_object", $role);
@@ -276,7 +279,7 @@
$user_role = true;
// Fetches buildings on property
- $buildings_on_property =
$this->get_buildings_on_property($user_role, $location_code, $level);
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
// Fetches all controls for the location within
time period
$controls_for_location_array =
$this->so_control->get_controls_by_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_object", $role);
@@ -694,38 +697,6 @@
return $agg_open_cases_pr_month_array;
}
- function get_buildings_on_property($user_role, $location_code,
$level)
- {
-
- // Property level
- if ($level == 1)
- {
- $property_location_code = $location_code;
- }
- // Building level
- else if ($level > 1)
- {
- $split_loc_code_array = explode('-',
$location_code);
- $property_location_code =
$split_loc_code_array[0];
- }
-
- if ($user_role)
- {
- $criteria = array();
- $criteria['location_code'] =
$property_location_code;
- $criteria['field_name'] = 'loc2_name';
- $criteria['child_level'] = '2';
-
- $buildings_on_property =
execMethod('property.solocation.get_children', $criteria);
- }
- else
- {
- $buildings_on_property =
execMethod('property.solocation.get_children', $property_location_code);
- }
-
- return $buildings_on_property;
- }
-
function get_start_month_for_control($control)
{
// Checks if control starts in the year that is
displayed
@@ -773,9 +744,6 @@
'allrows' => false
);
- $location_finder = new location_finder();
- $my_locations =
$location_finder->get_responsibilities($criteria);
-
if (empty($location_code))
{
$location_code =
$my_locations[0]["location_code"];
@@ -794,8 +762,7 @@
'allrows' => false
);
- $location_finder = new location_finder();
- $my_locations =
$location_finder->get_responsibilities($criteria);
+ $my_locations =
$this->location_finder->get_responsibilities($criteria);
$my_washed_locations = array();
Modified: trunk/controller/inc/class.uicase.inc.php
===================================================================
--- trunk/controller/inc/class.uicase.inc.php 2013-02-15 11:29:52 UTC (rev
10844)
+++ trunk/controller/inc/class.uicase.inc.php 2013-02-15 11:34:05 UTC (rev
10845)
@@ -61,7 +61,9 @@
'updateStatusForCases' => true,
'delete_case' => true,
'close_case' => true,
-
'open_case' => true
+
'open_case' => true,
+ 'view_open_cases' => true,
+
'view_closed_cases' => true
);
function __construct()
@@ -503,7 +505,49 @@
return json_encode( array( "status" => "false"
) );
}
}
+
+ function view_open_cases()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+
+ $check_list = $this->so->get_single($check_list_id);
+
+ $open_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, $type = null,
'open_or_waiting', null, 'return_array');
+
+ foreach($open_check_items_and_cases as $key =>
$check_item)
+ {
+ $control_item_with_options =
$this->so_control_item->get_single_with_options($check_item['control_item_id']);
+
+ $check_item['control_item']['options_array'] =
$control_item_with_options->get_options_array();
+ $open_check_items_and_cases[$key] = $check_item;
+ }
+
+ $data = array
+ (
+ 'open_check_items_and_cases' =>
$open_check_items_and_cases,
+ 'check_list'
=> $check_list
+ );
+
+ self::render_template_xsl(
array('check_list/fragments/cases_tab_menu', 'check_list/view_open_cases',
'check_list/fragments/case_row',
'check_list/fragments/select_buildings_on_property'), $data );
+ }
+ function view_closed_cases()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+
+ $check_list = $this->so->get_single($check_list_id);
+
+ $closed_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null,
'closed', null, 'return_array');
+
+ $data = array
+ (
+ 'closed_check_items_and_cases'
=> $closed_check_items_and_cases,
+ 'check_list'
=> $check_list
+ );
+
+ self::render_template_xsl(
array('check_list/fragments/cases_tab_menu', 'check_list/view_closed_cases',
'check_list/fragments/select_buildings_on_property'), $data );
+ }
+
function get_location_level($location_code)
{
$level = count(explode('-', $location_code));
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2013-02-15 11:29:52 UTC
(rev 10844)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2013-02-15 11:34:05 UTC
(rev 10845)
@@ -57,6 +57,7 @@
private $so_control_group_list;
private $so_control_group;
private $so_control_item_list;
+ private $location_finder;
var $public_functions = array(
'index'
=> true,
@@ -67,8 +68,6 @@
'view_cases_for_check_list' => true,
'print_check_list' => true,
'add_case'
=> true,
-
'view_open_cases' => true,
-
'view_closed_cases' => true,
'view_control_details' => true,
'view_control_items' => true,
'get_check_list_info' => true,
@@ -87,6 +86,7 @@
$this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
$this->so_control_group =
CreateObject('controller.socontrol_group');
$this->so_control_item_list =
CreateObject('controller.socontrol_item_list');
+ $this->location_finder =
CreateObject('controller.helper.location_finder');
self::set_active_menu('controller::control::check_list');
}
@@ -261,7 +261,7 @@
$user_role = true;
// Fetches buildings on property
- $buildings_on_property =
$this->get_buildings_on_property($user_role, $location_code, $level);
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
$data = array
(
@@ -333,7 +333,7 @@
$user_role = true;
// Fetches buildings on property
- $buildings_on_property =
$this->get_buildings_on_property($user_role, $location_code, $level);
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
$data = array
(
@@ -491,7 +491,7 @@
$user_role = true;
// Fetches buildings on property
- $buildings_on_property =
$this->get_buildings_on_property($user_role, $location_code, $level);
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
$data = array
(
@@ -559,7 +559,7 @@
$user_role = true;
// Fetches buildings on property
- $buildings_on_property =
$this->get_buildings_on_property($user_role, $location_code, $level);
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
$data = array
(
@@ -650,7 +650,7 @@
$user_role = true;
// Fetches buildings on property
- $buildings_on_property =
$this->get_buildings_on_property($user_role, $location_code, $level);
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
$data = array
(
@@ -677,48 +677,6 @@
self::render_template_xsl(array('check_list/fragments/check_list_tab_menu',
'check_list/fragments/nav_control_plan', 'check_list/add_case',
'check_list/fragments/select_buildings_on_property'), $data);
}
- function view_open_cases()
- {
- $check_list_id = phpgw::get_var('check_list_id');
-
- $check_list = $this->so->get_single($check_list_id);
-
- $open_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, $type = null,
'open_or_waiting', null, 'return_array');
-
- foreach($open_check_items_and_cases as $key =>
$check_item)
- {
- $control_item_with_options =
$this->so_control_item->get_single_with_options($check_item['control_item_id']);
-
- $check_item['control_item']['options_array'] =
$control_item_with_options->get_options_array();
- $open_check_items_and_cases[$key] = $check_item;
- }
-
- $data = array
- (
- 'open_check_items_and_cases' =>
$open_check_items_and_cases,
- 'check_list'
=> $check_list
- );
-
- self::render_template_xsl(
array('check_list/fragments/cases_tab_menu', 'check_list/view_open_cases',
'check_list/fragments/case_row',
'check_list/fragments/select_buildings_on_property'), $data );
- }
-
- function view_closed_cases()
- {
- $check_list_id = phpgw::get_var('check_list_id');
-
- $check_list = $this->so->get_single($check_list_id);
-
- $closed_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null,
'closed', null, 'return_array');
-
- $data = array
- (
- 'closed_check_items_and_cases'
=> $closed_check_items_and_cases,
- 'check_list'
=> $check_list
- );
-
- self::render_template_xsl(
array('check_list/fragments/cases_tab_menu', 'check_list/view_closed_cases',
'check_list/fragments/select_buildings_on_property'), $data );
- }
-
function view_control_items()
{
$check_list_id = phpgw::get_var('check_list_id');
@@ -824,35 +782,4 @@
}
public function query(){}
-
- function get_buildings_on_property($user_role, $location_code, $level)
- {
- // Property level
- if ($level == 1)
- {
- $property_location_code = $location_code;
- }
- // Building level
- else if ($level > 1)
- {
- $split_loc_code_array = explode('-',
$location_code);
- $property_location_code =
$split_loc_code_array[0];
- }
-
- if ($user_role)
- {
- $criteria = array();
- $criteria['location_code'] =
$property_location_code;
- $criteria['field_name'] = 'loc2_name';
- $criteria['child_level'] = '2';
-
- $buildings_on_property =
execMethod('property.solocation.get_children', $criteria);
- }
- else
- {
- $buildings_on_property =
execMethod('property.solocation.get_children', $property_location_code);
- }
-
- return $buildings_on_property;
- }
}
\ No newline at end of file
Modified: trunk/controller/inc/helper/class.location_finder.inc.php
===================================================================
--- trunk/controller/inc/helper/class.location_finder.inc.php 2013-02-15
11:29:52 UTC (rev 10844)
+++ trunk/controller/inc/helper/class.location_finder.inc.php 2013-02-15
11:34:05 UTC (rev 10845)
@@ -48,4 +48,36 @@
return $locations;
}
+
+ function get_buildings_on_property($user_role, $location_code, $level)
+ {
+
+ // Property level
+ if ($level == 1)
+ {
+ $property_location_code = $location_code;
+ }
+ // Building level
+ else if ($level > 1)
+ {
+ $split_loc_code_array = explode('-',
$location_code);
+ $property_location_code =
$split_loc_code_array[0];
+ }
+
+ if ($user_role)
+ {
+ $criteria = array();
+ $criteria['location_code'] =
$property_location_code;
+ $criteria['field_name'] = 'loc2_name';
+ $criteria['child_level'] = '2';
+
+ $buildings_on_property =
execMethod('property.solocation.get_children', $criteria);
+ }
+ else
+ {
+ $buildings_on_property =
execMethod('property.solocation.get_children', $property_location_code);
+ }
+
+ return $buildings_on_property;
+ }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10845] Moved function get_buildings-on-property to class location_finder and moved functions view open /closed cases to uicase,
Torstein <=