Aucune description

activity.blade.php 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  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 transformadora 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. @if($activity->transforming_actions != NULL)
  204. <hr>
  205. <h5>Transforming Actions</h5>
  206. {{{ $activity->transforming_actions }}}
  207. @endif
  208. @if($activity->assessment_comments != NULL)
  209. <hr>
  210. <h5>Assessment Comments</h5>
  211. {{{ $activity->assessment_comments }}}
  212. @endif
  213. </div>
  214. </div>
  215. <div class="row">
  216. <div class="col-md-12" id="criteriaGraph"></div>
  217. </div>
  218. <script>
  219. $('#button-add-activity-criterion').on('click', function(e){
  220. e.preventDefault();
  221. options = $('#select-activity-criterion').html();
  222. counter = $('#select-activity-criterion').data('count');
  223. var div = $('<div/>', {
  224. 'id': "selectFor"+counter
  225. });
  226. var divForSelect = $('<div/>', {
  227. 'class':'col-12 form-group'
  228. });
  229. var select = $('<select/>', {
  230. 'class':'selectpicker',
  231. 'name': 'trans_act[]',
  232. })
  233. var $button = $('<button/>', {
  234. 'type': 'button',
  235. 'class': 'btn btn-primary',
  236. 'onclick': '$(this).parent().parent().remove();$("#button-add-activity-criterion").show(); '
  237. }).html('X');
  238. divForSelect.append(select);
  239. divForSelect.append($button);
  240. div.append(divForSelect);
  241. $('#select-activity-criterion').parent().parent().after(div);
  242. select.html(options);
  243. refreshSelects();
  244. countSelects = $('.selectpicker').length;
  245. countOptions = $('#select-activity-criterion option').length;
  246. if(countOptions == countSelects){
  247. $('#button-add-activity-criterion').hide();
  248. }
  249. });
  250. function refreshSelects(){
  251. $('.selectpicker').each(function(){
  252. $(this).selectpicker('refresh');
  253. });
  254. }
  255. $(document).ready(function(){
  256. if({{count($transformative_actions)}}){
  257. var trans_actions = {{json_encode($transformative_actions)}};
  258. //$('#select-activity-criterion').val(trans_actions[0].activity_id);
  259. $('#name_trans').val(trans_actions[0].at_text);
  260. $('#transforming_actions').val(trans_actions[0].description);
  261. refreshSelects();
  262. for(index in trans_actions){
  263. if(index==0) continue;
  264. $('#button-add-activity-criterion').click();
  265. }
  266. $('.selectpicker').each(function(index){
  267. $(this).val(trans_actions[index].activity_criterion_id);
  268. });
  269. refreshSelects();
  270. }
  271. });
  272. </script>
  273. @stop
  274. @section('included-js')
  275. <!-- HighCharts -->
  276. <script src="{{ asset('vendor/highcharts/highcharts.js') }}"></script>
  277. <!--script src="http://code.highcharts.com/modules/exporting.js"></script -->
  278. <!-- Datepicker -->
  279. <script src="{{ asset('vendor/jquery-ui-1.11.4.custom/jquery-ui.min.js') }}"></script>
  280. @stop
  281. @section('javascript')
  282. $(function () {
  283. $('#date').datepicker({
  284. dateFormat: "yy-mm-dd"
  285. });
  286. $('#criteriaGraph').highcharts({
  287. chart: {
  288. type: 'bar',
  289. height:
  290. @if($activity->is_assessed())
  291. {{ count($activity->criteria_achieved() )*22+225 }}
  292. @else
  293. {{22+225}}
  294. @endif
  295. ,
  296. },
  297. title: {
  298. text: 'Criteria Achievement',
  299. },
  300. xAxis: {
  301. categories: [
  302. @if($activity->is_assessed())
  303. @foreach($activity->criteria_achieved() as $id=>$value)
  304. "{{{ Criterion::withTrashed()->find($id)->name }}}",
  305. @endforeach
  306. @endif
  307. ],
  308. labels: {
  309. style: {
  310. fontSize:'12px'
  311. },
  312. step:1,
  313. useHTML:true,
  314. formatter: function() {
  315. return '<div style="width:200px; word-break:break; text-overflow:ellipsis; overflow:hidden;">'+this.value+'</div>';
  316. },
  317. }
  318. },
  319. yAxis: {
  320. min: 0,
  321. max: 100,
  322. title: {
  323. text: 'Percentage'
  324. },
  325. @if(isset($activity->rubric[0]) and isset($activity->rubric[0]->expected_percentage) )
  326. plotLines:[{
  327. value:{{ $activity->rubric[0]->expected_percentage }},
  328. color: '#000',
  329. width:3,
  330. zIndex:4,
  331. label:{
  332. text: 'Goal ({{ $activity->rubric[0]->expected_percentage }}%)',
  333. style: {
  334. color: '#000',
  335. fontSize: '14px',
  336. }
  337. }
  338. }]
  339. @endif
  340. },
  341. tooltip: {
  342. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  343. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  344. '<td style="padding:0"><b>{point.y:.2f}%</b></td></tr>',
  345. footerFormat: '</table>',
  346. shared: true,
  347. useHTML: true
  348. },
  349. plotOptions: {
  350. bar: {
  351. //grouping: false,
  352. shadow: false,
  353. borderWidth: 0,
  354. },
  355. series: {
  356. pointPadding: 0,
  357. groupPadding: 0.1
  358. },
  359. },
  360. series: [{
  361. type:'column',
  362. name: 'Passed',
  363. color: '#e70033',
  364. dataLabels: {
  365. enabled: true,
  366. fontSize: 8,
  367. color: '#fff',
  368. align: 'right',
  369. format: '{y:.1f}%',
  370. style: {
  371. //fontWeight: 'bold'
  372. },
  373. y:-1
  374. },
  375. data:[
  376. @if($activity->is_assessed())
  377. @foreach($activity->cap_array as $id=>$crit)
  378. //This conditional is to ignore criteria that weren't assessed. These would have a value of null.
  379. @if($crit->score_percentage)
  380. {{{ $crit->score_percentage }}},
  381. @else
  382. 0,
  383. @endif
  384. @endforeach
  385. @endif
  386. ],
  387. pointPadding: 0,
  388. }
  389. ]
  390. });
  391. $('#graph').highcharts({
  392. chart: {
  393. type: 'bar',
  394. },
  395. title: {
  396. text: 'Performance by Learning Outcome Criteria in {{ $title }}'
  397. },
  398. xAxis: {
  399. categories: [
  400. @foreach($outcomes as $outcome)
  401. "{{{ $outcome->name }}}",
  402. @endforeach
  403. ],
  404. labels: {
  405. style: {
  406. fontSize:'11px'
  407. },
  408. step:1,
  409. useHTML:true,
  410. formatter: function() {
  411. return '<div style="width:200px; word-break:break; text-overflow:ellipsis; overflow:hidden;">'+this.value+'</div>';
  412. },
  413. }
  414. },
  415. yAxis: {
  416. min: 0,
  417. max: 100,
  418. title: {
  419. text: 'Percentage'
  420. }
  421. },
  422. tooltip: {
  423. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  424. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  425. '<td style="padding:0"><b>{point.y:.2f}</b></td></tr>',
  426. footerFormat: '</table>',
  427. shared: true,
  428. useHTML: true
  429. },
  430. plotOptions: {
  431. bar: {
  432. //grouping: false,
  433. shadow: false,
  434. borderWidth: 0,
  435. },
  436. series: {
  437. pointPadding: 0,
  438. groupPadding: 0.075
  439. },
  440. },
  441. series: [{
  442. name: 'Obtained Value',
  443. color: '#e70033',
  444. dataLabels: {
  445. enabled: true,
  446. fontSize: 8,
  447. color: '#fff',
  448. align: 'right',
  449. format: '{y:.1f}%',
  450. style: {
  451. //fontWeight: 'bold'
  452. },
  453. y:-1
  454. },
  455. data:[
  456. @foreach($outcomes as $index => $outcome)
  457. @if(
  458. is_array($outcomes_attempted)
  459. && array_key_exists($outcome->id, $outcomes_attempted)
  460. && $outcomes_attempted[$outcome->id]!=0)
  461. {{{ ($outcomes_achieved[$outcome->id]/$outcomes_attempted[$outcome->id])*100 }}},
  462. @else
  463. 0,
  464. @endif
  465. @endforeach
  466. ],
  467. pointPadding: 0,
  468. }, {
  469. name: 'Expected Value',
  470. color: '#555555',
  471. dataLabels: {
  472. enabled: true,
  473. fontSize: 8,
  474. color: '#fff',
  475. align: 'right',
  476. format: '{y:.1f}%',
  477. style: {
  478. //fontWeight: 'bold'
  479. },
  480. y:-1
  481. },
  482. data: [
  483. @foreach($outcomes as $index => $outcome)
  484. @if(
  485. is_array($outcomes_attempted)
  486. && array_key_exists($outcome->id, $outcomes_attempted)
  487. && $outcomes_attempted[$outcome->id]!=0)
  488. {{{ $outcome->expected_outcome }}},
  489. @else
  490. 0,
  491. @endif
  492. @endforeach
  493. ],
  494. pointPadding: 0,
  495. }]
  496. });
  497. var chart = $('#graph').highcharts();
  498. var titletext = $('#graph').highcharts().options.title.text;
  499. var newtitletext = titletext.replace("&#039;", "\'");
  500. chart.setTitle({text: newtitletext});
  501. // Include dummy graph for outcomes
  502. @include('global.dummy-outcomes')
  503. });
  504. @stop