egroupware/infolog/inc/class.infolog_export_ical.inc.php

128 lines
2.7 KiB
PHP
Raw Normal View History

2012-04-03 00:46:01 +02:00
<?php
/**
* eGroupWare
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package infolog
* @subpackage importexport
* @link http://www.egroupware.org
* @author Nathan Gray
* @copyright Nathan Gray
* @version $Id$
*/
2016-04-30 19:05:23 +02:00
use EGroupware\Api;
2012-04-03 00:46:01 +02:00
/**
* export iCal plugin of infolog
*/
class infolog_export_ical extends infolog_export_csv {
/**
* Exports records as defined in $_definition
*
* @param egw_record $_definition
*/
public function export( $_stream, importexport_definition $_definition) {
$options = $_definition->plugin_options;
$this->bo = new infolog_bo();
2016-04-30 19:05:23 +02:00
$limit_exception = Api\Storage\Merge::is_export_limit_excepted();
if (!$limit_exception) $export_limit = Api\Storage\Merge::getExportLimit('infolog');
2012-04-03 00:46:01 +02:00
$ids = array();
$query = array();
switch($options['selection'])
{
case 'search':
2016-04-30 19:05:23 +02:00
$query = array_merge(Api\Cache::getSession('infolog', 'session_data'), $query);
2012-04-03 00:46:01 +02:00
// Fall through
case 'all':
$query['num_rows'] = $export_limit ? $export_limit : -1;
$query['start'] = 0;
$this->selection = $this->bo->search($query);
2012-04-03 00:46:01 +02:00
break;
default:
$ids = $this->selection = explode(',',$options['selection']);
2012-04-03 00:46:01 +02:00
break;
}
$boical = new infolog_ical();
fwrite($_stream, $boical->exportvCalendar($this->selection));
2012-04-03 00:46:01 +02:00
}
/**
* returns translated name of plugin
*
* @return string name
*/
public static function get_name() {
2012-04-05 17:57:06 +02:00
return lang('Infolog iCal export');
2012-04-03 00:46:01 +02:00
}
/**
* returns translated (user) description of plugin
*
* @return string descriprion
*/
public static function get_description() {
return lang("Exports in iCal format.");
}
/**
* retruns file suffix for exported file
*
* @return string suffix
*/
public static function get_filesuffix() {
return 'ics';
}
public static function get_mimetype() {
return 'text/infolog';
}
/**
* Suggest a file name for the downloaded file
* No suffix
*/
public function get_filename()
{
if(is_array($this->selection) && count($this->selection) == 1)
{
return $this->bo->link_title(current($this->selection));
}
return false;
}
2012-04-03 00:46:01 +02:00
/**
* return array for options.
2012-04-03 00:46:01 +02:00
*
* @param $definition Specific definition
*
* @return array (
* name => string,
* content => array,
* sel_options => array,
* readonlys => array,
* preserv => array,
* )
2012-04-03 00:46:01 +02:00
*/
public function get_options_etpl(importexport_definition &$definition = NULL)
{
return false;
2012-04-03 00:46:01 +02:00
}
/**
* returns selectors of this plugin
*
*/
public function get_selectors_etpl() {
return array(
'name' => 'infolog.export_csv_selectors',
'content' => 'search'
);
}
}