[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12945] controller: modifications to components
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [12945] controller: modifications to components |
Date: |
Mon, 06 Apr 2015 17:25:54 +0000 |
Revision: 12945
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12945
Author: sigurdne
Date: 2015-04-06 17:25:53 +0000 (Mon, 06 Apr 2015)
Log Message:
-----------
controller: modifications to components
Modified Paths:
--------------
trunk/controller/inc/class.menu.inc.php
trunk/controller/inc/class.socheck_list.inc.php
trunk/controller/inc/class.socontrol.inc.php
trunk/controller/inc/class.uicalendar.inc.php
trunk/controller/inc/class.uicheck_list.inc.php
trunk/controller/inc/component/class.check_list_status_info.inc.php
trunk/controller/inc/component/class.check_list_status_manager.inc.php
trunk/controller/inc/component/class.month_calendar.inc.php
trunk/controller/inc/component/class.year_calendar.inc.php
trunk/controller/inc/model/class.check_list.inc.php
trunk/controller/inc/model/class.component.inc.php
trunk/controller/setup/phpgw_no.lang
trunk/controller/setup/setup.inc.php
trunk/controller/setup/tables_current.inc.php
trunk/controller/setup/tables_update.inc.php
trunk/controller/templates/base/calendar/check_list_status_manager.xsl
trunk/controller/templates/base/calendar/nav_calendar_month.xsl
trunk/controller/templates/base/calendar/nav_calendar_year.xsl
trunk/controller/templates/base/calendar/view_calendar_month.xsl
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
trunk/controller/templates/base/calendar/view_calendar_year.xsl
trunk/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
trunk/controller/templates/base/check_list/add_check_list.xsl
trunk/controller/templates/base/check_list/view_control_details.xsl
trunk/controller/templates/base/check_list/view_control_info.xsl
trunk/controller/templates/base/component.xsl
trunk/controller/templates/base/config.tpl
Added Paths:
-----------
trunk/controller/inc/class.uicomponent.inc.php
trunk/controller/inc/hook_config.inc.php
Modified: trunk/controller/inc/class.menu.inc.php
===================================================================
--- trunk/controller/inc/class.menu.inc.php 2015-04-02 00:46:05 UTC (rev
12944)
+++ trunk/controller/inc/class.menu.inc.php 2015-04-06 17:25:53 UTC (rev
12945)
@@ -105,7 +105,13 @@
'text' =>
lang('Calendar_overview'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicalendar.view_calendar_for_year') ),
'image' => array('property',
'location_1'),
- )
+ ),
+ 'status_components' => array
+ (
+ 'text' => lang('status
components'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'controller.uicomponent.index') ),
+ 'image' => array('property',
'location_1'),
+ ),
);
}
Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php 2015-04-02 00:46:05 UTC
(rev 12944)
+++ trunk/controller/inc/class.socheck_list.inc.php 2015-04-06 17:25:53 UTC
(rev 12945)
@@ -62,7 +62,7 @@
{
$check_list_id = (int) $check_list_id;
$sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.control_id, cl.comment as cl_comment, deadline, planned_date,assigned_to,
billable_hours, ";
- $sql .= "completed_date, location_code, component_id,
num_open_cases, num_pending_cases, location_id, ci.id as ci_id, control_item_id
";
+ $sql .= "completed_date, location_code, component_id,
num_open_cases, num_pending_cases, location_id, ci.id as ci_id,
control_item_id,serie_id ";
$sql .= "FROM controller_check_list cl ";
$sql .= "LEFT JOIN controller_check_item as ci ON cl.id =
ci.check_list_id ";
$sql .= "WHERE cl.id = {$check_list_id}";
@@ -84,6 +84,7 @@
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
'int'));
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'),
'int'));
$check_list->set_billable_hours($this->db->f('billable_hours'));
+ $check_list->set_serie_id($this->db->f('serie_id'));
if($check_list != null)
@@ -108,7 +109,7 @@
{
$check_list_id = (int) $check_list_id;
$sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.control_id, cl.comment as cl_comment, deadline, planned_date,
completed_date,assigned_to, num_open_cases, location_code, num_pending_cases, ";
- $sql .= "ci.id as ci_id, control_item_id, check_list_id, ";
+ $sql .= "ci.id as ci_id, control_item_id, check_list_id,
cl.serie_id";
$sql .= "coi.title as coi_title, coi.required as coi_required,
";
$sql .= "coi.what_to_do as coi_what_to_do, coi.how_to_do as
coi_how_to_do, coi.control_group_id as coi_control_group_id, coi.type ";
$sql .= "FROM controller_check_list cl ";
@@ -149,6 +150,7 @@
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
'int'));
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
'int'));
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'),
'int'));
+
$check_list->set_serie_id($this->db->f('serie_id'));
}
@@ -196,7 +198,7 @@
$sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, planned_date, assigned_to, ";
$sql .= "completed_date, component_id, location_code,
num_open_cases, num_pending_cases ";
- $sql .= "ci.id as ci_id, control_item_id, check_list_id ";
+ $sql .= "ci.id as ci_id, control_item_id, check_list_id,
cl.serie_id";
$sql .= "FROM controller_check_list cl, controller_check_item
ci ";
$sql .= "WHERE cl.control_id = {$control_id} ";
$sql .= "AND cl.id = ci.check_list_id ";
@@ -227,6 +229,7 @@
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
'int'));
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
'int'));
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'),
'int'));
+
$check_list->set_serie_id($this->db->f('serie_id'));
$check_items_array = array();
}
@@ -291,6 +294,7 @@
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
'int'));
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
'int'));
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'),
'int'));
+ $check_list->set_serie_id($this->db->f('serie_id'));
}
return $check_list;
@@ -318,7 +322,7 @@
}
$sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, planned_date, assigned_to,";
- $sql .= "completed_date, component_id, location_code,
num_open_cases, num_pending_cases ";
+ $sql .= "completed_date, component_id, location_code,
num_open_cases, num_pending_cases, cl.serie_id ";
$sql .= "FROM controller_check_list cl ";
$sql .= "WHERE cl.control_id = {$control_id} ";
$sql .= "AND cl.location_code = '{$location_code}' ";
@@ -350,6 +354,7 @@
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
'int'));
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
'int'));
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'),
'int'));
+
$check_list->set_serie_id($this->db->f('serie_id'));
}
$check_list_id = $check_list->get_id();
}
@@ -421,7 +426,7 @@
{
$sql = "SELECT c.id as c_id, ";
$sql .= "cl.id as cl_id, cl.status as cl_status, cl.comment as
cl_comment, deadline, planned_date, completed_date, assigned_to, ";
- $sql .= "cl.component_id as cl_component_id, cl.location_code
as cl_location_code, num_open_cases, num_pending_cases ";
+ $sql .= "cl.component_id as cl_component_id, cl.location_code
as cl_location_code, num_open_cases, num_pending_cases, cl.serie_id ";
$sql .= "FROM controller_control c ";
$sql .= "LEFT JOIN controller_check_list cl on cl.control_id =
c.id ";
$sql .= "WHERE cl.location_code = '{$location_code}' ";
@@ -465,6 +470,7 @@
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
'int'));
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
'int'));
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'),
'int'));
+ $check_list->set_serie_id($this->db->f('serie_id'));
$check_lists_array[] = $check_list;
@@ -496,7 +502,7 @@
$sql = "SELECT c.id as c_id, ";
$sql .= "cl.id as cl_id, cl.status as cl_status, cl.comment as
cl_comment, deadline, planned_date, completed_date, assigned_to, ";
- $sql .= "cl.component_id, cl.location_id, cl.location_code as
cl_location_code, num_open_cases, num_pending_cases ";
+ $sql .= "cl.component_id, cl.location_id, cl.location_code as
cl_location_code, num_open_cases, num_pending_cases, cl.serie_id ";
$sql .= "FROM controller_control c ";
$sql .= "LEFT JOIN controller_check_list cl on cl.control_id =
c.id ";
$sql .= "WHERE cl.location_id = {$location_id} ";
@@ -542,6 +548,7 @@
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
'int'));
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
'int'));
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'),
'int'));
+ $check_list->set_serie_id($this->db->f('serie_id'));
$check_lists_array[] = $check_list;
@@ -572,7 +579,7 @@
$control_id = (int) $control_id;
$sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, planned_date, completed_date, assigned_to,
";
- $sql .= "cl.component_id as cl_component_id, cl.location_code
as cl_location_code, num_open_cases, num_pending_cases ";
+ $sql .= "cl.component_id as cl_component_id, cl.location_code
as cl_location_code, num_open_cases, num_pending_cases, cl.serie_id ";
$sql .= "FROM controller_check_list cl ";
$sql .= "LEFT JOIN controller_control c on cl.control_id = c.id
";
$sql .= "WHERE cl.control_id = {$control_id} ";
@@ -604,6 +611,7 @@
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
'int'));
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
'int'));
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'),
'int'));
+ $check_list->set_serie_id($this->db->f('serie_id'));
$check_lists_array[] = $check_list;
}
@@ -628,7 +636,7 @@
$component_id = (int) $component_id;
$sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, planned_date, completed_date, assigned_to,
";
- $sql .= "cl.component_id as cl_component_id, cl.location_id as
cl_location_id, cl.location_code as cl_location_code, num_open_cases,
num_pending_cases ";
+ $sql .= "cl.component_id as cl_component_id, cl.location_id as
cl_location_id, cl.location_code as cl_location_code, num_open_cases,
num_pending_cases ,cl.serie_id ";
$sql .= "FROM controller_check_list cl ";
$sql .= "LEFT JOIN controller_control c on cl.control_id = c.id
";
$sql .= "WHERE cl.control_id = {$control_id} ";
@@ -659,6 +667,7 @@
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
'int'));
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
'int'));
$check_list->set_assigned_to($this->unmarshal($this->db->f('assigned_to'),
'int'));
+ $check_list->set_serie_id($this->db->f('serie_id'));
$check_lists_array[] = $check_list;
}
@@ -769,6 +778,7 @@
'completed_date',
'component_id',
'location_code',
+ 'serie_id',
'num_open_cases',
'num_pending_cases',
'location_id',
@@ -784,6 +794,7 @@
$this->marshal($check_list->get_completed_date(),
'int'),
$this->marshal($check_list->get_component_id(), 'int'),
$this->marshal($check_list->get_location_code(),
'string'),
+ $this->marshal($check_list->get_serie_id(), 'int'),
$this->marshal($check_list->get_num_open_cases(),
'int'),
$this->marshal($check_list->get_num_pending_cases(),
'int'),
$this->marshal($check_list->get_location_id(), 'int'),
Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php 2015-04-02 00:46:05 UTC
(rev 12944)
+++ trunk/controller/inc/class.socontrol.inc.php 2015-04-06 17:25:53 UTC
(rev 12945)
@@ -657,28 +657,51 @@
* @param $control_id control id
* @return array with arrays of component info
*/
- function get_components_for_control($control_id, $location_id =
0, $component_id = 0)
+ function get_components_for_control($control_id, $location_id =
0, $component_id = 0, $serie_id = 0)
{
$control_id = (int) $control_id;
+ $serie_id = (int) $serie_id;
$controls_array = array();
- $sql = "SELECT ccl.control_id, ccl.component_id as
component_id, ccl.location_id as location_id, bim_type.description,
bim_item.location_code ";
- $sql .= "FROM controller_control_component_list ccl,
fm_bim_item bim_item, fm_bim_type bim_type ";
+ $sql = "SELECT ccl.control_id, ccl.component_id as
component_id,"
+ . " ccl.location_id as location_id, ccs.id as serie_id,
ccs.assigned_to, ccs.start_date,"
+ . " ccs.repeat_type, ccs.repeat_interval,
ccs.service_time, ccs.controle_time,"
+ . " bim_type.description, bim_item.location_code ";
+
+ $sql .= "FROM controller_control_component_list
ccl,controller_control_serie ccs, fm_bim_item bim_item, fm_bim_type bim_type ";
+//controller_control_serie ON (controller_control_component_list.id =
controller_control_serie.control_relation_id AND
controller_control_serie.control_relation_type = 'component')"
$sql .= "WHERE ccl.control_id = $control_id ";
$sql .= "AND ccl.component_id = bim_item.id ";
$sql .= "AND ccl.location_id = bim_type.location_id ";
- $sql .= "AND bim_type.id = bim_item.type";
+ $sql .= "AND bim_type.id = bim_item.type ";
+ $sql .= "AND ccl.id = ccs.control_relation_id ";
+ $sql .= "AND ccs.control_relation_type = 'component'";
if($location_id && $component_id)
{
$sql .= " AND ccl.location_id = {$location_id}
AND ccl.component_id = {$component_id}";
}
+ if($serie_id)
+ {
+ $sql .= " AND ccs.id = {$serie_id}";
+ }
$this->db->query($sql);
while($this->db->next_record())
{
+ $control_relation = array
+ (
+ 'serie_id' =>
$this->db->f('serie_id'),
+ 'assigned_to' =>
$this->db->f('assigned_to'),
+ 'start_date' =>
$this->db->f('start_date'),
+ 'repeat_type' =>
$this->db->f('repeat_type'),
+ 'repeat_interval' =>
$this->db->f('repeat_interval'),
+ 'service_time' =>
$this->db->f('service_time'),
+ 'controle_time' =>
$this->db->f('controle_time')
+ );
+
$component = new controller_component();
$component->set_type($this->unmarshal($this->db->f('type'), 'int'));
$component->set_id($this->unmarshal($this->db->f('component_id'), 'int'));
@@ -688,6 +711,7 @@
$component->set_loc_1($this->unmarshal($this->db->f('loc_1', true), 'string'));
$component->set_address($this->unmarshal($this->db->f('address', true),
'string'));
$component->set_type_str($this->unmarshal($this->db->f('description', true),
'string'));
+
$component->set_control_relation($control_relation);
$components_array[] = $component;
}
@@ -879,6 +903,16 @@
'control_id'
=> $control_id,
'location_id'
=> $location_id,
'component_id'
=> $component_id,
+ );
+
+ $this->db->query("INSERT INTO
controller_control_component_list (" . implode(',',array_keys($values_insert))
. ') VALUES ('
+ .
$this->db->validate_insert(array_values($values_insert)) .
')',__LINE__,__FILE__);
+ $relation_id =
$this->db->get_last_insert_id('controller_control_component_list', 'id');
+
+ $values_insert = array
+ (
+ 'control_relation_id'
=> $relation_id,
+ 'control_relation_type'
=> 'component',
'assigned_to'
=> $assigned_to,
'start_date'
=> $start_date,
'repeat_type'
=> $repeat_type,
@@ -886,9 +920,10 @@
'controle_time'
=> $controle_time,
'service_time'
=> $service_time,
);
+
+ $this->db->query("INSERT INTO
controller_control_serie (" . implode(',',array_keys($values_insert)) . ')
VALUES ('
+ .
$this->db->validate_insert(array_values($values_insert)) .
')',__LINE__,__FILE__);
- $this->db->query("INSERT INTO
controller_control_component_list (" . implode(',',array_keys($values_insert))
. ') VALUES ('
- .
$this->db->validate_insert(array_values($values_insert)) .
')',__LINE__,__FILE__);
$ret = PHPGW_ACL_ADD; // Bit -
add
}
}
@@ -954,9 +989,18 @@
$location_id = (int)$data['location_id'];
$component_id = (int)$data['component_id'];
- $sql = "SELECT controller_control_component_list.* ,
controller_control.title, enabled"
- . " FROM controller_control_component_list"
- . " {$this->db->join} controller_control ON
controller_control.id = controller_control_component_list.control_id WHERE
location_id = {$location_id} AND component_id = {$component_id}";
+ $sql = "SELECT controller_control_component_list.* ,"
+ . " controller_control.title,
controller_control.enabled as control_enabled,"
+ . " controller_control_component_list.enabled as
relation_enabled,"
+ . " controller_control_serie.id as serie_id,"
+ . "
controller_control_serie.assigned_to,controller_control_serie.start_date,"
+ . "
controller_control_serie.repeat_type,controller_control_serie.repeat_interval,"
+ . "
controller_control_serie.service_time,controller_control_serie.controle_time "
+ . " FROM controller_control_component_list"
+ . " {$this->db->join} controller_control ON
controller_control.id = controller_control_component_list.control_id"
+ . " {$this->db->left_join} controller_control_serie ON
(controller_control_component_list.id =
controller_control_serie.control_relation_id AND
controller_control_serie.control_relation_type = 'component')"
+ . " WHERE location_id = {$location_id} AND component_id
= {$component_id}";
+// _debug_array($sql);
$this->db->query($sql,__LINE__,__FILE__);
$controls = array();
@@ -965,6 +1009,7 @@
$controls[] = array
(
'id' =>
$this->db->f('id'),
+ 'serie_id' =>
$this->db->f('serie_id'),
'control_id' =>
$this->db->f('control_id'),
'title' =>
$this->db->f('title',true),
'location_id' =>
$this->db->f('location_id'),
@@ -973,7 +1018,8 @@
'start_date' =>
$this->db->f('start_date'),
'repeat_type' =>
$this->db->f('repeat_type'),
'repeat_interval' =>
$this->db->f('repeat_interval'),
- 'enabled' =>
$this->db->f('enabled'),
+ 'control_enabled' =>
$this->db->f('control_enabled'),
+ 'relation_enabled' =>
$this->db->f('relation_enabled'),
'service_time' =>
(float)$this->db->f('service_time'),
'controle_time' =>
(float)$this->db->f('controle_time'),
);
@@ -981,7 +1027,7 @@
foreach($controls as &$entry)
{
- if(!isset($users[$entry['assigned_to']]))
+ if($entry['assigned_to'] &&
!isset($users[$entry['assigned_to']]))
{
$users[$entry['assigned_to']] =
$GLOBALS['phpgw']->accounts->get($entry['assigned_to'])->__toString();
}
Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php 2015-04-02 00:46:05 UTC
(rev 12944)
+++ trunk/controller/inc/class.uicalendar.inc.php 2015-04-06 17:25:53 UTC
(rev 12945)
@@ -1,5 +1,4 @@
<?php
-
/**
* phpGroupWare - controller: a part of a Facilities Management System.
*
@@ -56,45 +55,45 @@
private $so_control_item;
private $so_check_list;
private $so_check_item;
- private $location_finder;
+ private $location_finder;
public $public_functions = array
(
- 'view_calendar_for_month' => true,
- 'view_calendar_for_year' => true,
- 'view_calendar_year_for_locations' => true,
- 'view_calendar_month_for_locations' => true,
- 'update_bookmark'
=> true
+ 'view_calendar_for_month' =>
true,
+ 'view_calendar_for_year' =>
true,
+ 'view_calendar_year_for_locations' => true,
+ 'view_calendar_month_for_locations' => true,
+ 'update_bookmark'
=> true
);
public function __construct()
{
parent::__construct();
- $read = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_READ, 'controller'); //1
- $add = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_ADD, 'controller'); //2
- $edit = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_EDIT, 'controller'); //4
- $delete = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_DELETE, 'controller'); //8
+ $read = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_READ, 'controller'); //1
+ $add = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_ADD, 'controller'); //2
+ $edit = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_EDIT, 'controller'); //4
+ $delete = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_DELETE, 'controller'); //8
$manage = $GLOBALS['phpgw']->acl->check('.control', 16,
'controller'); //16
- $this->so = CreateObject('controller.socheck_list');
- $this->so_control =
CreateObject('controller.socontrol');
- $this->so_control_group =
CreateObject('controller.socontrol_group');
+ $this->so =
CreateObject('controller.socheck_list');
+ $this->so_control =
CreateObject('controller.socontrol');
+ $this->so_control_group =
CreateObject('controller.socontrol_group');
$this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
- $this->so_control_item =
CreateObject('controller.socontrol_item');
- $this->so_check_list =
CreateObject('controller.socheck_list');
- $this->so_check_item =
CreateObject('controller.socheck_item');
+ $this->so_control_item =
CreateObject('controller.socontrol_item');
+ $this->so_check_list =
CreateObject('controller.socheck_list');
+ $this->so_check_item =
CreateObject('controller.socheck_item');
- $this->location_finder = new location_finder();
-
+ $this->location_finder = new location_finder();
+
self::set_active_menu('controller::location_check_list');
if(phpgw::get_var('noframework', 'bool'))
{
$GLOBALS['phpgw_info']['flags']['noframework']
= true;
-
phpgwapi_cache::session_set('controller','noframework',true);
+ phpgwapi_cache::session_set('controller',
'noframework', true);
}
- else if
(phpgwapi_cache::session_get('controller','noframework'))
+ else if(phpgwapi_cache::session_get('controller',
'noframework'))
{
$GLOBALS['phpgw_info']['flags']['noframework']
= true;
}
@@ -102,11 +101,11 @@
public function view_calendar_for_month()
{
- $location_code = phpgw::get_var('location_code');
- $year = phpgw::get_var('year');
- $month = phpgw::get_var('month');
- $role = phpgw::get_var('role', 'int', 'REQUEST', -1);
- $repeat_type = phpgw::get_var('repeat_type');
+ $location_code = phpgw::get_var('location_code');
+ $year = phpgw::get_var('year');
+ $month = phpgw::get_var('month');
+ $role = phpgw::get_var('role',
'int', 'REQUEST', -1);
+ $repeat_type = phpgw::get_var('repeat_type');
// Validates year. If year is not set, current year is
chosen
$year = $this->validate_year($year);
@@ -119,7 +118,6 @@
// Validates role.
// $role = $this->validate_role($role);
-
// Gets timestamp value of first day in month
$from_date_ts =
month_calendar::get_start_date_month_ts($year, intval($month));
@@ -129,7 +127,7 @@
// Validates location_code. If not set, first location
among assigned locations
$location_code =
$this->validate_location_code($location_code);
- if ($location_code != null && $location_code != "")
+ if($location_code != null && $location_code != "")
{
$level =
$this->location_finder->get_location_level($location_code);
@@ -141,18 +139,18 @@
// 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);
- if ($level == 1)
+ if($level == 1)
{
// Fetches all controls for the
components for a location within time period
// $filter = "bim_item.location_code =
'$location_code' ";
- $filter = "bim_item.location_code LIKE
'$location_code%' ";
- $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
+ $filter
= "bim_item.location_code LIKE '$location_code%' ";
+ $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
}
else
{
// Fetches all controls for the
components for a location within time period
- $filter = "bim_item.location_code LIKE
'$location_code%' ";
- $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
+ $filter
= "bim_item.location_code LIKE '$location_code%' ";
+ $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
}
// Fetches all control ids with check lists for
specified time period
@@ -162,38 +160,40 @@
$controls_with_check_list_array =
$this->populate_controls_with_check_lists($controls_for_location_array,
$control_id_with_check_list_array);
$controls_calendar_array = array();
- foreach ($controls_with_check_list_array as
$control)
+ foreach($controls_with_check_list_array as
$control)
{
- $month_calendar = new
month_calendar($control, $year, $month, null, $location_code, "location");
- $calendar_array =
$month_calendar->build_calendar($control->get_check_lists_array());
+ $month_calendar = new
month_calendar($control, $year, $month, null, $location_code, "location");
+ $calendar_array =
$month_calendar->build_calendar($control->get_check_lists_array());
$controls_calendar_array[] =
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
}
// COMPONENTS
- foreach ($components_with_controls_array as
$component)
+ foreach($components_with_controls_array as
$component)
{
- $location_id =
$component->get_location_id();
- $component_id = $component->get_id();
+ $location_id =
$component->get_location_id();
+ $component_id = $component->get_id();
- $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+ $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id,
+ 'id' => $component_id));
$component->set_xml_short_desc($short_desc);
- $controls_for_component_array =
$component->get_controls_array();
- $controls_components_calendar_array =
array();
+ $controls_for_component_array
= $component->get_controls_array();
+ $controls_components_calendar_array
= array();
- foreach ($controls_for_component_array
as $control)
+ foreach($controls_for_component_array
as $control)
{
// Fetches control ids with
check lists for specified time period
-
$control_id_with_check_list_array =
$this->so->get_check_lists_for_component($component->get_location_id(),
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=0");
+
$control_id_with_check_list_array =
$this->so->get_check_lists_for_component($component->get_location_id(),
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type
= ">=0");
// Loops through all controls
for location and populates controls with check lists
$controls_for_component_array =
$this->populate_controls_with_check_lists($controls_for_component_array,
$control_id_with_check_list_array);
- $month_calendar = new
month_calendar($control, $year, $month, $component, null, "component");
- $calendar_array =
$month_calendar->build_calendar($control->get_check_lists_array());
+ $month_calendar = new
month_calendar($control, $year, $month, $component, null, "component");
+ $calendar_array =
$month_calendar->build_calendar($control->get_check_lists_array());
-
$controls_components_calendar_array[] = array("control" => $control->toArray(),
"calendar_array" => $calendar_array);
+
$controls_components_calendar_array[] = array("control" => $control->toArray(),
+ "calendar_array" =>
$calendar_array);
}
$components_calendar_array[] =
array("component" => $component->toArray(), "controls_calendar" =>
$controls_components_calendar_array);
@@ -201,7 +201,8 @@
$location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
- $property_array =
execMethod('property.solocation.read', array('type_id' => 1, 'allrows' =>
true));
+ $property_array =
execMethod('property.solocation.read', array('type_id' => 1,
+ 'allrows' => true));
// Gets array of locations assigned to current
user
$my_locations =
$this->get_my_assigned_locations($location_code);
@@ -218,35 +219,35 @@
);
$data = array
- (
- 'buildings_on_property' =>
$buildings_on_property,
- 'my_locations' =>
$my_locations,
- 'property_array' =>
$property_array,
- 'current_location' =>
$location_array,
- 'heading_array' =>
$heading_array,
- 'controls_calendar_array' =>
$controls_calendar_array,
- 'components_calendar_array' =>
$components_calendar_array,
- 'location_level' => $level,
- 'roles_array' =>
$roles_array,
- 'repeat_type_array' =>
$repeat_type_array,
- 'current_year' => $year,
- 'current_month_nr' => $month,
- 'current_role' => $role,
- 'current_repeat_type' =>
$repeat_type
+ (
+ 'buildings_on_property' =>
$buildings_on_property,
+ 'my_locations'
=> $my_locations,
+ 'property_array'
=> $property_array,
+ 'current_location'
=> $location_array,
+ 'heading_array'
=> $heading_array,
+ 'controls_calendar_array' =>
$controls_calendar_array,
+ 'components_calendar_array' =>
$components_calendar_array,
+ 'location_level'
=> $level,
+ 'roles_array'
=> $roles_array,
+ 'repeat_type_array'
=> $repeat_type_array,
+ 'current_year'
=> $year,
+ 'current_month_nr'
=> $month,
+ 'current_role'
=> $role,
+ 'current_repeat_type' =>
$repeat_type
);
phpgwapi_jquery::load_widget('autocomplete');
self::add_javascript('controller',
'controller', 'ajax.js');
self::render_template_xsl(array('calendar/view_calendar_month',
'calendar/check_list_status_manager',
- 'calendar/icon_color_map',
'calendar/select_my_locations',
-
'calendar/select_buildings_on_property',
'calendar/nav_calendar_month',
-
'calendar/calendar_filters'), $data);
+ 'calendar/icon_color_map',
'calendar/select_my_locations',
+
'calendar/select_buildings_on_property', 'calendar/nav_calendar_month',
+ 'calendar/calendar_filters'), $data);
}
else
{
$data = array(
- 'current_year' => $year,
- 'current_month_nr' => $month
+ 'current_year' => $year,
+ 'current_month_nr' => $month
);
phpgwapi_jquery::load_widget('autocomplete');
@@ -258,9 +259,9 @@
public function view_calendar_for_year()
{
- $location_code = phpgw::get_var('location_code');
- $year = phpgw::get_var('year');
- $role = phpgw::get_var('role', 'int');
+ $location_code = phpgw::get_var('location_code');
+ $year = phpgw::get_var('year');
+ $role = phpgw::get_var('role',
'int');
$repeat_type = phpgw::get_var('repeat_type');
@@ -272,7 +273,6 @@
// Validates role.
// $role = $this->validate_role($role);
-
// Gets timestamp of first day in year
$from_date_ts = $this->get_start_date_year_ts($year);
@@ -285,7 +285,7 @@
// Validates location_code. If not set, first location
among assigned locations
$location_code =
$this->validate_location_code($location_code);
- if ($location_code != null && $location_code != "")
+ if($location_code != null && $location_code != "")
{
$level =
$this->location_finder->get_location_level($location_code);
@@ -297,105 +297,108 @@
// 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);
- if ($level == 1)
+ if($level == 1)
{
// Fetches all controls for the
components for a location within time period
// $filter = "bim_item.location_code =
'$location_code' ";
- $filter = "bim_item.location_code LIKE
'$location_code%' ";
- $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
+ $filter
= "bim_item.location_code LIKE '$location_code%' ";
+ $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
}
else
{
// Fetches all controls for the
components for a location within time period
- $filter = "bim_item.location_code LIKE
'$location_code%' ";
- $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
+ $filter
= "bim_item.location_code LIKE '$location_code%' ";
+ $components_with_controls_array =
$this->so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_object", $role, $filter);
}
// Loops through controls with repeat type day
or week
// and populates array that contains aggregated
open cases pr month.
- foreach ($controls_for_location_array as
$control)
+ foreach($controls_for_location_array as
$control)
{
- if ($control->get_repeat_type() ==
controller_control::REPEAT_TYPE_DAY | $control->get_repeat_type() ==
controller_control::REPEAT_TYPE_WEEK)
+ if($control->get_repeat_type() ==
controller_control::REPEAT_TYPE_DAY | $control->get_repeat_type() ==
controller_control::REPEAT_TYPE_WEEK)
{
$cl_criteria = new
controller_check_list();
$cl_criteria->set_control_id($control->get_id());
$cl_criteria->set_location_code($location_code);
- $from_month =
$this->get_start_month_for_control($control);
- $to_month =
$this->get_end_month_for_control($control);
+ $from_month =
$this->get_start_month_for_control($control);
+ $to_month =
$this->get_end_month_for_control($control);
// Loops through controls and
populates aggregate open cases pr month array.
$agg_open_cases_pr_month_array
= $this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month,
$to_month);
- $year_calendar_agg = new
year_calendar_agg($control, $year, $location_code,
"VIEW_CONTROLS_FOR_LOCATION");
- $calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
+ $year_calendar_agg = new
year_calendar_agg($control, $year, $location_code,
"VIEW_CONTROLS_FOR_LOCATION");
+ $calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
$controls_calendar_array[] =
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
}
}
- $repeat_type_expr = ">=2";
+ $repeat_type_expr
= ">=2";
// Fetches control ids with check lists for
specified time period
- $control_id_with_check_list_array =
$this->so->get_check_lists_for_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type_expr);
+ $control_id_with_check_list_array =
$this->so->get_check_lists_for_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type_expr);
// Loops through all controls for location and
populates controls with check lists
$controls_for_location_array =
$this->populate_controls_with_check_lists($controls_for_location_array,
$control_id_with_check_list_array);
- foreach ($controls_for_location_array as
$control)
+ foreach($controls_for_location_array as
$control)
{
- if ($control->get_repeat_type() ==
controller_control::REPEAT_TYPE_MONTH | $control->get_repeat_type() ==
controller_control::REPEAT_TYPE_YEAR)
+ if($control->get_repeat_type() ==
controller_control::REPEAT_TYPE_MONTH | $control->get_repeat_type() ==
controller_control::REPEAT_TYPE_YEAR)
{
- $year_calendar = new
year_calendar($control, $year, null, $location_code, "location");
- $calendar_array =
$year_calendar->build_calendar($control->get_check_lists_array());
+ $year_calendar = new
year_calendar($control, $year, null, $location_code, "location");
+ $calendar_array =
$year_calendar->build_calendar($control->get_check_lists_array());
$controls_calendar_array[] =
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
}
}
// COMPONENTS
- foreach ($components_with_controls_array as
$component)
+ foreach($components_with_controls_array as
$component)
{
$location_id =
$component->get_location_id();
- $id = $component->get_id();
+ $id =
$component->get_id();
- $short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $id));
+ $short_desc_arr =
execMethod('property.soentity.get_short_description', array(
+ 'location_id' => $location_id,
'id' => $id));
$component->set_xml_short_desc($short_desc_arr);
- $controls_for_component_array =
$component->get_controls_array();
- $controls_components_calendar_array =
array();
+ $controls_for_component_array
= $component->get_controls_array();
+ $controls_components_calendar_array
= array();
// AGGREGATED VALUES PR MONTH: Puts
aggregated number of open cases for days and weeks in calendar array
- foreach ($controls_for_component_array
as $control)
+ foreach($controls_for_component_array
as $control)
{
- if ($control->get_repeat_type()
== controller_control::REPEAT_TYPE_DAY | $control->get_repeat_type() ==
controller_control::REPEAT_TYPE_WEEK)
+ if($control->get_repeat_type()
== controller_control::REPEAT_TYPE_DAY | $control->get_repeat_type() ==
controller_control::REPEAT_TYPE_WEEK)
{
$cl_criteria = new
controller_check_list();
$cl_criteria->set_control_id($control->get_id());
$cl_criteria->set_component_id($component->get_id());
$cl_criteria->set_location_id($component->get_location_id());
- $from_month =
$this->get_start_month_for_control($control);
- $to_month =
$this->get_end_month_for_control($control);
+ $from_month =
$this->get_start_month_for_control($control);
+ $to_month =
$this->get_end_month_for_control($control);
$agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month,
$to_month);
- $year_calendar_agg =
new year_calendar_agg($control, $year, $location_code,
"VIEW_CONTROLS_FOR_LOCATION");
- $calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
+ $year_calendar_agg
= new year_calendar_agg($control, $year, $location_code,
"VIEW_CONTROLS_FOR_LOCATION");
+ $calendar_array
= $year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
-
$controls_components_calendar_array[] = array("control" => $control->toArray(),
"calendar_array" => $calendar_array);
+
$controls_components_calendar_array[] = array("control" => $control->toArray(),
+
"calendar_array" => $calendar_array);
}
else
{
// Fetches control ids
with check lists for specified time period
-
$control_id_with_check_list_array =
$this->so->get_check_lists_for_component($component->get_location_id(),
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=2");
+
$control_id_with_check_list_array =
$this->so->get_check_lists_for_component($component->get_location_id(),
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type
= ">=2");
// Loops through all
controls for location and populates controls with check lists
$controls_for_component_array =
$this->populate_controls_with_check_lists($controls_for_component_array,
$control_id_with_check_list_array);
- $year_calendar = new
year_calendar($control, $year, $component, null, "component");
- $calendar_array =
$year_calendar->build_calendar($control->get_check_lists_array());
+ $year_calendar = new
year_calendar($control, $year, $component, null, "component");
+ $calendar_array =
$year_calendar->build_calendar($control->get_check_lists_array());
-
$controls_components_calendar_array[] = array("control" => $control->toArray(),
"calendar_array" => $calendar_array);
+
$controls_components_calendar_array[] = array("control" => $control->toArray(),
+
"calendar_array" => $calendar_array);
}
}
@@ -420,27 +423,27 @@
$data = array
(
- 'buildings_on_property' =>
$buildings_on_property,
- 'my_locations' => $my_locations,
- 'current_location' => $location_array,
- 'heading_array' => $heading_array,
- 'controls_calendar_array' =>
$controls_calendar_array,
- 'components_calendar_array' =>
$components_calendar_array,
- 'location_level' => $level,
- 'roles_array' => $roles_array,
- 'repeat_type_array' =>
$repeat_type_array,
- 'current_year' => $year,
- 'current_role' => $role,
- 'current_repeat_type' => $repeat_type
+ 'buildings_on_property' =>
$buildings_on_property,
+ 'my_locations'
=> $my_locations,
+ 'current_location'
=> $location_array,
+ 'heading_array'
=> $heading_array,
+ 'controls_calendar_array' =>
$controls_calendar_array,
+ 'components_calendar_array' =>
$components_calendar_array,
+ 'location_level'
=> $level,
+ 'roles_array'
=> $roles_array,
+ 'repeat_type_array'
=> $repeat_type_array,
+ 'current_year'
=> $year,
+ 'current_role'
=> $role,
+ 'current_repeat_type' =>
$repeat_type
);
phpgwapi_jquery::load_widget('autocomplete');
self::add_javascript('controller',
'controller', 'ajax.js');
self::render_template_xsl(array('calendar/view_calendar_year',
'calendar/check_list_status_manager',
- 'calendar/icon_color_map',
'calendar/select_my_locations',
-
'calendar/select_buildings_on_property', 'calendar/nav_calendar_year',
- 'calendar/calendar_filters'),
$data);
+ 'calendar/icon_color_map',
'calendar/select_my_locations',
+
'calendar/select_buildings_on_property', 'calendar/nav_calendar_year',
+ 'calendar/calendar_filters'), $data);
}
else
{
@@ -459,16 +462,18 @@
{
static $_location_name = array();
- $control_id = phpgw::get_var('control_id', 'int');
- $control = $this->so_control->get_single($control_id);
- $year = phpgw::get_var('year', 'int');
- $location_id = phpgw::get_var('location_id');
- $component_id = phpgw::get_var('component_id');
+ $control_id = phpgw::get_var('control_id',
'int');
+ $control =
$this->so_control->get_single($control_id);
+ $year = phpgw::get_var('year', 'int');
+ $location_id = phpgw::get_var('location_id', 'int');
+ $component_id = phpgw::get_var('component_id', 'int');
+ $serie_id = phpgw::get_var('serie_id',
'int');
+
$user_id = $GLOBALS['phpgw_info']['user']['account_id'];
- $bookmark_locations = array();
- $bookmarks = phpgwapi_cache::user_get('controller',
"location_bookmark", $user_id);
+ $bookmark_locations = array();
+ $bookmarks =
phpgwapi_cache::user_get('controller', "location_bookmark", $user_id);
if(is_array($bookmarks))
{
$bookmark_locations = array_keys($bookmarks);
@@ -478,26 +483,25 @@
{
$bookmark_locations[] = $location_code;
}
-
+
$locations_list = array();
- if (is_numeric($control_id) & $control_id > 0)
+ if(is_numeric($control_id) & $control_id > 0)
{
- $locations_for_control_array =
$this->so_control->get_locations_for_control($control_id);
- $components_for_control_array =
$this->so_control->get_components_for_control($control_id, $location_id,
$component_id);
- foreach ($locations_for_control_array as
$location)
+ $locations_for_control_array =
$this->so_control->get_locations_for_control($control_id);
+ $components_for_control_array =
$this->so_control->get_components_for_control($control_id, $location_id,
$component_id, $serie_id);
+ foreach($locations_for_control_array as
$location)
{
$locations_list[] = array
- (
- 'id' =>
$location['location_code'],
- 'name' =>
$location['loc_name'],
- 'selected' =>
$location_code == $location['location_code'] ? 1 : 0
+ (
+ 'id' =>
$location['location_code'],
+ 'name' =>
$location['loc_name'],
+ 'selected' =>
$location_code == $location['location_code'] ? 1 : 0
);
}
reset($locations_for_control_array);
unset($location);
-
}
// Validates year. If year is not set, current year is
chosen
@@ -513,12 +517,12 @@
// LOCATIONS: Process aggregated values for controls
with repeat type day or week
- if ($control->get_repeat_type() <=
controller_control::REPEAT_TYPE_WEEK)
+ if($control->get_repeat_type() <=
controller_control::REPEAT_TYPE_WEEK)
{
- foreach ($locations_for_control_array as
$location)
+ foreach($locations_for_control_array as
$location)
{
$curr_location_code =
$location['location_code'];
-
+
if(!$bookmark_locations ||
!in_array($curr_location_code, $bookmark_locations))
{
continue;
@@ -528,70 +532,71 @@
$cl_criteria->set_control_id($control->get_id());
$cl_criteria->set_location_code($curr_location_code);
- $from_month =
$this->get_start_month_for_control($control);
- $to_month =
$this->get_end_month_for_control($control);
+ $from_month =
$this->get_start_month_for_control($control);
+ $to_month =
$this->get_end_month_for_control($control);
// Loops through controls in
controls_for_location_array and populates aggregate open cases pr month array.
$agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month,
$to_month);
- $year_calendar_agg = new
year_calendar_agg($control, $year, $curr_location_code,
"VIEW_LOCATIONS_FOR_CONTROL");
- $calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
+ $year_calendar_agg = new
year_calendar_agg($control, $year, $curr_location_code,
"VIEW_LOCATIONS_FOR_CONTROL");
+ $calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
$locations_with_calendar_array[] = array
- (
- 'location'
=> $location,
- 'calendar_array' =>
$calendar_array,
- 'selected'
=> $bookmarks && isset($bookmarks[$curr_location_code])
+ (
+ 'location' =>
$location,
+ 'calendar_array' =>
$calendar_array,
+ 'selected' =>
$bookmarks && isset($bookmarks[$curr_location_code])
);
-
}
// COMPONENTS: Process aggregated values for
controls with repeat type day or week
- foreach ($components_for_control_array as
$component)
+ foreach($components_for_control_array as
$component)
{
- $short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component->get_location_id(), 'id' => $component->get_id()));
+ $short_desc_arr =
execMethod('property.soentity.get_short_description', array(
+ 'location_id' =>
$component->get_location_id(), 'id' => $component->get_id()));
if(!isset($_location_name[$component->get_location_code()]))
{
- $_location =
execMethod('property.solocation.read_single', $component->get_location_code());
- $location_arr = explode('-',
$component->get_location_code());
- $i=1;
- $name_arr = array();
+ $_location =
execMethod('property.solocation.read_single', $component->get_location_code());
+ $location_arr = explode('-',
$component->get_location_code());
+ $i
= 1;
+ $name_arr =
array();
foreach($location_arr as
$_dummy)
{
$name_arr[] =
$_location["loc{$i}_name"];
$i++;
}
-
$_location_name[$component->get_location_code()]= implode('::', $name_arr);
+
$_location_name[$component->get_location_code()] = implode('::', $name_arr);
}
- $short_desc_arr .= ' ['.
$_location_name[$component->get_location_code()] . ']';
+ $short_desc_arr .= ' [' .
$_location_name[$component->get_location_code()] . ']';
$component->set_xml_short_desc($short_desc_arr);
- $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);
+ $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);
$cl_criteria = new
controller_check_list();
$cl_criteria->set_control_id($control->get_id());
$cl_criteria->set_component_id($component->get_id());
$cl_criteria->set_location_id($component->get_location_id());
- $from_month =
$this->get_start_month_for_control($control);
- $to_month =
$this->get_end_month_for_control($control);
+ $from_month =
$this->get_start_month_for_control($control);
+ $to_month =
$this->get_end_month_for_control($control);
// Loops through controls in
controls_for_location_array and populates aggregate open cases pr month array.
$agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month,
$to_month);
- $year_calendar_agg = new
year_calendar_agg($control, $year, $location_code,
"VIEW_LOCATIONS_FOR_CONTROL");
- $calendar_array =
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
- $components_with_calendar_array[] =
array("component" => $component->toArray(), "calendar_array" =>
$calendar_array);
+ $year_calendar_agg
= new year_calendar_agg($control, $year, $location_code,
"VIEW_LOCATIONS_FOR_CONTROL");
+ $calendar_array
=
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
+ $components_with_calendar_array[]
= array("component" => $component->toArray(),
+ "calendar_array" =>
$calendar_array);
}
}
// Process values for controls with repeat type month
or year
- else if ($control->get_repeat_type() >
controller_control::REPEAT_TYPE_WEEK)
+ else if($control->get_repeat_type() >
controller_control::REPEAT_TYPE_WEEK)
{
- foreach ($locations_for_control_array as
$location)
+ foreach($locations_for_control_array as
$location)
{
$curr_location_code =
$location['location_code'];
@@ -600,56 +605,84 @@
continue;
}
- $repeat_type =
$control->get_repeat_type();
- $check_lists_array =
$this->so->get_check_lists_for_control_and_location($control_id,
$curr_location_code, $from_date_ts, $to_date_ts, $repeat_type);
+ $repeat_type =
$control->get_repeat_type();
+ $check_lists_array =
$this->so->get_check_lists_for_control_and_location($control_id,
$curr_location_code, $from_date_ts, $to_date_ts, $repeat_type);
- $year_calendar = new
year_calendar($control, $year, null, $curr_location_code, "location");
- $calendar_array =
$year_calendar->build_calendar($check_lists_array);
+ $year_calendar = new
year_calendar($control, $year, null, $curr_location_code, "location");
+ $calendar_array =
$year_calendar->build_calendar($check_lists_array);
$locations_with_calendar_array[] = array
- (
- 'location'
=> $location,
- 'calendar_array' =>
$calendar_array,
- 'selected'
=> $bookmarks && isset($bookmarks[$curr_location_code])
+ (
+ 'location' =>
$location,
+ 'calendar_array' =>
$calendar_array,
+ 'selected' =>
$bookmarks && isset($bookmarks[$curr_location_code])
);
}
- foreach ($components_for_control_array as
$component)
+ foreach($components_for_control_array as
$component)
{
- $short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component->get_location_id(), 'id' => $component->get_id()));
+ $short_desc_arr =
execMethod('property.soentity.get_short_description', array(
+ 'location_id' =>
$component->get_location_id(), 'id' => $component->get_id()));
//FIXME - make generic
-
- /*=>*/
+
+ /* => */
if(!isset($_location_name[$component->get_location_code()]))
{
- $_location =
execMethod('property.solocation.read_single', $component->get_location_code());
- $location_arr = explode('-',
$component->get_location_code());
- $i=1;
- $name_arr = array();
+ $_location =
execMethod('property.solocation.read_single', $component->get_location_code());
+ $location_arr = explode('-',
$component->get_location_code());
+ $i
= 1;
+ $name_arr =
array();
foreach($location_arr as
$_dummy)
{
$name_arr[] =
$_location["loc{$i}_name"];
$i++;
}
-
$_location_name[$component->get_location_code()]= implode('::', $name_arr);
+
$_location_name[$component->get_location_code()] = implode('::', $name_arr);
}
- $short_desc_arr .= ' ['.
$_location_name[$component->get_location_code()] . ']';
- /*<=*/
+ $short_desc_arr .= ' [' .
$_location_name[$component->get_location_code()] . ']';
+ /* <= */
$component->set_xml_short_desc($short_desc_arr);
- $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);
+ $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);
$check_lists_array =
$component_with_check_lists["check_lists_array"];
- $year_calendar = new
year_calendar($control, $year, $component, null, "component");
- $calendar_array =
$year_calendar->build_calendar($check_lists_array);
+ /*
+ * start override control with data
from serie
+ */
+ $control_relation =
$component->get_control_relation();
+
if(isset($control_relation['start_date']) && $control_relation['start_date'])
+ {
+
$control->set_start_date($control_relation['start_date']);
+ }
- $components_with_calendar_array[] =
array("component" => $component->toArray(), "calendar_array" =>
$calendar_array);
+ if(isset($control_relation['end_date'])
&& $control_relation['end_date'])
+ {
+
$control->set_end_date($control_relation['end_date']);
+ }
+
if(isset($control_relation['repeat_type']) && $control_relation['repeat_type'])
+ {
+
$control->set_repeat_type($control_relation['repeat_type']);
+ }
+
if(isset($control_relation['repeat_interval']) &&
$control_relation['repeat_interval'])
+ {
+
$control->set_repeat_interval($control_relation['repeat_interval']);
+ }
+
+ /*
+ * End override control with data from
serie
+ */
+
+ $year_calendar = new
year_calendar($control, $year, $component, null, "component");
+ $calendar_array =
$year_calendar->build_calendar($check_lists_array);
+
+ $components_with_calendar_array[] =
array("component" => $component->toArray(),
+ "calendar_array" =>
$calendar_array);
}
}
@@ -659,19 +692,21 @@
$heading_array = year_calendar::get_heading_array();
$data = array
- (
- 'locations_list'
=> $locations_list,
- 'my_locations'
=> $my_locations,
- 'control'
=> $control->toArray(),
- 'heading_array'
=> $heading_array,
- 'locations_with_calendar_array' =>
$locations_with_calendar_array,
- 'components_with_calendar_array' =>
$components_with_calendar_array,
- 'current_year'
=> $year,
- 'location_code'
=> $location_code
+ (
+ 'locations_list'
=> $locations_list,
+ 'my_locations'
=> $my_locations,
+ 'control'
=> $control->toArray(),
+ 'heading_array'
=> $heading_array,
+ 'locations_with_calendar_array' =>
$locations_with_calendar_array,
+ 'components_with_calendar_array' =>
$components_with_calendar_array,
+ 'current_year'
=> $year,
+ 'location_code'
=> $location_code,
+ 'serie_id'
=> $serie_id,
+
);
self::render_template_xsl(array('calendar/view_calendar_year_for_locations',
'calendar/check_list_status_manager',
- 'calendar/icon_color_map',
'calendar/select_my_locations', 'calendar/nav_calendar_year'), $data);
+ 'calendar/icon_color_map',
'calendar/select_my_locations', 'calendar/nav_calendar_year'), $data);
phpgwapi_jquery::load_widget('core');
self::add_javascript('controller', 'controller',
'ajax.js');
@@ -679,10 +714,10 @@
public function view_calendar_month_for_locations()
{
- static $_location_name = array();
- $control_id = phpgw::get_var('control_id');
- $control = $this->so_control->get_single($control_id);
- if(!$year = intval(phpgw::get_var('year')))
+ static $_location_name = array();
+ $control_id =
phpgw::get_var('control_id', 'int');
+ $control =
$this->so_control->get_single($control_id);
+ if(!$year =
intval(phpgw::get_var('year')))
{
$year = date('Y');
}
@@ -691,13 +726,15 @@
$month = date('m');
}
- $location_id = phpgw::get_var('location_id');
- $component_id = phpgw::get_var('component_id');
+ $location_id = phpgw::get_var('location_id', 'int');
+ $component_id = phpgw::get_var('component_id', 'int');
+ $serie_id = phpgw::get_var('serie_id',
'int');
+
$user_id = $GLOBALS['phpgw_info']['user']['account_id'];
- $bookmark_locations = array();
- $bookmarks = phpgwapi_cache::user_get('controller',
"location_bookmark", $user_id);
+ $bookmark_locations = array();
+ $bookmarks =
phpgwapi_cache::user_get('controller', "location_bookmark", $user_id);
if(is_array($bookmarks))
{
$bookmark_locations = array_keys($bookmarks);
@@ -708,23 +745,22 @@
$bookmark_locations[] = $location_code;
}
- if (is_numeric($control_id) & $control_id > 0)
+ if(is_numeric($control_id) & $control_id > 0)
{
- $locations_for_control_array =
$this->so_control->get_locations_for_control($control_id);
- $components_for_control_array =
$this->so_control->get_components_for_control($control_id, $location_id,
$component_id);
- foreach ($locations_for_control_array as
$location)
+ $locations_for_control_array =
$this->so_control->get_locations_for_control($control_id);
+ $components_for_control_array =
$this->so_control->get_components_for_control($control_id, $location_id,
$component_id,$serie_id);
+ foreach($locations_for_control_array as
$location)
{
$locations_list[] = array
- (
- 'id' =>
$location['location_code'],
- 'name' =>
$location['loc_name'],
- 'selected' =>
$location_code == $location['location_code'] ? 1 : 0
+ (
+ 'id' =>
$location['location_code'],
+ 'name' =>
$location['loc_name'],
+ 'selected' =>
$location_code == $location['location_code'] ? 1 : 0
);
}
reset($locations_for_control_array);
unset($location);
-
}
// Validates year. If year is not set, current year is
chosen
@@ -741,7 +777,7 @@
$locations_with_calendar_array = array();
- foreach ($locations_for_control_array as $location)
+ foreach($locations_for_control_array as $location)
{
$curr_location_code =
$location['location_code'];
@@ -750,51 +786,81 @@
continue;
}
- $repeat_type = $control->get_repeat_type();
- $check_lists_array =
$this->so->get_check_lists_for_control_and_location($control_id,
$curr_location_code, $from_date_ts, $to_date_ts, $control->get_repeat_type());
+ $repeat_type =
$control->get_repeat_type();
+ $check_lists_array =
$this->so->get_check_lists_for_control_and_location($control_id,
$curr_location_code, $from_date_ts, $to_date_ts, $control->get_repeat_type());
- $month_calendar = new month_calendar($control, $year, $month,
null, $curr_location_code, "location");
- $calendar_array =
$month_calendar->build_calendar($check_lists_array);
+ $month_calendar = new month_calendar($control,
$year, $month, null, $curr_location_code, "location");
+ $calendar_array =
$month_calendar->build_calendar($check_lists_array);
$locations_with_calendar_array[] = array
- (
- 'location' =>
$location,
- 'calendar_array' =>
$calendar_array,
- 'selected' =>
$bookmarks && isset($bookmarks[$curr_location_code])
+ (
+ 'location' => $location,
+ 'calendar_array' => $calendar_array,
+ 'selected' => $bookmarks
&& isset($bookmarks[$curr_location_code])
);
}
- foreach ($components_for_control_array as $component)
+ foreach($components_for_control_array as $component)
{
- $short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component->get_location_id(), 'id' => $component->get_id()));
-
if(!isset($_location_name[$component->get_location_code()]))
+ $short_desc_arr =
execMethod('property.soentity.get_short_description', array(
+ 'location_id' =>
$component->get_location_id(), 'id' => $component->get_id()));
+
if(!isset($_location_name[$component->get_location_code()]))
+ {
+ $_location =
execMethod('property.solocation.read_single', $component->get_location_code());
+ $location_arr = explode('-',
$component->get_location_code());
+ $i = 1;
+ $name_arr = array();
+ foreach($location_arr as $_dummy)
{
- $_location =
execMethod('property.solocation.read_single', $component->get_location_code());
- $location_arr = explode('-',
$component->get_location_code());
- $i=1;
- $name_arr = array();
- foreach($location_arr as
$_dummy)
- {
- $name_arr[] =
$_location["loc{$i}_name"];
- $i++;
- }
-
-
$_location_name[$component->get_location_code()]= implode('::', $name_arr);
+ $name_arr[] =
$_location["loc{$i}_name"];
+ $i++;
}
- $short_desc_arr .= ' ['.
$_location_name[$component->get_location_code()] . ']';
+
$_location_name[$component->get_location_code()] = implode('::', $name_arr);
+ }
+ $short_desc_arr .= ' [' .
$_location_name[$component->get_location_code()] . ']';
+
$component->set_xml_short_desc($short_desc_arr);
- $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, $control->get_repeat_type());
+ $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);
$check_lists_array =
$component_with_check_lists["check_lists_array"];
- $month_calendar = new month_calendar($control,
$year, $month, $component, null, "component");
- $calendar_array =
$month_calendar->build_calendar($check_lists_array);
+ /*
+ * Start override control with data from serie
+ */
- $components_with_calendar_array[] =
array("component" => $component->toArray(), "calendar_array" =>
$calendar_array);
+ $control_relation =
$component->get_control_relation();
+ if(isset($control_relation['start_date']) &&
$control_relation['start_date'])
+ {
+
$control->set_start_date($control_relation['start_date']);
+ }
+
+ if(isset($control_relation['end_date']) &&
$control_relation['end_date'])
+ {
+
$control->set_end_date($control_relation['end_date']);
+ }
+ if(isset($control_relation['repeat_type']) &&
$control_relation['repeat_type'])
+ {
+
$control->set_repeat_type($control_relation['repeat_type']);
+ }
+ if(isset($control_relation['repeat_interval'])
&& $control_relation['repeat_interval'])
+ {
+
$control->set_repeat_interval($control_relation['repeat_interval']);
+ }
+
+ /*
+ * End override control with data from serie
+ */
+
+ $month_calendar = new month_calendar($control,
$year, $month, $component, null, "component");
+ $calendar_array =
$month_calendar->build_calendar($check_lists_array);
+
+
+ $components_with_calendar_array[] =
array("component" => $component->toArray(),
+ "calendar_array" => $calendar_array);
}
// Gets array of locations assigned to current user
@@ -803,21 +869,23 @@
$heading_array =
month_calendar::get_heading_array($year, $month);
$data = array
- (
- 'control'
=> $control->toArray(),
- 'my_locations'
=> $my_locations,
- 'property_array'
=> $property_array,
- 'location_array'
=> $location_array,
- 'heading_array'
=> $heading_array,
- 'locations_with_calendar_array' =>
$locations_with_calendar_array,
- 'components_with_calendar_array' =>
$components_with_calendar_array,
- 'current_year'
=> $year,
- 'current_month_nr'
=> $month,
- 'locations_list'
=> $locations_list,
- 'location_code'
=> $location_code
+ (
+ 'control'
=> $control->toArray(),
+ 'my_locations'
=> $my_locations,
+ 'property_array'
=> $property_array,
+ 'location_array'
=> $location_array,
+ 'heading_array'
=> $heading_array,
+ 'locations_with_calendar_array' =>
$locations_with_calendar_array,
+ 'components_with_calendar_array' =>
$components_with_calendar_array,
+ 'current_year'
=> $year,
+ 'current_month_nr'
=> $month,
+ 'locations_list'
=> $locations_list,
+ 'location_code'
=> $location_code,
+ 'serie_id'
=> $serie_id,
);
-
self::render_template_xsl(array('calendar/view_calendar_month_for_locations',
'calendar/check_list_status_manager',
+
self::render_template_xsl(array('calendar/view_calendar_month_for_locations',
+ 'calendar/check_list_status_manager',
'calendar/icon_color_map',
'calendar/select_my_locations', 'calendar/nav_calendar_month'), $data);
phpgwapi_jquery::load_widget('core');
@@ -828,11 +896,11 @@
{
$controls_with_check_list = array();
- foreach ($controls_for_location_array as $control)
+ foreach($controls_for_location_array as $control)
{
- foreach ($control_id_with_check_list_array as
$control_id)
+ foreach($control_id_with_check_list_array as
$control_id)
{
- if ($control->get_id() ==
$control_id->get_id())
+ if($control->get_id() ==
$control_id->get_id())
{
$control->set_check_lists_array($control_id->get_check_lists_array());
}
@@ -851,10 +919,10 @@
$agg_open_cases_pr_month_array = array();
// Fetches aggregate value for open cases in each month
in time period
- for ($from_month; $from_month <= $to_month;
$from_month++)
+ for($from_month; $from_month <= $to_month;
$from_month++)
{
- $month_start_ts =
$this->get_month_start_ts($year, $from_month);
- $month_end_ts =
$this->get_month_start_ts($year, $from_month + 1);
+ $month_start_ts =
$this->get_month_start_ts($year, $from_month);
+ $month_end_ts =
$this->get_month_start_ts($year, $from_month + 1);
$num_open_cases_for_control_array = array();
@@ -862,9 +930,9 @@
$num_open_cases_for_control_array =
$this->so_check_list->get_num_open_cases_for_control($cl_criteria,
$month_start_ts, $month_end_ts);
// If there is a aggregated value for the
month, add aggregated status object to agg_open_cases_pr_month_array
- if (!empty($num_open_cases_for_control_array))
+ if(!empty($num_open_cases_for_control_array))
{
- $status_agg_month_info = new
status_agg_month_info();
+ $status_agg_month_info
= new status_agg_month_info();
$status_agg_month_info->set_month_nr($from_month);
$status_agg_month_info->set_agg_open_cases($num_open_cases_for_control_array["count"]);
$agg_open_cases_pr_month_array[] =
$status_agg_month_info;
@@ -877,7 +945,7 @@
function get_start_month_for_control($control)
{
// Checks if control starts in the year that is
displayed
- if (date("Y", $control->get_start_date()) == $year)
+ if(date("Y", $control->get_start_date()) == $year)
{
$from_month = date("n",
$control->get_start_date());
}
@@ -892,7 +960,7 @@
function get_end_month_for_control($control)
{
// Checks if control ends in the year that is displayed
- if (date("Y", $control->get_end_date()) == $year)
+ if(date("Y", $control->get_end_date()) == $year)
{
$to_month = date("n", $control->get_end_date());
}
@@ -908,19 +976,19 @@
{
$criteria = array
(
- 'user_id' =>
$GLOBALS['phpgw_info']['user']['account_id'],
- 'type_id' => 1,
- 'role_id' => 0, // For å begrense til en
bestemt rolle - ellers listes alle roller for brukeren
- 'allrows' => false
+ 'user_id' =>
$GLOBALS['phpgw_info']['user']['account_id'],
+ 'type_id' => 1,
+ 'role_id' => 0, // For å begrense til en
bestemt rolle - ellers listes alle roller for brukeren
+ 'allrows' => false
);
- if (empty($location_code))
+ if(empty($location_code))
{
- $my_locations =
$this->location_finder->get_responsibilities($criteria);
- if( count($my_locations) > 0 )
- {
- $location_code = $my_locations[0]["location_code"];
- }
+ $my_locations =
$this->location_finder->get_responsibilities($criteria);
+ if(count($my_locations) > 0)
+ {
+ $location_code =
$my_locations[0]["location_code"];
+ }
}
return $location_code;
@@ -930,19 +998,19 @@
{
$criteria = array
(
- 'user_id' =>
$GLOBALS['phpgw_info']['user']['account_id'], //
- 'type_id' => 1, // Nivå i bygningsregisteret
1:eiendom
- 'role_id' => 0, // For å begrense til en
bestemt rolle - ellers listes alle roller for brukeren
- 'allrows' => false
+ 'user_id' =>
$GLOBALS['phpgw_info']['user']['account_id'], //
+ 'type_id' => 1, // Nivå i
bygningsregisteret 1:eiendom
+ 'role_id' => 0, // For å begrense til en
bestemt rolle - ellers listes alle roller for brukeren
+ 'allrows' => false
);
$my_locations =
$this->location_finder->get_responsibilities($criteria);
$my_washed_locations = array();
- foreach ($my_locations as $location)
+ foreach($my_locations as $location)
{
- if ($location['location_code'] !=
$current_location_code)
+ if($location['location_code'] !=
$current_location_code)
{
$my_washed_locations[] = $location;
}
@@ -953,10 +1021,10 @@
function get_month_start_ts($year, $month)
{
- if ($month > 12)
+ if($month > 12)
{
- $year = $year + 1;
- $month = $month % 12;
+ $year = $year + 1;
+ $month = $month % 12;
}
return strtotime("$month/01/$year");
@@ -969,15 +1037,15 @@
function get_end_date_year_ts($year)
{
- $to_year = $year + 1;
- $end_date_year_ts = strtotime("01/01/$to_year");
+ $to_year = $year + 1;
+ $end_date_year_ts = strtotime("01/01/$to_year");
return $end_date_year_ts;
}
function validate_year($validate_year)
{
- if (empty($validate_year))
+ if(empty($validate_year))
{
$validate_year = date("Y");
}
@@ -989,7 +1057,7 @@
function validate_repeat_type($validate_repeat_type)
{
- if ($validate_repeat_type != 0 &
(empty($validate_repeat_type) | ($validate_repeat_type > 3)))
+ if($validate_repeat_type != 0 &
(empty($validate_repeat_type) | ($validate_repeat_type > 3)))
{
$validate_repeat_type = '';
}
@@ -999,7 +1067,7 @@
function validate_role($validate_role)
{
- if (empty($validate_role) |
(!is_numeric($validate_role)) | ($validate_role < 1))
+ if(empty($validate_role) |
(!is_numeric($validate_role)) | ($validate_role < 1))
{
$validate_role = '';
}
@@ -1009,7 +1077,7 @@
function validate_month($month)
{
- if (empty($month))
+ if(empty($month))
{
$month = date("n");
}
@@ -1021,12 +1089,13 @@
public function query()
{
+
+ }
- }
public function update_bookmark()
{
- $location_code = phpgw::get_var('location_code',
'string');
- $user_id = $GLOBALS['phpgw_info']['user']['account_id'];
+ $location_code = phpgw::get_var('location_code',
'string');
+ $user_id =
$GLOBALS['phpgw_info']['user']['account_id'];
$bookmarks = phpgwapi_cache::user_get('controller',
"location_bookmark", $user_id);
if($bookmarks && is_array($bookmarks) &&
isset($bookmarks[$location_code]))
@@ -1036,22 +1105,20 @@
}
else
{
- if(! is_array($bookmarks))
+ if(!is_array($bookmarks))
{
$bookmarks = array();
}
- $bookmarks[$location_code] = true;
- $status = lang('added');
+ $bookmarks[$location_code] = true;
+ $status
= lang('added');
}
-
+
phpgwapi_cache::user_set('controller',
"location_bookmark", $bookmarks, $user_id);
return array
- (
+ (
'status' => $status
);
}
-
- }
-
+ }
\ No newline at end of file
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2015-04-02 00:46:05 UTC
(rev 12944)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2015-04-06 17:25:53 UTC
(rev 12945)
@@ -226,6 +226,7 @@
$type = phpgw::get_var('type');
$control_id = phpgw::get_var('control_id');
$deadline_ts = phpgw::get_var('deadline_ts');
+ $serie_id = phpgw::get_var('serie_id', 'int');
$check_list = new controller_check_list();
$check_list->set_control_id($control_id);
@@ -333,7 +334,8 @@
'current_month_nr' => $month_nr,
'building_location_code' =>
$building_location_code,
'location_level' => $level,
- 'check_list_type' => 'add_check_list'
+ 'check_list_type' => 'add_check_list',
+ 'serie_id' => $serie_id
);
$GLOBALS['phpgw']->jqcal->add_listener('planned_date');
@@ -460,7 +462,8 @@
$this->redirect(array('menuaction' =>
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
}
- $control_id = phpgw::get_var('control_id');
+ $control_id = phpgw::get_var('control_id', 'int');
+ $serie_id = phpgw::get_var('serie_id', 'int');
$status = (int) phpgw::get_var('status');
$type = phpgw::get_var('type');
$deadline_date = phpgw::get_var('deadline_date',
'string');
@@ -517,7 +520,9 @@
$check_list->set_control_id($control_id);
$location_code =
phpgw::get_var('location_code');
$check_list->set_location_code($location_code);
+ $check_list->set_serie_id($serie_id);
+
if($type == "component")
{
$location_id =
phpgw::get_var('location_id');
@@ -562,6 +567,127 @@
}
}
+ function get_files2($location_id, $data)
+ {
+ $config = CreateObject('phpgwapi.config','controller');
+ $config->read();
+ $doc_types =
isset($config->config_data['document_cat']) &&
$config->config_data['document_cat'] ? $config->config_data['document_cat'] :
array();
+ $sodocument = CreateObject('property.sodocument');
+
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($location_id);
+ $type_arr = explode('.', $loc_arr['location']);
+ if(count($type_arr) != 4)
+ {
+ return array();
+ }
+
+ $type = $type_arr[1];
+ $entity_id = $type_arr[2];
+ $cat_id = $type_arr[3];
+
+ $document_list = array();
+ foreach ($doc_types as $doc_type)
+ {
+ if($doc_type)
+ {
+ $document_list =
array_merge($document_list, $sodocument->read_at_location(array(
+ 'entity_id' =>
$entity_id,'cat_id' => $cat_id, 'id' =>$data['id'], 'doc_type' => $doc_type,
'allrows' => true)));
+ }
+ }
+
+// $valid_types =
isset($config->config_data['document_valid_types']) &&
$config->config_data['document_valid_types'] ? str_replace ( ',' , '|' ,
$config->config_data['document_valid_types'] ) : '.pdf';
+
+ $values = array();
+// if($valid_types)
+ {
+ $lang_view = lang('click to view file');
+ foreach($document_list as $entry)
+ {
+// if (
!preg_match("/({$valid_types})$/i", $entry['document_name']) )
+// {
+// continue;
+// }
+ $link_file_data = array
+ (
+ 'menuaction' =>
'property.uidocument.view_file',
+ 'id' =>
$entry['document_id'],
+ 'p_num' =>
$data['id'],
+ 'cat_id' =>
$cat_id,
+ 'entity_id' =>
$entity_id,
+ );
+
+ $values[] = array
+ (
+ 'document_id'
=> $entry['document_id'],
+ 'file_name'
=> $entry['document_name'],
+ 'file_name'
=>'<a href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data)."\"
target='_blank' title='{$lang_view}'>{$entry['document_name']}</a>",
+ 'link'
=> $entry['link'],
+ 'title'
=> $entry['title'],
+ 'doc_type'
=> $entry['doc_type'],
+ 'document_date'
=>
$GLOBALS['phpgw']->common->show_date($entry['document_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+ );
+ }
+ }
+ return $values;
+ }
+ function get_files($location_id, $data)
+ {
+ $vfs = CreateObject('phpgwapi.vfs');
+ $vfs->override_acl = 1;
+
+ $location_data = explode('-', $data['location_code']);
+ $loc1 = isset($location_data[0]) && $location_data[0] ?
$location_data[0] : 'dummy';
+
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($location_id);
+
+ $type_arr = explode('.', $loc_arr['location']);
+
+ if(count($type_arr) != 4)
+ {
+ return array();
+ }
+
+ $type = $type_arr[1];
+ $entity_id = $type_arr[2];
+ $cat_id = $type_arr[3];
+ $category_dir = "{$type}_{$entity_id}_{$cat_id}";
+
+ $files = $vfs->ls (array(
+ 'string' =>
"/property/{$category_dir}/{$loc1}/{$data['id']}",
+ 'relatives' => array(RELATIVE_NONE)));
+
+ $vfs->override_acl = 0;
+
+ $values = array();
+ foreach ($files as $file)
+ {
+ $values[] = array
+ (
+ 'name' => $file['name'],
+ 'directory' => $file['directory'],
+ 'file_id' => $file['file_id'],
+ 'mime_type' => $file['mime_type']
+ );
+ }
+
+ $link_file_data = array
+ (
+ 'menuaction' =>
'property.uientity.view_file',
+ 'loc1' => $loc1,
+ 'id' => $data['id'],
+ 'cat_id' => $cat_id,
+ 'entity_id' => $entity_id,
+ 'type' => $type
+ );
+
+ foreach($values as &$_entry )
+ {
+ $_entry['file_name'] = '<a
href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data).'&file_name='.urlencode($_entry['name']).'"
target="_blank" title="'.lang('click to view
file').'">'.$_entry['name'].'</a>';
+ }
+
+ return $values;
+ }
+
function view_control_info()
{
$check_list_id = phpgw::get_var('check_list_id');
@@ -635,9 +761,25 @@
$control = $this->so_control->get_single($control_id);
+ $check_list_id = phpgw::get_var('check_list_id','int');
+
+ $check_list = $this->so->get_single($check_list_id);
+
+ $component_id = $check_list->get_component_id();
+ $files = array();
+
+ if($component_id > 0)
+ {
+ $location_id = $check_list->get_location_id();
+ $component_arr =
execMethod('property.soentity.read_single_eav', array('location_id' =>
$location_id, 'id' => $component_id));
+ $files =
$this->get_files2($location_id,$component_arr);
+ }
+
$data = array
(
- 'control' => $control,
+ 'control' => $control,
+ 'files' => $files
+
);
self::render_template_xsl('check_list/view_control_details', $data);
Added: trunk/controller/inc/class.uicomponent.inc.php
===================================================================
--- trunk/controller/inc/class.uicomponent.inc.php
(rev 0)
+++ trunk/controller/inc/class.uicomponent.inc.php 2015-04-06 17:25:53 UTC
(rev 12945)
@@ -0,0 +1,686 @@
+<?php
+ /**
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink Holm-Larsen <address@hidden>
+ * @author Torstein Vadla <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage controller
+ * @version $Id: class.uicomponent.inc.php 12210 2014-10-21 07:41:31Z
erikhl $
+ */
+ /**
+ * Import the jQuery class
+ */
+ phpgw::import_class('phpgwapi.jquery');
+
+ phpgw::import_class('phpgwapi.uicommon');
+
+ phpgw::import_class('controller.socheck_list');
+
+ include_class('controller', 'check_list', 'inc/model/');
+ include_class('controller', 'check_item', 'inc/model/');
+ include_class('controller', 'component', 'inc/model/');
+ include_class('controller', 'check_list_status_info', 'inc/component/');
+ include_class('controller', 'status_agg_month_info', 'inc/component/');
+ include_class('controller', 'location_finder', 'inc/helper/');
+ include_class('controller', 'year_calendar', 'inc/component/');
+ include_class('controller', 'year_calendar_agg', 'inc/component/');
+ include_class('controller', 'month_calendar', 'inc/component/');
+
+
+ class controller_uicomponent extends phpgwapi_uicommon
+ {
+
+ private $so;
+ private $_category_acl;
+ private $read;
+ private $add;
+ private $edit;
+ private $delete;
+ public $public_functions = array
+ (
+ 'index'
=> true,
+ );
+
+ public function __construct()
+ {
+ parent::__construct('controller');
+
+ $this->read =
$GLOBALS['phpgw']->acl->check('.control', PHPGW_ACL_READ, 'controller');//1
+ $this->add =
$GLOBALS['phpgw']->acl->check('.control', PHPGW_ACL_ADD, 'controller');//2
+ $this->edit =
$GLOBALS['phpgw']->acl->check('.control', PHPGW_ACL_EDIT, 'controller');//4
+ $this->delete =
$GLOBALS['phpgw']->acl->check('.control', PHPGW_ACL_DELETE, 'controller');//8
+ $this->manage =
$GLOBALS['phpgw']->acl->check('.control', 16, 'controller');//16
+
+// $this->so =
CreateObject('controller.socontrol');
+
+ $config =
CreateObject('phpgwapi.config', 'controller');
+ $config->read();
+ $this->_category_acl =
isset($config->config_data['acl_at_control_area']) &&
$config->config_data['acl_at_control_area'] == 1 ? true : false;
+
+ self::set_active_menu('controller::status_components');
+ $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
+ }
+
+ /**
+ * Fetches controls and returns to datatable
+ *
+ * @param HTTP::phpgw_return_as specifies how data should be
returned
+ * @return data array
+ */
+ public function index()
+ {
+ if(phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ return $this->query();
+ }
+ phpgwapi_jquery::load_widget('core');
+
+
+ $component_type =
phpgwapi_cache::session_get('controller', 'component_type');
+ if(!$component_type)
+ {
+ $this->soadmin_entity =
CreateObject('property.soadmin_entity');
+ $entity_list =
$this->soadmin_entity->read(array('allrows' => true));
+
+ $component_type = array();
+ foreach($entity_list as $entry)
+ {
+ $categories =
$this->soadmin_entity->read_category(array('entity_id' => $entry['id'],'order'
=> 'name','sort' => 'asc','enable_controller' => true, 'allrows' => true));
+ foreach($categories as $category)
+ {
+
+
if($category['enable_controller'])
+ {
+ $component_type[] =
array
+ (
+ 'id' =>
$category['location_id'],
+ 'name'=>
"{$entry['name']}::{$category['name']}"
+ );
+ }
+ }
+ }
+ array_unshift($component_type, array('id' =>
'', 'name' => lang('select value')));
+ phpgwapi_cache::session_set('controller',
'component_type', $component_type);
+ }
+
+ $users =
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT, '.control');
+ $user_list = array();
+ foreach($users as $user)
+ {
+ $user_list[] = array
+ (
+ 'id' => $user['account_id'],
+ 'name' =>
"{$user['account_lastname']}, {$user['account_firstname']}",
+ 'selected' => $this->account ==
$user['account_id'] ? 1 : 0
+ );
+ }
+
+ // Sigurd: Start categories
+ $cats =
CreateObject('phpgwapi.categories', -1, 'controller', '.control');
+ $cats->supress_info = true;
+
+ $control_areas =
$cats->formatted_xslt_list(array('format' => 'filter', 'selected' =>
$control_area_id,
+ 'globals' => true, 'use_acl' =>
$this->_category_acl));
+ array_unshift($control_areas['cat_list'],
array('cat_id' => '', 'name' => lang('select value')));
+ $control_areas_array = array();
+ foreach($control_areas['cat_list'] as $cat_list)
+ {
+ $control_areas_array[] = array
+ (
+ 'id' => $cat_list['cat_id'],
+ 'name' => $cat_list['name'],
+ );
+ }
+ // END categories
+ // start district
+ $property_bocommon =
CreateObject('property.bocommon');
+ $district_list =
$property_bocommon->select_district_list('dummy', $this->district_id);
+ array_unshift($district_list, array('id' => '', 'name'
=> lang('no district')));
+ // end district
+
+
+ $data = array(
+ 'datatable_name' => lang('status components'),
+ 'form' => array(
+ 'action' =>
self::link(array('menuaction' => 'controller.uicomponent.index')),
+ 'method' => 'POST',
+ 'toolbar' => array(
+ 'item' => array(
+ //as categories
+ array('type' =>
'filter',
+ 'name' =>
'location_id',
+ 'text' =>
lang('component'),
+ 'list' =>
$component_type,
+ 'onchange'
=> 'update_table();'
+ ),/*
+ array('type' =>
'filter',
+ 'name' =>
'control_area',
+ 'text' =>
lang('Control_area'),
+ 'list' =>
$control_areas_array,
+ 'onchange'
=> 'update_table();'
+ ),
+ array('type' =>
'filter',
+ 'name' =>
'user_id',
+ 'text' =>
lang('User'),
+ 'list' =>
$user_list,
+ 'onchange'
=> 'update_table();'
+ ),*/
+ array('type' =>
'filter',
+ 'name' =>
'district_id',
+ 'text' =>
lang('district'),
+ 'list' =>
$district_list,
+ 'onchange'
=> 'update_table();'
+ ),/*
+ array('type' =>
'text',
+ 'text' =>
lang('searchfield'),
+ 'name' =>
'query'
+ ),
+ array(
+ 'type' =>
'button',
+ 'name' =>
'search',
+ 'value' =>
lang('Search'),
+ 'onclick'=>
'update_table();'
+ ),*/
+ ),
+ ),
+ ),
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' => 'controller.uicomponent.index',
+ 'phpgw_return_as' => 'json')),
+ 'field' => $this->get_fields(),
+ ),
+ );
+ self::render_template_xsl(array('component'), $data);
+ }
+
+ private function get_fields()
+ {
+ $fields = array
+ (
+ array(
+ 'key' => 'component_id',
+ 'label' => lang('component'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => 'year',
+ 'label' => lang('year'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => 'descr',
+ 'label' => '',
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => '1',
+ 'label' => lang('jan'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => '2',
+ 'label' => lang('feb'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => '3',
+ 'label' => lang('mar'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => '4',
+ 'label' => lang('apr'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => '5',
+ 'label' => lang('may'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => '6',
+ 'label' => lang('june'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => '7',
+ 'label' => lang('july'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => '8',
+ 'label' => lang('aug'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => '9',
+ 'label' => lang('sept'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => '10',
+ 'label' => lang('oct'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => '11',
+ 'label' => lang('nov'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' => '12',
+ 'label' => lang('dec'),
+ 'sortable' => true,
+ ),
+ );
+ return $fields;
+ }
+
+ public function query()
+ {
+ static $_location_name = array();
+ $location_id = phpgw::get_var('location_id', 'int');
+ $control_area = phpgw::get_var('control_area', 'int');
+ $user_id = phpgw::get_var('user_id', 'int');
+ $district_id = phpgw::get_var('district_id', 'int');
+ $query = phpgw::get_var('query', 'string');
+ $year = phpgw::get_var('year', 'int');
+
+ $so_control =
CreateObject('controller.socontrol');
+ $this->so =
CreateObject('controller.socheck_list');
+
+ // Validates year. If year is not set, current year is
chosen
+ $year =
execMethod('controller.uicalendar.validate_year',$year);
+
+ // Gets timestamp of first day in year
+ $from_date_ts =
execMethod('controller.uicalendar.get_start_date_year_ts',$year);
+
+ // Gets timestamp of first day in next year
+ $to_date_ts =
execMethod('controller.uicalendar.get_end_date_year_ts',$year);
+
+ $components =
execMethod('property.soentity.read',array('location_id' => $location_id,
'district_id' => $district_id, 'allrows' => true));
+ $all_components = array();
+ $components_with_calendar_array = array();
+
+ foreach($components as $_component)
+ {
+ $component_id = $_component['id'];
+ $all_components[$component_id] = $_component;
+ $controls =
execMethod('controller.socontrol.get_controls_at_component',
array('location_id' => $location_id, 'component_id' => $component_id));
+ foreach($controls as $_control)
+ {
+ $control_id
= $_control['control_id'];
+ $control
= $so_control->get_single($_control['control_id']);
+ $components_for_control_array =
$so_control->get_components_for_control($control_id, $location_id,
$component_id);
+
+ // LOCATIONS: Process aggregated values
for controls with repeat type day or week
+ if($control->get_repeat_type() <=
controller_control::REPEAT_TYPE_WEEK)
+ {
+
+ // COMPONENTS: Process
aggregated values for controls with repeat type day or week
+
foreach($components_for_control_array as $component)
+ {
+ $short_desc_arr =
execMethod('property.soentity.get_short_description', array(
+ 'location_id'
=> $component->get_location_id(), 'id' => $component->get_id()));
+
if(!isset($_location_name[$component->get_location_code()]))
+ {
+ $_location
= execMethod('property.solocation.read_single',
$component->get_location_code());
+ $location_arr
= explode('-', $component->get_location_code());
+ $i
= 1;
+ $name_arr
= array();
+
foreach($location_arr as $_dummy)
+ {
+
$name_arr[] = $_location["loc{$i}_name"];
+ $i++;
+ }
+
+
$_location_name[$component->get_location_code()] = implode('::', $name_arr);
+ }
+
+ $short_desc_arr .= ' ['
. $_location_name[$component->get_location_code()] . ']';
+
+
$component->set_xml_short_desc($short_desc_arr);
+
+ $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);
+
+ $cl_criteria = new
controller_check_list();
+
$cl_criteria->set_control_id($control->get_id());
+
$cl_criteria->set_component_id($component->get_id());
+
$cl_criteria->set_location_id($component->get_location_id());
+
+ $from_month =
$this->get_start_month_for_control($control);
+ $to_month =
$this->get_end_month_for_control($control);
+
+ // Loops through
controls in controls_for_location_array and populates aggregate open cases pr
month array.
+
$agg_open_cases_pr_month_array =
$this->build_agg_open_cases_pr_month_array($cl_criteria, $year, $from_month,
$to_month);
+
+ $year_calendar_agg
= new year_calendar_agg($control, $year,
$location_code, "VIEW_LOCATIONS_FOR_CONTROL");
+ $calendar_array
=
$year_calendar_agg->build_calendar($agg_open_cases_pr_month_array);
+
$components_with_calendar_array[$component_id][] = array("component" =>
$component->toArray(),
+
"calendar_array" => $calendar_array);
+ }
+ }
+ // Process values for controls with
repeat type month or year
+ else if($control->get_repeat_type() >
controller_control::REPEAT_TYPE_WEEK)
+ {
+
foreach($components_for_control_array as $component)
+ {
+ $short_desc_arr =
execMethod('property.soentity.get_short_description', array(
+ 'location_id'
=> $component->get_location_id(), 'id' => $component->get_id()));
+
+ //FIXME - make generic
+
+ /* => */
+
if(!isset($_location_name[$component->get_location_code()]))
+ {
+ $_location
= execMethod('property.solocation.read_single',
$component->get_location_code());
+ $location_arr
= explode('-', $component->get_location_code());
+ $i
= 1;
+ $name_arr
= array();
+
foreach($location_arr as $_dummy)
+ {
+
$name_arr[] = $_location["loc{$i}_name"];
+ $i++;
+ }
+
+
$_location_name[$component->get_location_code()] = implode('::', $name_arr);
+ }
+
+ $short_desc_arr .= ' ['
. $_location_name[$component->get_location_code()] . ']';
+ /* <= */
+
+
$component->set_xml_short_desc($short_desc_arr);
+
+ $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);
+
+ $check_lists_array =
$component_with_check_lists["check_lists_array"];
+
+ /*
+ * start override
control with data from serie
+ */
+ $control_relation =
$component->get_control_relation();
+
if(isset($control_relation['start_date']) && $control_relation['start_date'])
+ {
+
$control->set_start_date($control_relation['start_date']);
+ }
+
+
if(isset($control_relation['end_date']) && $control_relation['end_date'])
+ {
+
$control->set_end_date($control_relation['end_date']);
+ }
+
if(isset($control_relation['repeat_type']) && $control_relation['repeat_type'])
+ {
+
$control->set_repeat_type($control_relation['repeat_type']);
+ }
+
if(isset($control_relation['repeat_interval']) &&
$control_relation['repeat_interval'])
+ {
+
$control->set_repeat_interval($control_relation['repeat_interval']);
+ }
+
+ /*
+ * End override control
with data from serie
+ */
+
+ $year_calendar = new
year_calendar($control, $year, $component, null, "component",
$control_relation);
+ $calendar_array =
$year_calendar->build_calendar($check_lists_array);
+
+
$components_with_calendar_array[$component_id][] = array("component" =>
$component->toArray(),
+
"calendar_array" => $calendar_array);
+ }
+ }
+
+
+
+ }
+ }
+ unset($component_id);
+ _debug_array($components_with_calendar_array[1]);
+// _debug_array($components);
+//
_debug_array(array_keys($components_with_calendar_array));
+ $repeat_type_array = array
+ (
+ "0"=> lang('day'),
+ "1"=> lang('week'),
+ "2"=> lang('month'),
+ "3"=> lang('year')
+ );
+
+ $values = array();
+ foreach($components_with_calendar_array as
$component_id => $entry)
+ {
+ unset($all_components[$component_id]);
+ $data = array();
+
+ $component_link_data = array
+ (
+ 'menuaction' =>
'property.uientity.edit',
+ 'location_id' => $location_id,
+ 'id' =>
$component_id,
+ 'active_tab' => 'controller'
+ );
+
+ $data['component_id'] = '<a
href="'.$GLOBALS['phpgw']->link('/index.php',$component_link_data)."\"
target='_blank'>{$component_id}{$entry[0]['component']['xml_short_desc']}</a>";
+
+ $max_repeat_type = 0;
+ $_data = array();
+ foreach($entry as $dataset)
+ {
+ $repeat_type =
(int)$dataset['component']['control_relation']['repeat_type'];
+ if($repeat_type > $max_repeat_type)
+ {
+ $max_repeat_type = $repeat_type;
+ }
+ foreach($dataset['calendar_array'] as
$month => $calendar)
+ {
+ if($calendar)
+ {
+
$_data[$month][$repeat_type] = $calendar;
+ }
+ }
+ }
+ for ( $_month=1; $_month < 13; $_month++ )
+ {
+
+ for ( $i = $max_repeat_type; $i > -1;
$i-- )
+ {
+ if(isset($_data[$_month][$i]))
+ {
+ $data[$_month] =
$_data[$_month][$i];
+
$data[$_month]['repeat_type'] = $repeat_type_array[$i];
+ break 1;
+ }
+ else
+ {
+ $data[$_month] =
array();
+ }
+ }
+ }
+
+ $values[] = $data;
+ }
+ unset( $entry);
+ unset($component_id);
+ unset($component);
+
+ if($all_components && count($all_components))
+ {
+ foreach($all_components as $component_id =>
$component)
+ {
+ $data = array();
+
+ $component_link_data = array
+ (
+ 'menuaction' =>
'property.uientity.edit',
+ 'location_id' => $location_id,
+ 'id' =>
$component_id,
+ 'active_tab' => 'controller'
+ );
+
+
+ ///////
+ $short_desc_arr =
execMethod('property.soentity.get_short_description', array(
+ 'location_id' => $location_id,
'id' => $component['id']));
+
+
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}{$short_desc_arr}</a>";
+ $data['missing_control'] = true;
+ $values[] = $data;
+
+ }
+ }
+//_debug_array($values);
+ $data_set = array();
+ foreach ($values as $entry)
+ {
+ $row['component_id'] = $entry['component_id'];
+ $row['year'] = '';
+ $row['descr'] = '';
+
+ if(!isset($entry['missing_control']))
+ {
+ $row['year'] = $year;
+ $row['descr'] =
"Frekvens<br/>Status<br/>Ansvarlig<br/>Utførende<br/>service tid<br/>kontroll
tid";
+ }
+
+ for ( $_month=1; $_month < 13; $_month++ )
+ {
+ $row[$_month] =
$this->translate_calendar_info($entry[$_month],$year, $_month);
+ }
+
+ $data_set[] = $row;
+ }
+ $fields = $this->get_fields();
+
+ $tbody = '';
+ foreach($data_set as $row_data )
+ {
+ $tbody .= '<tr>';
+ foreach($fields as $field )
+ {
+ $tbody .= '<td>';
+ $tbody .= $row_data[$field['key']];
+ $tbody .= '</td>';
+ }
+ $tbody .= '</tr>';
+ }
+
+ $result = array
+ (
+ 'tbody' => $tbody
+ );
+ return $result;
+ }
+
+ private function translate_calendar_info($param = array(),
$year, $month)
+ {
+ if(!isset($param['repeat_type']))
+ {
+ return '';
+ }
+ switch($param['status'])
+ {
+ case "CONTROL_NOT_DONE":
+ $status = 'Ikke utført';
+ break;
+ case "CONTROL_REGISTERED":
+ $status = 'Registrert';
+ break;
+ case "CONTROL_PLANNED":
+ $status = 'Planlagt';
+ break;
+ case "CONTROL_NOT_DONE_WITH_PLANNED_DATE":
+ $status = 'Forsinket, Ikke utført';
+ break;
+ case "CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS":
+ $status = 'Senere enn planagt';
+ break;
+ case "CONTROL_DONE_IN_TIME_WITHOUT_ERRORS":
+ $status = 'Utført uten avvik';
+ break;
+ case "CONTROL_DONE_WITH_ERRORS":
+ $status = "Utført med
{$param['info']['num_open_cases']} åpne avvik";
+ break;
+ case "CONTROL_CANCELED":
+ $status = 'Kansellert';
+ break;
+ default:
+ $status = '';
+ break;
+ }
+ if($param['info']['check_list_id'])
+ {
+ $control_link_data = array
+ (
+ 'menuaction' =>
'controller.uicheck_list.edit_check_list',
+ 'check_list_id' =>
$param['info']['check_list_id'],
+ );
+ }
+ 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
+ );
+ }
+ $repeat_type = '<a
href="'.$GLOBALS['phpgw']->link('/index.php',$control_link_data).'"
target="_blank">'. $param['repeat_type'].'</a>';
+
+ // $repeat_type = $param['repeat_type'];
+ $responsible = '---';
+ $assigned_to = $param['info']['assigned_to'] > 0 ?
$GLOBALS['phpgw']->accounts->id2name($param['info']['assigned_to']) : ' ';
+ $service_time = $param['info']['service_time'] ?
$param['info']['service_time'] : ' ';
+ $controle_time = $param['info']['controle_time'] ?
$param['info']['controle_time'] : ' ';
+
+ return
"{$repeat_type}<br/>{$status}<br/>{$responsible}<br/>{$assigned_to}<br/>{$service_time}<br/>{$controle_time}";
+ }
+ }
\ No newline at end of file
Modified: trunk/controller/inc/component/class.check_list_status_info.inc.php
===================================================================
--- trunk/controller/inc/component/class.check_list_status_info.inc.php
2015-04-02 00:46:05 UTC (rev 12944)
+++ trunk/controller/inc/component/class.check_list_status_info.inc.php
2015-04-06 17:25:53 UTC (rev 12945)
@@ -1,35 +1,36 @@
<?php
+
/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink Holm-Larsen <address@hidden>
+ * @author Torstein Vadla <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage controller
+ * @version $Id$
+ */
+ class check_list_status_info
+ {
- class check_list_status_info
- {
private $check_list_id;
private $control_id;
private $status;
@@ -42,109 +43,182 @@
private $location_id;
private $type;
private $num_open_cases;
+ private $serie_id;
+ private $assigned_to;
+ private $billable_hours;
+
+
+ public function __construct()
+ {
- public function __construct(){}
-
+ }
+
public function set_check_list_id($check_list_id)
{
$this->check_list_id = $check_list_id;
}
-
- public function get_check_list_id() { return
$this->check_list_id; }
-
+
+ public function get_check_list_id()
+ {
+ return $this->check_list_id;
+ }
+
public function set_control_id($control_id)
{
$this->control_id = $control_id;
}
-
- public function get_control_id() { return $this->control_id; }
-
+
+ public function get_control_id()
+ { return $this->control_id;}
+
public function set_status($status)
{
$this->status = $status;
}
-
- public function get_status() { return $this->status; }
-
+
+ public function get_status()
+ {
+ return $this->status;
+ }
+
public function set_status_text($status_text)
{
$this->status_text = $status_text;
}
-
- public function get_status_text() { return $this->status_text; }
-
+
+ public function get_status_text()
+ {
+ return $this->status_text;
+ }
+
public function set_deadline_date_ts($deadline_date_ts)
{
$this->deadline_date_ts = $deadline_date_ts;
}
-
- public function get_deadline_date_ts() { return
$this->deadline_date_ts; }
+ public function get_deadline_date_ts()
+ {
+ return $this->deadline_date_ts;
+ }
+
public function set_deadline_date_txt($deadline_date_txt)
{
$this->deadline_date_txt = $deadline_date_txt;
}
-
- public function get_deadline_date_txt() { return
$this->deadline_date_txt; }
-
+
+ public function get_deadline_date_txt()
+ {
+ return $this->deadline_date_txt;
+ }
+
public function set_info_text($info_text)
{
$this->info_text = $info_text;
}
-
- public function get_info_text() { return $this->info_text; }
-
+
+ public function get_info_text()
+ {
+ return $this->info_text;
+ }
+
public function set_location_code($location_code)
{
$this->location_code = $location_code;
}
-
- public function get_location_code() { return
$this->location_code; }
-
+
+ public function get_location_code()
+ {
+ return $this->location_code;
+ }
+
public function set_location_id($location_id)
{
$this->location_id = $location_id;
}
-
- public function get_location_id() { return $this->location_id; }
-
+
+ public function get_location_id()
+ {
+ return $this->location_id;
+ }
+
public function set_component_id($component_id)
{
$this->component_id = $component_id;
}
-
- public function get_component_id() { return
$this->component_id; }
-
- public function get_type() { return $this->type; }
-
+
+ public function get_component_id()
+ {
+ return $this->component_id;
+ }
+
+ public function get_type()
+ {
+ return $this->type;
+ }
+
public function set_type($type)
{
$this->type = $type;
}
-
+
public function set_num_open_cases($num_open_cases)
{
$this->num_open_cases = $num_open_cases;
}
-
- public function get_num_open_cases() { return
$this->num_open_cases; }
-
-
+
+ public function get_num_open_cases()
+ {
+ return $this->num_open_cases;
+ }
+
+ public function set_assigned_to($assigned_to)
+ {
+ $this->assigned_to = $assigned_to;
+ }
+
+ public function get_assigned_to()
+ {
+ return $this->assigned_to;
+ }
+
+ public function set_billable_hours($billable_hours)
+ {
+ $this->billable_hours = $billable_hours;
+ }
+
+ public function get_billable_hours()
+ {
+ return $this->billable_hours;
+ }
+
+ public function set_serie_id($serie_id)
+ {
+ $this->serie_id = $serie_id;
+ }
+
+ public function get_serie_id()
+ {
+ return $this->serie_id;
+ }
+
public function serialize()
{
return array(
- 'check_list_id' => $this->get_check_list_id(),
- 'control_id' => $this->get_control_id(),
- 'status' => $this->get_status(),
- 'status_text' => $this->get_status_text(),
- 'deadline_date_ts' =>
$this->get_deadline_date_ts(),
- 'deadline_date_txt' =>
$this->get_deadline_date_txt(),
- 'info_text' => $this->get_info_text(),
- 'location_code' => $this->get_location_code(),
- 'location_id' => $this->get_location_id(),
- 'component_id' => $this->get_component_id(),
- 'type' => $this->get_type(),
- 'num_open_cases' => $this->get_num_open_cases()
+ 'check_list_id' =>
$this->get_check_list_id(),
+ 'control_id' =>
$this->get_control_id(),
+ 'status' =>
$this->get_status(),
+ 'status_text' =>
$this->get_status_text(),
+ 'deadline_date_ts' =>
$this->get_deadline_date_ts(),
+ 'deadline_date_txt' =>
$this->get_deadline_date_txt(),
+ 'info_text' =>
$this->get_info_text(),
+ 'location_code' =>
$this->get_location_code(),
+ 'location_id' =>
$this->get_location_id(),
+ 'component_id' =>
$this->get_component_id(),
+ 'type' =>
$this->get_type(),
+ 'num_open_cases' =>
$this->get_num_open_cases(),
+ 'assigned_to' =>
$this->get_assigned_to(),
+ 'billable_hours' =>
$this->get_billable_hours(),
+ 'serie_id' =>
$this->get_serie_id()
);
}
- }
+ }
\ No newline at end of file
Modified: trunk/controller/inc/component/class.check_list_status_manager.inc.php
===================================================================
--- trunk/controller/inc/component/class.check_list_status_manager.inc.php
2015-04-02 00:46:05 UTC (rev 12944)
+++ trunk/controller/inc/component/class.check_list_status_manager.inc.php
2015-04-06 17:25:53 UTC (rev 12945)
@@ -1,112 +1,129 @@
<?php
/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-
+ * phpGroupWare - controller: a part of a Facilities Management System.
+ *
+ * @author Erink Holm-Larsen <address@hidden>
+ * @author Torstein Vadla <address@hidden>
+ * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/
+ * @package property
+ * @subpackage controller
+ * @version $Id$
+ */
include_class('controller', 'check_list_status_info', 'inc/component/');
class check_list_status_manager
- {
+ {
+
private $check_list;
private $type;
-
- public function __construct($check_list, $type) {
- $this->check_list = $check_list;
- $this->type = $type;
+
+ public function __construct($check_list, $type)
+ {
+ $this->check_list = $check_list;
+ $this->type = $type;
}
-
- function get_status_for_check_list() {
+
+ function get_status_for_check_list()
+ {
$check_list_status_info = new check_list_status_info();
-
+
$todays_date_ts = $this->get_todays_date_ts();
-
- if( $this->check_list->get_id() == 0){
-
- if($this->check_list->get_deadline() <
$todays_date_ts){
- $status = "CONTROL_NOT_DONE";
- }else{
- $status = "CONTROL_REGISTERED";
- }
- }else {
+
+ if($this->check_list->get_id() == 0)
+ {
+
+ if($this->check_list->get_deadline() <
$todays_date_ts)
+ {
+ $status = "CONTROL_NOT_DONE";
+ }
+ else
+ {
+ $status = "CONTROL_REGISTERED";
+ }
+ }
+ else
+ {
if($this->check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date()
> 0 & $this->check_list->get_deadline() >= $todays_date_ts)
{
$status = "CONTROL_PLANNED";
}
- else if( $this->check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_deadline() >=
$todays_date_ts )
+ else if($this->check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_deadline() >=
$todays_date_ts)
{
$status = "CONTROL_REGISTERED";
}
- else if( $this->check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date()
> 0 & $this->check_list->get_deadline() < $todays_date_ts )
+ else if($this->check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date()
> 0 & $this->check_list->get_deadline() < $todays_date_ts)
{
$status =
"CONTROL_NOT_DONE_WITH_PLANNED_DATE";
}
- else if( $this->check_list->get_status() ==
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() >
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() ==
0)
+ else if($this->check_list->get_status() ==
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() >
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() ==
0)
{
$status =
"CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS";
}
- else if( $this->check_list->get_status() ==
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() <
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() ==
0)
+ else if($this->check_list->get_status() ==
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() <
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() ==
0)
{
$status =
"CONTROL_DONE_IN_TIME_WITHOUT_ERRORS";
}
- else if( $this->check_list->get_status() ==
controller_check_list::STATUS_DONE & $this->check_list->get_num_open_cases() >
0){
+ else if($this->check_list->get_status() ==
controller_check_list::STATUS_DONE & $this->check_list->get_num_open_cases() >
0)
+ {
$status = "CONTROL_DONE_WITH_ERRORS";
-
+
$check_list_status_info->set_num_open_cases($this->check_list->get_num_open_cases());
}
- else if( $this->check_list->get_status() ==
controller_check_list::STATUS_CANCELED)
+ else if($this->check_list->get_status() ==
controller_check_list::STATUS_CANCELED)
{
$status = "CONTROL_CANCELED";
}
-
- $check_list_status_info->set_check_list_id(
$this->check_list->get_id() );
+
+
$check_list_status_info->set_check_list_id($this->check_list->get_id());
}
-
+
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
- $check_list_status_info->set_control_id(
$this->check_list->get_control_id() );
- $check_list_status_info->set_deadline_date_txt(
date($dateformat, $this->check_list->get_deadline()) );
- $check_list_status_info->set_deadline_date_ts(
$this->check_list->get_deadline() );
- $check_list_status_info->set_type( $this->type );
-
- if($this->type == "component"){
- $check_list_status_info->set_component_id(
$this->check_list->get_component_id() );
- $check_list_status_info->set_location_id(
$this->check_list->get_location_id() );
- }else {
- $check_list_status_info->set_location_code(
$this->check_list->get_location_code() );
+
$check_list_status_info->set_control_id($this->check_list->get_control_id());
+
$check_list_status_info->set_deadline_date_txt(date($dateformat,
$this->check_list->get_deadline()));
+
$check_list_status_info->set_deadline_date_ts($this->check_list->get_deadline());
+ $check_list_status_info->set_type($this->type);
+
+
$check_list_status_info->set_assigned_to($this->check_list->get_assigned_to());
+
$check_list_status_info->set_billable_hours($this->check_list->get_billable_hours());
+
$check_list_status_info->set_serie_id($this->check_list->get_serie_id());
+
+ if($this->type == "component")
+ {
+
$check_list_status_info->set_component_id($this->check_list->get_component_id());
+
$check_list_status_info->set_location_id($this->check_list->get_location_id());
}
-
+ else
+ {
+
$check_list_status_info->set_location_code($this->check_list->get_location_code());
+ }
+
$check_list_status_info->set_status($status);
-
- return $check_list_status_info;
+
+ return $check_list_status_info;
}
-
- public static function get_todays_date_ts(){
- $todays_date_ts = mktime(0,0,0,date("m"), date("d"),
date("Y"));
-
- return $todays_date_ts;
- }
- }
+
+ public static function get_todays_date_ts()
+ {
+ $todays_date_ts = mktime(0, 0, 0, date("m"), date("d"),
date("Y"));
+
+ return $todays_date_ts;
+ }
+ }
\ No newline at end of file
Modified: trunk/controller/inc/component/class.month_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.month_calendar.inc.php 2015-04-02
00:46:05 UTC (rev 12944)
+++ trunk/controller/inc/component/class.month_calendar.inc.php 2015-04-06
17:25:53 UTC (rev 12945)
@@ -1,123 +1,129 @@
<?php
-phpgw::import_class('controller.socheck_list');
-include_class('controller', 'date_generator', 'inc/component/');
-include_class('controller', 'check_list_status_info', 'inc/component/');
-include_class('controller', 'check_list_status_manager', 'inc/component/');
-
-/* This class transforms controls with checklists or controls with aggregated
number of open cases,
-* and puts these values in a calendar array for each control
-*/
+ phpgw::import_class('controller.socheck_list');
+ include_class('controller', 'date_generator', 'inc/component/');
+ include_class('controller', 'check_list_status_info', 'inc/component/');
+ include_class('controller', 'check_list_status_manager',
'inc/component/');
-class month_calendar {
- private $year;
- private $month;
- private $control;
- private $type;
- private $component;
- private $location_code;
- private $calendar_array = array();
-
- public function __construct($control, $year, $month, $component,
$location_code, $type){
- $this->control = $control;
- $this->year = $year;
- $this->month = $month;
- $this->component = $component;
- $this->location_code = $location_code;
- $this->type = $type;
-
- $this->init_calendar();
- }
-
- /* Initializes calendar by setting status for each month in calendar array.
- * - CONTROL_NOT_DONE if month date is in the past
- * - CONTROL_REGISTERED if month date is in the future */
- function init_calendar(){
- $ctr_start_date_ts = $this->control->get_start_date();
- $ctr_end_date_ts = $this->control->get_end_date();
- $period_start_date_ts = $this->get_start_date_month_ts($this->year,
$this->month);
- $period_end_date_ts = $this->get_next_start_date_month_ts($this->year,
$this->month);
- $repeat_type = $this->control->get_repeat_type();
- $repeat_interval = $this->control->get_repeat_interval();
+ /* This class transforms controls with checklists or controls with
aggregated number of open cases,
+ * and puts these values in a calendar array for each control
+ */
- $num_days_in_month = cal_days_in_month(CAL_GREGORIAN,
$this->month, $this->year);
-
- for($i=1;$i<=$num_days_in_month;$i++)
+ class month_calendar
+ {
+
+ private $year;
+ private $month;
+ private $control;
+ private $type;
+ private $component;
+ private $location_code;
+ private $calendar_array = array();
+
+ public function __construct($control, $year, $month,
$component, $location_code, $type)
{
- $this->calendar_array[$i] = null;
+ $this->control = $control;
+ $this->year = $year;
+ $this->month = $month;
+ $this->component = $component;
+ $this->location_code = $location_code;
+ $this->type = $type;
+
+ $this->init_calendar();
}
-
- $date_generator = new date_generator($ctr_start_date_ts,
$ctr_end_date_ts, $period_start_date_ts, $period_end_date_ts, $repeat_type,
$repeat_interval);
- $dates_array = $date_generator->get_dates();
-
- // Set status for control on each date to NOT DONE or REGISTERED
- foreach($dates_array as $date_ts)
+ /* Initializes calendar by setting status for each month in
calendar array.
+ * - CONTROL_NOT_DONE if month date is in the past
+ * - CONTROL_REGISTERED if month date is in the future */
+
+ function init_calendar()
{
- $check_list = new controller_check_list();
- $check_list->set_deadline( $date_ts );
- $check_list->set_control_id( $this->control->get_id() );
-
- if($this->type == "component")
- {
- $check_list->set_component_id( $this->component->get_id() );
- $check_list->set_location_id(
$this->component->get_location_id() );
- $check_list_status_manager = new check_list_status_manager(
$check_list, "component" );
- }
- else
- {
- $check_list->set_location_code( $this->location_code );
- $check_list_status_manager = new check_list_status_manager(
$check_list, "location" );
- }
-
- $check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
-
- $this->calendar_array[ date("j", $date_ts) ]["status"] =
$check_list_status_info->get_status();
- $this->calendar_array[ date("j", $date_ts) ]["info"] =
$check_list_status_info->serialize();
+ $ctr_start_date_ts =
$this->control->get_start_date();
+ $ctr_end_date_ts =
$this->control->get_end_date();
+ $period_start_date_ts =
$this->get_start_date_month_ts($this->year, $this->month);
+ $period_end_date_ts =
$this->get_next_start_date_month_ts($this->year, $this->month);
+ $repeat_type =
$this->control->get_repeat_type();
+ $repeat_interval =
$this->control->get_repeat_interval();
+
+ $num_days_in_month = cal_days_in_month(CAL_GREGORIAN,
$this->month, $this->year);
+
+ for($i = 1; $i <= $num_days_in_month; $i++)
+ {
+ $this->calendar_array[$i] = null;
+ }
+
+ $date_generator = new
date_generator($ctr_start_date_ts, $ctr_end_date_ts, $period_start_date_ts,
$period_end_date_ts, $repeat_type, $repeat_interval);
+ $dates_array = $date_generator->get_dates();
+
+ // Set status for control on each date to NOT DONE or
REGISTERED
+ foreach($dates_array as $date_ts)
+ {
+ $check_list = new controller_check_list();
+ $check_list->set_deadline($date_ts);
+
$check_list->set_control_id($this->control->get_id());
+
+ if($this->type == "component")
+ {
+
$check_list->set_component_id($this->component->get_id());
+
$check_list->set_location_id($this->component->get_location_id());
+ $check_list_status_manager = new
check_list_status_manager($check_list, "component");
+ }
+ else
+ {
+
$check_list->set_location_code($this->location_code);
+ $check_list_status_manager = new
check_list_status_manager($check_list, "location");
+ }
+
+ $check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
+
+ $this->calendar_array[date("j",
$date_ts)]["status"] = $check_list_status_info->get_status();
+ $this->calendar_array[date("j",
$date_ts)]["info"] = $check_list_status_info->serialize();
+ }
}
- }
-
- public function build_calendar( $check_lists_array )
- {
- foreach($check_lists_array as $check_list){
- $check_list_status_manager = new
check_list_status_manager( $check_list );
- $check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
-
- $this->calendar_array[ date("j",
$check_list->get_deadline()) ]["status"] =
$check_list_status_info->get_status();
- $this->calendar_array[ date("j",
$check_list->get_deadline()) ]["info"] = $check_list_status_info->serialize();
+
+ public function build_calendar($check_lists_array)
+ {
+ foreach($check_lists_array as $check_list)
+ {
+ $check_list_status_manager = new
check_list_status_manager($check_list);
+ $check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
+
+ $this->calendar_array[date("j",
$check_list->get_deadline())]["status"] =
$check_list_status_info->get_status();
+ $this->calendar_array[date("j",
$check_list->get_deadline())]["info"] =
$check_list_status_info->serialize();
+ }
+
+ return $this->calendar_array;
}
-
- return $this->calendar_array;
- }
-
- public static function get_heading_array($year, $month)
- {
- $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $month,
$year);
- $heading_array = array();
-
- for($i=1;$i<=$num_days_in_month;$i++)
+
+ public static function get_heading_array($year, $month)
{
- $heading_array[$i] = "$i";
+ $num_days_in_month =
cal_days_in_month(CAL_GREGORIAN, $month, $year);
+ $heading_array = array();
+
+ for($i = 1; $i <= $num_days_in_month; $i++)
+ {
+ $heading_array[$i] = "$i";
+ }
+
+ return $heading_array;
}
-
- return $heading_array;
- }
-
- public static function get_start_date_month_ts($year, $month){
- return strtotime("$month/01/$year");
- }
-
- public static function get_next_start_date_month_ts($year, $month)
- {
- if(($month + 1) > 12)
+
+ public static function get_start_date_month_ts($year, $month)
{
- $to_month = 1;
- $to_year = $year + 1;
+ return strtotime("$month/01/$year");
}
- else
+
+ public static function get_next_start_date_month_ts($year,
$month)
{
- $to_month = $month + 1;
- $to_year = $year;
+ if(($month + 1) > 12)
+ {
+ $to_month = 1;
+ $to_year = $year + 1;
+ }
+ else
+ {
+ $to_month = $month + 1;
+ $to_year = $year;
+ }
+
+ return strtotime("$to_month/01/$to_year");
}
-
- return strtotime("$to_month/01/$to_year");
- }
-}
\ No newline at end of file
+ }
\ No newline at end of file
Modified: trunk/controller/inc/component/class.year_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar.inc.php 2015-04-02
00:46:05 UTC (rev 12944)
+++ trunk/controller/inc/component/class.year_calendar.inc.php 2015-04-06
17:25:53 UTC (rev 12945)
@@ -14,14 +14,16 @@
private $component;
private $location_code;
private $calendar_array = array();
+ private $control_relation = array();
- public function __construct($control, $year, $component, $location_code,
$type)
+ public function __construct($control, $year, $component, $location_code,
$type, $control_relation)
{
$this->year = $year;
$this->control = $control;
$this->component = $component;
$this->location_code = $location_code;
$this->type = $type;
+ $this->control_relation = $control_relation;
$this->init_calendar();
}
@@ -73,6 +75,12 @@
$this->calendar_array[ $month_nr ]["status"] =
$check_list_status_info->get_status();
$this->calendar_array[ $month_nr ]["info"] =
$check_list_status_info->serialize();
+ if(! $this->calendar_array[ $month_nr ]["info"]['serie_id'])
+ {
+ $this->calendar_array[ $month_nr
]["info"]['serie_id'] = $this->control_relation['serie_id'];
+ }
+ $this->calendar_array[ $month_nr ]["info"]['service_time'] =
$this->control_relation['service_time'];
+ $this->calendar_array[ $month_nr ]["info"]['controle_time'] =
$this->control_relation['controle_time'];
}
}
Added: trunk/controller/inc/hook_config.inc.php
===================================================================
--- trunk/controller/inc/hook_config.inc.php (rev 0)
+++ trunk/controller/inc/hook_config.inc.php 2015-04-06 17:25:53 UTC (rev
12945)
@@ -0,0 +1,55 @@
+<?php
+ /**
+ * Frontend - configuration hook
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2015 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @package phpgroupware
+ * @subpackage Frontend
+ * @category hooks
+ * @version $Id: hook_config.inc.php 11377 2013-10-18 08:25:54Z sigurdne
$
+ */
+
+ /*
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+ /**
+ * Get HTML checkbox with categories that are candidates for frontend
documents cat
+ *
+ * @param $config
+ * @return string options for selectbox
+ */
+ function document_cat($config)
+ {
+ $cats = CreateObject('phpgwapi.categories', -1, 'property',
'.document');
+ $cats->supress_info = true;
+ $values = $cats->return_sorted_array(0, false, '', '', '',
$globals = true, '', $use_acl = false);
+ $tts_frontend_cat_selected = isset($config['document_cat']) ?
$config['document_cat'] : array();
+ $out = '';
+ foreach ( $values as $entry)
+ {
+ $checked = '';
+ if ( in_array($entry['id'], $tts_frontend_cat_selected))
+ {
+ $checked = ' checked';
+ }
+ $out .= <<<HTML
+ <tr><td><input type="checkbox"
name="newsettings[document_cat][]" value="{$entry['id']}"
{$checked}><label>{$entry['name']}</label></td></tr>
+HTML;
+ }
+ return $out;
+ }
\ No newline at end of file
Modified: trunk/controller/inc/model/class.check_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_list.inc.php 2015-04-02 00:46:05 UTC
(rev 12944)
+++ trunk/controller/inc/model/class.check_list.inc.php 2015-04-06 17:25:53 UTC
(rev 12945)
@@ -42,6 +42,7 @@
protected $title;//
protected $description;//
protected $control_id;
+ protected $serie_id;
protected $status;
protected $comment;
protected $deadline;
@@ -192,9 +193,19 @@
{
$this->location_id = $location_id;
}
-
+
public function get_location_id() { return $this->location_id; }
+ public function set_serie_id($serie_id)
+ {
+ $this->serie_id = $serie_id;
+ }
+
+ public function get_serie_id()
+ {
+ return $this->serie_id;
+ }
+
public function get_num_open_cases() { return
$this->num_open_cases; }
public function set_num_open_cases($num_open_cases)
@@ -273,7 +284,8 @@
'location_id' =>
$this->get_location_id(),
'num_open_cases' =>
$this->get_num_open_cases(),
'assigned_to' =>
$this->get_assigned_to(),
- 'billable_hours' =>
$this->get_billable_hours()
+ 'billable_hours' =>
$this->get_billable_hours(),
+ 'serie_id' =>
$this->get_serie_id()
);
}
Modified: trunk/controller/inc/model/class.component.inc.php
===================================================================
--- trunk/controller/inc/model/class.component.inc.php 2015-04-02 00:46:05 UTC
(rev 12944)
+++ trunk/controller/inc/model/class.component.inc.php 2015-04-06 17:25:53 UTC
(rev 12945)
@@ -45,6 +45,7 @@
protected $loc_1;
protected $address;
+ protected $control_relation = array();
// Objects
protected $controls_array = array();
@@ -129,8 +130,18 @@
{
$this->controls_array = $controls_array;
}
-
+
public function get_controls_array() { return
$this->controls_array; }
+
+ public function set_control_relation($control_relation)
+ {
+ $this->control_relation = $control_relation;
+ }
+
+ public function get_control_relation()
+ {
+ return $this->control_relation;
+ }
public function serialize()
{
@@ -141,7 +152,8 @@
'xml' => $this->get_xml(),
'location_code' => $this->get_location_code(),
'loc_1' => $this->get_loc_1(),
- 'address' => $this->get_address()
+ 'address' => $this->get_address(),
+ 'control_relation' =>
$this->get_control_relation(),
);
}
}
Modified: trunk/controller/setup/phpgw_no.lang
===================================================================
--- trunk/controller/setup/phpgw_no.lang 2015-04-02 00:46:05 UTC (rev
12944)
+++ trunk/controller/setup/phpgw_no.lang 2015-04-06 17:25:53 UTC (rev
12945)
@@ -372,4 +372,5 @@
Show message controller no Vis melding
Status not done controller no Status: Ikke utført
Status done controller no Status: Utført
-planned date common no Planlagt Dato
\ No newline at end of file
+planned date common no Planlagt Dato
+status components controller no Status komponenter
\ No newline at end of file
Modified: trunk/controller/setup/setup.inc.php
===================================================================
--- trunk/controller/setup/setup.inc.php 2015-04-02 00:46:05 UTC (rev
12944)
+++ trunk/controller/setup/setup.inc.php 2015-04-06 17:25:53 UTC (rev
12945)
@@ -1,6 +1,6 @@
<?php
$setup_info['controller']['name'] = 'controller';
- $setup_info['controller']['version'] = '0.1.50';
+ $setup_info['controller']['version'] = '0.1.51';
$setup_info['controller']['app_order'] = 100;
$setup_info['controller']['enable'] = 1;
$setup_info['controller']['app_group'] = 'office';
Modified: trunk/controller/setup/tables_current.inc.php
===================================================================
--- trunk/controller/setup/tables_current.inc.php 2015-04-02 00:46:05 UTC
(rev 12944)
+++ trunk/controller/setup/tables_current.inc.php 2015-04-06 17:25:53 UTC
(rev 12945)
@@ -70,6 +70,7 @@
'planned_date' => array('type' => 'int',
'precision' => 8, 'nullable' => True),
'completed_date' => array('type' => 'int',
'precision' => 8, 'nullable' => True),
'component_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
+ 'serie_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
'location_code' => array('type' => 'varchar',
'precision' => 30, 'nullable' => True),
'location_id' => array('type' => 'int',
'precision' => 4, 'nullable' => true),
'num_open_cases' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
@@ -147,12 +148,25 @@
'control_id' => array('type'
=> 'int', 'precision' => '4', 'nullable' => false),
'location_id' => array('type'
=> 'int', 'precision' => '4', 'nullable' => false),
'component_id' => array('type'
=> 'int', 'precision' => '4', 'nullable' => false),
- 'assigned_to' => array('type'
=> 'int', 'precision' => '4', 'nullable' => true),
- 'start_date' => array('type'
=> 'int', 'precision' => '', 'nullable' => true),
- 'repeat_type' => array('type'
=> 'int', 'precision' => '2', 'nullable' => true),
+ 'enabled' =>
array('type' => 'int', 'precision' => 2, 'nullable' => True)
+
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+ 'controller_control_serie' => array(
+ 'fd' => array(
+ 'id'
=> array('type' => 'auto', 'nullable' => false),
+ 'control_relation_id' => array('type'
=> 'int', 'precision' => '4', 'nullable' => false),
+ 'control_relation_type' => array('type'
=> 'varchar', 'precision' => '10', 'nullable' => false),
+ 'assigned_to' =>
array('type' => 'int', 'precision' => '4', 'nullable' => true),
+ 'start_date' =>
array('type' => 'int', 'precision' => '8', 'nullable' => true),
+ 'repeat_type' =>
array('type' => 'int', 'precision' => '2', 'nullable' => true),
'repeat_interval' =>
array('type' => 'int', 'precision' => '4', 'nullable' => true),
- 'service_time' => array('type' =>
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' =>
'0.00'),
- 'controle_time' => array('type' =>
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' =>
'0.00'),
+ 'service_time' =>
array('type' => 'decimal','precision' => '20','scale' => '2','nullable' =>
True,'default' => '0.00'),
+ 'controle_time' =>
array('type' => 'decimal','precision' => '20','scale' => '2','nullable' =>
True,'default' => '0.00'),
),
'pk' => array('id'),
'fk' => array(),
Modified: trunk/controller/setup/tables_update.inc.php
===================================================================
--- trunk/controller/setup/tables_update.inc.php 2015-04-02 00:46:05 UTC
(rev 12944)
+++ trunk/controller/setup/tables_update.inc.php 2015-04-06 17:25:53 UTC
(rev 12945)
@@ -10,19 +10,19 @@
'precision' => 4,
'nullable' => True
));
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_procedure','revision_no',array(
'type' => 'int',
'precision' => 4,
'nullable' => True
));
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_procedure','revision_date',array(
'type' => 'int',
'precision' => 8,
'nullable' => True
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.1';
return $GLOBALS['setup_info']['controller']['currentver'];
}
@@ -35,11 +35,11 @@
'precision' => 4,
'nullable' => True
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.2';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.2';
function controller_upgrade0_1_2()
{
@@ -56,23 +56,23 @@
'ix' => array(),
'uc' => array()
)
- );
-
+ );
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.3';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.3';
function controller_upgrade0_1_3()
{
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_control_group', array(),
'order_nr');
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.4';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
/* Update Controller from v 0.1.4 to 0.1.5 */
-
+
$test[] = '0.1.4';
function controller_upgrade0_1_4()
{
@@ -81,36 +81,36 @@
'precision' => 4,
'nullable' => True
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.5';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
/* Update Controller from v 0.1.5 to 0.1.6 */
-
+
$test[] = '0.1.5';
function controller_upgrade0_1_5()
{
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_check_list', array(),
'check_list_id');
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_list','planned_date',array(
'type' => 'int',
'precision' => 8,
'nullable' => True
));
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_list','completed_date',array(
'type' => 'int',
'precision' => 8,
'nullable' => True
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.6';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
/* Update Controller from v 0.1.6 to 0.1.7 */
-
+
$test[] = '0.1.6';
function controller_upgrade0_1_6()
{
@@ -125,31 +125,31 @@
'precision' => 4,
'nullable' => True
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.7';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
/* Update Controller from v 0.1.7 to 0.1.8 */
-
+
$test[] = '0.1.7';
function controller_upgrade0_1_7()
{
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_check_item', array(),
'status');
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_item','status',array(
'type' => 'int',
'precision' => 2,
'nullable' => true,
'default' => 0
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.8';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
/* Update Controller from v 0.1.8 to 0.1.9 */
-
+
$test[] = '0.1.8';
function controller_upgrade0_1_8()
{
@@ -165,16 +165,16 @@
'ix' => array(),
'uc' => array()
)
- );
-
+ );
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.9';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
/* Update Controller from v 0.1.9 to 0.1.10
* Add table for connecting equipment (BIM) and control
*/
-
+
$test[] = '0.1.9';
function controller_upgrade0_1_9()
{
@@ -190,8 +190,8 @@
'ix' => array(),
'uc' => array()
)
- );
-
+ );
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.10';
return $GLOBALS['setup_info']['controller']['currentver'];
}
@@ -199,7 +199,7 @@
/* Update Controller from v 0.1.10 to 0.1.11
* Alter from naming from equipment to more generic component
*/
-
+
$test[] = '0.1.10';
function controller_upgrade0_1_10()
{
@@ -215,11 +215,11 @@
'ix' => array(),
'uc' => array()
)
- );
+ );
$GLOBALS['phpgw_setup']->oProc->RenameColumn('controller_check_list','equipment_id','component_id');
-
$GLOBALS['phpgw_setup']->oProc->DropTable('controller_control_equipment_list');
+
$GLOBALS['phpgw_setup']->oProc->DropTable('controller_control_equipment_list');
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.11';
return $GLOBALS['setup_info']['controller']['currentver'];
@@ -228,13 +228,13 @@
/* Update Controller from v 0.1.11 to 0.1.12
* Add locations for control and checklist
*/
-
+
$test[] = '0.1.11';
function controller_upgrade0_1_11()
{
$GLOBALS['phpgw_setup']->oProc->RenameColumn('controller_control','equipment_type_id','component_type_id');
$GLOBALS['phpgw_setup']->oProc->RenameColumn('controller_control','equipment_id','component_id');
-
+
$GLOBALS['phpgw']->locations->add('.control', 'Control',
'controller');
$GLOBALS['phpgw']->locations->add('.checklist', 'Checklist',
'controller');
$GLOBALS['phpgw']->locations->add('.procedure', 'Procedure',
'controller');
@@ -242,7 +242,7 @@
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.12';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.12';
function controller_upgrade0_1_12()
{
@@ -258,7 +258,7 @@
'uc' => array()
)
);
-
+
$GLOBALS['phpgw_setup']->oProc->CreateTable(
'controller_document', array(
'fd' => array(
@@ -282,7 +282,7 @@
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.13';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.13';
function controller_upgrade0_1_13()
{
@@ -306,7 +306,7 @@
'nullable' => true,
'default' => 0
));
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_item',
'type',array(
'type' => 'varchar',
'precision' => 255,
@@ -317,13 +317,13 @@
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.15';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.15';
function controller_upgrade0_1_15()
{
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_check_item', array(),
'message_ticket_id');
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_check_item', array(),
'measurement');
-
+
$GLOBALS['phpgw_setup']->oProc->CreateTable(
'controller_check_item_case', array(
'fd' => array(
@@ -338,11 +338,11 @@
'uc' => array()
)
);
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.16';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.16';
function controller_upgrade0_1_16()
{
@@ -351,22 +351,22 @@
'precision' => '8',
'nullable' => true
));
-
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_item_case','measurement',array(
'type' => 'varchar',
'precision' => '50',
'nullable' => true
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.17';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.17';
function controller_upgrade0_1_17()
{
$GLOBALS['phpgw_setup']->oProc->DropTable('controller_check_item_case');
-
+
$GLOBALS['phpgw_setup']->oProc->CreateTable(
'controller_check_item_case', array(
'fd' => array(
@@ -387,7 +387,7 @@
'uc' => array()
)
);
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_item',
'measurement',array(
'type' => 'varchar',
'precision' => 50,
@@ -397,7 +397,7 @@
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.18';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.18';
function controller_upgrade0_1_18()
{
@@ -406,17 +406,17 @@
'precision' => 8,
'nullable' => false
));
-
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_item_case','modified_date',array(
'type' => 'int',
'precision' => 8,
'nullable' => true
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.19';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.19';
function controller_upgrade0_1_19()
{
@@ -425,7 +425,7 @@
'precision' => 4,
'nullable' => True
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.20';
return $GLOBALS['setup_info']['controller']['currentver'];
}
@@ -448,9 +448,9 @@
{
$GLOBALS['setup_info']['controller']['currentver'] =
'0.1.21';
return
$GLOBALS['setup_info']['controller']['currentver'];
- }
+ }
}
-
+
$test[] = '0.1.21';
function controller_upgrade0_1_21()
{
@@ -459,7 +459,7 @@
'precision' => '255',
'nullable' => true
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.22';
return $GLOBALS['setup_info']['controller']['currentver'];
}
@@ -494,9 +494,9 @@
{
$GLOBALS['setup_info']['controller']['currentver'] =
'0.1.23';
return
$GLOBALS['setup_info']['controller']['currentver'];
- }
+ }
}
-
+
$test[] = '0.1.23';
function controller_upgrade0_1_23()
{
@@ -504,11 +504,11 @@
'type' => 'text',
'nullable' => true
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.24';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.24';
function controller_upgrade0_1_24()
{
@@ -527,13 +527,13 @@
{
$GLOBALS['setup_info']['controller']['currentver'] =
'0.1.25';
return
$GLOBALS['setup_info']['controller']['currentver'];
- }
+ }
}
-
+
/* Update Controller from v 0.1.25 to 0.1.26
* Added table for connecting gontrol groups to components
*/
-
+
$test[] = '0.1.25';
function controller_upgrade0_1_25()
{
@@ -549,12 +549,12 @@
'ix' => array(),
'uc' => array()
)
- );
+ );
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.26';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.26';
function controller_upgrade0_1_26()
{
@@ -573,14 +573,14 @@
{
$GLOBALS['setup_info']['controller']['currentver'] =
'0.1.27';
return
$GLOBALS['setup_info']['controller']['currentver'];
- }
+ }
}
-
+
$test[] = '0.1.27';
function controller_upgrade0_1_27()
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_item_case','measurement',array(
'type' => 'varchar',
'precision' => 50,
@@ -602,11 +602,11 @@
'precision' => 4,
'nullable' => True
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.29';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.29';
function controller_upgrade0_1_29()
{
@@ -614,15 +614,15 @@
'type' => 'text',
'nullable' => true
));
-
+
$sql = "INSERT INTO controller_document_types (title)
values('procedures')";
$db = clone $GLOBALS['phpgw']->db;
$result = $db->query($sql, __LINE__, __FILE__);
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.30';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.30';
function controller_upgrade0_1_30()
{
@@ -630,22 +630,22 @@
'type' => 'text',
'nullable' => true
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.31';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.31';
function controller_upgrade0_1_31()
{
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_check_item', array(),
'status');
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_check_item', array(),
'comment');
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_check_item', array(),
'measurement');
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.32';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.32';
function controller_upgrade0_1_32()
{
@@ -653,11 +653,11 @@
'type' => 'text',
'nullable' => true
));
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.33';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.33';
function controller_upgrade0_1_33()
{
@@ -673,17 +673,17 @@
'ix' => array(),
'uc' => array()
)
- );
-
+ );
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.34';
return $GLOBALS['setup_info']['controller']['currentver'];
}
-
+
$test[] = '0.1.34';
function controller_upgrade0_1_34()
{
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_control', array(),
'location_code');
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.35';
return $GLOBALS['setup_info']['controller']['currentver'];
}
@@ -692,7 +692,7 @@
function controller_upgrade0_1_35()
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_component_list','location_id',array(
'type' => 'int',
'precision' => 4,
@@ -705,12 +705,12 @@
return
$GLOBALS['setup_info']['controller']['currentver'];
}
}
-
+
$test[] = '0.1.36';
function controller_upgrade0_1_36()
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_list','location_id',array(
'type' => 'int',
'precision' => 4,
@@ -723,13 +723,13 @@
return
$GLOBALS['setup_info']['controller']['currentver'];
}
}
-
+
$test[] = '0.1.37';
function controller_upgrade0_1_37()
{
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_control', array(),
'component_type_id');
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_control', array(),
'component_id');
-
+
$GLOBALS['setup_info']['controller']['currentver'] = '0.1.38';
return $GLOBALS['setup_info']['controller']['currentver'];
}
@@ -767,8 +767,8 @@
$sql = "UPDATE controller_check_list SET status =
{$entry['status']} WHERE id = {$entry['id']} ";
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
}
-
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_list','status',array(
'type' => 'int',
'precision' => 2,
@@ -787,52 +787,52 @@
return
$GLOBALS['setup_info']['controller']['currentver'];
}
}
-
+
$test[] = '0.1.39';
function controller_upgrade0_1_39()
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-
+
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_control_group_component_list',
array(), 'component_id');
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_group_component_list','location_id',array(
'type' => 'int',
'precision' => 4,
'nullable' => false
));
-
+
if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
{
$GLOBALS['setup_info']['controller']['currentver'] =
'0.1.40';
return
$GLOBALS['setup_info']['controller']['currentver'];
}
}
-
+
$test[] = '0.1.40';
function controller_upgrade0_1_40()
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-
+
$GLOBALS['phpgw_setup']->oProc->DropTable('controller_control_area');
-
+
if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
{
$GLOBALS['setup_info']['controller']['currentver'] =
'0.1.41';
return
$GLOBALS['setup_info']['controller']['currentver'];
}
}
-
+
$test[] = '0.1.41';
function controller_upgrade0_1_41()
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_item_case','location_code',array(
'type' => 'varchar',
'precision' => '30',
'nullable' => true
));
-
+
if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
{
$GLOBALS['setup_info']['controller']['currentver'] =
'0.1.42';
@@ -844,7 +844,7 @@
function controller_upgrade0_1_42()
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_group_list','temp_order_nr',array(
'type' => 'int',
'precision' => '4',
@@ -855,7 +855,7 @@
$GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_control_group_list',
array(), 'order_nr');
-
+
$GLOBALS['phpgw_setup']->oProc->RenameColumn('controller_control_group_list','temp_order_nr','order_nr');
if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
@@ -869,7 +869,7 @@
function controller_upgrade0_1_43()
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_list','assigned_to',array(
'type' => 'int',
'precision' => '4',
@@ -894,7 +894,7 @@
function controller_upgrade0_1_44()
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_group','component_location_id',array(
'type' => 'int',
'precision' => '4',
@@ -912,7 +912,7 @@
function controller_upgrade0_1_45()
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_item_case','component_id',array(
'type' => 'int',
'precision' => '4',
@@ -930,7 +930,7 @@
function controller_upgrade0_1_46()
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-
+
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12945] controller: modifications to components,
Sigurd Nes <=