No Description

view_template.blade.php 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. @extends('layouts.master')
  2. @section('navigation')
  3. @include('local.managers.admins._navigation')
  4. @stop
  5. @section('main')
  6. <div class="row">
  7. <div class="col-md-12">
  8. <div class="btn-group pull-right">
  9. {{ HTML::linkAction('TemplatesController@printview', 'Print', array($template->id), array('class'=>'btn btn-default')) }}
  10. </div>
  11. <p>Passing Criteria:
  12. <span id="expected_percentage">{{{ $template->expected_percentage }}}% of students must obtain at least </span>
  13. <span id="expected_points">{{{$template->expected_points}}}</span> points
  14. </p>
  15. <table class="table table-striped table-condensed datatable" id= "RubricTable">
  16. <thead>
  17. <tr>
  18. <th></th>
  19. <th>Criterion</th>
  20. @for($i = 0; $i <$template->num_scales; $i++)
  21. <th>Scale {{$i+1}} ({{1+($i*($template->max_score/$template->num_scales))}} - {{(1+$i)*($template->max_score/$template->num_scales)}})</th>
  22. @endfor
  23. <th>Learning Outcome</th>
  24. </tr>
  25. </thead>
  26. <tbody id ="bodyRubric">
  27. </tbody>
  28. </table>
  29. <br>
  30. <br>
  31. <div id="copyright-info">
  32. <hr>
  33. <p class="small"><strong>Copyright Information</strong></p>
  34. <ul id="copyright-list" class="list-unstyled small">
  35. </ul>
  36. <hr>
  37. </div>
  38. <br>
  39. <br>
  40. <br>
  41. </div>
  42. </div>
  43. <script>
  44. function createTable(){
  45. $.post("{{URL::action('TemplatesController@onLoadFetch')}}",
  46. {id :{{$template->id}}},
  47. function (json){
  48. table = $('#RubricTable');
  49. for(criterionIndex in json.criteria ){
  50. criterion = json.criteria[criterionIndex];
  51. trFull = '<tr data-criterion-copyright="'+criterion.copyright+'" data-criterion-notes="'+criterion.notes+'">';
  52. trFull+= '<td>'+(parseInt(criterionIndex)+1)+'.</td>';
  53. if(criterion.notes){
  54. trFull+= '<td><span><em data-toggle="tooltip" data-placement="top" title="'+criterion.notes+'">'+criterion.name+'</em></span><sup></sup></td>';
  55. //if(criterion.subcriteria){
  56. //}
  57. }
  58. else{
  59. trFull+='<td><span>'+criterion.name+'</span><sup></sup></td>';
  60. }
  61. for(scalesIndex in json.scales[criterion.criterion_id]){
  62. scale = json.scales[criterion.criterion_id][scalesIndex];
  63. trFull += '<td>'+scale.description+'</td>';
  64. }
  65. trFull += '<td>Prueba</td>';
  66. trFull +='</tr>';
  67. $("#bodyRubric").append(trFull);
  68. }
  69. }, 'json'
  70. );
  71. }
  72. </script>
  73. @stop
  74. @section('included-js')
  75. @include('global._datatables_js')
  76. @stop
  77. @section('javascript')
  78. // --------------------------------------------------------------------------
  79. // Page load
  80. // --------------------------------------------------------------------------
  81. createTable();
  82. buildCopyrightList();
  83. // --------------------------------------------------------------------------
  84. // Functions
  85. // --------------------------------------------------------------------------
  86. // Build list from copyright info in template
  87. function buildCopyrightList()
  88. {
  89. // Empty the copyright list
  90. $('#copyright-list').empty();
  91. $('tbody tr').each(function( index )
  92. {
  93. var criterion = $(this);
  94. // If there's copyright info (in this particular view, it checks for empty strings)
  95. if(criterion.data('criterion-copyright')!='')
  96. {
  97. var copyright = criterion.data('criterion-copyright');
  98. // If there is anything in the copyright list
  99. if($('#copyright-list li').length>0)
  100. {
  101. // Check copyright list for the same copyright text
  102. var found = false;
  103. $('#copyright-list li').each(function()
  104. {
  105. // If found, give the string its number
  106. if(copyright==$(this).find('span').text())
  107. {
  108. copyrightNumber = Number.parseInt($(this).find('sup').text());
  109. criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
  110. found =true;
  111. //to break
  112. return false;
  113. }
  114. });
  115. // Otherwise, give it the next number and append a new item to the
  116. // list
  117. if(!found)
  118. {
  119. var copyrightNumber = $('#copyright-list li').length+1;
  120. criterion.children('td:nth-child(2)').find('sup').text(copyrightNumber);
  121. $('#copyright-list').append('<li><sup>'+copyrightNumber+' </sup><span>'+copyright+'<span></li>');
  122. }
  123. }
  124. // Otherwise, give it number 1 and append it
  125. else
  126. {
  127. criterion.children('td:nth-child(2)').find('sup').text('1');
  128. $('#copyright-list').append('<li><sup>1 </sup><span>'+copyright+'<span></li>');
  129. }
  130. }
  131. });
  132. if($('#copyright-info li').length>0)
  133. {
  134. $('#copyright-info').show();
  135. }
  136. else
  137. {
  138. $('#copyright-info').hide();
  139. }
  140. }
  141. @stop