[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9925]
From: |
Torstein |
Subject: |
[Fmsystem-commits] [9925] |
Date: |
Wed, 29 Aug 2012 11:50:54 +0000 |
Revision: 9925
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9925
Author: vator
Date: 2012-08-29 11:50:54 +0000 (Wed, 29 Aug 2012)
Log Message:
-----------
Modified Paths:
--------------
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/component/class.year_calendar_agg.inc.php
trunk/controller/inc/hook_home.inc.php
trunk/controller/inc/model/class.control.inc.php
trunk/controller/js/controller/ajax.js
trunk/controller/templates/base/css/base.css
Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php 2012-08-29 11:48:05 UTC
(rev 9924)
+++ trunk/controller/inc/class.socheck_list.inc.php 2012-08-29 11:50:54 UTC
(rev 9925)
@@ -246,6 +246,47 @@
}
}
+ function get_check_list_for_control_by_date($control_id, $deadline_ts,
$status = null, $location_code, $location_id, $component_id, $type)
+ {
+ $sql = "SELECT * ";
+ $sql .= "FROM controller_check_list ";
+ $sql .= "WHERE control_id = {$control_id} ";
+ $sql .= "AND deadline = {$deadline_ts}";
+
+ if($type == "location")
+ {
+ $sql .= "AND location_code = '{$location_code}' ";
+ }
+ else if($type == "component")
+ {
+ $sql .= "AND location_id = '{$location_id}' AND
component_id = '{$component_id}' ";
+ }
+
+ if($status != null)
+ {
+ $sql .= "AND status = {$status} ";
+ }
+
+ $this->db->query($sql);
+
+ $check_list = null;
+ if( $this->db->next_record() )
+ {
+ $check_list = new
controller_check_list($this->unmarshal($this->db->f('id'), 'int'));
+
$check_list->set_status($this->unmarshal($this->db->f('status'), 'int'));
+
$check_list->set_comment($this->unmarshal($this->db->f('comment'), 'string'));
+
$check_list->set_deadline($this->unmarshal($this->db->f('deadline'), 'int'));
+
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date'),
'int'));
+
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date'),
'int'));
+
$check_list->set_component_id($this->unmarshal($this->db->f('component_id'),
'int'));
+
$check_list->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'string'));
+
$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'));
+ }
+
+ return $check_list;
+ }
+
/**
* Get check list objects for a control on a location with set planned
date
*
@@ -283,15 +324,12 @@
$check_list = null;
while ($this->db->next_record())
{
-
if( $this->db->f('cl_id') != $check_list_id )
{
-
if($check_list_id)
{
$check_list_array[] = $check_list;
}
-
$check_list = new
controller_check_list($this->unmarshal($this->db->f('cl_id'), 'int'));
$check_list->set_status($this->unmarshal($this->db->f('cl_status'), 'int'));
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment'),
'string'));
Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php 2012-08-29 11:48:05 UTC
(rev 9924)
+++ trunk/controller/inc/class.socontrol.inc.php 2012-08-29 11:50:54 UTC
(rev 9925)
@@ -200,39 +200,34 @@
* @param $role_id responsible role for carrying out the
control
* @return array with controls as objects or arrays
*/
-
+
public function
get_controls_for_components_by_location($location_code, $from_date, $to_date,
$repeat_type, $return_type = "return_object", $role_id = 0)
- {
- $role_id = (int) $role_id;
-
- if($repeat_type != null)
- {
- $repeat_type = (int) $repeat_type;
- }
-
+ {
$controls_array = array();
$sql = "SELECT distinct c.*,
fm_responsibility_role.name AS responsibility_name, ccl.location_id,
ccl.component_id ";
$sql .= "FROM controller_control_component_list ccl ";
- $sql .= "LEFT JOIN controller_control c on
ccl.control_id=c.id ";
+ $sql .= "LEFT JOIN controller_control c on
ccl.control_id = c.id ";
$sql .= "LEFT JOIN fm_responsibility_role ON
fm_responsibility_role.id = c.responsibility_id ";
$sql .= "LEFT JOIN fm_bim_item ON fm_bim_item.id =
ccl.component_id ";
- $sql .= "WHERE fm_bim_item.loc1 = '$location_code' ";
-
+ $sql .= "WHERE fm_bim_item.location_code LIKE
'$location_code%' ";
+
if( $repeat_type != null)
{
+ $repeat_type = (int) $repeat_type;
$sql .= "AND c.repeat_type = $repeat_type ";
}
if( $role_id)
{
+ $role_id = (int) $role_id;
$sql .= "AND c.responsibility_id = $role_id ";
}
- $sql .= "AND (c.start_date <= $from_date AND c.end_date
IS NULL ";
- $sql .= "OR c.end_date > $from_date AND c.start_date <
$to_date)";
+ $sql .= "AND ((c.start_date <= $to_date AND c.end_date
IS NULL) ";
+ $sql .= "OR (c.start_date <= $to_date AND c.end_date >
$from_date ))";
$this->db->query($sql);
-
+
while($this->db->next_record())
{
$control = new
controller_control($this->unmarshal($this->db->f('id'), 'int'));
@@ -249,11 +244,8 @@
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type'), 'int'));
$control->set_repeat_type_label($this->unmarshal($this->db->f('repeat_type'),
'int'));
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval'),
'int'));
-//Sigurd 3.august 2010:
-
$control->set_location_id($this->unmarshal($this->db->f('location_id'), 'int'));
-
$control->set_component_id($this->unmarshal($this->db->f('component_id'),
'int'));
-//
- if($return_type == "return_object")
+
+ if($return_type == "return_object")
{
$controls_array[] = $control;
}
@@ -263,14 +255,7 @@
}
}
- if( count( $controls_array ) > 0 )
- {
- return $controls_array;
- }
- else
- {
- return null;
- }
+ return $controls_array;
}
/**
@@ -284,11 +269,8 @@
* @param $role_id responsible role for carrying out the
control
* @return array of components as objects or arrays
*/
- public function get_controls_by_component($location_code,
$from_date, $to_date, $repeat_type = '', $return_type = "return_object",
$role_id = 0, $filter = null)
+ public function get_controls_by_component($from_date, $to_date,
$repeat_type, $return_type = "return_object", $role_id = 0, $filter = null)
{
- $role_id = (int) $role_id;
- $repeat_type = (int) $repeat_type;
-
$controls_array = array();
$sql = "SELECT c.id as control_id, c.*, ";
@@ -300,15 +282,16 @@
$sql .= "JOIN controller_control c on cl.control_id =
c.id ";
$sql .= "JOIN fm_responsibility_role ON
fm_responsibility_role.id = c.responsibility_id ";
$sql .= "AND bim_item.type = bim_type.id ";
- $sql .= "AND bim_item.type = bim_type.id ";
- if( $repeat_type)
+ if( $repeat_type != null)
{
+ $repeat_type = (int) $repeat_type;
$sql .= "AND c.repeat_type = $repeat_type ";
}
- if( $role_id)
+ if( $role_id )
{
- $sql .= "AND c.responsibility_id = $role_id ";
+ $role_id = (int) $role_id;
+ $sql .= "AND c.responsibility_id = $role_id ";
}
$sql .= "AND (c.start_date <= $from_date AND c.end_date
IS NULL ";
@@ -316,10 +299,10 @@
if($filter != null)
{
- $sql .= "AND " . $filter;
+ $sql .= "AND " . $filter;
}
- $sql .= "ORDER BY bim_item.id ";
+ $sql .= "ORDER BY bim_item.id ";
$this->db->query($sql);
Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php 2012-08-29 11:48:05 UTC
(rev 9924)
+++ trunk/controller/inc/class.uicalendar.inc.php 2012-08-29 11:50:54 UTC
(rev 9925)
@@ -123,12 +123,12 @@
if($level == 1){
// Fetches all controls for the components for
a location within time period
$filter = "bim_item.location_code =
'$location_code' ";
- $components_with_controls_array =
$this->so_control->get_controls_by_component($location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_object", $role, $filter);
+ $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($location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_object", $role, $filter);
+ $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
@@ -264,12 +264,12 @@
if($level == 1){
// Fetches all controls for the components for
a location within time period
$filter = "bim_item.location_code =
'$location_code' ";
- $components_with_controls_array =
$this->so_control->get_controls_by_component($location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_object", $role, $filter);
+ $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($location_code, $from_date_ts,
$to_date_ts, $repeat_type, "return_object", $role, $filter);
+ $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
Modified: trunk/controller/inc/component/class.year_calendar_agg.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar_agg.inc.php
2012-08-29 11:48:05 UTC (rev 9924)
+++ trunk/controller/inc/component/class.year_calendar_agg.inc.php
2012-08-29 11:50:54 UTC (rev 9925)
@@ -38,7 +38,7 @@
else if( ($month_nr < date("m")) && (date("Y",
$this->control->get_start_date()) == $this->year) )
{
$this->calendar_array[ $month_nr ]["status"] =
"CONTROLS_NOT_DONE";
- $this->calendar_array[ $month_nr ]["info"] = array("view" =>
$this->view, "control_id" => $this->control->get_id(), "year" => $this->year,
"month" => $month_nr);
+ $this->calendar_array[ $month_nr ]["info"] = array("view" =>
$this->view, "control_id" => $this->control->get_id(), "location_code" =>
$this->location_code, "year" => $this->year, "month" => $month_nr);
}
else
{
Modified: trunk/controller/inc/hook_home.inc.php
===================================================================
--- trunk/controller/inc/hook_home.inc.php 2012-08-29 11:48:05 UTC (rev
9924)
+++ trunk/controller/inc/hook_home.inc.php 2012-08-29 11:50:54 UTC (rev
9925)
@@ -54,50 +54,150 @@
$from_date_ts = strtotime("now");
$to_year = $year + 1;
$to_date_ts = strtotime("01/01/$to_year");
-
+
+ // Fetches my properties
$criteria = array
(
'user_id' => $GLOBALS['phpgw_info']['user']['account_id'],
- 'type_id' => 1,
+ '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
);
$location_finder = new location_finder();
- $my_locations = $location_finder->get_responsibilities( $criteria );
+ $my_properties = $location_finder->get_responsibilities( $criteria );
+ // Fetches my buildings
+ $criteria = array
+ (
+ 'user_id' => $GLOBALS['phpgw_info']['user']['account_id'],
+ 'type_id' => 2, // Nivå i bygningsregisteret 1:eiendom
+ 'role_id' => 0, // For å begrense til en bestemt rolle - ellers
listes alle roller for brukeren
+ 'allrows' => false
+ );
+
+ $location_finder = new location_finder();
+ $my_buildings = $location_finder->get_responsibilities( $criteria );
+
+ $my_locations = array_merge($my_properties, $my_buildings);
+
+
+ /* ======================================= CONTROLS NOT DONE
================================= */
+
+ $my_controls = array();
+
+ $to_date_ts = strtotime("now");
+ $to_year = date("Y") - 1;
+ $from_date_ts = strtotime("01/01/$to_year");
$repeat_type = null;
- $controls_for_location_array = array();
+
+ $my_controls = array();
foreach($my_locations as $location)
{
- $controls = array();
- $controls_loc =
$so_control->get_controls_by_location($location["location_code"],
$from_date_ts, $to_date_ts, $repeat_type, '', $location["role_id"] );
- $controls_comp =
$so_control->get_controls_for_components_by_location($location["location_code"],
$from_date_ts, $to_date_ts, $repeat_type, '', $location["role_id"] );
- foreach($controls_loc as $cl)
+ $controls = array();
+ $components_with_controls_array = array();
+ $location_code = $location["location_code"];
+
+ $controls_loc = $so_control->get_controls_by_location(
$location_code, $from_date_ts, $to_date_ts, $repeat_type, "return_array",
$location["role_id"] );
+
+ $level = count(explode('-', $location_code));
+
+ if($level == 1){
+ // Fetches all controls for the components for
a location within time period
+ $filter = "bim_item.location_code =
'$location_code' ";
+ $components_with_controls_array =
$so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_array", $location["role_id"], $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 =
$so_control->get_controls_by_component($from_date_ts, $to_date_ts,
$repeat_type, "return_array", $location["role_id"], $filter);
+ }
+
+ if( count($controls_loc) > 0 )
{
- $controls[] = $cl;
+ $my_controls[] = array( $location_code, 'location',
$controls_loc );
}
- foreach($controls_comp as $cc)
+
+ if( count($components_with_controls_array) > 0 )
{
- $controls[] = $cc;
+ foreach($components_with_controls_array as $component)
+ {
+ $my_controls[] = array( $location_code, 'component',
$component['controls_array'], $component );
+ }
}
-
- $controls_for_location_array[] = array($location["location_code"],
$controls);
}
-
- $controls_array = array();
- $control_dates = array();
- foreach($controls_for_location_array as $control_arr){
- $current_location = $control_arr[0];
- $controls_for_loc_array = $control_arr[1];
- foreach($controls_for_loc_array as $control)
+ $my_undone_controls = array();
+ $so_check_list = CreateObject('controller.socheck_list');
+
+ foreach($my_controls as $container_arr)
+ {
+ $location_code = $container_arr[0];
+ $control_type = $container_arr[1];
+ $controls = $container_arr[2];
+
+ foreach($controls as $my_control)
{
- $date_generator = new
date_generator($control["start_date"], $control["end_date"], $from_date_ts,
$to_date_ts, $control["repeat_type"], $control["repeat_interval"]);
- $controls_array[] = array($current_location, $control,
$date_generator->get_dates());
+ if($my_control["repeat_type"] == 0)
+ {
+ // Daily control: Fetch undone controls one
week back in time
+ $from_date_ts = mktime(0, 0, 0, date("n"),
date("j")-7, date("Y") );
+ }
+ else if($my_control["repeat_type"] == 1)
+ {
+ // Weekly control: Fetch undone controls one
month back in time
+ $from_date_ts = mktime(0, 0, 0, date("n")-1,
date("j"), date("Y") );
+ }
+ else if($my_control["repeat_type"] == 2)
+ {
+ // Monthly control: Fetch undone controls three
months back in time
+ $from_date_ts = mktime(0, 0, 0, date("n")-3,
date("j"), date("Y") );
+ }
+ else if($my_control["repeat_type"] == 3)
+ {
+ // Yearly control: Fetch undone controls one
year back in time
+ $from_date_ts = mktime(0, 0, 0, date("n"),
date("j"), date("Y")-1 );
+ }
+
+ $date_generator = new
date_generator($my_control["start_date"], $my_control["end_date"],
$from_date_ts, $to_date_ts, $my_control["repeat_type"],
$my_control["repeat_interval"]);
+ $deadline_dates_for_control =
$date_generator->get_dates();
+
+ $check_list_array = array();
+ foreach($deadline_dates_for_control as $deadline_ts)
+ {
+ $check_list = null;
+
+ if($control_type == "location")
+ {
+ $check_list =
$so_check_list->get_check_list_for_control_by_date($my_control['id'],
$deadline_ts, null, $location_code, null, null, "location" );
+ }
+ else if($control_type == "component")
+ {
+ $component = $container_arr[3];
+
+ $check_list =
$so_check_list->get_check_list_for_control_by_date($my_control['id'],
$deadline_ts, null, null, $component['location_id'], $component['id'],
"component" );
+ }
+
+ if($check_list == null)
+ {
+ if($control_type == "location")
+ {
+ $my_undone_controls[] = array("add",
$deadline_ts, $my_control, "location", $location_code );
+ }
+ else if($control_type == "component")
+ {
+ $component = $container_arr[3];
+ $my_undone_controls[] = array("add",
$deadline_ts, $my_control, "component", $component['location_id'],
$component['id'] );
+ }
+ }
+ else if($check_list->get_status() ==
controller_check_list::STATUS_NOT_DONE)
+ {
+ $my_undone_controls[] = array("edit",
$deadline_ts, $my_control, $check_list->get_id(), $location_code );
+ }
+ }
}
}
-
+
$portalbox0 = CreateObject('phpgwapi.listbox', array
(
'title' => "Mine glemte kontroller",
@@ -108,88 +208,140 @@
'outerborderwidth' => '0',
'header_background_image' =>
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler', '.png', False)
));
-
+
$app_id = $GLOBALS['phpgw']->applications->name2id('controller');
if( !isset($GLOBALS['portal_order']) ||!in_array($app_id,
$GLOBALS['portal_order']) )
{
$GLOBALS['portal_order'][] = $app_id;
}
- $var = array
- (
- 'up' => array('url' => '/set_box.php', 'app' =>
$app_id),
- 'down' => array('url' => '/set_box.php', 'app' =>
$app_id),
- 'close' => array('url' => '/set_box.php', 'app' =>
$app_id),
- 'question' => array('url' => '/set_box.php', 'app'
=> $app_id),
- 'edit' => array('url' => '/set_box.php', 'app' =>
$app_id)
- );
-
- $category_name = array(); // caching
- $cats = CreateObject('phpgwapi.categories', -1, 'controller',
'.control');
- $cats->supress_info = true;
- $control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','selected' => '','globals'
=> true,'use_acl' => $this->_category_acl));
- $portalbox0->data = array();
- $portalbox0_data = array();
- foreach ($controls_array as $control_instance)
+ function cmp($a, $b)
{
- $curr_location = $control_instance[0];
- $current_control = $control_instance[1];
- $check_lists =
$so->get_open_check_lists_for_control($current_control["id"], $curr_location,
$from_date_ts);
- $location_array = execMethod('property.bolocation.read_single',
array('location_code' => $curr_location));
- $location_name = $location_array["loc1_name"];
- if(isset($current_control['component_id']) &&
$current_control['component_id'])
+ if ($a[1] == $b[1]) {
+ return 0;
+ }
+
+ return ($a[1] < $b[1]) ? -1 : 1;
+ }
+
+ usort($my_undone_controls, "cmp");
+
+ foreach($my_undone_controls as $my_undone_control)
+ {
+
+ $check_list_status = $my_undone_control[0];
+ $deadline_ts = $my_undone_control[1];
+ $my_control = $my_undone_control[2];
+
+ $cats = CreateObject('phpgwapi.categories', -1, 'controller',
'.control');
+ $cats->supress_info = true;
+ $control_areas =
$cats->formatted_xslt_list(array('format'=>'filter','selected' => '','globals'
=> true,'use_acl' => $this->_category_acl));
+
+ foreach($control_areas['cat_list'] as $area)
{
- if($short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$current_control['location_id'], 'id' => $current_control['component_id'])))
+ if($area['cat_id'] == $my_control["control_area_id"])
{
- $location_name .= "::{$short_desc}";
+ $control_area_name = $area['name'];
}
}
-
- foreach($control_areas['cat_list'] as $area)
+
+ $date_str = date($dateformat, $deadline_ts);
+
+ if($check_list_status == "add")
{
- if($area['cat_id'] ==
$current_control["control_area_id"])
+ $check_list_type = $my_undone_control[3];
+
+ if($check_list_type == "location")
{
- $control_area_name = $area['name'];
+ $location_code = $my_undone_control[4];
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ $location_name = $location_array["loc1_name"];
+
+ $portalbox0->data[] = array(
+ 'text' => "<span
class='title'>{$location_name}</span><span
class='control-area'>{$control_area_name}</span> <span
class='control'>{$my_control['title']}</span> <span class='date'>Fristdato
{$date_str}</span>",
+ 'link' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'controller.uicheck_list.add_check_list', 'type' =>
"location", 'control_id' => $my_control['id'], 'location_code' =>
$location_code, 'deadline_ts' => $deadline_ts))
+ );
}
+ else if($check_list_type == "component")
+ {
+ $location_id = $my_undone_control[4];
+ $component_id = $my_undone_control[5];
+
+ $short_desc_arr =
execMethod('property.soentity.get_short_description', array('location_id' =>
$location_id, 'id' => $component_id));
+
+ $portalbox0->data[] = array(
+ 'text' => "<span
class='title'>{$short_desc_arr}</span><span
class='control-area'>{$control_area_name}</span> <span
class='control'>{$my_control['title']}</span> <span class='date'>Fristdato
{$date_str}</span>",
+ 'link' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'controller.uicheck_list.add_check_list', 'type' =>
"component", 'control_id' => $my_control['id'], 'location_id' => $location_id,
'component_id' => $component_id, 'deadline_ts' => $deadline_ts))
+ );
+ }
}
- foreach($check_lists as $check_list)
+ else if($check_list_status == "edit")
{
- $next_date = "Frist: " . date($dateformat,
$check_list->get_deadline());
- $portalbox0_data[] = array
- ($check_list->get_deadline(), array
- (
- 'text' => "<span
class='title'>{$location_name}</span><span
class='control-area'>{$control_area_name}</span> <span
class='control'>{$current_control["title"]}</span> <span
class='date'>{$next_date}</span>",
- 'link' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'controller.uicheck_list.edit_check_list',
'check_list_id' => $check_list->get_id()))
- ));
+ $check_list_id = $my_undone_control[3];
+ $location_code = $my_undone_control[4];
+
+ $location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ $location_name = $location_array["loc1_name"];
+
+ $portalbox0->data[] = array(
+ 'text' => "<span
class='title'>{$location_name}</span><span
class='control-area'>{$control_area_name}</span> <span
class='control'>{$my_control['title']}</span> <span class='date'>Fristdato
{$date_str}</span>",
+ 'link' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'controller.uicheck_list.edit_check_list',
'check_list_id' => $check_list_id))
+ );
}
}
- //sort data by planned date for check list
- sort($portalbox0_data);
- //$limit = 5;
- $tmp = 0;
- foreach($portalbox0_data as $check_list_dates)
- {
- if($tmp < $limit_no_of_planned)
- {
- $portalbox0->data[] = $check_list_dates[1];
- }
- $tmp++;
- }
-
+
$styling = "\n".'<!-- BEGIN checklist info -->'."\n ";
$styling .= "<style> .home_portal_content
a{color:#0066CC;text-decoration: none;text-transform: uppercase;}
.home_portal{margin: 20px 10px 0;} ";
$styling .= " .home-box {background: none repeat scroll 0 0 #EDF5FF;
border-color: #DBE5EF; border-radius: 4px; margin: 20px;}";
$styling .= " .home-box .home_portal{margin: 0;border: 1px solid
#DEEAF8;} .home_portal_content{padding:10px;} ";
- $styling .= " .home_portal_title h2{ background: #DEEAF8; margin: 0;
padding: 5px 10px;} .home_portal_content ul li{padding: 3px;}";
- $styling .= " .home_portal_content
.title{display:inline-block;width:300px;} .home_portal_content
.control-area{display:inline-block;width:200px;}";
+ $styling .= " .home_portal_title h2{ background: #DEEAF8; margin: 0;
padding: 5px 10px;} .home_portal_content ul li{padding: 7px 0;}";
+ $styling .= " .home_portal_content
.title{display:inline-block;width:300px;margin:0 20px 0 0;}
.home_portal_content .control-area{display:inline-block;width:200px;}";
$styling .= " .home_portal_content
.control{display:inline-block;width:300px;} .home_portal_content
.date{display:inline-block;width:300px;}";
+ $styling .= " .home_portal_content a span{cursor:
pointer;vertical-align: middle;}";
$styling .= "</style>";
$styling .= "\n".'<!-- END checklist info -->'."\n";
echo $styling;
echo "\n".'<!-- BEGIN checklist info -->'."\n <div
class='home-box'>".$portalbox0->draw()."</div>\n".'<!-- END checklist info
-->'."\n";
+ /* ======================================= MY PLANNED CONTROLS
================================= */
+
+ $repeat_type = null;
+ $controls_for_location_array = array();
+ foreach($my_locations as $location)
+ {
+ $controls = array();
+ $controls_loc =
$so_control->get_controls_by_location($location["location_code"],
$from_date_ts, $to_date_ts, $repeat_type, "return_array", $location["role_id"]
);
+ $controls_comp =
$so_control->get_controls_for_components_by_location($location["location_code"],
$from_date_ts, $to_date_ts, $repeat_type, "return_array", $location["role_id"]
);
+
+ foreach($controls_loc as $cl)
+ {
+ $controls[] = $cl;
+ }
+
+ foreach($controls_comp as $cc)
+ {
+ $controls[] = $cc;
+ }
+
+ $controls_for_location_array[] = array($location["location_code"],
$controls);
+ }
+
+ $controls_array = array();
+ $control_dates = array();
+ foreach($controls_for_location_array as $control_arr){
+ $current_location = $control_arr[0];
+ $controls_for_loc_array = $control_arr[1];
+ foreach($controls_for_loc_array as $control)
+ {
+ $date_generator = new
date_generator($control["start_date"], $control["end_date"], $from_date_ts,
$to_date_ts, $control["repeat_type"], $control["repeat_interval"]);
+ $controls_array[] = array($current_location, $control,
$date_generator->get_dates());
+ }
+ }
+
+
+
$portalbox1 = CreateObject('phpgwapi.listbox', array
(
'title' => "Mine planlagte kontroller",
@@ -215,6 +367,8 @@
'edit' => array('url' => '/set_box.php', 'app' =>
$app_id)
);
+ /* ======================================= MY CONTROLS
================================= */
+
$category_name = array(); // caching
$cats = CreateObject('phpgwapi.categories', -1, 'controller',
'.control');
@@ -295,11 +449,6 @@
'edit' => array('url' => '/set_box.php', 'app' =>
$app_id)
);
- foreach ( $var as $key => $value )
- {
-// $portalbox2->set_controls($key,$value);
- }
-
$category_name = array(); // caching
$portalbox2->data = array();
@@ -350,7 +499,7 @@
'deadline_ts'
=> $current_date,
'control_id'
=> $current_control["id"],
'location_code'
=> $curr_location,
- 'type'
=> $current_control['component_id'] ? 'component' : '',
+ 'type'
=> $current_control['component_id'] ? 'component' : 'location',
'location_id'
=> $current_control['location_id'],
'component_id'
=> $current_control['component_id']
))
@@ -385,7 +534,7 @@
'deadline_ts' =>
$current_date,
'control_id' =>
$current_control["id"],
'location_code' =>
$curr_location,
- 'type' =>
$current_control['component_id'] ? 'component' : '',
+ 'type' =>
$current_control['component_id'] ? 'component' : 'location',
'location_id' =>
$current_control['location_id'],
'component_id' =>
$current_control['component_id']
))
@@ -407,3 +556,4 @@
$tmp++;
}
echo "\n".'<!-- BEGIN assigned checklist info -->'."\n<div
class='home-box'>".$portalbox2->draw()."</div>\n".'<!-- END assigned checklist
info -->'."\n";
+
\ No newline at end of file
Modified: trunk/controller/inc/model/class.control.inc.php
===================================================================
--- trunk/controller/inc/model/class.control.inc.php 2012-08-29 11:48:05 UTC
(rev 9924)
+++ trunk/controller/inc/model/class.control.inc.php 2012-08-29 11:50:54 UTC
(rev 9925)
@@ -57,8 +57,6 @@
protected $responsibility_name;
protected $control_area_id;
protected $control_area_name;
- protected $location_id;
- protected $component_id;
// Objects
protected $check_lists_array = array();
@@ -235,32 +233,6 @@
$this->error_msg_array = $error_msg_array;
}
-
-
-//Sigurd 3.august 2010: needed for
socontrol::get_controls_for_components_by_location()
-
- public function set_location_id($location_id)
- {
- $this->location_id = $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;
- }
-
-//
-
/**
* Get a static reference to the storage object associated with
this model object
*
Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js 2012-08-29 11:48:05 UTC (rev
9924)
+++ trunk/controller/js/controller/ajax.js 2012-08-29 11:50:54 UTC (rev
9925)
@@ -543,58 +543,34 @@
var check_list_id = $("#check_list_id").val();
- var statusFieldVal = $("#status").val();
- var statusRow = $("#status").closest(".row");
- var plannedDateVal = $("#planned_date").val();
- var plannedDateRow = $("#planned_date").closest(".row");
- var completedDateVal = $("#completed_date").val();
- var completedDateRow =
$("#completed_date").closest(".row");
-
- // Checks that COMPLETE DATE is set if status is set to
DONE
- if(statusFieldVal == 1 & completedDateVal == ''){
- e.preventDefault();
- // Displays error message above completed date
- $(completedDateRow).before("<div
class='input_error_msg'>Vennligst angi når kontrollen ble utført</div>");
- }
- else if(statusFieldVal == 0 && completedDateVal != ''){
- e.preventDefault();
- // Displays error message above completed date
- $(statusRow).before("<div
class='input_error_msg'>Vennligst endre status til utført</div>");
+ var statusFieldVal = $("#status").val();
+ var statusRow = $("#status").closest(".row");
+ var plannedDateVal = $("#planned_date").val();
+ var plannedDateRow = $("#planned_date").closest(".row");
+ var completedDateVal = $("#completed_date").val();
+ var completedDateRow = $("#completed_date").closest(".row");
+
+ $(thisForm).find('.input_error_msg').remove();
+
+ // Checks that COMPLETE DATE is set if status is set to DONE
+ if(statusFieldVal == 1 & completedDateVal == ''){
+ e.preventDefault();
+ // Displays error message above completed date
+ $(completedDateRow).before("<div
class='input_error_msg'>Vennligst angi når kontrollen ble utført</div>");
+ }
+ else if(statusFieldVal == 0 && completedDateVal != ''){
+ e.preventDefault();
+ // Displays error message above completed date
+ $(statusRow).before("<div
class='input_error_msg'>Vennligst endre status til utført eller slett
utførtdato</div>");
+ }
+ else if(statusFieldVal == 0 & plannedDateVal == ''){
+ e.preventDefault();
+ // Displays error message above planned date
+ if(
!$(plannedDateRow).prev().hasClass("input_error_msg") )
+ {
+ $(plannedDateRow).before("<div
class='input_error_msg'>Vennligst endre status for kontroll eller angi
planlagtdato</div>");
}
- else if(statusFieldVal == 0 & plannedDateVal == ''){
- e.preventDefault();
- // Displays error message above planned date
- if(
!$(plannedDateRow).prev().hasClass("input_error_msg") )
- {
- $(plannedDateRow).before("<div
class='input_error_msg'>Vennligst endre status for kontroll eller angi
planlagtdato</div>");
- }
- }
- /*
- else{
- $(".input_error_msg").hide();
-
- $.ajax({
- type: 'POST',
- url: requestUrl +
"&phpgw_return_as=json&" + $(thisForm).serialize(),
- success: function(data) {
- if(data){
- var obj =
jQuery.parseJSON(data);
-
- if(obj.status == "updated"){
- var submitBnt =
$(thisForm).find("input[type='submit']");
-
$(submitBnt).val("Lagret");
-
- // Changes text on
save button back to original
-
window.setTimeout(function() {
-
$(submitBnt).val('Lagre detaljer');
-
$(submitBnt).addClass("not_active");
- }, 1000);
- }
- }
- }
- });
- }
- */
+ }
});
// Display submit button on click
Modified: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css 2012-08-29 11:48:05 UTC
(rev 9924)
+++ trunk/controller/templates/base/css/base.css 2012-08-29 11:50:54 UTC
(rev 9925)
@@ -1015,7 +1015,7 @@
}
#check_list_details .col_1 {
- width: 46%;
+ width: 50%;
}
/* ======================================= TAB CHECK LIST DETAILS
========================================= */
@@ -2174,8 +2174,8 @@
margin-bottom: 5px;
margin-top: 5px;
padding: 5px;
- width: 100%;
text-align: center;
+ width: 90%;
}
.error_msg {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9925],
Torstein <=