Sorry ... / #2194

Sorry I have to disappoint you :-(.

I didn't solve it at the class ListBlock.

But I implemented:
  1. a function exportToCSV($args)

from std/export.inc.php

function exportToCSV($args)
{
	header('Content-Type: text/csv; charset=iso-8859-15');
	header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
	header('Content-Disposition: attachment; filename=download.xls');
	header('Pragma: no-cache');
	
	$export = "";
	$count = 0;
	$num_col = 0;
	
	## get number of cols ##
	foreach($args as $key => $value)
	{	
		foreach($args[$key] as $k => $value)
		{
			$num_col++;
		}
		break;
	}
	
	## build export-string ##
	for($i = 0; $i < $num_col; $i++)
	{
		foreach($args as $key => $value)
		{	
			$str = $args[$key][$i];
			$str = iconv("utf-8", "iso-8859-15", $str); /* necessary for e.g. German characters like ä, ö, ü and ß */
			$export .= "" . $str . "t";
		}
		$export .= "n";
	}
	
	echo $export;
}

and
  1. functions for each "page" like companiesExport() (at pages/company.inc.php), personsExport() (at pages/person.inc.php) etc.

from pages/effort.inc.php

function effortsExport()
{
	global $PH;
	global $auth;
   	
	### get effort ####
    $ids= getPassedIds('effort','efforts_*');
	
	if(!$ids) {
        $PH->abortWarning(__("Select one or more efforts"));
        return;
	}
	
	$valid = false;
	
	if(isset($args)) {
		unset($args);
	}
		
	$args['project'][0] = __('Project');
	$args['task'][0] = __('Task');
	$args['person'][0] = __('Person');
	$args['effort'][0] = __('Effort');
	$args['time_start'][0] = __('Start');
	$args['time_end'][0] = __('End');
	$args['duration'][0] = __('len');
	
	$count = 1;
	foreach($ids as $id) {
	 	if($e= Effort::getVisibleById($id)) {
			## array with all efforts ##
			$e_array[] = $e;
			
			## check project of first effort ##
            if(count($e_array) == 1) {
                if(!$project = Project::getVisibleById($e->project)) {
                    $PH->abortWarning('could not get project');
                }
				else {
					$valid = true;
				}
            }
			
			if($valid) {
				$args['project'][$count] = $project->name;
			}
			else {
				$args['project'][$count] = '';
			}
			
			## get tasks ##
			if(!$task = Task::getVisibleById($e->task)) {
				$args['task'][$count] = '';
			}
			else {
				$args['task'][$count] = $task->name;
			}
						
			## get persons ##
			if(!$person = Person::getById($e->person)) {
				$args['person'][$count] = '';
			}
			else {
				$args['person'][$count] = $person->nickname;
			}
				
			## get efforts ##
			$args['effort'][$count] = $e->name;
			
			## get time_start ##
			$args['time_start'][$count] = $e->time_start;
			
			## get time_end ##
			$args['time_end'][$count] = $e->time_end;
			
			## get duration ##
			$duration = round((strToGMTime($e->time_end) - strToGMTime($e->time_start))/60/60,1);
			$duration = str_replace('.',',',$duration); /* what about English syntax??? */
			$args['duration'][$count] = $duration;
			
			$count++;
		}
		else {
			$PH->abortWarning(__("You do not have enough rights"), ERROR_RIGHTS);
		}
	}
	
	exportToCSV($args);
}

Do you think that you can live with this kind of export?

Furthermore I would like to start a discussion about how to handle differences in German and English syntax with regard to numbers (e.g. 1,*3 (German), but 1.3 (English))?
The problem is if I have a German Excel I cannot write 1.3.
The other way round I can write 1,3, but that's maybe a little bit confusing for people from Great Britain or the USA?