fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9078] Added comments


From: Torstein
Subject: [Fmsystem-commits] [9078] Added comments
Date: Thu, 29 Mar 2012 12:52:29 +0000

Revision: 9078
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9078
Author:   vator
Date:     2012-03-29 12:52:29 +0000 (Thu, 29 Mar 2012)
Log Message:
-----------
Added comments

Modified Paths:
--------------
    trunk/controller/inc/class.uicalendar.inc.php

Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php       2012-03-29 12:52:01 UTC 
(rev 9077)
+++ trunk/controller/inc/class.uicalendar.inc.php       2012-03-29 12:52:29 UTC 
(rev 9078)
@@ -168,6 +168,9 @@
                        $location_code = phpgw::get_var('location_code');
                        $year = phpgw::get_var('year');
                        
+                       // Array that should conatain control and calendar 
objects that will be sent to view            
+                       $controls_calendar_array = array();
+                       
                        if(empty($year)){
                                $year = date("Y");
                        }
@@ -177,7 +180,7 @@
                        $from_date_ts = strtotime("01/01/$year");
                        $to_year = $year + 1;
                        $to_date_ts = strtotime("01/01/$to_year");
-                       
+                                               
                        $criteria = array
                        (
                                'user_id' => 
$GLOBALS['phpgw_info']['user']['account_id'],
@@ -192,23 +195,25 @@
                        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);
                        
-                       $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();
-               
+                       // 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){
                                if($control->get_repeat_type() == 0 | 
$control->get_repeat_type() == 1){
+                                       
+                                       // 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 );
                                }
                        }
-               
+                       
                        $repeat_type = 2;
                        // Fetches control ids with check lists for specified 
time period
                        $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location_2($location_code, $from_date_ts, 
$to_date_ts, $repeat_type);
@@ -346,13 +351,17 @@
                        return $controls_with_check_list;
                }
                
+               // Generates array of aggregated number of open cases for each 
month in time period 
                function build_agg_open_cases_pr_month_array($control, 
$location_code, $year){
+                               
+                       // Checks if control starts in the year that will be 
shown 
                        if( date("Y", $control->get_start_date()) == $year ){
                                $from_month = date("n", 
$control->get_start_date());    
                        }else{
                                $from_month = 1;
                        }
                        
+                       // Checks if control ends in the year that will be shown
                        if( date("Y", $control->get_end_date()) == $year ){
                                $to_month = date("n", $control->get_end_date());
                        }else{
@@ -361,16 +370,18 @@
                                        
                        $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++){
                
                                $trail_from_date_ts = 
strtotime("$from_month/01/$year");
-                               
                                $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 );       
+                               
+                               // Fetches aggregate value for open cases in a 
month from db    
+                               $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 ); 
                
+                               // 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) ){
                                        $status_agg_month_info = new 
status_agg_month_info();
                                        
$status_agg_month_info->set_month_nr(date("n", $from_month));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]