[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] [18633] Clear up my own confusion about the two array
From: |
Johan Gunnarsson |
Subject: |
[Phpgroupware-cvs] [18633] Clear up my own confusion about the two array formats. |
Date: |
Wed, 02 Jul 2008 16:50:09 +0000 |
Revision: 18633
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18633
Author: johang
Date: 2008-07-02 16:50:08 +0000 (Wed, 02 Jul 2008)
Log Message:
-----------
Clear up my own confusion about the two array formats.
Modified Paths:
--------------
trunk/calendar/inc/class.ipc_calendar.inc.php
trunk/calendar/test/class.ipc_calendar_test.inc.php
Modified: trunk/calendar/inc/class.ipc_calendar.inc.php
===================================================================
--- trunk/calendar/inc/class.ipc_calendar.inc.php 2008-07-02 14:24:21 UTC
(rev 18632)
+++ trunk/calendar/inc/class.ipc_calendar.inc.php 2008-07-02 16:50:08 UTC
(rev 18633)
@@ -215,7 +215,12 @@
}
/**
+ * ICalendar string to internal array structure.
*
+ * The internal array structure WITH 'cal' key.
+ *
+ * @param $data string Internal array structure of a calendar
event.
+ * @return array The calendar event in iCalendar format.
*/
function convertICalToInternal($data)
{
@@ -285,30 +290,31 @@
/**
* Convert internal array structure to iCalendar.
*
+ * The internal array structure WITHOUT 'cal' key.
+ *
* @param $data array Internal array structure of a calendar
event.
* @return string The calendar event in iCalendar format.
*/
function convertInternalToICal($internal_data)
{
- list($syear, $smonth, $sday) = explode(
- '/', $internal_data['start']['str']);
+ // @todo alarm, modtime
- list($eyear, $emonth, $eday) = explode(
- '/', $internal_data['end']['str']);
+ list($syear, $smonth, $sday, $shour, $smin, $ssec) =
+ array_values($internal_data['start']);
- /*
- percent-complete, priority and class seems so
be missing from
+ list($eyear, $emonth, $eday, $ehour, $emin, $esec) =
+ array_values($internal_data['end']);
- */
-
return CreateObject('phpgwapi.icalendar', array(
- 'DTSTART' => sprintf('%d%d%dT000000', $syear,
$smonth, $sday),
- 'DTEND' => sprintf('%d%d%dT000000', $eyear,
$emonth, $eday),
- 'SUMMARY' => $internal_data['cal']['title'],
- 'DESCRIPTION' =>
$internal_data['cal']['description'],
- /* 'PERCENT-COMPLETE' =>
$internal_data['status'],
- 'PRIORITY' => $internal_data['pri'],
- 'CLASS' =>
strtoupper($internal_data['access']), */
+ 'DTSTART' => sprintf('%d%d%dT%02d%02d%02d',
+ $syear, $smonth, $sday, $shour, $smin,
$ssec),
+ 'DTEND' => sprintf('%d%d%dT%02d%02d%02d',
+ $eyear, $emonth, $eday, $ehour, $emin,
$esec),
+ 'SUMMARY' => $internal_data['title'],
+ 'DESCRIPTION' => $internal_data['description'],
+ 'PRIORITY' =>
intval($internal_data['priority']),
+ 'CLASS' => (isset($internal_data['public']) &&
+ $internal_data['public']) ? "PUBLIC" :
"PRIVATE",
'type' => 'VEVENT'
))->render();
}
Modified: trunk/calendar/test/class.ipc_calendar_test.inc.php
===================================================================
--- trunk/calendar/test/class.ipc_calendar_test.inc.php 2008-07-02 14:24:21 UTC
(rev 18632)
+++ trunk/calendar/test/class.ipc_calendar_test.inc.php 2008-07-02 16:50:08 UTC
(rev 18633)
@@ -50,7 +50,8 @@
'title' => 'TITLE!',
'description' => 'DESCRIPTION!',
'location' => 'LOCATION!',
- 'priority' => '0',
+ 'priority' => '1',
+ 'access' => 'PRIVATE',
'recur_type' => '0',
'recur_interval' => ''
),
@@ -102,6 +103,7 @@
$this->assertTrue($id);
$this->assertTrue(is_array($data));
+
$this->assertEqual($data['title'],
$this->sample_item['cal']['title']);
@@ -187,8 +189,12 @@
function test_convertData_to_ical_1()
{
+ $id = $this->ipc->addData($this->sample_item,
+ "application/x-phpgw-calendar");
+
$converted_data = $this->ipc->convertData(
- $this->sample_item,
"application/x-phpgw-calendar",
+ $this->ipc->getData($id,
"application/x-phpgw-calendar"),
+ "application/x-phpgw-calendar",
"text/x-vcalendar");
$this->assertTrue(strpos($converted_data,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] [18633] Clear up my own confusion about the two array formats.,
Johan Gunnarsson <=