fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8677]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [8677]
Date: Wed, 25 Jan 2012 09:24:48 +0000

Revision: 8677
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8677
Author:   erikhl
Date:     2012-01-25 09:24:48 +0000 (Wed, 25 Jan 2012)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/component/class.date_generator.inc.php
    trunk/controller/inc/hook_home.inc.php

Modified: trunk/controller/inc/component/class.date_generator.inc.php
===================================================================
--- trunk/controller/inc/component/class.date_generator.inc.php 2012-01-25 
08:50:17 UTC (rev 8676)
+++ trunk/controller/inc/component/class.date_generator.inc.php 2012-01-25 
09:24:48 UTC (rev 8677)
@@ -25,12 +25,17 @@
        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){
+               while(($interval_date < $this->period_end_date) && 
($interval_date <= $control_end_date)){
                        
                        $this->calendar_array[] = $interval_date; 
                                                

Modified: trunk/controller/inc/hook_home.inc.php
===================================================================
--- trunk/controller/inc/hook_home.inc.php      2012-01-25 08:50:17 UTC (rev 
8676)
+++ trunk/controller/inc/hook_home.inc.php      2012-01-25 09:24:48 UTC (rev 
8677)
@@ -31,13 +31,13 @@
        include_class('controller', 'check_list', 'inc/model/');
        include_class('controller', 'check_item', 'inc/model/');
        include_class('controller', 'check_list_status_info', 'inc/helper/');
-       include_class('controller', 'calendar_builder', 'inc/component/');
+       include_class('controller', 'date_generator', 'inc/component/');
        include_class('controller', 'location_finder', 'inc/helper/');
        
        $so = CreateObject('controller.socheck_list');
        $so_control = CreateObject('controller.socontrol');
 
-       echo '<H1> Hook for controller </H1>';  
+       //echo '<H1> Hook for controller </H1>';        
        $location_code = '1101';
        $year = phpgw::get_var('year');
        
@@ -47,7 +47,8 @@
        
        $year = intval($year);
                                
-       $from_date_ts = strtotime("01/01/$year");
+       //$from_date_ts = strtotime("01/01/$year");
+       $from_date_ts = strtotime("now");
        $to_year = $year + 1;
        $to_date_ts = strtotime("01/01/$to_year");      
                                
@@ -61,7 +62,7 @@
 
        $location_finder = new location_finder();
        $my_locations = $location_finder->get_responsibilities( $criteria );
-       print_r($my_locations);
+       //print_r($my_locations);
        
        if(empty($location_code)){
                $location_code = $my_locations[0]["location_code"];     
@@ -70,23 +71,14 @@
        $repeat_type = null;
        
        $controls_for_location_array = 
$so_control->get_controls_by_location($location_code, $from_date_ts, 
$to_date_ts, $repeat_type );
-       
-       $calendar_builder = new calendar_builder($from_date_ts, $to_date_ts);
-
-       $controls_calendar_array = array();
-
-       // Puts aggregate values for daily controls in a twelve month array 
+       //var_dump($controls_for_location_array);
+       $controls_array = array();
+       $control_dates = array();
        foreach($controls_for_location_array as $control){
-               if($control->get_repeat_type() == 0){
-                       $controls_calendar_array = 
$calendar_builder->build_agg_calendar_array($controls_calendar_array, $control, 
$location_code, $year);
-               }
+               $date_generator = new 
date_generator($control->get_start_date(), $control->get_end_date(), 
$from_date_ts, $to_date_ts, $control->get_repeat_type(), 
$control->get_repeat_interval());
+               $controls_array[] = array($control, 
$date_generator->get_dates());
        }
-       
-       $repeat_type = 2;
-       $control_check_list_array = $so->get_check_lists_for_location( 
$location_code, $from_date_ts, $to_date_ts, $repeat_type );
-       
-       $controls_calendar_array = $calendar_builder->build_calendar_array( 
$controls_calendar_array, $control_check_list_array, 12, "view_months" );
-       //print_r($controls_calendar_array);
+
        $location_array = execMethod('property.bolocation.read_single', 
array('location_code' => $location_code));
        
        $portalbox = CreateObject('phpgwapi.listbox', array
@@ -122,42 +114,18 @@
        $category_name = array(); // caching
 
        $portalbox->data = array();
-       foreach ($control_check_list_array as $checklist)
+       foreach ($controls_array as $control_instance)
        {
-/*             if(!$ticket['subject'])
+               $current_control = $control_instance[0];
+               $current_dates = $control_instance[1];
+               foreach($current_dates as $current_date)
                {
-                       if(!isset($category_name[$ticket['cat_id']]))
-                       {
-                               $ticket['subject']= 
execMethod('property.botts.get_category_name', $ticket['cat_id']);
-                               $category_name[$ticket['cat_id']] = 
$ticket['subject'];
-                       }
-                       else
-                       {
-                               $ticket['subject'] = 
$category_name[$ticket['cat_id']];
-                       }
+                       $next_date = date('d/m/Y', $current_date);
+                       $portalbox->data[] = array
+                       (
+                               'text' => "{$current_control->get_title()} :: 
Neste gjennomføring: {$next_date}",
+                               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'controller.uicheck_list_for_location.add_check_list', 
'date' => $current_date, 'control_id' => $current_control->get_id(), 
'location_code' => '1101'))
+                       );
                }
-
-               $location = execMethod('property.bolocation.read_single', 
array('location_code' => $ticket['location_code'], 'extra' => array('view' => 
true))); 
-
-               $group = '';
-               if($ticket['group_id'])
-               {
-                       $group = '[' . 
$GLOBALS['phpgw']->accounts->get($ticket['group_id'])->__toString() . ']';
-               }*/
-               $portalbox->data[] = array
-               (
-                       'text' => "kontroll :: {$checklist->get_id()}",
-                       'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'controller.uicontrol.index'))
-               );
        }
-       
-       $portalbox->data[] = array
-       (
-               'text' => "test :: test",
-               'link' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'controller.uicontrol.index'))
-       );
-
-       echo "\n".'<!-- BEGIN ticket info 
-->'."\n".$portalbox->draw()."\n".'<!-- END ticket info -->'."\n";
-
-       //var_dump($location_array);
-       //$calendar->view_calendar_for_year();
+       echo "\n".'<!-- BEGIN checklist info 
-->'."\n".$portalbox->draw()."\n".'<!-- END checklist info -->'."\n";




reply via email to

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