Нема описа

activity.blade.php 22KB

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