public function exportAction()
 {
     $id = mysql_escape_string($_GET['id']);
     $week = !empty($_GET['week']) ? (int) $_GET['week'] : 1;
     if ($this->webStorageIndex->indexHasId($id)) {
         $type = !empty($_GET['type']) ? $_GET['type'] : 'html';
         $this->view->setParameter('timesheet', new Timesheet($id));
         switch ($type) {
             default:
             case 'html':
                 $this->view->header = array('title' => array(1 => $this->view->timesheet->getName()), 'description' => 'Timesheet pour la semaine (' . $week . ')', 'week-date' => $this->view->timesheet->getWeekDate($week));
                 $this->view->setParameter('weekindex', $week);
                 break;
             case 'csv':
                 header('Content-Encoding: UTF-8');
                 header('Content-type: text/csv; charset=UTF-8');
                 header("Content-type: text/csv");
                 header("Content-Disposition: attachment; filename=export_" . $id . "_week" . $week . ".csv");
                 header("Pragma: no-cache");
                 header("Expires: 0");
                 echo "";
                 // UTF-8 BOM
                 echo $this->view->timesheet->getName() . ' Timesheet pour la semaine (' . $week . ')' . "\n";
                 $timesheet = new Timesheet($id);
                 foreach ($timesheet->getTasksWeek($week) as $task) {
                     echo $task->getTime() . ';' . $task->getName() . "\n";
                 }
                 exit;
                 break;
         }
     } else {
         $this->view->setTemplate('404_timesheet');
     }
 }