Ingen beskrivning

activity.blade.php 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. @extends('layouts.master')
  2. @section('css')
  3. {{ HTML::style('vendor/jquery-ui-1.11.4.custom/jquery-ui.min.css') }}
  4. {{ HTML::style('vendor/jquery-ui-1.11.4.custom/jquery-ui.theme.min.css') }}
  5. @stop
  6. @section('navigation')
  7. @if($role==1)
  8. @include('local.managers.admins._navigation')
  9. @elseif($role==2)
  10. @include('local.managers.sCoords._navigation')
  11. @elseif($role==3)
  12. @include('local.managers.pCoords._navigation')
  13. @else
  14. @include('local.professors._navigation')
  15. @endif
  16. @stop
  17. @section('main')
  18. <!-- Edit Activity -->
  19. <div class="modal fade" id="modal-edit-activity">
  20. <div class="modal-dialog modal-sm">
  21. <div class="modal-content">
  22. <div class="modal-header">
  23. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  24. <h4 class="modal-title">Edit Activity</h4>
  25. </div>
  26. <div class="modal-body">
  27. {{ Form::open(array('action' => array('ActivitiesController@update', $activity->id))) }}
  28. <div class="form-group">
  29. {{ Form::label('name', 'Name') }}
  30. {{ Form::text('name', $activity->name, array('class' => 'form-control')) }}
  31. </div>
  32. <div class="form-group">
  33. {{ Form::label('description', 'Description') }}
  34. {{ Form::textarea('description', $activity->description, array('class' => 'form-control', 'rows'=> 4, 'placeholder'=>'Minimum 10 characters')) }}
  35. </div>
  36. <div class="form-group">
  37. {{ Form::label('date', 'Date') }}
  38. {{ Form::text('date', $activity->date, array('id'=>'date', 'class' => 'form-control', 'maxLength'=>10)) }}
  39. </div>
  40. </div>
  41. <div class="modal-footer">
  42. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  43. <input class="btn btn-primary" name="update_activity_information" value="Save" type="submit"/>
  44. {{ Form::close() }}
  45. </div>
  46. </div><!-- /.modal-content -->
  47. </div><!-- /.modal-dialog -->
  48. </div><!-- /.modal -->
  49. <!-- Edit Transforming Actions -->
  50. <div class="modal fade" id="modal-edit-transforming-actions">
  51. <div class="modal-dialog modal-sm">
  52. <div class="modal-content">
  53. <div class="modal-header">
  54. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  55. <h4 class="modal-title">Edit Formative Actions</h4>
  56. </div>
  57. <div class="modal-body">
  58. {{ Form::open(array('action' => array('TransformativeActionsController@postActivityCriterion', $activity->id))) }}
  59. <p>A Formative Action is the educational action to be taken to address the criteria of an unachieved Learning Outcome.</p>
  60. <p>Una acción formativa es una acción educativa a tomarse para atender el o los criterios de un dominio dado que no se alcanzaron.</p>
  61. <h5>Choose criteria for the transforming action <br>
  62. Escoge los criterion para la acción transformadora</h5>
  63. <div class="form-group">
  64. {{ Form::label('select-activity-criterion', 'Criteria')}}
  65. <select id='select-activity-criterion' name = "trans_act[]"data-count = "1" class="form-control selectpicker" >
  66. @foreach ($activity_criterion as $ac)
  67. <option value='{{$ac->id}}' selected>{{$ac->name}}</option>
  68. @endforeach
  69. </select>
  70. </div>
  71. <button id='button-add-activity-criterion' class='btn btn-md btn-secondary'>
  72. <span class='glyphicon glyphicon-plus'>
  73. </span>
  74. Add another Criteria
  75. </button>
  76. <hr>
  77. <div class ="form-group">
  78. {{ Form::label('name_trans', 'Name of Formative Actions')}}
  79. {{ Form::text('name_trans', '', array('class' => 'form-control')) }}
  80. </div>
  81. <div class="form-group">
  82. {{ Form::label('transforming_actions', 'Formative Actions') }}
  83. {{ Form::textarea('transforming_actions', $activity->transforming_actions, array('class' => 'form-control', 'rows'=> 4, 'placeholder'=>'Actions to improve student performance after assessment (optional)')) }}
  84. </div>
  85. </div>
  86. <div class="modal-footer">
  87. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  88. <input class="btn btn-primary" name="update_transforming_actions" value="Save" type="submit"/>
  89. {{ Form::close() }}
  90. </div>
  91. </div><!-- /.modal-content -->
  92. </div><!-- /.modal-dialog -->
  93. </div><!-- /.modal -->
  94. <!-- Edit Transforming Actions -->
  95. <div class="modal fade" id="modal-edit-assessment-comments">
  96. <div class="modal-dialog modal-sm">
  97. <div class="modal-content">
  98. <div class="modal-header">
  99. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  100. <h4 class="modal-title">Edit Assessment Comments</h4>
  101. </div>
  102. <div class="modal-body">
  103. {{ Form::open(array('action' => array('ActivitiesController@update', $activity->id))) }}
  104. <p>Write any additional comments about this activity.</p>
  105. <p>Escriba cualquier comentario adicional sobre esta actividad.</p>
  106. <div class="form-group">
  107. {{ Form::label('assessment_comments', 'Assessment Comments') }}
  108. {{ Form::textarea('assessment_comments', $activity->assessment_comments, array('class' => 'form-control', 'rows'=> 4, 'placeholder'=>'(optional)')) }}
  109. </div>
  110. </div>
  111. <div class="modal-footer">
  112. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  113. <input class="btn btn-primary" name="update_assessment_comments" value="Save" type="submit"/>
  114. {{ Form::close() }}
  115. </div>
  116. </div><!-- /.modal-content -->
  117. </div><!-- /.modal-dialog -->
  118. </div><!-- /.modal -->
  119. <!-- Delete Activity Modal -->
  120. <div class="modal fade" id="modal-confirm-delete-activity">
  121. <div class="modal-dialog modal-sm">
  122. <div class="modal-content">
  123. <div class="modal-header">
  124. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  125. <h4 class="modal-title">Delete Activity</h4>
  126. </div>
  127. <div class="modal-body">
  128. <p>Deleting this activity will also delete any related assessment data. Do you want to continue?</p>
  129. </div>
  130. <div class="modal-footer">
  131. <!-- Confirm deletion (must use form, because Laravel needs to use the DELETE method) -->
  132. {{ Form::open(array('action' => array('ActivitiesController@destroy', $activity->id), 'method'=>'delete')) }}
  133. <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
  134. <button class="btn btn-primary" type="submit">Delete</button>
  135. {{ Form::close() }}
  136. </div>
  137. </div><!-- /.modal-content -->
  138. </div><!-- /.modal-dialog -->
  139. </div><!-- /.modal -->
  140. <!-- Delete Assessment Modal -->
  141. <div class="modal fade" id="modal-confirm-delete-assessment">
  142. <div class="modal-dialog modal-sm">
  143. <div class="modal-content">
  144. <div class="modal-header">
  145. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  146. <h4 class="modal-title">Delete Assessment</h4>
  147. </div>
  148. <div class="modal-body">
  149. <p>Are you sure you want to delete the assessment results?</p>
  150. </div>
  151. <div class="modal-footer">
  152. <!-- Confirm deletion (must use form, because Laravel needs to use the DELETE method) -->
  153. {{ Form::open(array('action' => array('ActivitiesController@deleteAssessment'))) }}
  154. <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
  155. <input type="hidden" id="id" name="id" value="{{ $activity->id }}">
  156. <button class="btn btn-primary" type="submit">Delete</button>
  157. {{ Form::close() }}
  158. </div>
  159. </div><!-- /.modal-content -->
  160. </div><!-- /.modal-dialog -->
  161. </div><!-- /.modal -->
  162. <div class="row">
  163. <div class="col-md-9" id="graph"></div>
  164. <div class="col-md-3">
  165. <div class="btn-group-vertical btn-block" role="group" aria-label="...">
  166. <!-- If semester is active, allow users to delete the activity -->
  167. @if (in_array($course->semester->id, $active_semesters))
  168. <button class="btn btn-primary btn-sm btn-block" btn-block data-toggle="modal" data-target="#modal-edit-activity">Edit Activity Information</button>
  169. @endif
  170. <!-- If no rubric is assigned and the semester is active -->
  171. @if(count($activity->rubric) == 0 && in_array($course->semester->id, $active_semesters))
  172. {{ HTML::linkAction('RubricsController@newRubric', 'Assign Rubric', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
  173. <!--{{ HTML::linkAction('RubricsController@newOtherMethod', 'Assign Other Assessment Method', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}-->
  174. @else
  175. {{ HTML::linkAction('RubricsController@show', 'View Rubric', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
  176. <!-- If semester is active, allow users to change rubrics -->
  177. @if (in_array($course->semester->id, $active_semesters))
  178. {{ HTML::linkAction('RubricsController@newRubric', 'Change Rubric', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
  179. @endif
  180. <!-- If there is no assessment and the semester is active -->
  181. @if(!$activity->is_assessed() && in_array($course->semester->id, $active_semesters))
  182. {{ HTML::linkAction('ActivitiesController@assess', 'Assess', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
  183. @else
  184. {{ HTML::linkAction('ActivitiesController@viewAssessment', 'View Assessment Sheet', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
  185. <!-- If semester is active, allow users to edit assessments -->
  186. @if (in_array($course->semester->id, $active_semesters))
  187. {{ HTML::linkAction('ActivitiesController@assess', 'Edit Assessment', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
  188. <button class="btn btn-primary btn-sm btn-block" btn-block data-toggle="modal" data-target="#modal-confirm-delete-assessment">Delete Assessment</button>
  189. <button class="btn btn-primary btn-sm btn-block" btn-block data-toggle="modal" data-target="#modal-edit-transforming-actions">Formative Actions</button>
  190. <button class="btn btn-primary btn-sm btn-block" btn-block data-toggle="modal" data-target="#modal-edit-assessment-comments">Assessment Comments</button>
  191. @endif
  192. @endif
  193. @endif
  194. <!-- If semester is active, allow users to delete the activity -->
  195. @if (in_array($course->semester->id, $active_semesters))
  196. <button class="btn btn-primary btn-sm btn-block" btn-block data-toggle="modal" data-target="#modal-confirm-delete-activity">Delete Activity</button>
  197. @endif
  198. {{ HTML::linkAction('CoursesController@show', 'Back to Section', array($course->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
  199. </div>
  200. <hr>
  201. <h5>Description</h5>
  202. <p>{{ $activity->description }}</p>
  203. <?php
  204. $formative_actions = $activity->formativeActionsWithCriteria();
  205. ?>
  206. @if($formative_actions != NULL)
  207. <hr>
  208. <h5>Formative Actions</h5>
  209. <p><strong>{{ $formative_actions[0]->at_text }}: </strong> {{$formative_actions[0]->description}}</p>
  210. <h5>Formative Action's Associated Criteria</h5>
  211. <ul>
  212. @foreach($formative_actions as $criteria)
  213. <li>{{$criteria->name}}</li>
  214. @endforeach
  215. </ul>
  216. @endif
  217. @if($activity->assessment_comments != NULL)
  218. <hr>
  219. <h5>Assessment Comments</h5>
  220. {{{ $activity->assessment_comments }}}
  221. @endif
  222. </div>
  223. </div>
  224. <div class="row">
  225. <div class="col-md-12" id="criteriaGraph"></div>
  226. </div>
  227. <script>
  228. $('#button-add-activity-criterion').on('click', function(e){
  229. e.preventDefault();
  230. options = $('#select-activity-criterion').html();
  231. counter = $('#select-activity-criterion').data('count');
  232. var div = $('<div/>', {
  233. 'id': "selectFor"+counter
  234. });
  235. var divForSelect = $('<div/>', {
  236. 'class':'col-12 form-group'
  237. });
  238. var select = $('<select/>', {
  239. 'class':'selectpicker',
  240. 'name': 'trans_act[]',
  241. })
  242. var $button = $('<button/>', {
  243. 'type': 'button',
  244. 'class': 'btn btn-primary',
  245. 'onclick': '$(this).parent().parent().remove();$("#button-add-activity-criterion").show(); '
  246. }).html('X');
  247. divForSelect.append(select);
  248. divForSelect.append($button);
  249. div.append(divForSelect);
  250. $('#select-activity-criterion').parent().parent().after(div);
  251. select.html(options);
  252. refreshSelects();
  253. countSelects = $('.selectpicker').length;
  254. countOptions = $('#select-activity-criterion option').length;
  255. if(countOptions == countSelects){
  256. $('#button-add-activity-criterion').hide();
  257. }
  258. });
  259. function refreshSelects(){
  260. $('.selectpicker').each(function(){
  261. $(this).selectpicker('refresh');
  262. });
  263. }
  264. $(document).ready(function(){
  265. if({{count($transformative_actions)}}){
  266. var trans_actions = {{json_encode($transformative_actions)}};
  267. //$('#select-activity-criterion').val(trans_actions[0].activity_id);
  268. $('#name_trans').val(trans_actions[0].at_text);
  269. $('#transforming_actions').val(trans_actions[0].description);
  270. refreshSelects();
  271. for(index in trans_actions){
  272. if(index==0) continue;
  273. $('#button-add-activity-criterion').click();
  274. }
  275. $('.selectpicker').each(function(index){
  276. $(this).val(trans_actions[index].activity_criterion_id);
  277. });
  278. refreshSelects();
  279. }
  280. });
  281. </script>
  282. @stop
  283. @section('included-js')
  284. <!-- HighCharts -->
  285. <script src="{{ asset('vendor/highcharts/highcharts.js') }}"></script>
  286. <!--script src="http://code.highcharts.com/modules/exporting.js"></script -->
  287. <!-- Datepicker -->
  288. <script src="{{ asset('vendor/jquery-ui-1.11.4.custom/jquery-ui.min.js') }}"></script>
  289. @stop
  290. @section('javascript')
  291. $(function () {
  292. $('#date').datepicker({
  293. dateFormat: "yy-mm-dd"
  294. });
  295. $('#criteriaGraph').highcharts({
  296. chart: {
  297. type: 'bar',
  298. height:
  299. @if($activity->is_assessed())
  300. {{ count($activity->criteria_achieved() )*22+225 }}
  301. @else
  302. {{22+225}}
  303. @endif
  304. ,
  305. },
  306. title: {
  307. text: 'Criteria Achievement',
  308. },
  309. xAxis: {
  310. categories: [
  311. @if($activity->is_assessed())
  312. @foreach($activity->criteria_achieved() as $id=>$value)
  313. "{{{ Criterion::withTrashed()->find($id)->name }}}",
  314. @endforeach
  315. @endif
  316. ],
  317. labels: {
  318. style: {
  319. fontSize:'12px'
  320. },
  321. step:1,
  322. useHTML:true,
  323. formatter: function() {
  324. return '<div style="width:200px; word-break:break; text-overflow:ellipsis; overflow:hidden;">'+this.value+'</div>';
  325. },
  326. }
  327. },
  328. yAxis: {
  329. min: 0,
  330. max: 100,
  331. title: {
  332. text: 'Percentage'
  333. },
  334. @if(isset($activity->rubric[0]) and isset($activity->rubric[0]->expected_percentage) )
  335. plotLines:[{
  336. value:{{ $activity->rubric[0]->expected_percentage }},
  337. color: '#000',
  338. width:3,
  339. zIndex:4,
  340. label:{
  341. text: 'Goal ({{ $activity->rubric[0]->expected_percentage }}%)',
  342. style: {
  343. color: '#000',
  344. fontSize: '14px',
  345. }
  346. }
  347. }]
  348. @endif
  349. },
  350. tooltip: {
  351. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  352. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  353. '<td style="padding:0"><b>{point.y:.2f}%</b></td></tr>',
  354. footerFormat: '</table>',
  355. shared: true,
  356. useHTML: true
  357. },
  358. plotOptions: {
  359. bar: {
  360. //grouping: false,
  361. shadow: false,
  362. borderWidth: 0,
  363. },
  364. series: {
  365. pointPadding: 0,
  366. groupPadding: 0.1
  367. },
  368. },
  369. series: [{
  370. type:'column',
  371. name: 'Passed',
  372. color: '#e70033',
  373. dataLabels: {
  374. enabled: true,
  375. fontSize: 8,
  376. color: '#fff',
  377. align: 'right',
  378. format: '{y:.1f}%',
  379. style: {
  380. //fontWeight: 'bold'
  381. },
  382. y:-1
  383. },
  384. data:[
  385. @if($activity->is_assessed())
  386. @foreach($activity->cap_array as $id=>$crit)
  387. //This conditional is to ignore criteria that weren't assessed. These would have a value of null.
  388. @if($crit->score_percentage)
  389. {{{ $crit->score_percentage }}},
  390. @else
  391. 0,
  392. @endif
  393. @endforeach
  394. @endif
  395. ],
  396. pointPadding: 0,
  397. }
  398. ]
  399. });
  400. $('#graph').highcharts({
  401. chart: {
  402. type: 'bar',
  403. },
  404. title: {
  405. text: 'Performance by Learning Outcome Criteria in {{ $title }}'
  406. },
  407. xAxis: {
  408. categories: [
  409. @foreach($outcomes as $outcome)
  410. "{{{ $outcome->name }}}",
  411. @endforeach
  412. ],
  413. labels: {
  414. style: {
  415. fontSize:'11px'
  416. },
  417. step:1,
  418. useHTML:true,
  419. formatter: function() {
  420. return '<div style="width:200px; word-break:break; text-overflow:ellipsis; overflow:hidden;">'+this.value+'</div>';
  421. },
  422. }
  423. },
  424. yAxis: {
  425. min: 0,
  426. max: 100,
  427. title: {
  428. text: 'Percentage'
  429. }
  430. },
  431. tooltip: {
  432. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  433. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  434. '<td style="padding:0"><b>{point.y:.2f}</b></td></tr>',
  435. footerFormat: '</table>',
  436. shared: true,
  437. useHTML: true
  438. },
  439. plotOptions: {
  440. bar: {
  441. //grouping: false,
  442. shadow: false,
  443. borderWidth: 0,
  444. },
  445. series: {
  446. pointPadding: 0,
  447. groupPadding: 0.075
  448. },
  449. },
  450. series: [{
  451. name: 'Obtained Value',
  452. color: '#e70033',
  453. dataLabels: {
  454. enabled: true,
  455. fontSize: 8,
  456. color: '#fff',
  457. align: 'right',
  458. format: '{y:.1f}%',
  459. style: {
  460. //fontWeight: 'bold'
  461. },
  462. y:-1
  463. },
  464. data:[
  465. @foreach($outcomes as $index => $outcome)
  466. @if(
  467. is_array($outcomes_attempted)
  468. && array_key_exists($outcome->id, $outcomes_attempted)
  469. && $outcomes_attempted[$outcome->id]!=0)
  470. {{{ ($outcomes_achieved[$outcome->id]/$outcomes_attempted[$outcome->id])*100 }}},
  471. @else
  472. 0,
  473. @endif
  474. @endforeach
  475. ],
  476. pointPadding: 0,
  477. }, {
  478. name: 'Expected Value',
  479. color: '#555555',
  480. dataLabels: {
  481. enabled: true,
  482. fontSize: 8,
  483. color: '#fff',
  484. align: 'right',
  485. format: '{y:.1f}%',
  486. style: {
  487. //fontWeight: 'bold'
  488. },
  489. y:-1
  490. },
  491. data: [
  492. @foreach($outcomes as $index => $outcome)
  493. @if(
  494. is_array($outcomes_attempted)
  495. && array_key_exists($outcome->id, $outcomes_attempted)
  496. && $outcomes_attempted[$outcome->id]!=0)
  497. {{{ $outcome->expected_outcome }}},
  498. @else
  499. 0,
  500. @endif
  501. @endforeach
  502. ],
  503. pointPadding: 0,
  504. }]
  505. });
  506. var chart = $('#graph').highcharts();
  507. var titletext = $('#graph').highcharts().options.title.text;
  508. var newtitletext = titletext.replace("&#039;", "\'");
  509. chart.setTitle({text: newtitletext});
  510. // Include dummy graph for outcomes
  511. @include('global.dummy-outcomes')
  512. });
  513. @stop