[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8627]
From: |
Torstein |
Subject: |
[Fmsystem-commits] [8627] |
Date: |
Sat, 21 Jan 2012 09:47:00 +0000 |
Revision: 8627
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8627
Author: vator
Date: 2012-01-21 09:47:00 +0000 (Sat, 21 Jan 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/controller/inc/class.socheck_list.inc.php
trunk/controller/inc/class.uicalendar.inc.php
trunk/controller/inc/component/class.calendar_builder.inc.php
trunk/controller/js/controller/ajax.js
trunk/controller/templates/base/calendar/view_calendar_year.xsl
trunk/controller/templates/base/check_list/view_open_cases.xsl
Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php 2012-01-20 15:26:17 UTC
(rev 8626)
+++ trunk/controller/inc/class.socheck_list.inc.php 2012-01-21 09:47:00 UTC
(rev 8627)
@@ -324,7 +324,7 @@
$sql .= "AND cl.control_id = c.id ";
$sql .= "AND cl.deadline >= $from_date_ts AND $to_date_ts >
cl.deadline ";
$sql .= "GROUP BY c.id";
-
+
$this->db->query($sql);
if ($this->db->next_record() & $this->db->f('count', true) > 0)
{
Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php 2012-01-20 15:26:17 UTC
(rev 8626)
+++ trunk/controller/inc/class.uicalendar.inc.php 2012-01-21 09:47:00 UTC
(rev 8627)
@@ -121,7 +121,8 @@
$controls_with_check_list =
$this->populate_controls_with_check_lists($controls_for_location_array,
$control_id_with_check_list_array);
- $controls_calendar_array =
$this->calendar_builder->build_calendar_array( $controls_with_check_list, 31,
"view_days" );
+ $controls_calendar_array = array();
+ $controls_calendar_array =
$this->calendar_builder->build_calendar_array( $controls_calendar_array,
$controls_with_check_list, 31, "view_days" );
$location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
@@ -198,55 +199,25 @@
$repeat_type = null;
$controls_for_location_array =
$this->so_control->get_controls_by_location($location_code, $from_date_ts,
$to_date_ts, $repeat_type );
-
+
$this->calendar_builder = new
calendar_builder($from_date_ts, $to_date_ts);
+
+ $controls_calendar_array = array();
+ // Puts aggregate values for daily controls in a twelve
month array
foreach($controls_for_location_array as $control){
-
if($control->get_repeat_type() == 0){
-
- $twelve_month_array = array();
-
- $trail_year = $year;
-
-
for($from_month=1;$from_month<=12;$from_month++){
-
- $trail_from_date_ts =
strtotime("$from_month/01/$trail_year");
-
- if(($from_month + 1) > 12)
- {
- $to_month = 1;
- $cal_to_year = $year +
1;
- }
- else
- {
- $to_month = $from_month
+ 1;
- }
-
- $trail_to_date_ts =
strtotime("$to_month/01/$trail_year");
-
-
$num_open_cases_for_control_array = array();
-
$num_open_cases_for_control_array =
$this->so_check_list->get_num_open_cases_for_control( $control->get_id(),
$location_code, $trail_from_date_ts, $trail_to_date_ts );
-
- $status =
"control_agg_accomplished_with_errors";
-
-
$twelve_month_array[$from_month-1]["status"] = $status;
-
$twelve_month_array[$from_month-1]["info"] =
$num_open_cases_for_control_array["count"];
-
- }
-
- $days_controls_calendar_array[] =
array("control" => $control->toArray(), "calendar_array" =>
$twelve_month_array);
+ $controls_calendar_array =
$this->calendar_builder->build_agg_calendar_array($controls_calendar_array,
$control, $location_code, $year);
}
-
}
$repeat_type = 2;
$control_check_list_array =
$this->so->get_check_lists_for_location( $location_code, $from_date_ts,
$to_date_ts, $repeat_type );
- $month_controls_calendar_array =
$this->calendar_builder->build_calendar_array( $control_check_list_array, 12,
"view_months" );
-
- $controls_calendar_array =
array_merge($days_controls_calendar_array, $month_controls_calendar_array);
+ $controls_calendar_array =
$this->calendar_builder->build_calendar_array( $controls_calendar_array,
$control_check_list_array, 12, "view_months" );
+ //print_r($controls_calendar_array);
+
$location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
$heading_array = array("Jan", "Feb", "Mar", "Apr",
"Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des");
Modified: trunk/controller/inc/component/class.calendar_builder.inc.php
===================================================================
--- trunk/controller/inc/component/class.calendar_builder.inc.php
2012-01-20 15:26:17 UTC (rev 8626)
+++ trunk/controller/inc/component/class.calendar_builder.inc.php
2012-01-21 09:47:00 UTC (rev 8627)
@@ -1,7 +1,8 @@
<?php
-
+phpgw::import_class('controller.socheck_list');
include_class('controller', 'date_generator', 'inc/component/');
+
class calendar_builder {
private $period_start_date;
@@ -12,7 +13,7 @@
$this->period_end_date = $period_end_date;
}
- public function build_calendar_array( $control_array, $num,
$period_type ){
+ public function build_calendar_array( $controls_calendar_array,
$control_array, $num, $period_type ){
foreach($control_array as $control){
@@ -76,37 +77,65 @@
return $controls_calendar_array;
}
- // Function receives array with control objects that each contain
check_lists for a certain period
- public function build_agg_calendar_array( $controls_array ){
-
- $calendar_array = array();
+ public function build_agg_calendar_array($controls_calendar_array,
$control, $location_code, $year){
+
+ if( date("Y", $control->get_start_date()) == $year ){
+ $from_month = date("n", $control->get_start_date());
+ }else{
+ $from_month = 1;
+ }
- foreach($controls_array as $control_array){
+ if( date("Y", $control->get_end_date()) == $year ){
+ $to_month = date("n", $control->get_end_date());
+ }else{
+ $to_month = 12;
+ }
+
+ $todays_date_ts = mktime(0,0,0,date("m"), date("d"), date("Y"));
+
+ $twelve_month_array = array();
+
+ for($i=1;$i<=12;$i++){
+ $trail_date_ts = strtotime("$i/01/$year");
+
+ if($trail_date_ts > $control->get_start_date() &
$trail_date_ts < $todays_date_ts){
+ $status = "controls_not_accomplished";
+ }else if($trail_date_ts > $control->get_start_date() &
$trail_date_ts > $todays_date_ts){
+ $status = "controls_registered";
+ }
+
+ $twelve_month_array[$i-1]["status"] = $status;
+ }
+
+ print_r($twelve_month_array);
+
+ for($from_month;$from_month<=$to_month;$from_month++){
+
+ $trail_from_date_ts = strtotime("$from_month/01/$year");
- $control_info = $control_array['control'];
- $check_list_array = $control_array['check_list'];
-
- $control_id = $control_info['id'];
-
- // Initialises twelve_months_array
- for($i=0;$i<12;$i++){
- $calendar_array[$i] = null;
+ $trail_to_date_ts = strtotime("$to_month/01/$year");
+ $so_check_list =
CreateObject('controller.socheck_list');
+
+ $num_open_cases_for_control_array = array();
+ $num_open_cases_for_control_array =
$so_check_list->get_num_open_cases_for_control( $control->get_id(),
$location_code, $trail_from_date_ts, $trail_to_date_ts );
+
+ if( !empty($num_open_cases_for_control_array) ){
+ $status = "controls_accomplished_with_errors";
+
+ $twelve_month_array[$from_month-1]["status"] =
$status;
+ $twelve_month_array[$from_month-1]["info"] =
$num_open_cases_for_control_array["count"];
+ }else{
+ $status =
"controls_accomplished_without_errors";
+
+ $twelve_month_array[$from_month-1]["status"] =
$status;
}
-
- $status = "control_agg_accomplished_with_errors";
-
- // Inserts check_list object on deadline month in
twelve_months_array
- foreach($check_list_array as $check_list){
- $calendar_array[ date("m",
$check_list['deadline']) - 1 ] ["status"] = $status;
- $calendar_array[ date("m",
$check_list['deadline']) - 1 ] ["info"] = $check_list['count'];
- }
-
- $control_calendar_array[] = array("control" =>
$control_info, "calendar_array" => $calendar_array);
}
-
- return $control_calendar_array;
+
+ $controls_calendar_array[] = array("control" =>
$control->toArray(), "calendar_array" => $twelve_month_array);
+
+ return $controls_calendar_array;
}
-
+
function init_calendar( $control, $calendar_array, $num, $period_type ){
// Initialises twelve_months_array
Modified: trunk/controller/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js 2012-01-20 15:26:17 UTC (rev
8626)
+++ trunk/controller/js/controller/ajax.js 2012-01-21 09:47:00 UTC (rev
8627)
@@ -369,6 +369,13 @@
return false;
});
+ $(".make_case_editable").live("click", function(e){
+ var thisForm = $(this);
+ var submitBnt = $(thisForm).find("input[type='submit']");
+ $(submitBnt).removeClass("not_active");
+ });
+
+
$("#frm_update_check_list").live("click", function(e){
var thisForm = $(this);
var submitBnt = $(thisForm).find("input[type='submit']");
@@ -394,6 +401,7 @@
});
});
+
//Updates order number for hidden field and number in front of row
function update_order_nr(element, sign){
Modified: trunk/controller/templates/base/calendar/view_calendar_year.xsl
===================================================================
--- trunk/controller/templates/base/calendar/view_calendar_year.xsl
2012-01-20 15:26:17 UTC (rev 8626)
+++ trunk/controller/templates/base/calendar/view_calendar_year.xsl
2012-01-21 09:47:00 UTC (rev 8627)
@@ -40,12 +40,10 @@
</form>
<ul id="icon_color_map">
- <li><img height="15"
src="controller/images/status_icon_yellow_ring.png" /><span>Kontroll satt
opp</span></li>
- <li><img height="15"
src="controller/images/status_icon_yellow.png" /><span>Kontroll har planlagt
dato</span></li>
- <li><img height="15"
src="controller/images/status_icon_dark_green.png" /><span>Kontroll gjennomført
uten feil før frist</span></li>
- <li><img height="15"
src="controller/images/status_icon_light_green.png" /><span>Kontroll
gjennomført uten feil etter frist</span></li>
- <li><img height="15"
src="controller/images/status_icon_red_empty.png" /><span>Kontroll gjennomført
med rapporterte feil</span></li>
- <li><img height="15"
src="controller/images/status_icon_red_cross.png" /><span>Kontroll ikke
gjennomført</span></li>
+ <li><img height="15"
src="controller/images/status_icon_yellow_ring.png" /><span>Kontroller satt
opp</span></li>
+ <li><img height="15"
src="controller/images/status_icon_dark_green.png" /><span>Kontroller
gjennomført uten feil</span></li>
+ <li><img height="15"
src="controller/images/status_icon_red_empty.png" /><span>Kontroller
gjennomført med rapporterte feil</span></li>
+ <li><img height="15"
src="controller/images/status_icon_red_cross.png" /><span>Kontroller ikke
gjennomført</span></li>
</ul>
</div>
@@ -111,7 +109,7 @@
<div class="months">
<xsl:for-each
select="calendar_array">
<xsl:choose>
-
<xsl:when test="status = 'control_registered'">
+
<xsl:when test="status = 'control_registered' or status =
'controls_registered'">
<div>
<a>
<xsl:attribute name="href">
@@ -166,6 +164,11 @@
</a>
</div>
</xsl:when>
+
<xsl:when test="status = 'controls_accomplished_without_errors'">
+
<div>
+
<img height="15" src="controller/images/status_icon_dark_green.png" />
+
</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>
@@ -183,20 +186,10 @@
</a>
</div>
</xsl:when>
-
<xsl:when test="status = 'control_agg_accomplished_with_errors'">
+
<xsl:when test="status = 'controls_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</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"/>
+
<a class="view_check_list">
+
<xsl:value-of select="info"/>
</a>
</div>
@@ -206,7 +199,7 @@
<img height="12" src="controller/images/status_icon_red_cross.png" />
</div>
</xsl:when>
-
<xsl:when test="status = 'control_not_accomplished'">
+
<xsl:when test="status = 'control_not_accomplished' or status =
'controls_not_accomplished'">
<div>
<img height="12" src="controller/images/status_icon_red_cross.png" />
</div>
Modified: trunk/controller/templates/base/check_list/view_open_cases.xsl
===================================================================
--- trunk/controller/templates/base/check_list/view_open_cases.xsl
2012-01-20 15:26:17 UTC (rev 8626)
+++ trunk/controller/templates/base/check_list/view_open_cases.xsl
2012-01-21 09:47:00 UTC (rev 8627)
@@ -21,7 +21,12 @@
<ul>
<xsl:for-each select="cases_array">
<xsl:variable name="cases_id"><xsl:value-of select="id"/></xsl:variable>
-
<li><span class="order_nr"><xsl:number /></span>. <xsl:value-of select="descr"/>
+
<li><span style="float:left;" class="order_nr"><xsl:number />.</span>
+
<div style="float:left;width:500px;" class="description">
+
+
<xsl:value-of select="descr"/>
+
+
</div>
<xsl:choose>
<xsl:when test="location_item_id > 0">
<div style="float:right;">
@@ -40,7 +45,7 @@
</xsl:otherwise>
</xsl:choose>
<div class="quick_menu">
-
<a>
+
<a class="make_case_editable">
<xsl:attribute name="href">
<xsl:text>index.php?menuaction=controller.uicase.edit_case</xsl:text>
<xsl:text>&case_id=</xsl:text>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8627],
Torstein <=