Skip to content

Commit

Permalink
[jan] Add script to import tasks from Open-Xchange.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Mar 20, 2014
1 parent 1d6ab9b commit 6cc601a
Show file tree
Hide file tree
Showing 7 changed files with 393 additions and 7 deletions.
3 changes: 3 additions & 0 deletions framework/OpenXchange/lib/Horde/OpenXchange/Events.php
Expand Up @@ -48,6 +48,9 @@ public function __construct(array $params = array())
207 => 'recur_position',
210 => 'recur_change_exceptions',
211 => 'recur_delete_exceptions',
224 => 'organizer',
225 => 'sequence',
226 => 'confirmations',
400 => 'location',
401 => 'allday',
402 => 'status',
Expand Down
Expand Up @@ -48,9 +48,6 @@ abstract class Horde_OpenXchange_EventsAndTasks extends Horde_OpenXchange_Base
221 => 'users',
222 => 'recur_count',
223 => 'uid',
224 => 'organizer',
225 => 'sequence',
226 => 'confirmations',
);

/**
Expand Down
124 changes: 124 additions & 0 deletions framework/OpenXchange/lib/Horde/OpenXchange/Tasks.php
@@ -0,0 +1,124 @@
<?php
/**
* Copyright 2014 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @author Jan Schneider <jan@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package OpenXchange
*/

/**
* Horde_OpenXchange_Tasks is the interface class for the tasks storage
* of an Open-Xchange server.
*
* @author Jan Schneider <jan@horde.org>
* @category Horde
* @copyright 2014 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package OpenXchange
*/
class Horde_OpenXchange_Tasks extends Horde_OpenXchange_EventsAndTasks
{
/**
* Status: not started.
*/
const STATUS_NOT_STARTED = 1;

/**
* Status: in progress.
*/
const STATUS_IN_PROGRESS = 2;

/**
* Status: done.
*/
const STATUS_DONE = 3;

/**
* Status: waiting.
*/
const STATUS_WAITING = 4;

/**
* Status: deferred.
*/
const STATUS_DEFERRED = 5;

/**
* Priority: high.
*/
const PRIORITY_LOW = 1;

/**
* Priority: high.
*/
const PRIORITY_MEDIUM = 2;

/**
* Priority: high.
*/
const PRIORITY_HIGH = 3;

/**
* The folder category.
*
* @var string
*/
protected $_folderType = 'tasks';

/**
* Constructor.
*
* @param array $params List of optional parameters:
* - client: (Horde_Http_Client) An HTTP client.
* - endpoint: (string) The URI of the OX API
* endpoint.
* - user: (string) Authentication user.
* - password: (string) Authentication password.
*/
public function __construct(array $params = array())
{
parent::__construct($params);
$this->_columns += array(
300 => 'status',
301 => 'percent',
308 => 'duration',
309 => 'priority',
315 => 'completed',
);
}

/**
* Returns a list tasks.
*
* @param integer $folder A folder ID. If empty, returns tasks of all
* visible task lists.
* @param Horde_Date $start Start date, defaults to epoch.
* @param Horde_Date $end End date, defaults to maximum date possible.
*
* @return array List of task hashes.
* @throws Horde_OpenXchange_Exception.
*/
public function listTasks($folder = null, $start = null, $end = null)
{
return $this->_listObjects($folder, $start, $end);
}

/**
* Returns an task.
*
* @param integer $folder A folder ID.
* @param integer $id An task ID.
*
* @return array The task hash.
* @throws Horde_OpenXchange_Exception.
*/
public function getTask($folder, $id)
{
return $this->_getObject($folder, $id);
}
}
6 changes: 4 additions & 2 deletions framework/OpenXchange/package.xml
Expand Up @@ -10,7 +10,7 @@
<email>jan@horde.org</email>
<active>yes</active>
</lead>
<date>2014-03-18</date>
<date>2014-03-20</date>
<version>
<release>1.0.0alpha1</release>
<api>1.0.0alpha1</api>
Expand All @@ -33,6 +33,7 @@
<file name="Events.php" role="php" />
<file name="EventsAndTasks.php" role="php" />
<file name="Exception.php" role="php" />
<file name="Tasks.php" role="php" />
</dir> <!-- /lib/Horde/OpenXchange -->
</dir> <!-- /lib/Horde -->
</dir> <!-- /lib -->
Expand Down Expand Up @@ -83,6 +84,7 @@
<install as="Horde/OpenXchange/Events.php" name="lib/Horde/OpenXchange/Events.php" />
<install as="Horde/OpenXchange/EventsAndTasks.php" name="lib/Horde/OpenXchange/EventsAndTasks.php" />
<install as="Horde/OpenXchange/Exception.php" name="lib/Horde/OpenXchange/Exception.php" />
<install as="Horde/OpenXchange/Tasks.php" name="lib/Horde/OpenXchange/Tasks.php" />
</filelist>
</phprelease>
<changelog>
Expand All @@ -95,7 +97,7 @@
<release>alpha</release>
<api>alpha</api>
</stability>
<date>2014-03-18</date>
<date>2014-03-20</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* Initial release.
Expand Down

0 comments on commit 6cc601a

Please sign in to comment.