[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11118] more on controller
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11118] more on controller |
Date: |
Tue, 21 May 2013 13:38:13 +0000 |
Revision: 11118
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11118
Author: sigurdne
Date: 2013-05-21 13:38:13 +0000 (Tue, 21 May 2013)
Log Message:
-----------
more on controller
Modified Paths:
--------------
trunk/controller/inc/class.hook_helper.inc.php
trunk/controller/inc/class.socontrol.inc.php
trunk/controller/inc/model/class.check_list.inc.php
Modified: trunk/controller/inc/class.hook_helper.inc.php
===================================================================
--- trunk/controller/inc/class.hook_helper.inc.php 2013-05-21 10:25:32 UTC
(rev 11117)
+++ trunk/controller/inc/class.hook_helper.inc.php 2013-05-21 13:38:13 UTC
(rev 11118)
@@ -172,6 +172,8 @@
$my_controls = array();
$my_controls = $this->get_my_controls($my_locations,
$from_date_ts, $to_date_ts, $repeat_type);
+ $my_check_lists =
$this->get_my_assigned_check_list($from_date_ts, $to_date_ts, $repeat_type);
+
$my_planned_controls = array();
// Generates an array with planned controls
@@ -279,6 +281,8 @@
// Fetches controls current user is responsible for 3 months
back in time
$my_controls = $this->get_my_controls($my_locations,
$from_date_ts, $to_date_ts, $repeat_type);
+ $my_check_lists =
$this->get_my_assigned_check_list($from_date_ts, $to_date_ts, $repeat_type);
+
$my_undone_controls = array();
// Generates an array containing undone controls
@@ -671,15 +675,37 @@
/* ================================ FUNCTIONS
======================================== */
+ function get_my_assigned_check_list($from_date_ts, $to_date_ts,
$repeat_type)
+ {
+ $check_list_array = array();
+
+ $so_control = CreateObject('controller.socontrol');
+
+ $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
+ $assigned_check_list_at_location =
$so_control->get_assigned_check_list_at_location( $from_date_ts, $to_date_ts,
$repeat_type, $user_id,"return_array");
+
+ foreach ($assigned_check_list_at_location as
$assigned_check_list)
+ {
+ $check_list_array[$assigned_check_list['id']] =
$assigned_check_list;
+ }
+
+ $assigned_check_list_at_component =
$so_control->get_assigned_check_list_by_component( $from_date_ts, $to_date_ts,
$repeat_type, $user_id,"return_array");
+
+//_debug_array($check_list_array);
+//_debug_array($assigned_check_list_at_component);
+
+
+ }
+
+
function get_my_controls($my_locations, $from_date_ts,
$to_date_ts, $repeat_type)
{
$so_control = CreateObject('controller.socontrol');
foreach($my_locations as $location)
{
-
- $controls = array();
- $components_with_controls_array = array();
+ $my_controls = array();
+ // $components_with_controls_array = array();
$location_code = $location["location_code"];
$controls_at_location =
$so_control->get_controls_by_location( $location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_array", $location["role_id"] );
@@ -715,11 +741,8 @@
}
}
- $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
- $assigned_controls_at_location =
$so_control->get_assigned_controls_at_location( $from_date_ts, $to_date_ts,
$repeat_type, $user_id,"return_array");
- $assigned_controls_at_component =
$so_control->get_assigned_controls_by_component( $from_date_ts, $to_date_ts,
$repeat_type, $user_id,"return_array");
-//_debug_array($assigned_controls);
-//_debug_array($assigned_controls);
+
+
return $my_controls;
}
Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php 2013-05-21 10:25:32 UTC
(rev 11117)
+++ trunk/controller/inc/class.socontrol.inc.php 2013-05-21 13:38:13 UTC
(rev 11118)
@@ -31,6 +31,7 @@
phpgw::import_class('controller.socommon');
include_class('controller', 'control', 'inc/model/');
+ include_class('controller', 'check_list', 'inc/model/');
include_class('controller', 'component', 'inc/model/');
include_class('controller', 'control_location', 'inc/model/');
@@ -123,24 +124,25 @@
* @param $role_id responsible role for carrying out the
control
* @return array with controls as objects or arrays
*/
- public function get_assigned_controls_at_location($from_date,
$to_date, $repeat_type, $user_id, $return_type = "return_object")
+ public function get_assigned_check_list_at_location($from_date,
$to_date, $repeat_type, $user_id, $return_type = "return_object")
{
$user_id = (int) $user_id;
$repeat_type = (int) $repeat_type;
- $controls_array = array();
+ $check_list_array = array();
$sql = "SELECT controller_check_list.location_code,
controller_check_list.control_id, controller_check_list.id AS check_list_id,"
- . "
procedure_id,requirement_id,costresponsibility_id,control_area_id,description,
start_date, end_date,"
+ . "
procedure_id,requirement_id,costresponsibility_id,control_area_id,description,
start_date, end_date,deadline,"
. " control_area_id,
repeat_type,repeat_interval, title"
. " FROM controller_check_list"
. " {$this->join} controller_control ON
controller_check_list.control_id = controller_control.id"
. " {$this->join}
controller_control_location_list ON controller_control_location_list.control_id
= controller_control.id"
. " WHERE assigned_to = {$user_id}";
-
+
+//_debug_array($sql);
if( $repeat_type )
{
- $sql .= "AND controller_control.repeat_type =
$repeat_type ";
+// $sql .= "AND controller_control.repeat_type =
$repeat_type ";
}
@@ -152,42 +154,35 @@
while($this->db->next_record())
{
- $control = new
controller_control($this->unmarshal($this->db->f('control_id'), 'int'));
-
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
-
$control->set_description($this->unmarshal($this->db->f('description', true),
'string'));
-
$control->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
-
$control->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
-
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
-
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id'),
'int'));
-
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id'),
'int'));
- //
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id'),
'int'));
- //
$control->set_responsibility_name($this->unmarshal($this->db->f('responsibility_name',
true), 'string'));
-
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
-
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type'), 'int'));
-
$control->set_repeat_type_label($this->unmarshal($this->db->f('repeat_type'),
'int'));
-
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval'),
'int'));
-
+ $check_list = new
controller_check_list($this->unmarshal($this->db->f('check_list_id'), 'int'));
+
$check_list->set_control_id($this->unmarshal($this->db->f('control_id'),
'int'));
+
$check_list->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+
$check_list->set_description($this->unmarshal($this->db->f('description',
true), 'string'));
+
$check_list->set_start_date($this->unmarshal($this->db->f('start_date'),
'int'));
+
$check_list->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
+
$check_list->set_deadline($this->unmarshal($this->db->f('deadline'), 'int'));
+ //
$check_list->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
+ //
$check_list->set_requirement_id($this->unmarshal($this->db->f('requirement_id'),
'int'));
+ //
$check_list->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id'),
'int'));
+
$check_list->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
+ //
$check_list->set_repeat_type($this->unmarshal($this->db->f('repeat_type'),
'int'));
+ //
$check_list->set_repeat_type_label($this->unmarshal($this->db->f('repeat_type'),
'int'));
+ //
$check_list->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval'),
'int'));
+
$check_list->set_assigned_to($this->unmarshal($user_id, 'int'));
+
if($return_type == "return_object")
{
- $controls_array[] = $control;
+ $check_list_array[] = $check_list;
}
else
{
- $controls_array[] = $control->toArray();
+ $check_list_array[] =
$check_list->toArray();
}
}
- if( count( $controls_array ) > 0 )
- {
- return $controls_array;
- }
- else
- {
- return null;
- }
+ return $check_list_array;
}
-
//---------
@@ -202,15 +197,14 @@
* @param $role_id responsible role for carrying out the
control
* @return array of components as objects or arrays
*/
- public function get_assigned_controls_by_component($from_date,
$to_date, $repeat_type, $user_id, $return_type = "return_object")
+ public function
get_assigned_check_list_by_component($from_date, $to_date, $repeat_type,
$user_id, $return_type = "return_object")
{
$repeat_type = $repeat_type;
$user_id = (int)$user_id;
- $controls_array = array();
-
+
$sql = "SELECT controller_check_list.location_code,
controller_check_list.control_id, controller_check_list.id AS check_list_id,"
- . "
procedure_id,requirement_id,costresponsibility_id,control_area_id,
controller_control.description, start_date, end_date,"
+ . "
procedure_id,requirement_id,costresponsibility_id,control_area_id,
controller_control.description, start_date, end_date, deadline,"
. " control_area_id,
repeat_type,repeat_interval, title,"
. " bim_item.guid,bim_item.type as
component_type, bim_item.id as component_id, bim_item.address,"
. " bim_item.loc1"
@@ -223,7 +217,7 @@
if( $repeat_type )
{
- $sql .= "AND controller_control.repeat_type =
$repeat_type ";
+// $sql .= "AND controller_control.repeat_type =
$repeat_type ";
}
$sql .= "AND ((controller_control.start_date <=
$to_date AND controller_control.end_date IS NULL) ";
@@ -232,6 +226,8 @@
$this->db->query($sql);
+ $check_list_array = array();
+ $components_array = array();
$component_id = 0;
$component = null;
while($this->db->next_record())
@@ -263,28 +259,32 @@
$component->set_address($this->unmarshal($this->db->f('address', true),
'string'));
}
- $control = new
controller_control($this->unmarshal($this->db->f('control_id'), 'int'));
-
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
-
$control->set_description($this->unmarshal($this->db->f('description', true),
'string'));
-
$control->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));
-
$control->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
-
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
-
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name',
true), 'string'));
-
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id'),
'int'));
-
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id'),
'int'));
-
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
-
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
true), 'string'));
-
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type'), 'int'));
-
$control->set_repeat_type_label($this->unmarshal($this->db->f('repeat_type'),
'int'));
-
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval'),
'int'));
+ $check_list = new
controller_check_list($this->unmarshal($this->db->f('check_list_id'), 'int'));
+
$check_list->set_control_id($this->unmarshal($this->db->f('control_id'),
'int'));
+
$check_list->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+
$check_list->set_description($this->unmarshal($this->db->f('description',
true), 'string'));
+
$check_list->set_start_date($this->unmarshal($this->db->f('start_date'),
'int'));
+
$check_list->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
+
$check_list->set_deadline($this->unmarshal($this->db->f('deadline'), 'int'));
+ //
$check_list->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
+ //
$check_list->set_requirement_id($this->unmarshal($this->db->f('requirement_id'),
'int'));
+ //
$check_list->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id'),
'int'));
+
$check_list->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
+ //
$check_list->set_repeat_type($this->unmarshal($this->db->f('repeat_type'),
'int'));
+ //
$check_list->set_repeat_type_label($this->unmarshal($this->db->f('repeat_type'),
'int'));
+ //
$check_list->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval'),
'int'));
+
$check_list->set_assigned_to($this->unmarshal($user_id, 'int'));
+
+
+
if($return_type == "return_object")
{
- $controls_array[] = $control;
+ $check_list_array[] = $check_list;
}
else
{
- $controls_array[] = $control->toArray();
+ $check_list_array[] =
$check_list->toArray();
}
$component_id = $component->get_id();
@@ -292,7 +292,7 @@
if($component != null)
{
- $component->set_controls_array($controls_array);
+
$component->set_controls_array($check_list_array);
if($return_type == "return_array")
{
@@ -302,13 +302,9 @@
{
$components_array[] = $component;
}
-
- return $components_array;
}
- else
- {
- return null;
- }
+
+ return $components_array;
}
Modified: trunk/controller/inc/model/class.check_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_list.inc.php 2013-05-21 10:25:32 UTC
(rev 11117)
+++ trunk/controller/inc/model/class.check_list.inc.php 2013-05-21 13:38:13 UTC
(rev 11118)
@@ -39,10 +39,14 @@
const STATUS_CANCELED = 3;
protected $id;
+ protected $title;//
+ protected $description;//
protected $control_id;
protected $status;
protected $comment;
protected $deadline;
+ protected $start_date;
+ protected $end_date;
protected $planned_date;
protected $completed_date;
protected $location_code;
@@ -50,7 +54,8 @@
protected $location_id;
protected $assigned_to;
protected $billable_hours;
-
+ protected $control_area_id;
+
// Aggregate fields. Fields not in a table
protected $num_open_cases;
protected $num_pending_cases;
@@ -80,6 +85,46 @@
public function get_id() { return $this->id; }
+ public function set_title($title)
+ {
+ $this->title = $title;
+ }
+
+ public function get_title()
+ {
+ return $this->title;
+ }
+
+ public function set_description($description)
+ {
+ $this->description = $description;
+ }
+
+ public function get_description()
+ {
+ return $this->description;
+ }
+
+ public function set_end_date($end_date)
+ {
+ $this->end_date = $end_date;
+ }
+
+ public function get_end_date()
+ {
+ return $this->end_date;
+ }
+
+ public function set_start_date($start_date)
+ {
+ $this->start_date = $start_date;
+ }
+
+ public function get_start_date()
+ {
+ return $this->start_date;
+ }
+
public function set_control_id($control_id)
{
$this->control_id = $control_id;
@@ -178,6 +223,16 @@
$this->error_msg_array = $error_msg_array;
}
+ public function set_control_area_id($control_area_id)
+ {
+ $this->control_area_id = $control_area_id;
+ }
+
+ public function get_control_area_id()
+ {
+ return $this->control_area_id;
+ }
+
public function set_assigned_to($assigned_to)
{
$this->assigned_to = $assigned_to;
@@ -202,12 +257,17 @@
{
return array(
'id' =>
$this->get_id(),
+ 'title' =>
$this->get_title(),
+ 'description' =>
$this->get_description(),
'control_id' =>
$this->get_control_id(),
'status' =>
$this->get_status(),
'comment' =>
$this->get_comment(),
'deadline' =>
$this->get_deadline(),
'planned_date' =>
$this->get_planned_date(),
'completed_date' =>
$this->get_completed_date(),
+ 'start_date' =>
$this->get_start_date(),
+ 'end_date' =>
$this->get_end_date(),
+ 'control_area_id' =>
$this->get_control_area_id(),
'location_code' =>
$this->get_location_code(),
'component_id' =>
$this->get_component_id(),
'location_id' =>
$this->get_location_id(),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11118] more on controller,
Sigurd Nes <=