exp.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /*
  3. DOKEOS - elearning and course management software
  4. For a full list of contributors, see documentation/credits.html
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. See "documentation/licence.html" more details.
  10. Contact:
  11. Dokeos
  12. Rue des Palais 44 Paleizenstraat
  13. B-1030 Brussels - Belgium
  14. Tel. +32 (2) 211 34 56
  15. */
  16. /**
  17. * @package dokeos.survey
  18. * @author
  19. * @version $Id: exp.php 10605 2007-01-06 17:55:20Z pcool $
  20. */
  21. $filename = 'account_history_'.date('mdY').'.csv';
  22. //$strExportList = array(0=>'a',1=>'b',2=>'c');
  23. //$strExportList=$_REQUEST['strExportList'];
  24. //echo "Transaction Date, Particulars, Amount($)";
  25. if($_REQUEST[qtype]=="1"){
  26. $strRows .="Total No. of users attempted this survey =";
  27. $strRows .=$_REQUEST['count_total_user'];
  28. $strRows .="\n";
  29. $strRows .=$_REQUEST['caption'];
  30. $strRows .= ",";
  31. $strRows .= "No. of Votes";
  32. $strRows .= ",";
  33. $strRows .= "Result (%)";
  34. $strRows .="\n";
  35. $strRows .=$_REQUEST['a1'];
  36. $strRows .=",";
  37. $strRows .=$_REQUEST[count_a1];
  38. $strRows .=",";
  39. $strRows .="30%";
  40. $strRows .="\n";
  41. $strRows .=$_REQUEST['a2'];
  42. $strRows .=",";
  43. $strRows .=$_REQUEST[count_a2];
  44. $strRows .=",";
  45. $strRows .="40%";
  46. }
  47. if($strExportList[0])
  48. {
  49. $intCount = 0;
  50. //$strRows='';
  51. foreach($strExportList as $arrRow)
  52. {
  53. $ItemCount = count($strExportList);
  54. $strRows .=strip_tags(str_replace("<BR>"," ", $arrRow[0])).",";
  55. $strRows .=str_pad($arrRow[1],255);
  56. $strRows .=",".str_pad($arrRow[2],12);
  57. $strRows .=",";
  58. $strRows.= "\r\n";
  59. $intCount++;
  60. }
  61. }
  62. // Stream the file, will prompt user to open or save
  63. header("Content-type: application/vnd.ms-excel");
  64. header ("Content-Type: application/octet-stream");
  65. header("Content-disposition: attachment; filename=$filename");
  66. header("Pragma: no-cache");
  67. header("Expires: 0");
  68. echo $strRows;
  69. die();
  70. ?>