Нема описа

activity.blade.php 23KB

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