[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15492]
From: |
saul . huanay |
Subject: |
[Fmsystem-commits] [15492] |
Date: |
Fri, 19 Aug 2016 00:36:59 +0000 (UTC) |
Revision: 15492
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15492
Author: psaul
Date: 2016-08-19 00:36:59 +0000 (Fri, 19 Aug 2016)
Log Message:
-----------
Modified Paths:
--------------
branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
branches/dev-syncromind-2/rental/inc/class.uicomposite.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-19 00:33:26 UTC (rev 15491)
+++ branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
2016-08-19 00:36:59 UTC (rev 15492)
@@ -520,6 +520,7 @@
public function get_schedule () {
$date = new DateTime(phpgw::get_var('date'));
+ $composite_id = (int)phpgw::get_var('id');
if ($date->format('w') != 1) {
$date->modify('last monday');
@@ -528,12 +529,49 @@
$prev_date = clone $date;
$prev_date->modify('-1 week');
$next_date = clone $date;
- $next_date->modify('+1 week');
+ $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');
+ $composite1['date'] = $date->format('Y-m-d');
+ $composite1['prev_date'] = $prev_date->format('Y-m-d');
+ $composite1['next_date'] = $next_date->format('Y-m-d');
- return $composite;
+ $days = array();
+ $date_to_array = clone $date;
+ for ($i = 0; $i < 7; $i++)
+ {
+ $days[] = clone $date_to_array->modify("+1 day");
+ }
+
/*----------------------------------------------------------------*/
+
+ $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();
+
+ $data_contracts = array();
+
+ foreach ($contracts as $contract) {
+ $contract = $contract->serialize();
+ $contract_date = date_format(date_create_from_format('d/m/Y',
$contract['date_start']), 'Y-m-d');
+ $data_contracts[date_format($date, 'D')] = $contract_date;
+ }
+
+ var_dump($data_contracts);
+ exit();
+
+ return $composite1;
}
}
\ 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-19 00:33:26 UTC (rev 15491)
+++ branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php
2016-08-19 00:36:59 UTC (rev 15492)
@@ -22,7 +22,8 @@
'remove_unit' => true,
'query' => true,
'download' => true,
- 'schedule' => true
+ 'schedule' => true,
+ 'get_schedule' => true
);
public function __construct()
@@ -1107,35 +1108,32 @@
public function schedule () {
$composite_id = (int)phpgw::get_var('id');
+ $date = new DateTime(phpgw::get_var('date'));
+ if ($date->format('w') != 1) {
+ $date->modify('last monday');
+ }
- $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'
- );
+ $schedule['datasource_url'] = self::link(array(
+ 'menuaction' => 'rental.uicomposite.get_schedule',
+ 'composite_id' => $composite_id,
+ 'phpgw_return_as' => 'json'
+ ));
+ $schedule['date'] = $date;
+ $schedule['picker_img'] =
$GLOBALS['phpgw']->common->image('phpgwapi', 'cal');
- $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));
- }
+ self::render_template_xsl(array('schedule'), array('schedule' =>
$schedule));
+ }
+
+ public function get_schedule () {
+ $composite_id = (int)phpgw::get_var('id');
+ $date = phpgw::get_var('date');
+ $schedule = rental_socomposite::get_instance()->get_schedule();
+
+ return $date;
+ }
}
\ No newline at end of file
Modified: branches/dev-syncromind-2/rental/templates/base/schedule.xsl
===================================================================
--- branches/dev-syncromind-2/rental/templates/base/schedule.xsl
2016-08-19 00:33:26 UTC (rev 15491)
+++ branches/dev-syncromind-2/rental/templates/base/schedule.xsl
2016-08-19 00:36:59 UTC (rev 15492)
@@ -47,12 +47,8 @@
var img_src = '<xsl:value-of select="picker_img"/>';
- <![CDATA[
- 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.datasourceUrl = '<xsl:value-of select="datasource_url"/>';
+ var initialRequest = getUrlData("date") || '<xsl:value-of
select="date"/>';
schedule.includeResource = false;
schedule.colFormatter = '';
@@ -61,8 +57,6 @@
schedule.renderSchedule('schedule_container',
schedule.datasourceUrl, schedule.date, schedule.colFormatter,
schedule.includeResource);
};
- var initialRequest = getUrlData("date") || '<xsl:value-of
select="date"/>';
-
var state = getUrlData("date") || initialRequest;
if (state){
handleHistoryNavigation(state);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15492],
saul . huanay <=