fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8347]


From: Torstein
Subject: [Fmsystem-commits] [8347]
Date: Fri, 16 Dec 2011 13:56:22 +0000

Revision: 8347
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8347
Author:   vator
Date:     2011-12-16 13:56:22 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.socheck_list.inc.php
    trunk/controller/inc/class.uicheck_list_for_location.inc.php
    trunk/controller/inc/class.uilocation_check_list.inc.php

Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php     2011-12-16 13:21:57 UTC 
(rev 8346)
+++ trunk/controller/inc/class.socheck_list.inc.php     2011-12-16 13:56:22 UTC 
(rev 8347)
@@ -85,45 +85,50 @@
        }
                
        public function get_single_with_check_items($check_list_id){
-               $sql  = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, ";
+               $sql  = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, completed_date, ";
                $sql .= "ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment as ci_comment, check_list_id, "; 
                $sql .= "coi.title as coi_id, coi.title as coi_title, 
coi.required as coi_required, coi.required as coi_required, ";
                $sql .= "coi.what_to_do as coi_what_to_do, coi.how_to_do as 
coi_how_to_do, coi.control_group_id as coi_control_group_id "; 
-               $sql .= "FROM controller_check_list cl, controller_check_item 
ci, controller_control_item as coi "; 
-               $sql .= "WHERE cl.id = $check_list_id ";
-               $sql .= "AND cl.id = ci.check_list_id ";
-               $sql .= "AND ci.control_item_id=coi.id;";
-               
+               $sql .= "FROM controller_check_list cl "; 
+               $sql .= "LEFT JOIN controller_check_item as ci ON cl.id = 
ci.check_list_id ";
+               $sql .= "LEFT JOIN controller_control_item as coi ON 
ci.control_item_id=coi.id ";
+               $sql .= "WHERE cl.id = $check_list_id;";
+                               
                $this->db->query($sql);
                
                $counter = 0;
                $check_list = null;
+       
                while ($this->db->next_record()) {
                        
                        if($counter == 0){
                                $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
                                
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true), 
'bool'));
                                
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
-                               
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true), 
'int'));     
+                               
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true), 
'int'));
+                               
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date', 
true), 'int'));
+                               
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date', 
true), 'int')); 
                        }
+                                               
+                       if($this->db->f('ci_id', true) != ''){
+                               $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
+                               
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
+                               
$check_item->set_status($this->unmarshal($this->db->f('ci_status', true), 
'bool'));
+                               
$check_item->set_comment($this->unmarshal($this->db->f('ci_comment', true), 
'string'));
+                               
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
+                               
+                               $control_item = new 
controller_control_item($this->unmarshal($this->db->f('coi_id', true), 'int'));
+                               
$control_item->set_title($this->db->f('coi_title', true), 'string');
+                               
$control_item->set_required($this->db->f('coi_required', true), 'string');
+                               
$control_item->set_what_to_do($this->db->f('coi_what_to_do', true), 'string');
+                               
$control_item->set_how_to_do($this->db->f('coi_how_to_do', true), 'string');
+                               
$control_item->set_control_group_id($this->db->f('coi_control_group_id', true), 
'string');
+                               
+                               
$check_item->set_control_item($control_item->toArray());
+                               
+                               $check_items_array[] = $check_item->toArray();
+                       }
                        
-                       $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
-                       
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
-                       
$check_item->set_status($this->unmarshal($this->db->f('ci_status', true), 
'bool'));
-                       
$check_item->set_comment($this->unmarshal($this->db->f('ci_comment', true), 
'string'));
-                       
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
-                       
-                       $control_item = new 
controller_control_item($this->unmarshal($this->db->f('coi_id', true), 'int'));
-                       $control_item->set_title($this->db->f('coi_title', 
true), 'string');
-                       
$control_item->set_required($this->db->f('coi_required', true), 'string');
-                       
$control_item->set_what_to_do($this->db->f('coi_what_to_do', true), 'string');
-                       
$control_item->set_how_to_do($this->db->f('coi_how_to_do', true), 'string');
-                       
$control_item->set_control_group_id($this->db->f('coi_control_group_id', true), 
'string');
-                       
-                       $check_item->set_control_item($control_item->toArray());
-                       
-                       $check_items_array[] = $check_item->toArray();
-                       
                        $counter++;
                }
                
@@ -226,14 +231,14 @@
        
        function get_agg_check_lists_for_location( $location_code, $from_date, 
$to_date ){
                
-               $sql =  "SELECT c.id as c_id, title, cl.id as cl_id, 
c.repeat_type, c.repeat_interval, deadline, count(ci.id) ";
+               $sql =  "SELECT c.id as c_id, title, start_date, end_date, 
cl.id as cl_id, c.repeat_type, c.repeat_interval, cl.deadline, count(ci.id) ";
                $sql .= "FROM controller_check_list cl, controller_control c, 
controller_check_item ci ";
                $sql .= "WHERE cl.location_code = $location_code ";
                $sql .= "AND c.repeat_type < 2 ";
                $sql .= "AND cl.control_id = c.id ";
                $sql .= "AND cl.id = ci.check_list_id ";
                $sql .= "AND deadline BETWEEN $from_date AND $to_date ";
-               $sql .= "GROUP BY c.id, title, cl.id, cl.deadline, 
c.repeat_type, c.repeat_interval ";
+               $sql .= "GROUP BY c.id, title, start_date, end_date, cl.id, 
cl.deadline, c.repeat_type, c.repeat_interval ";
                $sql .= "ORDER BY c.id";
 
                $this->db->query($sql);
@@ -253,7 +258,9 @@
                                                                                
"id"                      => $this->unmarshal($this->db->f('c_id', true), 
'int'),
                                                                                
"title"                   => $this->unmarshal($this->db->f('title', true), 
'string'),
                                                                                
"repeat_type"     => $this->unmarshal($this->db->f('repeat_type', true), 'int'),
-                                                                               
"repeat_interval" => $this->unmarshal($this->db->f('repeat_interval', true), 
'int')
+                                                                               
"repeat_interval" => $this->unmarshal($this->db->f('repeat_interval', true), 
'int'),
+                                                                               
"start_date" => $this->unmarshal($this->db->f('start_date', true), 'int'),
+                                                                               
"end_date" => $this->unmarshal($this->db->f('end_date', true), 'int')
                                                                        );
                        }
 

Modified: trunk/controller/inc/class.uicheck_list_for_location.inc.php
===================================================================
--- trunk/controller/inc/class.uicheck_list_for_location.inc.php        
2011-12-16 13:21:57 UTC (rev 8346)
+++ trunk/controller/inc/class.uicheck_list_for_location.inc.php        
2011-12-16 13:56:22 UTC (rev 8347)
@@ -358,7 +358,7 @@
                        $check_list_id = phpgw::get_var('check_list_id');
                        
                        $check_list = 
$this->so_check_list->get_single_with_check_items($check_list_id);
-                       
+               
                        $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
        
                        $data = array
@@ -366,7 +366,7 @@
                                'check_list'            => $check_list,
                                'date_format'           => $date_format
                        );
-       
+                       
                        self::add_javascript('controller', 'controller', 
'jquery.js');
                        self::add_javascript('controller', 'controller', 
'jquery-ui.custom.min.js');
                        self::add_javascript('controller', 'controller', 
'custom_ui.js');

Modified: trunk/controller/inc/class.uilocation_check_list.inc.php
===================================================================
--- trunk/controller/inc/class.uilocation_check_list.inc.php    2011-12-16 
13:21:57 UTC (rev 8346)
+++ trunk/controller/inc/class.uilocation_check_list.inc.php    2011-12-16 
13:56:22 UTC (rev 8347)
@@ -77,7 +77,6 @@
                
                public function view_calendar_for_month()
                {
-                       $control_id = phpgw::get_var('control_id');
                        $location_code = phpgw::get_var('location_code');
                        $year = phpgw::get_var('year');
                        $month = phpgw::get_var('month');
@@ -88,9 +87,7 @@
                        $from_date = strtotime("$from_month/01/$year");
                        $to_month = $from_month + 1;
                        $to_date = strtotime("$to_month/01/$year+1");
-                                               
-                       $control = $this->so_control->get_single($control_id);
-                       
+                                                                       
                        if(empty($location_code)){
                                $location_code = "1101";        
                        }
@@ -125,7 +122,6 @@
                
                public function view_calendar_for_year()
                {
-                       $control_id = phpgw::get_var('control_id');
                        $location_code = phpgw::get_var('location_code');
                        $year = phpgw::get_var('year');
                        
@@ -134,22 +130,20 @@
                        $from_date = strtotime("01/01/$year");
                        $to_year = $year + 1;
                        $to_date = strtotime("01/01/$to_year"); 
-                       
-                       $control = $this->so_control->get_single($control_id);
-                       
+                                               
                        if(empty($location_code)){
                                $location_code = "1101";        
                        }
                        
                        $this->calendar_builder = new 
calendar_builder($from_date, $to_date);
-                       
+
                        // Gets an array of controls that contains check_lists 
for the specified location
                        $agg_check_list_array = 
$this->so->get_agg_check_lists_for_location( $location_code, $from_date, 
$to_date );
                        $controls_calendar_array = 
$this->calendar_builder->build_agg_calendar_array( $agg_check_list_array );
-               
+                       
                        $repeat_type = 2;
-                       $check_list_array = 
$this->so->get_check_lists_for_location( $location_code, $from_date, $to_date, 
$repeat_type );
-                       $controls_calendar_array = 
$this->calendar_builder->build_calendar_array( $check_list_array, 
$controls_calendar_array, 12, "view_months" );
+                       $control_check_list_array = 
$this->so->get_check_lists_for_location( $location_code, $from_date, $to_date, 
$repeat_type );
+                       $controls_calendar_array = 
$this->calendar_builder->build_calendar_array( $control_check_list_array, 
$controls_calendar_array, 12, "view_months" );
                        
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                        
@@ -167,7 +161,6 @@
                        
                        self::render_template_xsl('view_calendar_year', $data);
                        
-                       
                        self::add_javascript('controller', 'controller', 
'jquery.js');
                        self::add_javascript('controller', 'controller', 
'ajax.js');
                }




reply via email to

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