Нет описания

course.blade.php 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. @extends('layouts.master')
  2. @section('navigation')
  3. @if($role==1)
  4. @include('local.managers.admins._new_navigation')
  5. @elseif($role==2)
  6. @include('local.managers.sCoords._new_navigation')
  7. @elseif($role==3)
  8. @include('local.managers.pCoords._new_navigation')
  9. @else
  10. @include('local.professors._navigation')
  11. @endif
  12. @stop
  13. @section('main')
  14. <!-- New Activity Modal -->
  15. <div class="modal fade" id="newActivityModal" tabindex="-1" role="dialog" aria-labelledby="newActivityModalLabel" aria-hidden="true">
  16. <div class="modal-dialog modal-sm">
  17. <div class="modal-content">
  18. <div class="modal-header">
  19. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  20. <h4 class="modal-title" id="newActivityModalLabel">New Activity</h4>
  21. </div>
  22. <div class="modal-body">
  23. {{ Form::open(array('action' => array('ActivitiesController@create', $course->id))) }}
  24. <div class="form-group">
  25. {{ Form::label('name', 'Name') }}
  26. {{ Form::text('name', Input::old('name'), array('class' => 'form-control')) }}
  27. </div>
  28. <div class="form-group">
  29. {{ Form::label('description', 'Description') }}
  30. {{ Form::textarea('description', Input::old('description'), array('class' => 'form-control', 'rows'=> 5, 'placeholder'=>'Minimum 10 characters')) }}
  31. </div>
  32. <div class="btn-group" role="group">
  33. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  34. <button type="submit" class="btn btn-default btn-primary">Submit</button>
  35. </div>
  36. {{ Form::close() }}
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="row">
  42. <div class="col-md-12">
  43. <p>{{$course->name}}</p>
  44. </div>
  45. </div>
  46. <div id="dummy-graph-container" class="row">
  47. @if(is_array($outcomes_attempted))
  48. <div class="col-md-12" id="graph"></div>
  49. @else
  50. <div id="overlay"><h2>No Data</h2></div>
  51. <div class="col-md-12" id="dummy"></div>
  52. @endif
  53. </div>
  54. <div class="row">
  55. <div class="col-md-7">
  56. <h3>Activities</h3>
  57. @if(!$activities->isEmpty())
  58. @if (in_array($course->semester->id, $active_semesters))
  59. <button data-toggle="modal" data-target="#newActivityModal" class="btn btn-sm btn-default pull-right"> New Activity</button>
  60. @endif
  61. <table class="table table-striped table-condensed">
  62. <thead>
  63. <tr>
  64. <th>Name</th>
  65. <th>Date</th>
  66. <th>Updated</th>
  67. <th>Assessed</th>
  68. <th>Published</th>
  69. <th>Diagnostic</th>
  70. </tr>
  71. </thead>
  72. <tbody>
  73. @foreach ($activities as $activity)
  74. <tr>
  75. <td>{{ link_to_action('ActivitiesController@show', $activity->name, $parameters = array('id'=>$activity->id)) }}</td>
  76. <td>{{ date('M d, Y', strtotime($activity->date)) }}</td>
  77. <td>{{ date('M d, Y', strtotime($activity->updated_at)) }}</td>
  78. <td>
  79. @if($activity->o_att_array)
  80. <?php Log::info($activity->id);?>
  81. <span class="glyphicon glyphicon-ok"></span>
  82. @endif
  83. </td>
  84. <td>
  85. @if($activity->o_att_array && !$activity->draft && !$activity->diagnostic)
  86. <span class="glyphicon glyphicon-ok"></span>
  87. @endif
  88. </td>
  89. <td>
  90. @if($activity->o_att_array && !$activity->draft && $activity->diagnostic)
  91. <span class="glyphicon glyphicon-ok"></span>
  92. @endif
  93. </td>
  94. </tr>
  95. @endforeach
  96. @if (!in_array($course->semester->id, $active_semesters))
  97. <tr>
  98. <td colspan="3"><div class="alert alert-info">The semester for this course is inactive. You cannot create any more activities.</div></td>
  99. </tr>
  100. @endif
  101. </tbody>
  102. </table>
  103. <p>Unplublished activity results are <strong>not considered</strong> in the graph above.</p>
  104. @else
  105. <div class="alert alert-info">
  106. @if(in_array($course->semester->id, $active_semesters))
  107. <p>
  108. No activities.
  109. <a data-toggle="modal" data-target="#newActivityModal">
  110. Create one.
  111. </a>
  112. </p>
  113. @else
  114. <p>The semester for this course is inactive. You cannot create any activities.</p>
  115. @endif
  116. </div>
  117. @endif
  118. <button class="btn-lg btn-primary" style="margin:5px;" data-toggle="modal" data-target="#compareActivities">Compare Activities</button>
  119. <div class="modal fade" id="compareActivities">
  120. <div class="modal-dialog modal-sm">
  121. <div class="modal-content">
  122. <div class="modal-header">
  123. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  124. <h4 class="modal-title">Compare Two Activities</h4>
  125. </div>
  126. <div class="modal-body">
  127. <p></p>
  128. <h5>Select two activities to compare and present their data. <br></h5>
  129. <div class="form-group">
  130. <label>Activity 1</label>
  131. <select id='select-activity-1' data-count = "1" class="form-control selectpicker" data-live-search='true' >
  132. @foreach ($activities as $activity)
  133. @if($activity->is_assessed())
  134. <option value='{{$activity->id}}' >{{$activity->name}}</option>
  135. @endif
  136. @endforeach
  137. </select>
  138. <hr>
  139. <label>Activity 2</label>
  140. <select id='select-activity-2' data-count = "1" class="form-control selectpicker" data-live-search='true' >
  141. @foreach ($activities as $activity)
  142. @if($activity->is_assessed())
  143. <option value='{{$activity->id}}' >{{$activity->name}}</option>
  144. @endif
  145. @endforeach
  146. </select>
  147. <hr>
  148. </div>
  149. </div>
  150. <div class="modal-footer">
  151. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  152. <button type ="button" class= 'btn btn-primary' onclick ="goToURL()"
  153. @if(!count($activities))
  154. disabled
  155. @endif
  156. >Compare</button>
  157. {{ Form::close() }}
  158. </div>
  159. </div><!-- /.modal-content -->
  160. </div><!-- /.modal-dialog -->
  161. </div>
  162. </div>
  163. <div class="col-md-5">
  164. <h3>Students</h3>
  165. @if(!$students->isEmpty())
  166. <!-- If any section is assessed -->
  167. @if($course->outcomes_attempted!=NULL)
  168. {{ HTML::linkAction('CoursesController@exportGrades', 'Export grades to CSV file', array('id'=>$course->id), array('class'=>'btn btn-default btn-sm pull-right')) }}
  169. @endif
  170. {{ HTML::linkAction('CoursesController@exportGrades', 'Export grades to CSV file', array('id'=>$course->id), array('class'=>'btn btn-default btn-sm pull-right')) }}
  171. <table class="table table-striped table-condensed">
  172. <thead><tr>
  173. <th></th>
  174. <th>Name</th>
  175. <th>Number</th>
  176. <th>School</th>
  177. <th>Major</th>
  178. </tr></thead>
  179. <tbody>
  180. @foreach ($students as $i => $student)
  181. <?php $formatted_student_number = substr($student->number, 0, 3).'-'.substr($student->number, 3, -4).'-'.substr($student->number, 5, 8); ?>
  182. <tr>
  183. <td>{{$i+1}}</td>
  184. <td><a href="{{ URL::action('StudentsController@show', array('semester'=>$course->semester_id, 'id'=>$course->code.$course->number.'-'.$course->section, 'number'=>$student->number)) }}">{{ $student->name }}</a></td>
  185. <td>{{ $formatted_student_number }}</td>
  186. <td>{{ $student->school_code }}</td>
  187. <td>{{ $student->conc_code }}</td>
  188. </tr>
  189. @endforeach
  190. </tbody>
  191. </table>
  192. @else
  193. <div class="alert alert-info"><p>No students. <a href=""></a></p></div>
  194. @endif
  195. </div>
  196. </div>
  197. <script>
  198. function goToURL(){
  199. activity1 = $('#select-activity-1').val();
  200. activity2 = $('#select-activity-2').val();
  201. if(activity1 && activity2)
  202. window.open('../compare_activities/'+activity1+'/'+activity2,'_self');
  203. }
  204. </script>
  205. @stop
  206. @section('included-js')
  207. <!-- HighCharts -->
  208. <script src="{{ asset('vendor/highcharts/highcharts.js') }}"></script>
  209. <!--script src="http://code.highcharts.com/modules/exporting.js"></script -->
  210. @stop
  211. @section('javascript')
  212. <?php
  213. $student_ach = $course->student_report_for_outcome;
  214. ?>
  215. $(function () {
  216. $('#graph').highcharts({
  217. chart: {
  218. type: 'bar'
  219. },
  220. title: {
  221. text: 'Performance by Learning Outcome Criteria in {{ $title }}'
  222. },
  223. xAxis: {
  224. categories: [
  225. @foreach($outcomes as $outcome)
  226. @if(
  227. is_array($student_ach)
  228. && array_key_exists($outcome->id, $student_ach)
  229. && $student_ach[$outcome->id]['calculations']['student_attempted']!=0)
  230. <?php
  231. $attempted = $student_ach[$outcome->id]['calculations']['student_attempted'];
  232. if( isset($student_ach[$outcome->id]['calculations']['student_achieved']))
  233. $achieved =$student_ach[$outcome->id]['calculations']['student_achieved'];
  234. else $achieved = 0;
  235. ?>
  236. @else
  237. <?php
  238. $attempted =0;
  239. $achieved = 0;
  240. ?>
  241. @endif
  242. "{{{ $outcome->name }}} <br> (N = {{$attempted}} , {{$achieved}} ) ",
  243. @endforeach
  244. ],
  245. labels: {
  246. style: {
  247. fontSize:'11px'
  248. },
  249. step:1,
  250. useHTML:true,
  251. formatter: function() {
  252. return '<div style="width:200px; word-break:break; text-overflow:ellipsis; overflow:hidden;">'+this.value+'</div>';
  253. },
  254. }
  255. },
  256. yAxis: {
  257. min: 0,
  258. max: 100,
  259. title: {
  260. text: 'Percentage'
  261. },
  262. @if($course->program->expected_outcome_target == null)
  263. plotLines:[{
  264. value:70.00,
  265. color: '#000',
  266. width:3,
  267. zIndex:4,
  268. label:{
  269. text: 'Goal (70.00%)',
  270. style: {
  271. color: '#000',
  272. fontSize: '14px',
  273. }
  274. }
  275. }]
  276. @else
  277. plotLines:[{
  278. value:{{$course->program->expected_outcome_target->expected_target}},
  279. color: '#000',
  280. width:3,
  281. zIndex:4,
  282. label:{
  283. text: 'Goal ({{$course->program->expected_outcome_target->expected_target}}%)',
  284. style: {
  285. color: '#000',
  286. fontSize: '14px',
  287. }
  288. }
  289. }]
  290. @endif
  291. },
  292. tooltip: {
  293. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  294. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  295. '<td style="padding:0"><b>{point.y:.2f}</b></td></tr>',
  296. footerFormat: '</table>',
  297. shared: true,
  298. useHTML: true
  299. },
  300. plotOptions: {
  301. bar: {
  302. //grouping: false,
  303. shadow: false,
  304. borderWidth: 0,
  305. },
  306. series: {
  307. pointPadding: 0,
  308. groupPadding: 0.075
  309. },
  310. },
  311. series: [{
  312. name: 'Obtained Value',
  313. color: '#e70033',
  314. dataLabels: {
  315. enabled: true,
  316. fontSize: 8,
  317. color: '#fff',
  318. align: 'right',
  319. format: '{y:.1f}%',
  320. style: {
  321. //fontWeight: 'bold'
  322. },
  323. y:-1
  324. },
  325. data:[
  326. @foreach($outcomes as $index => $outcome)
  327. @if(
  328. is_array($student_ach)
  329. && array_key_exists($outcome->id, $student_ach)
  330. && $student_ach[$outcome->id]['calculations']['student_attempted']!=0
  331. && $student_ach[$outcome->id]['calculations']['student_achieved'])
  332. {{{ ($student_ach[$outcome->id]['calculations']['student_achieved']/$student_ach[$outcome->id]['calculations']['student_attempted'])*100 }}},
  333. @else
  334. 0,
  335. @endif
  336. @endforeach
  337. ],
  338. pointPadding: 0,
  339. }]
  340. });
  341. // Include dummy graph for outcomes
  342. @include('global.dummy-outcomes')
  343. });
  344. @stop