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('look.export', 'com_demo') && $user->authorise('core.export', 'com_demo')) { // 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('Looks'); // get the data to export $data = $model->getExportData($pks); if (DemoHelper::checkArray($data)) { // now set the data to the spreadsheet $date = JFactory::getDate(); DemoHelper::xls($data, 'Looks_' . $date->format('jS_F_Y'), 'Looks exported (' . $date->format('jS F, Y') . ')', 'looks'); } } // Redirect to the list screen with error. $message = JText::_('COM_DEMO_EXPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_demo&view=looks', false), $message, 'error'); return; }