public function exportData()
 {
     // Check for request forgeries
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // check if export is allowed for this user.
     $user = JFactory::getUser();
     if ($user->authorise('help_document.export', 'com_costbenefitprojection') && $user->authorise('core.export', 'com_costbenefitprojection')) {
         // Get the input
         $input = JFactory::getApplication()->input;
         $pks = $input->post->get('cid', array(), 'array');
         // Sanitize the input
         JArrayHelper::toInteger($pks);
         // Get the model
         $model = $this->getModel('Help_documents');
         // get the data to export
         $data = $model->getExportData($pks);
         if (CostbenefitprojectionHelper::checkArray($data)) {
             // now set the data to the spreadsheet
             $date = JFactory::getDate();
             CostbenefitprojectionHelper::xls($data, 'Help_documents_' . $date->format('jS_F_Y'), 'Help documents exported (' . $date->format('jS F, Y') . ')', 'help documents');
         }
     }
     // Redirect to the list screen with error.
     $message = JText::_('COM_COSTBENEFITPROJECTION_EXPORT_FAILED');
     $this->setRedirect(JRoute::_('index.php?option=com_costbenefitprojection&view=help_documents', false), $message, 'error');
     return;
 }