No Description

view_template.blade.php 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. @extends('layouts.master')
  2. @section('navigation')
  3. @if(Auth::user()->role==1)
  4. @include('local.managers.admins._new_navigation')
  5. @elseif(Auth::user()->role==2)
  6. @include('local.managers.sCoords._new_navigation')
  7. @elseif(Auth::user()->role==3)
  8. @include('local.managers.pCoords._new_navigation')
  9. @elseif(Auth::user()->role==4)
  10. @include('local.professors._navigation')
  11. @endif
  12. @stop
  13. @section('main')
  14. <div class="row">
  15. <div class="col-md-12">
  16. <div class="btn-group pull-right">
  17. {{ HTML::linkAction('TemplatesController@printview', 'Print', array($template->id), array('class'=>'btn btn-default')) }}
  18. <button class= 'btn btn-default' onclick ='fetchObjectivesForTemplate("#bodyRubric")'>View Objectives</button>
  19. </div>
  20. <p>Passing Criteria:
  21. <span id="expected_percentage">{{{ $template->expected_percentage }}}% of students must obtain at least </span>
  22. <span id="expected_points">{{{$template->expected_points}}}</span> points
  23. </p>
  24. <table class="table datatable" id= "RubricTable">
  25. <thead>
  26. <tr>
  27. <th></th>
  28. <th>Criterion</th>
  29. @for($i = 0; $i <$template->num_scales; $i++)
  30. <th>{{$template->titles[$i]}} ({{1+($i*($template->max_score/$template->num_scales))}} - {{(1+$i)*($template->max_score/$template->num_scales)}})</th>
  31. @endfor
  32. <th>Learning Outcome</th>
  33. </tr>
  34. </thead>
  35. <tbody id ="bodyRubric">
  36. @foreach($template->criteria as $index=> $criterion)
  37. <tr data-criterion-id = "{{$criterion->id}}" data-criterion-copyright="{{$criterion->copyright}}" data-criterion-notes="{{$criterion->notes}}">
  38. <td>{{$index+1}}.</td>
  39. @if($criterion->notes)
  40. <td><span><em data-toggle="tooltip" data-placement="top" title="{{$criterion->notes}}">{{$criterion->name}}</em></span><sup></sup></td>
  41. @else
  42. <td><span>{{$criterion->name}}</span><sup></sup></td>
  43. @endif
  44. @foreach ($criterion->scales as $scale)
  45. <td>{{$scale}}</td>
  46. @endforeach
  47. <td><ol>
  48. @foreach ($criterion->outcomes as $outcome)
  49. <p>{{$outcome->name}}</p>
  50. @endforeach
  51. </ol></td>
  52. @endforeach
  53. </tbody>
  54. </table>
  55. <br>
  56. <br>
  57. <div id="copyright-info">
  58. <hr>
  59. <p class="small"><strong>Copyright Information</strong></p>
  60. <ul id="copyright-list" class="list-unstyled small">
  61. </ul>
  62. <hr>
  63. </div>
  64. <br>
  65. <br>
  66. <br>
  67. </div>
  68. </div>
  69. <div class="modal fade" id="objectives-crit-modal">
  70. <div class="modal-dialog modal-md">
  71. <div class="modal-content">
  72. <div class="modal-header">
  73. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  74. <h4 class="modal-title text-center" id ="modal-title-rubric">These are the objectives in each Criterion in this Rubric</h4>
  75. </div>
  76. <div class="modal-body" id ="objectives-crit-modal-body">
  77. </div>
  78. <div class="modal-footer">
  79. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  80. </div>
  81. </div><!-- /.modal-content -->
  82. </div><!-- /.modal-dialog -->
  83. </div>
  84. <script>
  85. function fetchObjectivesForTemplate(tbody){
  86. allCriteria = [];
  87. $(tbody).children('tr').each(function (index){
  88. allCriteria.push($(this).data('criterion-id'));
  89. })
  90. $.post(
  91. "{{URL::action('TemplatesController@fetchObjectivesForTemplate')}}",
  92. {
  93. allCriteria:allCriteria
  94. },
  95. function(crit){
  96. modal_name = '#objectives-crit-modal';
  97. $(modal_name+'-body').html(' ');
  98. ol_crit = $("<ol>")
  99. $(modal_name+'-body').append(ol_crit);
  100. $.each(crit, function(index, cri){
  101. li = $("<li>").html("<strong>"+cri.name+"</strong>");
  102. ul_for_ob = $("<ul>");
  103. $.each(cri.all_objectives, function(ind, obj){
  104. li2 = $("<li>").html(obj.text)
  105. ul_for_ob.append(li2);
  106. })
  107. li.append(ul_for_ob);
  108. ol_crit.append(li);
  109. })
  110. $(modal_name).modal('show');
  111. }
  112. )
  113. }
  114. /*
  115. function createTable(){
  116. $.post("{{URL::action('TemplatesController@onLoadFetch')}}",
  117. {id :{{$template->id}}},
  118. function (json){
  119. table = $('#RubricTable');
  120. for(criterionIndex in json.criteria ){
  121. criterion = json.criteria[criterionIndex];
  122. trFull = '<tr data-criterion-copyright="'+criterion.copyright+'" data-criterion-notes="'+criterion.notes+'">';
  123. trFull+= '<td>'+(parseInt(criterionIndex)+1)+'.</td>';
  124. if(criterion.notes){
  125. trFull+= '<td><span><em data-toggle="tooltip" data-placement="top" title="'+criterion.notes+'">'+criterion.name+'</em></span><sup></sup></td>';
  126. //if(criterion.subcriteria){
  127. //}
  128. }
  129. else{
  130. trFull+='<td><span>'+criterion.name+'</span><sup></sup></td>';
  131. }
  132. for(scalesIndex in json.scales[criterion.criterion_id]){
  133. scale = json.scales[criterion.criterion_id][scalesIndex];
  134. trFull += '<td>'+scale.description+'</td>';
  135. }
  136. trFull += '<td>Prueba</td>';
  137. trFull +='</tr>';
  138. $("#bodyRubric").append(trFull);
  139. }
  140. }, 'json'
  141. );
  142. }**/
  143. </script>
  144. @stop
  145. @section('included-js')
  146. @include('global._datatables_js')
  147. @stop
  148. @section('javascript')
  149. // --------------------------------------------------------------------------
  150. // Page load
  151. // --------------------------------------------------------------------------
  152. buildCopyrightList();
  153. // --------------------------------------------------------------------------
  154. // Functions
  155. // --------------------------------------------------------------------------
  156. // Build list from copyright info in template
  157. function buildCopyrightList()
  158. {
  159. // Empty the copyright list
  160. $('#copyright-list').empty();
  161. $('tbody tr').each(function( index )
  162. {
  163. var criterion = $(this);
  164. // If there's copyright info (in this particular view, it checks for empty strings)
  165. if(criterion.data('criterion-copyright')!='')
  166. {
  167. var copyright = criterion.data('criterion-copyright');
  168. // If there is anything in the copyright list
  169. if($('#copyright-list li').length>0)
  170. {
  171. // Check copyright list for the same copyright text
  172. var found = false;
  173. $('#copyright-list li').each(function()
  174. {
  175. // If found, give the string its number
  176. if(copyright==$(this).find('span').text())
  177. {
  178. copyrightNumber = Number.parseInt($(this).find('sup').text());
  179. criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
  180. found =true;
  181. //to break
  182. return false;
  183. }
  184. });
  185. // Otherwise, give it the next number and append a new item to the
  186. // list
  187. if(!found)
  188. {
  189. var copyrightNumber = $('#copyright-list li').length+1;
  190. criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
  191. $('#copyright-list').append('<li><sup>'+copyrightNumber+' </sup><span>'+copyright+'<span></li>');
  192. }
  193. }
  194. // Otherwise, give it number 1 and append it
  195. else
  196. {
  197. criterion.children('td:nth-child(2)').find('sup').text('1');
  198. $('#copyright-list').append('<li><sup>1 </sup><span>'+copyright+'<span></li>');
  199. }
  200. }
  201. });
  202. if($('#copyright-info li').length>0)
  203. {
  204. $('#copyright-info').show();
  205. }
  206. else
  207. {
  208. $('#copyright-info').hide();
  209. }
  210. }
  211. @stop