fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9993] Overwriting earlier commited formatting


From: Torstein
Subject: [Fmsystem-commits] [9993] Overwriting earlier commited formatting
Date: Tue, 11 Sep 2012 07:51:08 +0000

Revision: 9993
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9993
Author:   vator
Date:     2012-09-11 07:51:08 +0000 (Tue, 11 Sep 2012)
Log Message:
-----------
Overwriting earlier commited formatting

Modified Paths:
--------------
    trunk/controller/inc/component/class.check_list_status_info.inc.php
    trunk/controller/inc/component/class.check_list_status_manager.inc.php
    trunk/controller/inc/component/class.date_generator.inc.php
    trunk/controller/inc/component/class.month_calendar.inc.php
    trunk/controller/inc/component/class.status_agg_month_info.inc.php
    trunk/controller/inc/component/class.year_calendar.inc.php
    trunk/controller/inc/component/class.year_calendar_agg.inc.php

Modified: trunk/controller/inc/component/class.check_list_status_info.inc.php
===================================================================
--- trunk/controller/inc/component/class.check_list_status_info.inc.php 
2012-09-11 07:49:59 UTC (rev 9992)
+++ trunk/controller/inc/component/class.check_list_status_info.inc.php 
2012-09-11 07:51:08 UTC (rev 9993)
@@ -1,163 +1,150 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id$
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-class check_list_status_info {
+       class check_list_status_info
+       {               
+               private $check_list_id;
+               private $control_id;
+               private $status;
+               private $status_text;
+               private $deadline_date_ts;
+               private $deadline_date_txt;
+               private $info_text;
+               private $location_code;
+               private $component_id;
+               private $location_id;
+               private $type;
+               private $num_open_cases;
+                       
+               public function __construct(){}
+               
+               public function set_check_list_id($check_list_id)
+               {
+                       $this->check_list_id = $check_list_id;
+               }
+               
+               public function get_check_list_id() { return 
$this->check_list_id; }
+               
+               public function set_control_id($control_id)
+               {
+                       $this->control_id = $control_id;
+               }
+               
+               public function get_control_id() { return $this->control_id; }
+               
+               public function set_status($status)
+               {
+                       $this->status = $status;
+               }
+               
+               public function get_status() { return $this->status; }
+               
+               public function set_status_text($status_text)
+               {
+                       $this->status_text = $status_text;
+               }
+               
+               public function get_status_text() { return $this->status_text; }
+               
+               public function set_deadline_date_ts($deadline_date_ts)
+               {
+                       $this->deadline_date_ts = $deadline_date_ts;
+               }
+               
+               public function get_deadline_date_ts() { return 
$this->deadline_date_ts; }
 
-  private $check_list_id;
-  private $control_id;
-  private $status;
-  private $status_text;
-  private $deadline_date_ts;
-  private $deadline_date_txt;
-  private $info_text;
-  private $location_code;
-  private $component_id;
-  private $location_id;
-  private $type;
-  private $num_open_cases;
-
-  public function __construct() {
-    
-  }
-
-  public function set_check_list_id($check_list_id) {
-    $this->check_list_id = $check_list_id;
-  }
-
-  public function get_check_list_id() {
-    return $this->check_list_id;
-  }
-
-  public function set_control_id($control_id) {
-    $this->control_id = $control_id;
-  }
-
-  public function get_control_id() {
-    return $this->control_id;
-  }
-
-  public function set_status($status) {
-    $this->status = $status;
-  }
-
-  public function get_status() {
-    return $this->status;
-  }
-
-  public function set_status_text($status_text) {
-    $this->status_text = $status_text;
-  }
-
-  public function get_status_text() {
-    return $this->status_text;
-  }
-
-  public function set_deadline_date_ts($deadline_date_ts) {
-    $this->deadline_date_ts = $deadline_date_ts;
-  }
-
-  public function get_deadline_date_ts() {
-    return $this->deadline_date_ts;
-  }
-
-  public function set_deadline_date_txt($deadline_date_txt) {
-    $this->deadline_date_txt = $deadline_date_txt;
-  }
-
-  public function get_deadline_date_txt() {
-    return $this->deadline_date_txt;
-  }
-
-  public function set_info_text($info_text) {
-    $this->info_text = $info_text;
-  }
-
-  public function get_info_text() {
-    return $this->info_text;
-  }
-
-  public function set_location_code($location_code) {
-    $this->location_code = $location_code;
-  }
-
-  public function get_location_code() {
-    return $this->location_code;
-  }
-
-  public function set_location_id($location_id) {
-    $this->location_id = $location_id;
-  }
-
-  public function get_location_id() {
-    return $this->location_id;
-  }
-
-  public function set_component_id($component_id) {
-    $this->component_id = $component_id;
-  }
-
-  public function get_component_id() {
-    return $this->component_id;
-  }
-
-  public function get_type() {
-    return $this->type;
-  }
-
-  public function set_type($type) {
-    $this->type = $type;
-  }
-
-  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(
-        'check_list_id' => $this->get_check_list_id(),
-        'control_id' => $this->get_control_id(),
-        'status' => $this->get_status(),
-        'status_text' => $this->get_status_text(),
-        'deadline_date_ts' => $this->get_deadline_date_ts(),
-        'deadline_date_txt' => $this->get_deadline_date_txt(),
-        'info_text' => $this->get_info_text(),
-        'location_code' => $this->get_location_code(),
-        'location_id' => $this->get_location_id(),
-        'component_id' => $this->get_component_id(),
-        'type' => $this->get_type(),
-        'num_open_cases' => $this->get_num_open_cases()
-    );
-  }
-
-}
+               public function set_deadline_date_txt($deadline_date_txt)
+               {
+                       $this->deadline_date_txt = $deadline_date_txt;
+               }
+               
+               public function get_deadline_date_txt() { return 
$this->deadline_date_txt; }
+               
+               public function set_info_text($info_text)
+               {
+                       $this->info_text = $info_text;
+               }
+               
+               public function get_info_text() { return $this->info_text; }
+               
+               public function set_location_code($location_code)
+               {
+                       $this->location_code = $location_code;
+               }
+               
+               public function get_location_code() { return 
$this->location_code; }
+               
+               public function set_location_id($location_id)
+               {
+                       $this->location_id = $location_id;
+               }
+               
+               public function get_location_id() { return $this->location_id; }
+               
+               public function set_component_id($component_id)
+               {
+                       $this->component_id = $component_id;
+               }
+               
+               public function get_component_id() { return 
$this->component_id; }
+               
+               public function get_type() { return $this->type; }
+               
+               public function set_type($type)
+               {
+                       $this->type = $type;
+               }
+               
+               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(
+                               'check_list_id' => $this->get_check_list_id(),
+                               'control_id' => $this->get_control_id(),
+                               'status' => $this->get_status(),
+                               'status_text' => $this->get_status_text(),
+                               'deadline_date_ts' => 
$this->get_deadline_date_ts(),
+                               'deadline_date_txt' => 
$this->get_deadline_date_txt(),
+                               'info_text' => $this->get_info_text(),
+                               'location_code' => $this->get_location_code(),
+                               'location_id' => $this->get_location_id(),
+                               'component_id' => $this->get_component_id(),
+                               'type' => $this->get_type(),
+                               'num_open_cases' => $this->get_num_open_cases()
+                       );
+               }
+       }

Modified: trunk/controller/inc/component/class.check_list_status_manager.inc.php
===================================================================
--- trunk/controller/inc/component/class.check_list_status_manager.inc.php      
2012-09-11 07:49:59 UTC (rev 9992)
+++ trunk/controller/inc/component/class.check_list_status_manager.inc.php      
2012-09-11 07:51:08 UTC (rev 9993)
@@ -1,100 +1,111 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.check_list_status_info.inc.php 8885 2012-02-16 
07:41:15Z vator $
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id: class.check_list_status_info.inc.php 8885 2012-02-16 
07:41:15Z vator $
- */
-include_class('controller', 'check_list_status_info', 'inc/component/');
+       include_class('controller', 'check_list_status_info', 'inc/component/');
 
-class check_list_status_manager {
-
-  private $check_list;
-  private $type;
-
-  public function __construct($check_list, $type) {
-    $this->check_list = $check_list;
-    $this->type = $type;
-  }
-
-  function get_status_for_check_list() {
-    $check_list_status_info = new check_list_status_info();
-
-    $todays_date_ts = $this->get_todays_date_ts();
-
-    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_PLANNED";
-      } 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_WITH_CHECKLIST";
-      } 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_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_check_list_id($this->check_list->get_id());
-    }
-
-    
$check_list_status_info->set_control_id($this->check_list->get_control_id());
-    $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_type($this->type);
-
-    if ($this->type == "component") {
-      
$check_list_status_info->set_component_id($this->check_list->get_component_id());
-      
$check_list_status_info->set_location_id($this->check_list->get_location_id());
-    } else {
-      
$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;
-  }
-
-}
+       class check_list_status_manager
+       {               
+               private $check_list;
+               private $type;
+                                               
+               public function __construct($check_list, $type) {
+                       $this->check_list               = $check_list;
+       $this->type                                     = $type;
+               }
+               
+               function get_status_for_check_list() {
+                       $check_list_status_info = new check_list_status_info();
+                               
+                       $todays_date_ts = $this->get_todays_date_ts();
+                       
+                       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_PLANNED";
+                               }
+                               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_WITH_CHECKLIST";
+                               }
+                               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_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_check_list_id( 
$this->check_list->get_id() );
+                       }
+                       
+                       $check_list_status_info->set_control_id( 
$this->check_list->get_control_id() );
+                       $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_type( $this->type );
+                       
+                       if($this->type == "component"){
+                               $check_list_status_info->set_component_id( 
$this->check_list->get_component_id() );
+                               $check_list_status_info->set_location_id( 
$this->check_list->get_location_id() );
+                       }else {
+                               $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;
+         }
+       }

Modified: trunk/controller/inc/component/class.date_generator.inc.php
===================================================================
--- trunk/controller/inc/component/class.date_generator.inc.php 2012-09-11 
07:49:59 UTC (rev 9992)
+++ trunk/controller/inc/component/class.date_generator.inc.php 2012-09-11 
07:51:08 UTC (rev 9993)
@@ -4,18 +4,19 @@
  * repeat type(day, week, month, year) and repeat interval
  */
 
-class date_generator {
+class date_generator 
+{              
+       private $start_date;
+       private $end_date;
+       private $period_start_date;
+       private $period_end_date;
+       private $repeat_type;
+       private $repeat_interval;
+       
+       private $calendar_array = array();
 
-  private $start_date;
-  private $end_date;
-  private $period_start_date;
-  private $period_end_date;
-  private $repeat_type;
-  private $repeat_interval;
-  private $calendar_array = array();
-
-  public function __construct($start_date, $end_date, $period_start_date, 
$period_end_date, $repeat_type, $repeat_interval) {
-    $this->start_date = $start_date;
+       public function __construct($start_date, $end_date, $period_start_date, 
$period_end_date, $repeat_type, $repeat_interval){
+               $this->start_date = $start_date;
     $this->end_date = $end_date;
     $this->period_start_date = $period_start_date;
     $this->period_end_date = $period_end_date;
@@ -24,96 +25,122 @@
 
     $this->generate_calendar();
   }
-
-  function generate_calendar() {
-    $control_start_date = $this->find_control_start_date();
-    $control_end_date = $this->end_date;
-
-    if ($control_end_date == null) {
-      $control_end_date = $this->period_end_date;
-    }
-
-    $period_start_date = 
$this->find_start_date_for_period($control_start_date);
-
-    $interval_date = $period_start_date;
-
-    while (($interval_date < $this->period_end_date) && ($interval_date <= 
$control_end_date)) {
-      $this->calendar_array[] = $interval_date;
-
-      if ($this->repeat_type == 0) {
-        $interval_date = mktime(0, 0, 0, date("m", $interval_date), date("d", 
$interval_date) + $this->repeat_interval, date("Y", $interval_date));
-      } else if ($this->repeat_type == 1) {
-        $interval_date = mktime(0, 0, 0, date("m", $interval_date), date("d", 
$interval_date) + ($this->repeat_interval * 7), date("Y", $interval_date));
-      } else if ($this->repeat_type == 2) {
-        $month = date("m", $interval_date) + $this->repeat_interval;
-        $year = date("Y", $interval_date);
-        if ($month > 12) {
-          $month = $month % 12;
-          $year += 1;
-        }
-
-        $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $year);
-        $interval_date = mktime(0, 0, 0, $month, $num_days_in_month, $year);
-      } else if ($this->repeat_type == 3) {
-        $interval_date = mktime(0, 0, 0, date("m", $interval_date), date("d", 
$interval_date), date("Y", $interval_date) + $this->repeat_interval);
-      }
-    }
+               
+       function generate_calendar(){
+               $control_start_date = $this->find_control_start_date();
+               $control_end_date = $this->end_date;
+                               
+               if($control_end_date == null)
+               {
+                       $control_end_date = $this->period_end_date;
+               }
+               
+               $period_start_date = $this->find_start_date_for_period( 
$control_start_date );
+         
+               $interval_date = $period_start_date;
+               
+               while(($interval_date < $this->period_end_date) && 
($interval_date <= $control_end_date))
+               {
+                       $this->calendar_array[] = $interval_date; 
+                                               
+                       if($this->repeat_type == 0)
+                       {
+                               $interval_date = mktime(0,0,0, date("m", 
$interval_date), date("d", $interval_date)+$this->repeat_interval, date("Y", 
$interval_date));
+                       }
+                       else if($this->repeat_type == 1)
+                       {
+                               $interval_date = mktime(0,0,0, date("m", 
$interval_date), date("d", $interval_date) + ($this->repeat_interval * 7), 
date("Y", $interval_date));
+                       }
+                       else if($this->repeat_type == 2)
+                       {
+                               $month = date("m", 
$interval_date)+$this->repeat_interval;
+                               $year = date("Y", $interval_date);
+                               if($month > 12){
+                                       $month = $month % 12;
+                                       $year += 1;
+                               }
+                               
+                               $num_days_in_month = 
cal_days_in_month(CAL_GREGORIAN, $month, $year);
+                               $interval_date = mktime(0,0,0, $month, 
$num_days_in_month, $year);
+                       }
+                       else if($this->repeat_type == 3)
+                       {
+                               $interval_date = mktime(0,0,0, date("m", 
$interval_date), date("d", $interval_date), date("Y", 
$interval_date)+$this->repeat_interval);
+                       }
+               }
   }
-
-  public function find_control_start_date() {
-
-    if ($this->repeat_type == 0) {
-      $control_start_date = $this->start_date;
-    } else if ($this->repeat_type == 1) {
-      $control_start_date = $this->start_date;
-
-      while (date("l", $control_start_date) != "Sunday") {
-        $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, date("m", 
$control_start_date), date("y", $control_start_date));
-
-        if ($num_days_in_month <= date("d", $control_start_date)) {
-          $control_start_date = mktime(0, 0, 0, date("m", $control_start_date) 
+ 1, 1, date("Y", $control_start_date));
-        } else {
-          $control_start_date = mktime(0, 0, 0, date("m", 
$control_start_date), date("d", $control_start_date) + 1, date("Y", 
$control_start_date));
-        }
-      }
-    } else if ($this->repeat_type == 2) {
-      $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, date("m", 
$this->start_date), date("y", $this->start_date));
-      $control_start_date = mktime(0, 0, 0, date("m", $this->start_date), 
$num_days_in_month, date("y", $this->start_date));
-    } else if ($this->repeat_type == 3) {
-      $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, 12, date("y", 
$this->start_date));
-      $control_start_date = mktime(0, 0, 0, 12, $num_days_in_month, date("y", 
$this->start_date));
-    }
-
-    return $control_start_date;
+       
+  public function find_control_start_date(){
+       
+       if( $this->repeat_type == 0 )
+       {
+                       $control_start_date = $this->start_date;
+               }
+               else if( $this->repeat_type == 1 )
+               {
+                       $control_start_date = $this->start_date;
+       
+                       while(date("l", $control_start_date) != "Sunday")
+                       {
+                               $num_days_in_month = 
cal_days_in_month(CAL_GREGORIAN, date("m", $control_start_date), date("y", 
$control_start_date));
+                               
+                               if($num_days_in_month <= date("d", 
$control_start_date) )
+                               {
+                                       $control_start_date = mktime(0,0,0, 
date("m", $control_start_date)+1, 1, date("Y", $control_start_date));
+                               }       
+                               else
+                               {
+                                       $control_start_date = mktime(0,0,0, 
date("m", $control_start_date), date("d", $control_start_date)+1, date("Y", 
$control_start_date));
+                               }
+                       }
+               }
+               else if( $this->repeat_type == 2 ){
+                       $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, 
date("m", $this->start_date), date("y", $this->start_date));
+                       $control_start_date = mktime(0,0,0, date("m", 
$this->start_date), $num_days_in_month, date("y", $this->start_date));
+               }
+       else if( $this->repeat_type == 3 ){
+                       $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, 
12, date("y", $this->start_date));
+                       $control_start_date = mktime(0,0,0, 12, 
$num_days_in_month, date("y", $this->start_date));
+               }
+               
+               return $control_start_date;
   }
+       
+  public function find_start_date_for_period( $trail_period_start_date )
+  {                            
+       while( $trail_period_start_date < $this->period_start_date )
+       {
+                       if($this->repeat_type == 0)
+                       {
+                               $trail_period_start_date = mktime(0,0,0, 
date("m", $trail_period_start_date), date("d", $trail_period_start_date) + 
$this->repeat_interval, date("Y", $trail_period_start_date));
+                       }
+               else if($this->repeat_type == 1)
+                       {
+                               $trail_period_start_date = mktime(0,0,0, 
date("m", $trail_period_start_date), date("d", $trail_period_start_date) + 
($this->repeat_interval * 7), date("Y", $trail_period_start_date));
+                       }
+                       else if($this->repeat_type == 2)
+                       {
+                               $month = date("m", $trail_period_start_date) + 
$this->repeat_interval;
+                               $year = date("Y", $trail_period_start_date);
+                               
+                               if($month > 12){
+                                       $month = $month % 12;
+                                       $year += 1;
+                               }
 
-  public function find_start_date_for_period($trail_period_start_date) {
-    while ($trail_period_start_date < $this->period_start_date) {
-      if ($this->repeat_type == 0) {
-        $trail_period_start_date = mktime(0, 0, 0, date("m", 
$trail_period_start_date), date("d", $trail_period_start_date) + 
$this->repeat_interval, date("Y", $trail_period_start_date));
-      } else if ($this->repeat_type == 1) {
-        $trail_period_start_date = mktime(0, 0, 0, date("m", 
$trail_period_start_date), date("d", $trail_period_start_date) + 
($this->repeat_interval * 7), date("Y", $trail_period_start_date));
-      } else if ($this->repeat_type == 2) {
-        $month = date("m", $trail_period_start_date) + $this->repeat_interval;
-        $year = date("Y", $trail_period_start_date);
-
-        if ($month > 12) {
-          $month = $month % 12;
-          $year += 1;
-        }
-
-        $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $year);
-        $trail_period_start_date = mktime(0, 0, 0, $month, $num_days_in_month, 
$year);
-      } else if ($this->repeat_type == 3) {
-        $trail_period_start_date = mktime(0, 0, 0, date("m", 
$trail_period_start_date), date("d", $trail_period_start_date), date("Y", 
$trail_period_start_date) + $this->repeat_interval);
-      }
-    }
-
-    return $trail_period_start_date;
-  }
-
-  public function get_dates() {
-    return $this->calendar_array;
-  }
-
+                               $num_days_in_month = 
cal_days_in_month(CAL_GREGORIAN, $month, $year);
+                               $trail_period_start_date = mktime(0,0,0, 
$month, $num_days_in_month, $year);
+                       }
+                       else if($this->repeat_type == 3)
+                       {
+                               $trail_period_start_date = mktime(0,0,0, 
date("m", $trail_period_start_date), date("d", $trail_period_start_date), 
date("Y", $trail_period_start_date)+$this->repeat_interval); 
+                       }
+               }
+               
+               return $trail_period_start_date;
+       }
+               
+       public function get_dates(){
+               return $this->calendar_array;
+       }
 }

Modified: trunk/controller/inc/component/class.month_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.month_calendar.inc.php 2012-09-11 
07:49:59 UTC (rev 9992)
+++ trunk/controller/inc/component/class.month_calendar.inc.php 2012-09-11 
07:51:08 UTC (rev 9993)
@@ -1,115 +1,123 @@
 <?php
-
 phpgw::import_class('controller.socheck_list');
 include_class('controller', 'date_generator', 'inc/component/');
 include_class('controller', 'check_list_status_info', 'inc/component/');
 include_class('controller', 'check_list_status_manager', 'inc/component/');
-
+               
 /* 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
- */
+*  and puts these values in a calendar array for each control
+*/  
 
 class month_calendar {
-
-  private $year;
-  private $month;
-  private $control;
-  private $type;
-  private $component;
-  private $location_code;
-  private $calendar_array = array();
-
-  public function __construct($control, $year, $month, $component, 
$location_code, $type) {
+       private $year;
+       private $month;
+       private $control;
+       private $type;
+       private $component;
+       private $location_code;
+       private $calendar_array = array();
+       
+       public function __construct($control, $year, $month, $component, 
$location_code, $type){
     $this->control = $control;
-    $this->year = $year;
+               $this->year = $year;
     $this->month = $month;
     $this->component = $component;
     $this->location_code = $location_code;
     $this->type = $type;
-
+                   
     $this->init_calendar();
   }
-
+       
   /* Initializes calendar by setting status for each month in calendar array. 
-   *   - CONTROL_NOT_DONE if month date is in the past 
-   *   - CONTROL_REGISTERED if month date is in the future */
-
-  function init_calendar() {
-    $ctr_start_date_ts = $this->control->get_start_date();
+  *    - CONTROL_NOT_DONE if month date is in the past 
+  *    - CONTROL_REGISTERED if month date is in the future */ 
+       function init_calendar(){
+               $ctr_start_date_ts = $this->control->get_start_date();
     $ctr_end_date_ts = $this->control->get_end_date();
     $period_start_date_ts = $this->get_start_date_month_ts($this->year, 
$this->month);
     $period_end_date_ts = $this->get_next_start_date_month_ts($this->year, 
$this->month);
     $repeat_type = $this->control->get_repeat_type();
     $repeat_interval = $this->control->get_repeat_interval();
 
-    $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $this->month, 
$this->year);
-
-    for ($i = 1; $i <= $num_days_in_month; $i++) {
-      $this->calendar_array[$i] = null;
-    }
-
-    $date_generator = new date_generator($ctr_start_date_ts, $ctr_end_date_ts, 
$period_start_date_ts, $period_end_date_ts, $repeat_type, $repeat_interval);
-    $dates_array = $date_generator->get_dates();
-
-    // Set status for control on each date to NOT DONE or REGISTERED   
-    foreach ($dates_array as $date_ts) {
-      $check_list = new controller_check_list();
-      $check_list->set_deadline($date_ts);
-      $check_list->set_control_id($this->control->get_id());
-
-      if ($this->type == "component") {
-        $check_list->set_component_id($this->component->get_id());
-        $check_list->set_location_id($this->component->get_location_id());
-        $check_list_status_manager = new 
check_list_status_manager($check_list, "component");
-      } else {
-        $check_list->set_location_code($this->location_code);
-        $check_list_status_manager = new 
check_list_status_manager($check_list, "location");
-      }
-
-      $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list();
-
-      $this->calendar_array[date("j", $date_ts)]["status"] = 
$check_list_status_info->get_status();
-      $this->calendar_array[date("j", $date_ts)]["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("j", $check_list->get_deadline())]["status"] 
= $check_list_status_info->get_status();
-      $this->calendar_array[date("j", $check_list->get_deadline())]["info"] = 
$check_list_status_info->serialize();
-    }
-
-    return $this->calendar_array;
-  }
-
-  public static function get_heading_array($year, $month) {
-    $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $month, $year);
-    $heading_array = array();
-
-    for ($i = 1; $i <= $num_days_in_month; $i++) {
-      $heading_array[$i] = "$i";
-    }
-
-    return $heading_array;
-  }
-
-  public static function get_start_date_month_ts($year, $month) {
-    return strtotime("$month/01/$year");
-  }
-
-  public static function get_next_start_date_month_ts($year, $month) {
-    if (($month + 1) > 12) {
-      $to_month = 1;
-      $to_year = $year + 1;
-    } else {
-      $to_month = $month + 1;
-      $to_year = $year;
-    }
-
-    return strtotime("$to_month/01/$to_year");
-  }
-
+               $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, 
$this->month, $this->year);
+               
+               for($i=1;$i<=$num_days_in_month;$i++)
+               {
+                       $this->calendar_array[$i] = null;
+               }
+       
+               $date_generator = new date_generator($ctr_start_date_ts, 
$ctr_end_date_ts, $period_start_date_ts, $period_end_date_ts, $repeat_type, 
$repeat_interval);
+               $dates_array = $date_generator->get_dates();
+                                       
+         // Set status for control on each date to NOT DONE or REGISTERED   
+               foreach($dates_array as $date_ts)
+               {
+                       $check_list = new controller_check_list();
+       $check_list->set_deadline( $date_ts );
+       $check_list->set_control_id( $this->control->get_id() );
+       
+       if($this->type == "component")
+       {
+               $check_list->set_component_id( $this->component->get_id() );
+               $check_list->set_location_id( 
$this->component->get_location_id() );
+               $check_list_status_manager = new check_list_status_manager( 
$check_list, "component" );
+       }
+       else 
+       {
+               $check_list->set_location_code( $this->location_code );
+               $check_list_status_manager = new check_list_status_manager( 
$check_list, "location" );
+       } 
+       
+                       $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list(); 
+       
+      $this->calendar_array[ date("j", $date_ts) ]["status"] = 
$check_list_status_info->get_status();
+      $this->calendar_array[ date("j", $date_ts) ]["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("j", 
$check_list->get_deadline()) ]["status"] = 
$check_list_status_info->get_status();
+                       $this->calendar_array[ date("j", 
$check_list->get_deadline()) ]["info"] = $check_list_status_info->serialize();
+               }
+               
+               return $this->calendar_array;
+       }
+       
+       public static function get_heading_array($year, $month)
+       {
+               $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $month, 
$year);           
+               $heading_array = array();
+               
+               for($i=1;$i<=$num_days_in_month;$i++)
+               {
+                       $heading_array[$i] = "$i";      
+               }
+               
+               return $heading_array;
+       }
+       
+       public static function get_start_date_month_ts($year, $month){
+               return strtotime("$month/01/$year");
+       }
+       
+       public static function get_next_start_date_month_ts($year, $month)
+       {
+               if(($month + 1) > 12)
+               {
+                       $to_month = 1;
+                       $to_year = $year + 1;
+               }
+               else
+               {
+                       $to_month = $month + 1;
+                       $to_year = $year;
+               }
+               
+               return strtotime("$to_month/01/$to_year");
+       }
 }
\ No newline at end of file

Modified: trunk/controller/inc/component/class.status_agg_month_info.inc.php
===================================================================
--- trunk/controller/inc/component/class.status_agg_month_info.inc.php  
2012-09-11 07:49:59 UTC (rev 9992)
+++ trunk/controller/inc/component/class.status_agg_month_info.inc.php  
2012-09-11 07:51:08 UTC (rev 9993)
@@ -1,63 +1,59 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.check_list_status_info.inc.php 8571 2012-01-15 
13:46:27Z vator $
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id: class.check_list_status_info.inc.php 8571 2012-01-15 
13:46:27Z vator $
- */
-class status_agg_month_info {
-
-  private $month_nr;
-  private $agg_open_cases;
-
-  public function __construct() {
-    
-  }
-
-  public function set_month_nr($month_nr) {
-    $this->month_nr = $month_nr;
-  }
-
-  public function get_month_nr() {
-    return $this->month_nr;
-  }
-
-  public function set_agg_open_cases($agg_open_cases) {
-    $this->agg_open_cases = $agg_open_cases;
-  }
-
-  public function get_agg_open_cases() {
-    return $this->agg_open_cases;
-  }
-
-  public function serialize() {
-    return array(
-        'agg_open_cases' => $this->get_agg_open_cases(),
-        'month_nr' => $this->get_month_nr()
-    );
-  }
-
-}
+       class status_agg_month_info
+       {               
+               private $month_nr;
+               private $agg_open_cases;
+                       
+               public function __construct(){}
+               
+               public function set_month_nr($month_nr)
+               {
+                       $this->month_nr = $month_nr;
+               }
+               
+               public function get_month_nr() { return $this->month_nr; }
+               
+               public function set_agg_open_cases($agg_open_cases)
+               {
+                       $this->agg_open_cases = $agg_open_cases;
+               }
+               
+               public function get_agg_open_cases() { return 
$this->agg_open_cases; }
+                               
+               public function serialize()
+               {
+                       return array(
+                               'agg_open_cases' => $this->get_agg_open_cases(),
+                               'month_nr' => $this->get_month_nr()
+                       );
+               }
+       }

Modified: trunk/controller/inc/component/class.year_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar.inc.php  2012-09-11 
07:49:59 UTC (rev 9992)
+++ trunk/controller/inc/component/class.year_calendar.inc.php  2012-09-11 
07:51:08 UTC (rev 9993)
@@ -1,117 +1,125 @@
 <?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/component/');
 include_class('controller', 'check_list_status_manager', 'inc/component/');
 include_class('controller', 'check_list', 'inc/model/');
+       
 
 class year_calendar {
-
-  private $year;
-  private $control;
-  private $type;
-  private $component;
-  private $location_code;
-  private $calendar_array = array();
-
-  public function __construct($control, $year, $component, $location_code, 
$type) {
+       private $year;
+       private $control;
+       private $type;
+       private $component;
+       private $location_code;
+       private $calendar_array = array();
+       
+  public function __construct($control, $year, $component, $location_code, 
$type)
+  {
     $this->year = $year;
     $this->control = $control;
     $this->component = $component;
     $this->location_code = $location_code;
     $this->type = $type;
-
+        
     $this->init_calendar();
   }
-
+               
   /* Initializes calendar by setting status for each month in calendar array. 
    *   - CONTROL_NOT_DONE if month date is in the past 
-   *   - CONTROL_REGISTERED if month date is in the future */
-
-  function init_calendar() {
-    // Sets null values for twelve months in calendar array 
-    for ($i = 1; $i <= 12; $i++) {
-      $this->calendar_array[$i] = null;
+   *   - CONTROL_REGISTERED if month date is in the future */ 
+       function init_calendar()
+       {
+               // Sets null values for twelve months in calendar array 
+    for($i = 1;$i <= 12;$i++)
+    {
+                 $this->calendar_array[$i] = null;
     }
-
+               
     $ctr_start_date_ts = $this->control->get_start_date();
     $ctr_end_date_ts = $this->control->get_end_date();
     $period_start_date_ts = $this->get_start_date_year_ts($this->year);
-    $period_end_date_ts = $this->get_start_date_year_ts($this->year + 1);
+    $period_end_date_ts = $this->get_start_date_year_ts($this->year+1);
     $repeat_type = $this->control->get_repeat_type();
     $repeat_interval = $this->control->get_repeat_interval();
-
+    
     // Generates dates for time period with specified interval 
     $date_generator = new date_generator($ctr_start_date_ts, $ctr_end_date_ts, 
$period_start_date_ts, $period_end_date_ts, $repeat_type, $repeat_interval);
     $dates_array = $date_generator->get_dates();
-
+               
     // Set status for control on each date to NOT DONE or REGISTERED   
-    foreach ($dates_array as $date_ts) {
-      $check_list = new controller_check_list();
-      $check_list->set_deadline($date_ts);
-      $check_list->set_control_id($this->control->get_id());
+    foreach($dates_array as $date_ts)
+    {
+       $check_list = new controller_check_list();
+       $check_list->set_deadline( $date_ts );
+       $check_list->set_control_id( $this->control->get_id() );
+       
+       if($this->type == "component")
+       {
+               $check_list->set_component_id( $this->component->get_id() );
+               $check_list->set_location_id( 
$this->component->get_location_id() );
+               $check_list_status_manager = new check_list_status_manager( 
$check_list, "component" );
+       }
+       else 
+       {
+               $check_list->set_location_code( $this->location_code );
+               $check_list_status_manager = new check_list_status_manager( 
$check_list, "location" );
+       } 
+       
+                       $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list(); 
+       
+                       $month_nr = date("n", $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();
+               }
+       }
+       
+       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(); 
 
-      if ($this->type == "component") {
-        $check_list->set_component_id($this->component->get_id());
-        $check_list->set_location_id($this->component->get_location_id());
-        $check_list_status_manager = new 
check_list_status_manager($check_list, "component");
-      } else {
-        $check_list->set_location_code($this->location_code);
-        $check_list_status_manager = new 
check_list_status_manager($check_list, "location");
-      }
-
-      $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list();
-
-      $month_nr = date("n", $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();
-    }
-  }
-
-  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();
-
-      $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;
-  }
-
-  public function build_agg_month_calendar($agg_open_cases_pr_month_array) {
-
-    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();
-    }
-
-    return $this->calendar_array;
-  }
-
-  public static function get_heading_array() {
-
-    $heading_array = array();
-
-    for ($i = 1; $i <= 12; $i++) {
-      $heading_array[$i] = "$i";
-    }
-
-    return $heading_array;
-  }
-
-  public static function get_start_date_year_ts($year) {
-    $start_date_year_ts = strtotime("01/01/$year");
-
-    return $start_date_year_ts;
-  }
-
+                       $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;
+       }
+       
+       public function build_agg_month_calendar( 
$agg_open_cases_pr_month_array )
+       {
+               
+               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();
+               }
+                                       
+               return $this->calendar_array;
+       }
+       
+       public static function get_heading_array(){
+                       
+               $heading_array = array();
+               
+               for($i=1;$i<=12;$i++){
+                       $heading_array[$i] = "$i";      
+               }
+               
+               return $heading_array;
+       }
+       
+       public static function get_start_date_year_ts($year){
+         $start_date_year_ts = strtotime("01/01/$year");
+                       
+               return $start_date_year_ts;
+       }
 }
\ No newline at end of file

Modified: trunk/controller/inc/component/class.year_calendar_agg.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar_agg.inc.php      
2012-09-11 07:49:59 UTC (rev 9992)
+++ trunk/controller/inc/component/class.year_calendar_agg.inc.php      
2012-09-11 07:51:08 UTC (rev 9993)
@@ -1,93 +1,110 @@
 <?php
-
 phpgw::import_class('controller.socheck_list');
 include_class('controller', 'date_generator', 'inc/component/');
 include_class('controller', 'check_list_status_info', 'inc/component/');
 include_class('controller', 'check_list_status_manager', 'inc/component/');
 include_class('controller', 'check_list', 'inc/model/');
+       
 
 class year_calendar_agg {
-
-  private $year;
-  private $control;
-  private $location_code;
-  private $view;
-  private $calendar_array = array();
-
-  public function __construct($control, $year, $location_code, $view) {
+       private $year;
+       private $control;
+       private $location_code;
+       private $view;
+       
+       private $calendar_array = array();
+       
+  public function __construct($control, $year, $location_code, $view)
+  {
     $this->year = $year;
     $this->control = $control;
     $this->location_code = $location_code;
     $this->view = $view;
-
+         
     $this->init_calendar();
   }
-
-  function init_calendar() {
-    $start_month_nr = $this->get_start_month_for_control($this->control, 
$this->year);
-    $end_month_nr = $this->get_end_month_for_control($this->control, 
$this->year);
-
-    for ($month_nr = 1; $month_nr <= 12; $month_nr++) {
-      if (($month_nr < $start_month_nr) || ($month_nr > $end_month_nr)) {
-        $this->calendar_array[$month_nr] = null;
-      } else if (($month_nr < date("m")) && (date("Y", 
$this->control->get_start_date()) == $this->year)) {
-        $this->calendar_array[$month_nr]["status"] = "CONTROLS_NOT_DONE";
-        $this->calendar_array[$month_nr]["info"] = array("view" => 
$this->view, "control_id" => $this->control->get_id(), "location_code" => 
$this->location_code, "year" => $this->year, "month" => $month_nr);
-      } else {
-        $this->calendar_array[$month_nr]["status"] = "CONTROLS_REGISTERED";
-        $this->calendar_array[$month_nr]["info"] = array("view" => 
$this->view, "control_id" => $this->control->get_id(), "location_code" => 
$this->location_code, "year" => $this->year, "month" => $month_nr);
-      }
+                
+       function init_calendar()
+       {
+               $start_month_nr = $this->get_start_month_for_control( 
$this->control, $this->year );
+               $end_month_nr = $this->get_end_month_for_control( 
$this->control, $this->year ); 
+               
+    for($month_nr = 1;$month_nr <= 12;$month_nr++)
+    {
+       if( ($month_nr < $start_month_nr) || ($month_nr > $end_month_nr) )
+       {
+               $this->calendar_array[ $month_nr ] = null;
+       }
+       else if( ($month_nr < date("m"))  && (date("Y", 
$this->control->get_start_date()) == $this->year) )
+       {
+               $this->calendar_array[ $month_nr ]["status"] = 
"CONTROLS_NOT_DONE";
+               $this->calendar_array[ $month_nr ]["info"] = array("view" => 
$this->view, "control_id" => $this->control->get_id(), "location_code" =>  
$this->location_code, "year" => $this->year, "month" => $month_nr);
+       }
+       else
+       {
+               $this->calendar_array[ $month_nr ]["status"] = 
"CONTROLS_REGISTERED";
+               $this->calendar_array[ $month_nr ]["info"] = array("view" => 
$this->view, "control_id" => $this->control->get_id(), "location_code" =>  
$this->location_code, "year" => $this->year, "month" => $month_nr);
+       }
     }
-  }
-
-  public function build_calendar($agg_open_cases_pr_month_array) {
-    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();
-    }
-
-    return $this->calendar_array;
-  }
-
-  public static function get_heading_array() {
-
-    $heading_array = array();
-
-    for ($i = 1; $i <= 12; $i++) {
-      $heading_array[$i] = "$i";
-    }
-
-    return $heading_array;
-  }
-
-  function get_start_month_for_control($control, $year) {
-    // Checks if control starts in the year that is displayed 
-    if (date("Y", $control->get_start_date()) == $year) {
-      $from_month = date("n", $control->get_start_date());
-    } else {
-      $from_month = 1;
-    }
-
-    return $from_month;
-  }
-
-  function get_end_month_for_control($control, $year) {
-    // Checks if control ends in the year that is displayed
-    if (date("Y", $control->get_end_date()) == $year) {
-      $to_month = date("n", $control->get_end_date());
-    } else {
-      $to_month = 12;
-    }
-
-    return $to_month;
-  }
-
-  public static function get_start_date_year_ts($year) {
-    $start_date_year_ts = strtotime("01/01/$year");
-
-    return $start_date_year_ts;
-  }
-
+       }
+       
+       public function build_calendar( $agg_open_cases_pr_month_array )
+       {
+               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();
+               }
+                                       
+               return $this->calendar_array;
+       }
+       
+       public static function get_heading_array(){
+                       
+               $heading_array = array();
+               
+               for($i=1;$i<=12;$i++){
+                       $heading_array[$i] = "$i";      
+               }
+               
+               return $heading_array;
+       }
+       
+       function get_start_month_for_control($control, $year)
+       {
+                 // Checks if control starts in the year that is displayed 
+                       if( date("Y", $control->get_start_date()) == $year )
+                       {
+                               $from_month = date("n", 
$control->get_start_date());    
+                       }
+                       else
+                       {
+                               $from_month = 1;
+                       }
+                       
+                       return $from_month;
+               }
+               
+               function get_end_month_for_control($control, $year)
+               {       
+                       // Checks if control ends in the year that is displayed
+                       if( date("Y", $control->get_end_date()) == $year )
+                       {
+                               $to_month = date("n", $control->get_end_date());
+                       }
+                       else
+                       {
+                               $to_month = 12;
+                       }
+                       
+                       return $to_month;
+         }
+       
+       public static function get_start_date_year_ts($year){
+         $start_date_year_ts = strtotime("01/01/$year");
+                       
+               return $start_date_year_ts;
+       }
 }
\ No newline at end of file




reply via email to

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