Няма описание

activity.blade.php 22KB

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