Nenhuma descrição

downloadtemplate.blade.php 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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));
  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/html; 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><br>
  60. <table class="table table-striped table-condensed">
  61. <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></tr></thead>
  62. <tbody>
  63. @foreach(json_decode($rubric->contents) as $criterion)
  64. <tr>
  65. @if(isset($criterion->notes))
  66. <td>
  67. <em data-toggle="tooltip" data-placement="top" title="{{ $criterion->notes }}">{{{ $criterion->name }}}</em>
  68. </td>
  69. @else
  70. <td>
  71. {{{ $criterion->name }}}
  72. </td>
  73. @endif
  74. <td>{{{ $criterion->description12 }}}</td>
  75. <td>{{{ $criterion->description34 }}}</td>
  76. <td>{{{ $criterion->description56 }}}</td>
  77. <td>{{{ $criterion->description78 }}}</td>
  78. </tr>
  79. @endforeach
  80. </tbody>
  81. </table>
  82. <?
  83. echo '</body>';
  84. echo '</html>';
  85. ?>