2007-03-08 12:22:57 +01:00
< ? php
/**
* eGroupWare
*
* @ license http :// opensource . org / licenses / gpl - license . php GPL - GNU General Public License
* @ package timesheet
* @ subpackage importexport
* @ link http :// www . egroupware . org
* @ author Knut Moeller < k . moeller @ metaways . de >
* @ copyright Knut Moeller < k . moeller @ metaways . de >
* @ version $Id : $
*/
/**
* export plugin of addressbook
*/
2010-03-22 16:12:01 +01:00
class timesheet_export_csv implements importexport_iface_export_plugin {
2007-03-08 12:22:57 +01:00
/**
* Exports records as defined in $_definition
*
* @ param egw_record $_definition
*/
2010-03-22 16:12:01 +01:00
public function export ( $_stream , importexport_definition $_definition ) {
$options = $_definition -> plugin_options ;
2007-03-08 12:22:57 +01:00
2010-03-22 16:12:01 +01:00
$uitimesheet = new timesheet_ui ();
2007-03-08 12:22:57 +01:00
$selection = array ();
$query = $GLOBALS [ 'egw' ] -> session -> appsession ( 'index' , TIMESHEET_APP );
$query [ 'num_rows' ] = - 1 ; // all
$uitimesheet -> get_rows ( $query , $selection , $readonlys , true ); // true = only return the id's
$options [ 'begin_with_fieldnames' ] = true ;
2010-03-22 16:12:01 +01:00
$export_object = new importexport_export_csv ( $_stream , ( array ) $options );
2007-03-08 12:22:57 +01:00
// $options['selection'] is array of identifiers as this plugin doesn't
// support other selectors atm.
foreach ( $selection as $identifier ) {
2010-03-22 16:12:01 +01:00
$timesheetentry = new timesheet_egw_record ( $identifier );
2007-03-08 12:22:57 +01:00
$export_object -> export_record ( $timesheetentry );
unset ( $timesheetentry );
}
}
/**
* returns translated name of plugin
*
* @ return string name
*/
public static function get_name () {
return lang ( 'Timesheet CSV export' );
}
/**
* returns translated ( user ) description of plugin
*
* @ return string descriprion
*/
public static function get_description () {
2009-03-20 14:34:02 +01:00
return lang ( " Exports entries from your Timesheet into a CSV File. CSV means 'Comma Seperated Values'. However in the options Tab you can also choose other seperators. " );
2007-03-08 12:22:57 +01:00
}
/**
* returns file suffix for exported file
*
* @ return string suffix
*/
public static function get_filesuffix () {
return 'csv' ;
}
/**
* return html for options .
* this way the plugin has all opportunities for options tab
*
* @ return string html
*/
2010-03-22 16:12:01 +01:00
public function get_options_etpl () {
2007-03-08 12:22:57 +01:00
return 'timesheet.export_csv_options' ;
}
/**
* returns slectors of this plugin via xajax
*
*/
2010-03-22 16:12:01 +01:00
public function get_selectors_etpl () {
2007-03-08 12:22:57 +01:00
return '<b>Selectors:</b>' ;
}
2010-03-22 16:12:01 +01:00
}