id,$the_module, 'access') == ACL_ALLOW_ENABLED && (ACLAction::getUserAccessLevel($current_user->id, $the_module, 'admin') == ACL_ALLOW_ADMIN || ACLAction::getUserAccessLevel($current_user->id, $the_module, 'admin') == ACL_ALLOW_ADMIN_DEV))))){ die($GLOBALS['app_strings']['ERR_EXPORT_DISABLED']); } //check to see if this is a request for a sample or for a regular export if(!empty($_REQUEST['sample'])){ //call special method that will create dummy data for bean as well as insert standard help message. $content = exportSample(clean_string($_REQUEST['module'])); }else if(!empty($_REQUEST['uid'])){ $content = export(clean_string($_REQUEST['module']), $_REQUEST['uid'], isset($_REQUEST['members']) ? $_REQUEST['members'] : false); }else{ $content = export(clean_string($_REQUEST['module'])); } $filename = $_REQUEST['module']; //use label if one is defined if(!empty($app_list_strings['moduleList'][$_REQUEST['module']])){ $filename = $app_list_strings['moduleList'][$_REQUEST['module']]; } //strip away any blank spaces $filename = str_replace(' ','',$filename); $transContent = $GLOBALS['locale']->translateCharset($content, 'UTF-8', $GLOBALS['locale']->getExportCharset()); if($_REQUEST['members'] == true) $filename .= '_'.'members'; /////////////////////////////////////////////////////////////////////////////// //// BUILD THE EXPORT FILE ob_clean(); header("Pragma: cache"); header("Content-type: application/octet-stream; charset=".$GLOBALS['locale']->getExportCharset()); header("Content-Disposition: attachment; filename={$filename}.csv"); header("Content-transfer-encoding: binary"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); header("Last-Modified: " . TimeDate::httpTime() ); header("Cache-Control: post-check=0, pre-check=0", false ); header("Content-Length: ".mb_strlen($transContent, '8bit')); if (!empty($sugar_config['export_excel_compatible'])) { $transContent=chr(255) . chr(254) . mb_convert_encoding($transContent, 'UTF-16LE', 'UTF-8'); } print $transContent; sugar_cleanup(true);