fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9622]


From: Torstein
Subject: [Fmsystem-commits] [9622]
Date: Tue, 19 Jun 2012 10:04:14 +0000

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


Modified Paths:
--------------
    trunk/controller/inc/class.socheck_list.inc.php
    trunk/controller/inc/class.uicalendar.inc.php
    trunk/controller/inc/class.uicontrol_item.inc.php
    trunk/controller/inc/component/class.year_calendar.inc.php
    trunk/controller/js/controller/ajax.js
    trunk/controller/templates/base/control_item/control_item.xsl
    trunk/controller/templates/base/css/base.css

Modified: trunk/controller/inc/class.socheck_list.inc.php
===================================================================
--- trunk/controller/inc/class.socheck_list.inc.php     2012-06-19 07:13:54 UTC 
(rev 9621)
+++ trunk/controller/inc/class.socheck_list.inc.php     2012-06-19 10:04:14 UTC 
(rev 9622)
@@ -564,7 +564,7 @@
                return $controls_array;
        }
        
-       function get_check_lists_for_component( $location_id, $component_id, 
$from_date_ts, $to_date_ts, $repeat_type ){
+       function get_check_lists_for_component( $location_id, $component_id, 
$from_date_ts, $to_date_ts, $repeat_type_expr = null ){
                $sql =  "SELECT c.id as c_id, ";
                $sql .= "cl.id as cl_id, cl.status as cl_status, cl.comment as 
cl_comment, deadline, planned_date, completed_date, ";
                $sql .= "cl.component_id, cl.location_id, cl.location_code as 
cl_location_code, num_open_cases, num_pending_cases "; 
@@ -573,8 +573,8 @@
                $sql .= "WHERE cl.location_id = $location_id ";
                $sql .= "AND cl.component_id = $component_id ";
                
-               if( is_numeric($repeat_type) )
-                       $sql .= "AND c.repeat_type = $repeat_type ";
+               if( $repeat_type != null )
+                       $sql .= "AND c.repeat_type $repeat_type_expr ";
                
                $sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
                $sql .= "ORDER BY c.id;";

Modified: trunk/controller/inc/class.uicalendar.inc.php
===================================================================
--- trunk/controller/inc/class.uicalendar.inc.php       2012-06-19 07:13:54 UTC 
(rev 9621)
+++ trunk/controller/inc/class.uicalendar.inc.php       2012-06-19 10:04:14 UTC 
(rev 9622)
@@ -256,22 +256,13 @@
 
                                          $controls_components_calendar_array[] 
= array("control" => $control->toArray(), "calendar_array" => $calendar_array);
                                  }else {
-                                   $repeat_type = 2;
-                                               
                                    // Fetches control ids with check lists for 
specified time period
-                                               
$control_id_with_check_list_array = 
$this->so->get_check_lists_for_component($component->get_type(), 
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type);
+                                               
$control_id_with_check_list_array = 
$this->so->get_check_lists_for_component($component->get_type(), 
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=2");
 
                                                // Loops through all controls 
for location and populates controls with check lists
                                                $controls_for_component_array = 
$this->populate_controls_with_check_lists($controls_for_component_array, 
$control_id_with_check_list_array);
                                                
-                                               $repeat_type = 3;
-                                               // Fetches control ids with 
check lists for specified time period
-                                               
$control_id_with_check_list_array = 
$this->so->get_check_lists_for_component($component->get_type(), 
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type);
-                                               
-                                               // Loops through all controls 
for location and populates controls with check lists
-                                               $controls_for_component_array = 
$this->populate_controls_with_check_lists($controls_for_component_array, 
$control_id_with_check_list_array);
-                       
-                                               $year_calendar = new 
year_calendar($control, $year);
+                                               $year_calendar = new 
year_calendar($control, $year, $component, null, "component");
                                                $calendar_array = 
$year_calendar->build_calendar( $control->get_check_lists_array() );
                                                                                
                                
                                                
$controls_components_calendar_array[] = array("control" => $control->toArray(), 
"calendar_array" => $calendar_array);
@@ -280,7 +271,7 @@
                        
                          $components_calendar_array[] = array("component" => 
$component->toArray(), "controls_calendar" => 
$controls_components_calendar_array);
                        }
-                       //print_r($components_calendar_array);
+                       print_r($components_calendar_array);
                        
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
 

Modified: trunk/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_item.inc.php   2012-06-19 07:13:54 UTC 
(rev 9621)
+++ trunk/controller/inc/class.uicontrol_item.inc.php   2012-06-19 10:04:14 UTC 
(rev 9622)
@@ -191,6 +191,7 @@
                public function edit()
                {
                        $control_item_id = phpgw::get_var('id');
+                       $control_item = $this->so->get_single( $control_item_id 
); 
                        
                        // Sigurd: START as categories
                        $cats   = CreateObject('phpgwapi.categories', -1, 
'controller', '.control');
@@ -200,15 +201,13 @@
                        $control_areas_array = $control_areas['cat_list'];
 
                        $control_groups_array = 
$this->so_control_group->get_control_group_array();
-                       
-                       /*
-                        * hack to fix display of   char 
-                        */
+
+                       // Hack to fix display of   char
                        $control_item->set_what_to_do(str_replace(" ", " 
",$control_item->get_what_to_do()));
                        $control_item->set_how_to_do(str_replace(' ', ' ', 
$control_item->get_how_to_do()));
 
                        $control_item_array = $control_item->toArray();
-                       
+
                        $data = array
                        (
                                'editable'                              => true,

Modified: trunk/controller/inc/component/class.year_calendar.inc.php
===================================================================
--- trunk/controller/inc/component/class.year_calendar.inc.php  2012-06-19 
07:13:54 UTC (rev 9621)
+++ trunk/controller/inc/component/class.year_calendar.inc.php  2012-06-19 
10:04:14 UTC (rev 9622)
@@ -6,41 +6,70 @@
        
 
 class year_calendar {
-  private $period_start_date_ts;
-  private $period_end_date_ts;
        private $year;
        private $control;
+       private $type;
+       private $component;
+       private $location_code;
+       
        private $calendar_array = array();
        
-  public function __construct($control, $year){
+  public function __construct($control, $year, $component, $location_code, 
$type){
     $this->year = $year;
     $this->control = $control;
-    $this->period_start_date_ts = $this->get_start_date_year_ts($year);
-    $this->period_end_date_ts = $this->get_start_date_year_ts($year+1);
+    $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(){
     for($i = 1;$i <= 12;$i++){
                  $this->calendar_array[$i] = null;
     }
                
-    $date_generator = new date_generator($this->control->get_start_date(), 
$this->control->get_end_date(), $this->period_start_date_ts, 
$this->period_end_date_ts, $this->control->get_repeat_type(), 
$this->control->get_repeat_interval());
+    $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);
+    $repeat_type = $this->control->get_repeat_type();
+    $repeat_interval = $this->control->get_repeat_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();
                
     // Inserts dates 
-    foreach($dates_array as $date){
-      $todays_date = mktime(0,0,0,date("m"), date("d"), date("Y"));
-                       
-      if($date < $todays_date){
+    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) ]["status"]  = $status;
-      $this->calendar_array[ date("n", $date) ]["info"]  = array("date" => 
$date, "control_id" => $this->control->get_id());
+      $this->calendar_array[ date("n", $date_ts) ]["status"]  = $status;
+      
+      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 
+                                                                               
                                                                                
                                                                                
                );
+      }
                }
        }
        
@@ -82,6 +111,11 @@
                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/js/controller/ajax.js
===================================================================
--- trunk/controller/js/controller/ajax.js      2012-06-19 07:13:54 UTC (rev 
9621)
+++ trunk/controller/js/controller/ajax.js      2012-06-19 10:04:14 UTC (rev 
9622)
@@ -380,6 +380,10 @@
                }
        });
        
+       $("#control_item_options li .delete").live("click", function(e){
+               $(this).closest("li").fadeOut();
+       });
+       
        $("#add_control_item_list_value input[type=button]").live("click", 
function(e){
                e.preventDefault();
                

Modified: trunk/controller/templates/base/control_item/control_item.xsl
===================================================================
--- trunk/controller/templates/base/control_item/control_item.xsl       
2012-06-19 07:13:54 UTC (rev 9621)
+++ trunk/controller/templates/base/control_item/control_item.xsl       
2012-06-19 10:04:14 UTC (rev 9622)
@@ -28,7 +28,7 @@
                <form action="#" method="post">
                        <input type="hidden" name="id" 
value="{control_item/id}">
                        </input>
-                       <dl class="proplist-col">
+                       <dl class="proplist">
                                <dt>
                                        <label for="title">Tittel</label>
                                        <xsl:choose>

Modified: trunk/controller/templates/base/css/base.css
===================================================================
--- trunk/controller/templates/base/css/base.css        2012-06-19 07:13:54 UTC 
(rev 9621)
+++ trunk/controller/templates/base/css/base.css        2012-06-19 10:04:14 UTC 
(rev 9622)
@@ -127,12 +127,6 @@
     margin: 1em 0;
     padding-left: 2em;
 }
-dl.proplist dt,
-dl.proplist-col dt { 
-    font-weight: bolder; 
-    font-size: 90%; 
-    margin: .8em 0 .1em 0;
-}
 
 dl.proplist-col,
 dl.form-col {




reply via email to

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