print.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * See copyright information in the Dokeos root directory, dokeos_license.txt
  5. * @package chamilo.calendar
  6. */
  7. /**
  8. * Code
  9. */
  10. // name of the language file that needs to be included
  11. $language_file = 'agenda';
  12. $id=$_GET['id'];
  13. if(strstr($id,',')) {
  14. $id=explode(',',$id);
  15. $id=array_map('intval',$id);
  16. $id=implode(',',$id);
  17. } else {
  18. $id=intval($id);
  19. }
  20. // setting the global file that gets the general configuration, the databases, the languages, ...
  21. //require_once '../inc/global.inc.php';
  22. $course_id = api_get_course_int_id();
  23. $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA);
  24. $sql = "SELECT * FROM $TABLEAGENDA WHERE c_id = $course_id AND id IN($id) ORDER BY start_date DESC";
  25. $result = Database::query($sql);
  26. ?>
  27. <html>
  28. <head>
  29. <title><?php echo get_lang('Print'); ?></title>
  30. </head>
  31. <body style="margin: 15px; padding: 0px;">
  32. <center>
  33. <input type="button" value="<?php echo api_htmlentities(get_lang('Print'),ENT_QUOTES,$charset); ?>" onClick="javascript:window.print();" />
  34. </center>
  35. <br /><br />
  36. <?php
  37. while($row=Database::fetch_array($result)) {
  38. $row['content'] = $row['content'];
  39. $row['content'] = Text::make_clickable($row['content']);
  40. $row['content'] = str_replace('<a ','<a target="_blank" ',$row['content']);
  41. if(!empty($row['title'])) {
  42. echo '<h2>'.$row['title'].'</h2><br />';
  43. }
  44. echo get_lang('StartTime').' : ';
  45. echo api_convert_and_format_date($row["start_date"]);
  46. echo '<br />';
  47. echo get_lang('EndTime').' : ';
  48. echo api_convert_and_format_date($row["end_date"]);
  49. echo '<br /><br />';
  50. echo $row['content'].'<hr size="1" noshade="noshade" />';
  51. }
  52. ?>
  53. <br /><br />
  54. <center>
  55. <input type="button" value="<?php echo api_htmlentities(get_lang('Print'), ENT_QUOTES); ?>" onClick="javascript: window.print();" />
  56. </center>
  57. </body>
  58. </html>