fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15487]


From: saul . huanay
Subject: [Fmsystem-commits] [15487]
Date: Thu, 18 Aug 2016 01:06:58 +0000 (UTC)

Revision: 15487
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15487
Author:   psaul
Date:     2016-08-18 01:06:58 +0000 (Thu, 18 Aug 2016)
Log Message:
-----------


Modified Paths:
--------------
    branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
    branches/dev-syncromind-2/rental/inc/class.socontract.inc.php
    branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php
    branches/dev-syncromind-2/rental/inc/class.uicontract.inc.php
    branches/dev-syncromind-2/rental/templates/base/schedule.xsl

Modified: branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php      
2016-08-18 00:58:35 UTC (rev 15486)
+++ branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php      
2016-08-18 01:06:58 UTC (rev 15487)
@@ -517,4 +517,23 @@
 
                        return $uicols;
                }
+        
+        public function get_schedule () {
+            $date = new DateTime(phpgw::get_var('date'));
+            
+            if ($date->format('w') != 1) {
+                $date->modify('last monday');
+            }
+            
+            $prev_date = clone $date;
+            $prev_date->modify('-1 week');
+            $next_date = clone $date;
+            $next_date->modify('+1 week');            
+            
+            $composite['date'] = $date->format('Y-m-d');
+            $composite['prev_date'] = $prev_date->format('Y-m-d');
+            $composite['next_date'] = $next_date->format('Y-m-d');
+            
+            return $composite;
+        }
        }
\ No newline at end of file

Modified: branches/dev-syncromind-2/rental/inc/class.socontract.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.socontract.inc.php       
2016-08-18 00:58:35 UTC (rev 15486)
+++ branches/dev-syncromind-2/rental/inc/class.socontract.inc.php       
2016-08-18 01:06:58 UTC (rev 15487)
@@ -1251,4 +1251,4 @@
                        }
                        return $price_items;
                }
-       }
\ No newline at end of file
+    }
\ No newline at end of file

Modified: branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php      
2016-08-18 00:58:35 UTC (rev 15486)
+++ branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php      
2016-08-18 01:06:58 UTC (rev 15487)
@@ -21,7 +21,8 @@
                        'add_unit' => true,
                        'remove_unit' => true,
                        'query' => true,
-                       'download' => true
+                       'download' => true,
+            'schedule' => true
                );
 
                public function __construct()
@@ -1103,4 +1104,38 @@
                                
$GLOBALS['phpgw']->preferences->save_repository();
                        }
                }
+        
+        public function schedule () {
+            $composite_id = (int)phpgw::get_var('id');
+
+            $filters = array(
+                rental_socomposite::get_id_field_name() => $composite_id,
+                'availability_date_from' => '2010-1-1',
+                'availability_date_to' => '2017-12-31',
+                'has_contract' => 'both'
+            );
+
+            $composite = null;
+            $composite_obj = rental_socomposite::get_instance()->get(0, 0, '', 
false, '', '', $filters);
+            
+            if (count($composite_obj) > 0)
+                       {
+                               $keys = array_keys($composite_obj);
+                               $composite = $composite_obj[$keys[0]];
+                       }
+            
+            $contracts = $composite->get_contracts();
+            var_dump($contracts);exit();
+
+            $composite = rental_socomposite::get_instance()->get_schedule();
+
+            $composite['picker_img'] = 
$GLOBALS['phpgw']->common->image('phpgwapi', 'cal');
+
+//            self::add_javascript('booking','booking','common.js');
+            self::add_javascript('booking','booking','schedule.js');
+
+            phpgwapi_jquery::load_widget("datepicker");
+
+            self::render_template_xsl(array('schedule'), array('schedule' => 
$composite));            
+        }        
        }
\ No newline at end of file

Modified: branches/dev-syncromind-2/rental/inc/class.uicontract.inc.php
===================================================================
--- branches/dev-syncromind-2/rental/inc/class.uicontract.inc.php       
2016-08-18 00:58:35 UTC (rev 15486)
+++ branches/dev-syncromind-2/rental/inc/class.uicontract.inc.php       
2016-08-18 01:06:58 UTC (rev 15487)
@@ -33,7 +33,6 @@
                        'index' => true,
                        'query' => true,
                        'view' => true,
-            'schedule' => true,
                        'add_party' => true,
                        'remove_party' => true,
                        'add_composite' => true,
@@ -2209,23 +2208,6 @@
                }
         
         /**
-                * Create a new empty contract
-                */
-        public function schedule () {
-            $contract_id = (int)phpgw::get_var('id');
-            $date = phpgw::get_var($date);
-
-            $contracts['picker_img'] = 
$GLOBALS['phpgw']->common->image('phpgwapi', 'cal');
-
-//            self::add_javascript('booking','booking','common.js');
-            self::add_javascript('booking','booking','schedule.js');
-            phpgwapi_jquery::load_widget("datepicker");
-            
-            self::render_template_xsl(array('schedule'), array('schedule' => 
$contracts));
-            
-        }
-
-               /**
                 * Create a new contract tied to the composite provided in the 
composite_id parameter
                 */
                public function add_from_composite()

Modified: branches/dev-syncromind-2/rental/templates/base/schedule.xsl
===================================================================
--- branches/dev-syncromind-2/rental/templates/base/schedule.xsl        
2016-08-18 00:58:35 UTC (rev 15486)
+++ branches/dev-syncromind-2/rental/templates/base/schedule.xsl        
2016-08-18 01:06:58 UTC (rev 15487)
@@ -51,6 +51,8 @@
             schedule.datasourceUrl = 
'/dev-syncromind-2/index.php?menuaction=booking.uibooking.resource_schedule&resource_id=1&phpgw_return_as=json&click_history=69fd120cc81d86e6d90b214b5ab89033';
             schedule.newApplicationUrl = 
'/dev-syncromind-2/index.php?menuaction=booking.uiapplication.add&building_id=3&building_name=Vitalitetsenteret&activity_id=1&resource=1&click_history=69fd120cc81d86e6d90b214b5ab89033';
             ]]>
+            var next_date = '<xsl:value-of select="next_date" />';
+            var prev_date = '<xsl:value-of select="prev_date" />';
 
             schedule.includeResource = false;
             schedule.colFormatter = '';
@@ -59,7 +61,7 @@
                 schedule.renderSchedule('schedule_container', 
schedule.datasourceUrl, schedule.date, schedule.colFormatter, 
schedule.includeResource);
             };
 
-            var initialRequest = getUrlData("date") || '2016-08-15';
+            var initialRequest = getUrlData("date") || '<xsl:value-of 
select="date"/>';
 
             var state = getUrlData("date") || initialRequest;
             if (state){




reply via email to

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