[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9355]
From: |
Torstein |
Subject: |
[Fmsystem-commits] [9355] |
Date: |
Thu, 10 May 2012 11:07:38 +0000 |
Revision: 9355
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9355
Author: vator
Date: 2012-05-10 11:07:37 +0000 (Thu, 10 May 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/controller/inc/class.uicalendar.inc.php
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
Removed Paths:
-------------
trunk/controller/inc/component/class.calendar_builder.inc.php
Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php 2012-05-10 09:46:50 UTC
(rev 9354)
+++ trunk/controller/inc/class.uicalendar.inc.php 2012-05-10 11:07:37 UTC
(rev 9355)
@@ -35,7 +35,6 @@
include_class('controller', 'check_item', 'inc/model/');
include_class('controller', 'check_list_status_info', 'inc/helper/');
include_class('controller', 'status_agg_month_info', 'inc/helper/');
- include_class('controller', 'calendar_builder', 'inc/component/');
include_class('controller', 'location_finder', 'inc/helper/');
include_class('controller', 'year_calendar', 'inc/component/');
include_class('controller', 'month_calendar', 'inc/component/');
@@ -49,7 +48,6 @@
private $so_control_item;
private $so_check_list;
private $so_check_item;
- private $calendar_builder;
public $public_functions = array
(
@@ -167,7 +165,7 @@
$to_year = $year + 1;
$to_date_ts = strtotime("01/01/$to_year");
- $manage=false;
+ $manage = false;
if($manage)
{
@@ -189,13 +187,12 @@
if(empty($location_code)){
$location_code =
$my_locations[0]["location_code"];
}
-
+
// 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 = null);
-
- // Creates a calendar object for time period
- $this->calendar_builder = new
calendar_builder($from_date_ts, $to_date_ts);
+ $controls_calendar_array = array();
+
// Loops through controls with repeat type day or week
in controls_for_location_array
// and populates array that contains aggregate open
cases pr month.
foreach($controls_for_location_array as $control){
@@ -203,8 +200,11 @@
// 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($control, $location_code, $year);
-
-
$control->set_agg_open_cases_pr_month_array( $agg_open_cases_pr_month_array );
+
+ $year_calendar = new
year_calendar($control, $year);
+ $calendar_array =
$year_calendar->build_agg_calendar($agg_open_cases_pr_month_array);
+
+ $controls_calendar_array[] =
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
}
}
@@ -221,8 +221,16 @@
// 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);
-
- $controls_calendar_array =
$this->calendar_builder->build_calendar_array( $controls_for_location_array,
12, "view_months" );
+
+ foreach($controls_for_location_array as $control){
+ if($control->get_repeat_type() == 2 |
$control->get_repeat_type() == 3){
+
+ $year_calendar = new
year_calendar($control, $year);
+ $calendar_array =
$year_calendar->build_calendar( $control->get_check_lists_array() );
+
+ $controls_calendar_array[] =
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
+ }
+ }
$location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
@@ -374,6 +382,7 @@
$data = array
(
+ 'control'
=> $control->toArray(),
'my_locations'
=> $my_locations,
'view_location_code' =>
$location_code,
'property_array'
=> $property_array,
Deleted: trunk/controller/inc/component/class.calendar_builder.inc.php
===================================================================
--- trunk/controller/inc/component/class.calendar_builder.inc.php
2012-05-10 09:46:50 UTC (rev 9354)
+++ trunk/controller/inc/component/class.calendar_builder.inc.php
2012-05-10 11:07:37 UTC (rev 9355)
@@ -1,112 +0,0 @@
-<?php
-phpgw::import_class('controller.socheck_list');
-include_class('controller', 'date_generator', 'inc/component/');
-include_class('controller', 'check_list_status_info', 'inc/helper/');
-include_class('controller', 'check_list_status_manager', 'inc/helper/');
-
-/* 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
-*/
-
-class calendar_builder {
-
- private $period_start_date;
- private $period_end_date;
-
- public function __construct($period_start_date, $period_end_date){
- $this->period_start_date = $period_start_date;
- $this->period_end_date = $period_end_date;
- }
-
- function init_calendar( $control, $num, $period_type ){
-
- $calendar_array = array();
-
- 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
- foreach($dates_array as $date){
-
- $todays_date = mktime(0,0,0,date("m"), date("d"),
date("Y"));
-
- if($date < $todays_date){
- $status = "CONTROL_NOT_DONE";
- }else{
- $status = "CONTROL_REGISTERED";
- }
-
- if( $period_type == "view_months" )
- {
- $calendar_array[ date("n", $date) ]["status"]
= $status;
- $calendar_array[ date("n", $date) ]["info"] =
array("date" => $date, "control_id" => $control->get_id());
- }
- else if( $period_type == "view_days" )
- {
- $calendar_array[ date("j", $date) ]["status"]
= $status;
- $calendar_array[ date("j", $date) ]["info"] =
array("date" => $date, "control_id" => $control->get_id());
- }
- }
-
- return $calendar_array;
- }
-
- // Function that puts checklists into a twelve months array for
displaying a year or a days array for displaying a month
- public function build_calendar_array( $controls_with_check_lists_array,
$num, $period_type ){
-
- foreach($controls_with_check_lists_array as $control){
-
- // ======================== DISPLAY STATUS FOR A MONTH
OR DAYS IN A MONTH ==========================
- if($period_type == "view_days" | ($period_type ==
"view_months" & $control->get_repeat_type() == 2 | $control->get_repeat_type()
== 3))
- {
- $check_list_array =
$control->get_check_lists_array();
-
- $calendar_array = $this->init_calendar(
$control, $num, $period_type );
-
- foreach($control->get_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();
-
- if( $period_type == "view_months" )
- {
- $calendar_array[ date("n",
$check_list_status_info->get_deadline_date_ts()) ]["status"] =
$check_list_status_info->get_status();
- $calendar_array[ date("n",
$check_list_status_info->get_deadline_date_ts()) ]["info"] =
$check_list_status_info->serialize();
- }
- else if( $period_type == "view_days" )
- {
- $calendar_array[ date("j",
$check_list->get_deadline()) ]["status"] =
$check_list_status_info->get_status();
- $calendar_array[ date("j",
$check_list->get_deadline()) ]["info"] = $check_list_status_info->serialize();
- }
- }
-
- $controls_calendar_array[] = array("control" =>
$control->toArray(), "calendar_array" => $calendar_array);
- }
- // ======================== DISPLAY AGGREGATE STATUS
FOR A MONTH ==========================
- else if($period_type == "view_months" &
($control->get_repeat_type() == 0 | $control->get_repeat_type() == 1))
- {
- $calendar_array = array();
-
- for($i=1;$i<=12;$i++)
- $calendar_array[$i] = "";
-
-
foreach($control->get_agg_open_cases_pr_month_array() as $status_agg_month_info)
- {
- $status = "CONTROLS_DONE_WITH_ERRORS";
-
-
$calendar_array[$status_agg_month_info->get_month_nr()]["status"] = $status;
-
$calendar_array[$status_agg_month_info->get_month_nr()]["info"] =
$status_agg_month_info->get_agg_open_cases();
- }
-
- $controls_calendar_array[] = array("control" =>
$control->toArray(), "calendar_array" => $calendar_array);
- }
- }
-
- return $controls_calendar_array;
- }
-}
\ No newline at end of file
Modified:
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
===================================================================
---
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
2012-05-10 09:46:50 UTC (rev 9354)
+++
trunk/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
2012-05-10 11:07:37 UTC (rev 9355)
@@ -30,6 +30,17 @@
</div>
<div class="middle">
<xsl:call-template name="icon_color_map" />
+
+ <a style="display:block;font-weight: bold;font-size:
14px;float:left;">
+ <xsl:attribute name="href">
+
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_year_for_locations</xsl:text>
+ <xsl:text>&year=</xsl:text>
+ <xsl:value-of select="year"/>
+ <xsl:text>&control_id=</xsl:text>
+ <xsl:value-of select="control/id"/>
+ </xsl:attribute>
+ Ã…rsoversikt
+ </a>
</div>
<div id="cal_wrp">
<table id="calendar" class="month">
@@ -42,16 +53,7 @@
</th>
<xsl:for-each select="heading_array">
<th>
- <a>
- <xsl:attribute
name="href">
-
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_month_for_locations</xsl:text>
-
<xsl:text>&year=</xsl:text>
-
<xsl:value-of select="$year"/>
-
<xsl:text>&month=</xsl:text>
-
<xsl:number/>
- </xsl:attribute>
- <xsl:value-of
select="."/>
- </a>
+ <xsl:value-of
select="."/>
</th>
</xsl:for-each>
</tr>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9355],
Torstein <=