[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8571]
From: |
Torstein |
Subject: |
[Fmsystem-commits] [8571] |
Date: |
Sun, 15 Jan 2012 13:46:27 +0000 |
Revision: 8571
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8571
Author: vator
Date: 2012-01-15 13:46:27 +0000 (Sun, 15 Jan 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/class.uicheck_list.inc.php
trunk/controller/inc/component/class.calendar_builder.inc.php
trunk/controller/inc/component/class.date_generator.inc.php
trunk/controller/inc/helper/class.check_list_status_info.inc.php
trunk/controller/js/controller/ajax.js
trunk/controller/templates/base/calendar/view_calendar_month.xsl
trunk/controller/templates/base/check_list/cases_tab_menu.xsl
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-01-14 18:45:33 UTC
(rev 8570)
+++ trunk/controller/inc/class.socheck_list.inc.php 2012-01-15 13:46:27 UTC
(rev 8571)
@@ -97,7 +97,7 @@
public function get_single_with_check_items($check_list_id, $status,
$type){
$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, location_code, ";
$sql .= "ci.id as ci_id, ci.status as ci_status,
control_item_id, ci.comment as ci_comment, check_list_id, ";
- $sql .= "coi.title as coi_id, coi.title as coi_title,
coi.required as coi_required, coi.required as coi_required, ";
+ $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 ";
$sql .= "LEFT JOIN controller_check_item as ci ON cl.id =
ci.check_list_id ";
@@ -203,7 +203,8 @@
}
function get_check_lists_for_control($control_id){
- $sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, ";
+ $sql = "SELECT cl.id as cl_id, cl.status as cl_status,
cl.comment as cl_comment, deadline, planned_date, ";
+ $sql .= "completed_date, component_id, location_code,
num_open_cases ";
$sql .= "ci.id as ci_id, ci.status as ci_status,
control_item_id, ci.comment as ci_comment, check_list_id ";
$sql .= "FROM controller_check_list cl, controller_check_item
ci ";
$sql .= "WHERE cl.control_id = $control_id ";
@@ -225,8 +226,13 @@
$check_list = new
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true),
'bool'));
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true),
'string'));
-
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true),
'int'));
-
+
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true),
'int'));
+
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date',
true), 'int'));
+
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date',
true), 'int'));
+
$check_list->set_component_id($this->unmarshal($this->db->f('component_id',
true), 'int'));
+
$check_list->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'int'));
+
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases',
true), 'int'));
+
$check_items_array = array();
}
@@ -306,19 +312,21 @@
}
function get_check_lists_for_location( $location_code, $from_date,
$to_date, $repeat_type ){
- $sql = "SELECT c.id as c_id, cl.id as cl_id, cl.status as
cl_status, cl.comment as cl_comment, ";
- $sql .= "deadline, planned_date, completed_date,
cl.location_code as cl_loc, c.* ";
- $sql .= "FROM controller_check_list cl, controller_control c ";
+ $sql = "SELECT c.id as c_id, title, description, start_date,
end_date, control_area_id, c.location_code as c_location_code, repeat_type,
repeat_interval, ";
+ $sql .= "cl.id as cl_id, cl.status as cl_status, cl.comment as
cl_comment, deadline, planned_date, completed_date, ";
+ $sql .= "cl.component_id as cl_component_id, cl.location_code
as cl_location_code, num_open_cases ";
+ $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 ";
$sql .= "AND c.repeat_type = $repeat_type ";
- $sql .= "AND cl.control_id = c.id ";
- $sql .= "AND deadline BETWEEN $from_date AND $to_date";
+ $sql .= "AND deadline BETWEEN $from_date AND $to_date ";
$sql .= "ORDER BY c.id;";
-
+ echo $sql;
$this->db->query($sql);
$control_id = 0;
$control = null;
+ $controls_array = array();
while ($this->db->next_record()) {
if( $this->db->f('c_id', true) != $control_id ){
@@ -333,16 +341,8 @@
$control->set_description($this->unmarshal($this->db->f('description', true),
'boolean'));
$control->set_start_date($this->unmarshal($this->db->f('start_date', true),
'int'));
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
-
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true),
'int'));
-
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name',
true), 'string'));
-
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id',
true), 'int'));
-
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
true), 'int'));
-
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
true), 'int'));
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'int'));
-
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
true), 'string'));
-
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
true), 'int'));
-
$control->set_component_id($this->unmarshal($this->db->f('component_id', true),
'int'));
-
$control->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'int'));
+
$control->set_location_code($this->unmarshal($this->db->f('c_location_code',
true), 'int'));
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true),
'int'));
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval',
true), 'int'));
@@ -350,13 +350,15 @@
}
$check_list = new
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
-
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true),
'string'));
+
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true),
'int'));
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true),
'string'));
-
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true),
'int'));
+
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true),
'int'));
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date',
true), 'int'));
-
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date',
true), 'int'));
-
$check_list->set_location_code($this->unmarshal($this->db->f('cl_loc', true),
'int'));
-
+
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date',
true), 'int'));
+
$check_list->set_component_id($this->unmarshal($this->db->f('cl_component_id',
true), 'int'));
+
$check_list->set_location_code($this->unmarshal($this->db->f('cl_location_code',
true), 'int'));
+
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases',
true), 'int'));
+
$check_lists_array[] = $check_list;
$control_id = $control->get_id();
@@ -365,11 +367,9 @@
if($control != null){
$control->set_check_lists_array($check_lists_array);
$controls_array[] = $control;
-
- return $controls_array;
- }else {
- return null;
}
+
+ return $controls_array;
}
function get_query(string $sort_field, boolean $ascending, string
$search_for, string $search_type, array $filters, boolean $return_count)
Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php 2012-01-14 18:45:33 UTC
(rev 8570)
+++ trunk/controller/inc/class.socontrol.inc.php 2012-01-15 13:46:27 UTC
(rev 8571)
@@ -112,8 +112,44 @@
//return isset($result);
}
+ public function get_controls_by_location($location_code)
+ {
+ $controls_array = array();
+
+ $sql = "SELECT * FROM controller_control_location_list
WHERE location_code = $location_code";
+ $this->db->query($sql);
+ while($this->db->next_record()) {
+ $control = new
controller_control($this->unmarshal($this->db->f('id', true), 'int'));
+
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+
$control->set_description($this->unmarshal($this->db->f('description', true),
'boolean'));
+
$control->set_start_date($this->unmarshal($this->db->f('start_date', true),
'int'));
+
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
+
$control->set_procedure_id($this->unmarshal($this->db->f('procedure_id', true),
'int'));
+
$control->set_procedure_name($this->unmarshal($this->db->f('procedure_name',
true), 'string'));
+
$control->set_requirement_id($this->unmarshal($this->db->f('requirement_id',
true), 'int'));
+
$control->set_costresponsibility_id($this->unmarshal($this->db->f('costresponsibility_id',
true), 'int'));
+
$control->set_responsibility_id($this->unmarshal($this->db->f('responsibility_id',
true), 'int'));
+
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'int'));
+
$control->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
true), 'string'));
+
$control->set_component_type_id($this->unmarshal($this->db->f('component_type_id',
true), 'int'));
+
$control->set_component_id($this->unmarshal($this->db->f('component_id', true),
'int'));
+
$control->set_location_code($this->unmarshal($this->db->f('location_code',
true), 'int'));
+
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true),
'int'));
+
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval',
true), 'int'));
+ $controls_array[] = $control->toArray();
+ }
+
+ if( count( $controls_array ) > 0 ){
+ return $controls_array;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
function get_controls_by_control_area($control_area_id)
{
$controls_array = array();
Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php 2012-01-14 18:45:33 UTC
(rev 8570)
+++ trunk/controller/inc/class.uicalendar.inc.php 2012-01-15 13:46:27 UTC
(rev 8571)
@@ -93,12 +93,15 @@
}
$this->calendar_builder = new
calendar_builder($from_date, $to_date);
-
+
$repeat_type = 0;
- $check_list_array =
$this->so->get_check_lists_for_location( $location_code, $from_date, $to_date,
$repeat_type);
+ $controls_for_location_array =
$this->so_control->get_controls_by_location( $location_code );
+
+ $check_list_array =
$this->so->get_check_lists_for_location_2( $location_code, $from_date,
$to_date, $repeat_type);
+
$controls_calendar_array =
$this->calendar_builder->build_calendar_array( $check_list_array, null, 31,
"view_days" );
-
+
$location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
$month_array = array("Januar", "Februar", "Mars",
"April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November",
"Desember");
Modified: trunk/controller/inc/class.uicheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list.inc.php 2012-01-14 18:45:33 UTC
(rev 8570)
+++ trunk/controller/inc/class.uicheck_list.inc.php 2012-01-15 13:46:27 UTC
(rev 8571)
@@ -64,8 +64,8 @@
'register_case'
=> true,
'view_open_cases'
=> true,
'view_closed_cases'
=> true,
- 'view_measurements'
=> true
-
+ 'view_measurements'
=> true,
+ 'get_cases_for_check_list' =>
true
);
public function __construct()
@@ -209,7 +209,16 @@
return json_encode( $check_list );
}
+
+ public function get_cases_for_check_list()
+ {
+ $check_list_id = phpgw::get_var('check_list_id');
+ $check_items_with_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, "open", null,
"return_array");
+
+ return json_encode( $check_items_with_cases );
+ }
+
public function edit_check_list()
{
$check_list_id = phpgw::get_var('check_list_id');
Modified: trunk/controller/inc/component/class.calendar_builder.inc.php
===================================================================
--- trunk/controller/inc/component/class.calendar_builder.inc.php
2012-01-14 18:45:33 UTC (rev 8570)
+++ trunk/controller/inc/component/class.calendar_builder.inc.php
2012-01-15 13:46:27 UTC (rev 8571)
@@ -20,10 +20,10 @@
for($i=1;$i<=$num;$i++){
$calendar_array[$i] = null;
}
-
+
$date_generator = new
date_generator($control->get_start_date(), $control->get_end_date(),
$this->period_start_date, $this->period_end_date, $control->get_repeat_type(),
$control->get_repeat_interval());
$dates_array = $date_generator->get_dates();
-
+
// Inserts dates on behalf of repeat type and repeat
interval
foreach($dates_array as $date){
@@ -78,6 +78,7 @@
}
else if( $check_list->get_status() == 2 ){
$status =
"control_accomplished_with_errors";
+
$check_list_status_info->set_num_open_cases($check_list->get_num_open_cases());
}
else if( $check_list->get_status() == 3 )
{
Modified: trunk/controller/inc/component/class.date_generator.inc.php
===================================================================
--- trunk/controller/inc/component/class.date_generator.inc.php 2012-01-14
18:45:33 UTC (rev 8570)
+++ trunk/controller/inc/component/class.date_generator.inc.php 2012-01-15
13:46:27 UTC (rev 8571)
@@ -25,8 +25,11 @@
function generate_calendar(){
$control_start_date = $this->find_control_start_date();
+ echo " control_start_date: " . date("d/m-Y",
$control_start_date);
$period_start_date = $this->find_start_date_for_period(
$control_start_date );
-
+
+ echo " period_start_date: " . date("d/m-Y",
$period_start_date);
+
$interval_date = $period_start_date;
while($interval_date <= $this->period_end_date){
@@ -59,8 +62,11 @@
public function find_control_start_date(){
- if( $this->repeat_type == 1 || $this->repeat_type == 0 ){
+ if( $this->repeat_type == 0 ){
$search_date = $this->start_date;
+ }
+ else if( $this->repeat_type == 1 ){
+ $search_date = $this->start_date;
while(date("l", $search_date) != "Sunday")
{
Modified: trunk/controller/inc/helper/class.check_list_status_info.inc.php
===================================================================
--- trunk/controller/inc/helper/class.check_list_status_info.inc.php
2012-01-14 18:45:33 UTC (rev 8570)
+++ trunk/controller/inc/helper/class.check_list_status_info.inc.php
2012-01-15 13:46:27 UTC (rev 8571)
@@ -35,7 +35,8 @@
private $status_text;
private $deadline_date;
private $info_text;
-
+ private $num_open_cases;
+
public function __construct(){}
public function set_check_list_id($check_list_id)
@@ -73,7 +74,14 @@
public function get_info_text() { return $this->info_text; }
+ 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 serialize()
{
return array(
@@ -81,7 +89,8 @@
'status' => $this->get_status(),
'status_text' => $this->get_status_text(),
'deadline_date' => $this->get_deadline_date(),
- 'info_text' => $this->get_info_text()
+ 'info_text' => $this->get_info_text(),
+ 'num_open_cases' => $this->get_num_open_cases()
);
}
}
Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js 2012-01-14 18:45:33 UTC (rev
8570)
+++ trunk/controller/js/controller/ajax.js 2012-01-15 13:46:27 UTC (rev
8571)
@@ -136,7 +136,7 @@
var add_param = $(thisA).find("span").text();
- var requestUrl =
"http://portico/pe/index.php?menuaction=controller.uicheck_list.get_check_list_info"
+ add_param;
+ var requestUrl =
"http://portico/pe/index.php?menuaction=controller.uicheck_list.get_cases_for_check_list"
+ add_param;
$.ajax({
type: 'POST',
@@ -151,32 +151,22 @@
$(infoBox).show();
$(infoBox).html("");
- if(obj.deadline == 0 ){
- var deadline_string = "Ikke satt";
- }else{
- var date = new Date(obj.deadline *
1000);
- var deadline_string = date.getDate()
+ "/" + (parseInt(date.getMonth()) + 1) + "-" + date.getFullYear();
- }
+ $(infoBox).html("<h5>Åpne saker</h5>");
- var months = ['Januar', 'Februar', 'Mars',
'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November',
'Desember'];
-
-
- $(infoBox).html("<h5>Sjekkliste for " +
months[date.getMonth()]);
-
- var htmlList = "<ul>" +
-
"<li><label>Frist</label><span> " + deadline_string + "</span></li>" +
-
"<li><label>Status</label><span> " + obj.status + "</span></li>" +
-
"<li><label>Kommentar</label><span>" + obj.comment + "</span></li>" +
-
"<li><label>Sjekkpunkter</label><li>";
-
- $.each(obj.check_item_array, function(i) {
- htmlList += "<ul><li><label>" +
(parseInt(i) + 1) + ": Tittel</label><span>" +
obj.check_item_array[i].control_item.title + "</span></li>" +
-
"<li><label>Status</label><span>" + obj.check_item_array[i].status +
"</span></li>" +
-
"<li><label>Kommentar</label><span>" + obj.check_item_array[i].comment +
"</span></li></ul>";
+ var htmlList = "<ul>";
+
+ $.each(obj, function(i) {
+ htmlList += "<li><label>" +
(parseInt(i) + 1) + ": Tittel</label><span>" + obj[i].control_item.title +
"</span>";
+ htmlList += "<ul>";
+
+
$(obj[i].cases_array).each(function(j) {
+ htmlList += "<li>" + "Sak " +
(parseInt(j) + 1) + ": " + obj[i].cases_array[j].descr + "</li>";
+ });
+ htmlList += "</li></ul>";
});
- htmlList += "</li></ul>";
-
+ htmlList += "</ul>";
+
$(infoBox).append( htmlList );
}
}
Modified: trunk/controller/templates/base/calendar/view_calendar_month.xsl
===================================================================
--- trunk/controller/templates/base/calendar/view_calendar_month.xsl
2012-01-14 18:45:33 UTC (rev 8570)
+++ trunk/controller/templates/base/calendar/view_calendar_month.xsl
2012-01-15 13:46:27 UTC (rev 8571)
@@ -170,6 +170,23 @@
</div>
</xsl:when>
<xsl:when test="status = 'control_accomplished_with_errors'">
+
<div style="position:relative;background:
url(controller/images/status_icon_red_empty.png) no-repeat 50% 50%;">
+
<div id="info_box" style="position:absolute;display:none;"></div>
+
<a class="view_check_list">
+
<xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicheck_list_for_location.edit_check_list_for_location</xsl:text>
+
<xsl:text>&check_list_id=</xsl:text>
+
<xsl:value-of select="info/check_list_id"/>
+
</xsl:attribute>
+
<span style="display:none">
+
<xsl:text>&check_list_id=</xsl:text><xsl:value-of
select="info/check_list_id"/>
+
<xsl:text>&phpgw_return_as=json</xsl:text>
+
</span>
+
<xsl:value-of select="info/num_open_cases"/>
+
</a>
+
</div>
+
</xsl:when>
+ <!--
xsl:when test="status = 'control_accomplished_with_errors'">
<div style="position:relative;">
<div id="info_box" style="position:absolute;display:none;"></div>
<a class="view_check_list">
@@ -186,6 +203,7 @@
</a>
</div>
</xsl:when>
+ -->
<xsl:when test="status = 'control_not_accomplished_with_info'">
<div style="position:relative;">
<div id="info_box" style="position:absolute;display:none;"></div>
Modified: trunk/controller/templates/base/check_list/cases_tab_menu.xsl
===================================================================
--- trunk/controller/templates/base/check_list/cases_tab_menu.xsl
2012-01-14 18:45:33 UTC (rev 8570)
+++ trunk/controller/templates/base/check_list/cases_tab_menu.xsl
2012-01-15 13:46:27 UTC (rev 8571)
@@ -13,7 +13,7 @@
<xsl:value-of select="check_list/id"/>
<xsl:text>&phpgw_return_as=stripped_html</xsl:text>
</xsl:attribute>
- Vis åpne saker
+ Åpne saker
</a>
<a id="view_closed_cases">
<xsl:if test="$active_tab = 'view_closed_cases'">
@@ -25,7 +25,7 @@
<xsl:value-of select="check_list/id"/>
<xsl:text>&phpgw_return_as=stripped_html</xsl:text>
</xsl:attribute>
- Vis lukkede saker
+ Lukkede saker
</a>
<a id="view_measurements">
<xsl:if test="$active_tab = 'view_measurements'">
@@ -37,7 +37,7 @@
<xsl:value-of select="check_list/id"/>
<xsl:text>&phpgw_return_as=stripped_html</xsl:text>
</xsl:attribute>
- Vis målinger
+ Målinger
</a>
</div>
</xsl:template>
Modified: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css 2012-01-14 18:45:33 UTC
(rev 8570)
+++ trunk/controller/templates/base/css/base.css 2012-01-15 13:46:27 UTC
(rev 8571)
@@ -1221,4 +1221,13 @@
li.check_item_cases ul li {
list-style: disc outside none;
margin: 5px 0 0 20px;
+}
+a.view_check_list{
+ color: #FFFFFF;
+ display: block;
+ font-size: 10px;
+ font-weight: bold;
+ height: 13px;
+ text-decoration: none;
+ width: 24px;
}
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8571],
Torstein <=