Aucune description

downloadrubric.blade.php 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. //Function from rorypicko (Stack Overflow)
  3. function seoUrl($string) {
  4. //Lower case everything
  5. $string = strtolower($string);
  6. //Make alphanumeric (removes all other characters)
  7. $string = preg_replace("/[^a-z0-9_\s-]/", "", $string);
  8. //Clean up multiple dashes or whitespaces
  9. $string = preg_replace("/[\s-]+/", " ", $string);
  10. //Convert whitespaces and underscore to dash
  11. $string = preg_replace("/[\s_]/", "-", $string);
  12. return $string;
  13. }
  14. header('Content-type: application/vnd.ms-word');
  15. header('Content-Disposition: attachment; Filename='.seoURL($rubric->name).'.doc');
  16. echo '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">';
  17. echo '<meta http-equiv=\'Content-Type\' content=\'text/plain; charset=utf-8\'>';
  18. echo '<body>';
  19. //Inline styles (necessary because it's a download)
  20. echo
  21. '<style>
  22. body
  23. {
  24. font: "Arial", sans-serif;
  25. }
  26. .header-text
  27. {
  28. text-align:center;
  29. font-weight: bold;
  30. margin:0;
  31. }
  32. table
  33. {
  34. border-collapse: collapse;
  35. border: 1px solid black;
  36. width: 100%;
  37. }
  38. td, th
  39. {
  40. border: 1px solid black;
  41. padding: 5px;
  42. }
  43. @page
  44. {
  45. mso-page-orientation: landscape;
  46. }
  47. </style>';
  48. ?>
  49. <p class="header-text">University of Puerto Rico, Río Piedras Campus</p>
  50. <p class="header-text">Online Learning Assessment System</p>
  51. <p class="header-text">{{$course->program->name}} Program</p>
  52. <p class="header-text">{{{ $course->code }}} {{{ $course->number }}} - {{$course->name}}</p>
  53. <h1 class="header-text">Assessment Rubric </h1>
  54. <span>Rubric: {{{ $rubric->name}}}</span><br>
  55. <span>Activity: {{{ $activity->name}}} </span><br>
  56. <span>Passing Criteria:
  57. <span id="expected_percentage">{{{ $rubric->expected_percentage }}}% of students must obtain at least </span>
  58. <span id="expected_points">{{{$rubric->expected_points}}}</span> points
  59. </span><br>
  60. <span>Date: {{ date('M d, Y') }}<br>
  61. <br>
  62. <table class="table table-striped table-condensed">
  63. <thead><tr><th>Criterion</th><th>Beginning (1-2)</th><th>In Progress (3-4)</th><th>Good (5-6)</th><th>Excellent (7-8)</th><th>Copyright</th><th>Notes</th></tr></thead>
  64. <tbody>
  65. @foreach(json_decode($rubric->contents) as $criterion)
  66. <tr>
  67. <td>
  68. {{{ $criterion->name }}}
  69. </td>
  70. <td>{{{ $criterion->description12 }}}</td>
  71. <td>{{{ $criterion->description34 }}}</td>
  72. <td>{{{ $criterion->description56 }}}</td>
  73. <td>{{{ $criterion->description78 }}}</td>
  74. <td>
  75. @if($criterion->copyright)
  76. {{{ $criterion->copyright }}}
  77. @endif
  78. </td>
  79. <td>
  80. @if($criterion->notes)
  81. {{{ $criterion->notes }}}
  82. @endif
  83. </td>
  84. </tr>
  85. @endforeach
  86. </tbody>
  87. </table>
  88. <?
  89. echo '</body>';
  90. echo '</html>';
  91. ?>