fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9627]


From: Torstein
Subject: [Fmsystem-commits] [9627]
Date: Tue, 19 Jun 2012 12:08:12 +0000

Revision: 9627
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9627
Author:   vator
Date:     2012-06-19 12:08:11 +0000 (Tue, 19 Jun 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/component/class.year_calendar.inc.php
    trunk/controller/inc/helper/class.check_list_status_manager.inc.php

Modified: trunk/controller/inc/component/class.year_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar.inc.php  2012-06-19 
10:35:54 UTC (rev 9626)
+++ trunk/controller/inc/component/class.year_calendar.inc.php  2012-06-19 
12:08:11 UTC (rev 9627)
@@ -1,8 +1,10 @@
 <?php
 phpgw::import_class('controller.socheck_list');
 include_class('controller', 'date_generator', 'inc/component/');
+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/');
+include_class('controller', 'check_list', 'inc/model/');
        
 
 class year_calendar {
@@ -45,43 +47,30 @@
                
     // Inserts dates 
     foreach($dates_array as $date_ts){
-      $todays_date_ts = $this->get_todays_date_ts();
-
-      if($date_ts < $todays_date_ts){
-        $status = "CONTROL_NOT_DONE";
-      }else{
-        $status = "CONTROL_REGISTERED";
-      }
-                       
-      $this->calendar_array[ date("n", $date_ts) ]["status"]  = $status;
+       
+       $check_list = new controller_check_list();
+       $check_list->set_deadline( $date_ts );
+       
+       $check_list_status_manager = new check_list_status_manager( $check_list 
);
+                       $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list(); 
+       
+                       $month_nr = date("n", $date_ts);
       
-      if($this->type = "component"){
-       $this->calendar_array[ date("n", $date_ts) ]["info"]  = array(
-                                                                               
                                                                                
                                                                                
                        "date" => $date_ts, 
-                                                                               
                                                                                
                                                                                
                        "control_id" => $this->control->get_id(),
-                                                                               
                                                                                
                                                                                
                        "type" => "component", 
-                                                                               
                                                                                
                                                                                
                        "component" = $component->toArray() 
-                                                                               
                                                                                
                                                                                
                );
-      }else{
-       $this->calendar_array[ date("n", $date_ts) ]["info"]  = array(
-                                                                               
                                                                                
                                                                                
                        "date" => $date_ts, 
-                                                                               
                                                                                
                                                                                
                        "control_id" => $this->control->get_id(),
-                                                                               
                                                                                
                                                                                
                        "type" => "location", 
-                                                                               
                                                                                
                                                                                
                        "location_code" = $location_code 
-                                                                               
                                                                                
                                                                                
                );
-      }
+      $this->calendar_array[ $month_nr ]["status"]  = 
$check_list_status_info->get_status();
+      $this->calendar_array[ $month_nr ]["info"]  = 
$check_list_status_info->serialize();
                }
        }
        
        public function build_calendar( $check_lists_array ){
                
                foreach($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(); 
-                                                       
-                       $this->calendar_array[ date("n", 
$check_list_status_info->get_deadline_date_ts()) ]["status"]  = 
$check_list_status_info->get_status();
-                       $this->calendar_array[ date("n", 
$check_list_status_info->get_deadline_date_ts()) ]["info"]  = 
$check_list_status_info->serialize();
+
+                       $month_nr = date("n", 
$check_list_status_info->get_deadline_date_ts());
+                       
+                       $this->calendar_array[ $month_nr ]["status"]  = 
$check_list_status_info->get_status();
+                       $this->calendar_array[ $month_nr ]["info"]  = 
$check_list_status_info->serialize();
                }
                
                return $this->calendar_array;
@@ -92,7 +81,7 @@
                foreach($agg_open_cases_pr_month_array as 
$status_agg_month_info)
                {
                        $status = "CONTROLS_DONE_WITH_ERRORS";
-                                       
+                       
                        
$this->calendar_array[$status_agg_month_info->get_month_nr()]["status"] = 
$status;
                        
$this->calendar_array[$status_agg_month_info->get_month_nr()]["info"]["agg_open_errors"]
 = $status_agg_month_info->get_agg_open_cases();
                }
@@ -111,11 +100,6 @@
                return $heading_array;
        }
        
-       public static function get_todays_date_ts(){
-               $todays_date_ts = mktime(0,0,0,date("m"), date("d"), date("Y"));
-               return $todays_date_ts;
-       }
-       
        public static function get_start_date_year_ts($year){
          $start_date_year_ts = strtotime("01/01/$year");
                        

Modified: trunk/controller/inc/helper/class.check_list_status_manager.inc.php
===================================================================
--- trunk/controller/inc/helper/class.check_list_status_manager.inc.php 
2012-06-19 10:35:54 UTC (rev 9626)
+++ trunk/controller/inc/helper/class.check_list_status_manager.inc.php 
2012-06-19 12:08:11 UTC (rev 9627)
@@ -43,44 +43,57 @@
                        $check_list_status_info = new check_list_status_info();
                        $check_list_status_info->set_check_list_id( 
$this->check_list->get_id() );
        
-                       $todays_date_ts = mktime(0,0,0,date("m"), date("d"), 
date("Y"));
+                       $todays_date_ts = $this->get_todays_date_ts();
                        
-                       // Control PLANNED - the checklist has a planned date
-                       if( $this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date() 
> 0 & $this->check_list->get_deadline() >= $todays_date_ts)
-                       {
-                               $status = "CONTROL_PLANNED";
+                       if( $this->check_list->get_id() == 0){
+                               if($this->check_list->get_deadline() < 
$todays_date_ts){
+               $status = "CONTROL_NOT_DONE";
+             }else{
+               $status = "CONTROL_REGISTERED";
+             }
                        }
-                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date() 
> 0 & $this->check_list->get_deadline() < $todays_date_ts )
-                       {
-                               $status = "CONTROL_NOT_DONE_WITH_PLANNED_DATE";
+                       else{
+                               if($this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date() 
> 0 & $this->check_list->get_deadline() >= $todays_date_ts)
+                               {
+                                       $status = "CONTROL_PLANNED";
+                               }
+                               else if( $this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_planned_date() 
> 0 & $this->check_list->get_deadline() < $todays_date_ts )
+                               {
+                                       $status = 
"CONTROL_NOT_DONE_WITH_PLANNED_DATE";
+                               }
+                               else if( $this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_deadline() < 
$todays_date_ts )
+                               {
+                                       $status = "CONTROL_NOT_DONE";
+                               }
+                               else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() > 
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() == 
0)
+                               {
+                                       $status = 
"CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS";
+                               }
+                               else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() < 
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() == 
0)
+                               {
+                                       $status = 
"CONTROL_DONE_IN_TIME_WITHOUT_ERRORS";
+                               }
+                               else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_num_open_cases() > 
0){
+                                       $status = "CONTROL_DONE_WITH_ERRORS";
+                                       
$check_list_status_info->set_num_open_cases($this->check_list->get_num_open_cases());
+                               }
+                               else if( $this->check_list->get_status() == 
controller_check_list::STATUS_CANCELED)
+                               {
+                                       $status = "CONTROL_CANCELED";
+                               }
                        }
-                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE & $this->check_list->get_deadline() < 
$todays_date_ts )
-                       {
-                               $status = "CONTROL_NOT_DONE";
-                       }
-                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() > 
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() == 
0)
-                       {
-                               $status = 
"CONTROL_DONE_OVER_TIME_WITHOUT_ERRORS";
-                       }
-                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_completed_date() < 
$this->check_list->get_deadline() & $this->check_list->get_num_open_cases() == 
0)
-                       {
-                               $status = "CONTROL_DONE_IN_TIME_WITHOUT_ERRORS";
-                       }
-                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_DONE & $this->check_list->get_num_open_cases() > 
0){
-                               $status = "CONTROL_DONE_WITH_ERRORS";
-                               
$check_list_status_info->set_num_open_cases($this->check_list->get_num_open_cases());
-                       }
-                       else if( $this->check_list->get_status() == 
controller_check_list::STATUS_CANCELED)
-                       {
-                               $status = "CONTROL_CANCELED";
-                       }
                        
-                       
                        $check_list_status_info->set_deadline_date_txt( 
date("d/m-Y", $this->check_list->get_deadline()) );
                        $check_list_status_info->set_deadline_date_ts( 
$this->check_list->get_deadline() );
                        $check_list_status_info->set_location_code( 
$this->check_list->get_location_code() );
                        $check_list_status_info->set_status($status);
-               
+                       
                        return $check_list_status_info; 
                }
+               
+               public static function get_todays_date_ts(){
+                 $todays_date_ts = mktime(0,0,0,date("m"), date("d"), 
date("Y"));
+                 
+                 return $todays_date_ts;
+         }
        }




reply via email to

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