説明なし

activity.blade.php 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  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 Transforming Actions</h4>
  56. </div>
  57. <div class="modal-body">
  58. {{ Form::open(array('action' => array('TransformativeActionsController@postActivityCriterion', $activity->id))) }}
  59. <p>A Transforming 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 Transforming Actions')}}
  79. {{ Form::text('name_trans', '', array('class' => 'form-control')) }}
  80. </div>
  81. <div class="form-group">
  82. {{ Form::label('transforming_actions', 'Transforming 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->o_att_array == NULL && 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">Transforming 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: {{{ count($activity->criteria_achieved() )*22+225 }}},
  290. },
  291. title: {
  292. text: 'Criteria Achievement',
  293. },
  294. xAxis: {
  295. categories: [
  296. @if($activity->cap_array!=NULL)
  297. @foreach($activity->criteria_achieved() as $id=>$value)
  298. "{{{ Criterion::withTrashed()->find($id)->name }}}",
  299. @endforeach
  300. @endif
  301. ],
  302. labels: {
  303. style: {
  304. fontSize:'12px'
  305. },
  306. step:1,
  307. useHTML:true,
  308. formatter: function() {
  309. return '<div style="width:200px; word-break:break; text-overflow:ellipsis; overflow:hidden;">'+this.value+'</div>';
  310. },
  311. }
  312. },
  313. yAxis: {
  314. min: 0,
  315. max: 100,
  316. title: {
  317. text: 'Percentage'
  318. },
  319. @if(isset($activity->rubric[0]->expected_percentage) )
  320. plotLines:[{
  321. value:{{ $activity->rubric[0]->expected_percentage }},
  322. color: '#000',
  323. width:3,
  324. zIndex:4,
  325. label:{
  326. text: 'Goal ({{ $activity->rubric[0]->expected_percentage }}%)',
  327. style: {
  328. color: '#000',
  329. fontSize: '14px',
  330. }
  331. }
  332. }]
  333. @endif
  334. },
  335. tooltip: {
  336. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  337. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  338. '<td style="padding:0"><b>{point.y:.2f}%</b></td></tr>',
  339. footerFormat: '</table>',
  340. shared: true,
  341. useHTML: true
  342. },
  343. plotOptions: {
  344. bar: {
  345. //grouping: false,
  346. shadow: false,
  347. borderWidth: 0,
  348. },
  349. series: {
  350. pointPadding: 0,
  351. groupPadding: 0.1
  352. },
  353. },
  354. series: [{
  355. type:'column',
  356. name: 'Passed',
  357. color: '#e70033',
  358. dataLabels: {
  359. enabled: true,
  360. fontSize: 8,
  361. color: '#fff',
  362. align: 'right',
  363. format: '{y:.1f}%',
  364. style: {
  365. //fontWeight: 'bold'
  366. },
  367. y:-1
  368. },
  369. data:[
  370. @if($activity->cap_array!=NULL)
  371. @foreach($activity->cap_array as $id=>$crit)
  372. //This conditional is to ignore criteria that weren't assessed. These would have a value of null.
  373. @if($crit->score_percentage)
  374. {{{ $crit->score_percentage }}},
  375. @else
  376. 0,
  377. @endif
  378. @endforeach
  379. @endif
  380. ],
  381. pointPadding: 0,
  382. }
  383. ]
  384. });
  385. $('#graph').highcharts({
  386. chart: {
  387. type: 'bar',
  388. },
  389. title: {
  390. text: 'Performance by Learning Outcome Criteria in {{ $title }}'
  391. },
  392. xAxis: {
  393. categories: [
  394. @foreach($outcomes as $outcome)
  395. "{{{ $outcome->name }}}",
  396. @endforeach
  397. ],
  398. labels: {
  399. style: {
  400. fontSize:'11px'
  401. },
  402. step:1,
  403. useHTML:true,
  404. formatter: function() {
  405. return '<div style="width:200px; word-break:break; text-overflow:ellipsis; overflow:hidden;">'+this.value+'</div>';
  406. },
  407. }
  408. },
  409. yAxis: {
  410. min: 0,
  411. max: 100,
  412. title: {
  413. text: 'Percentage'
  414. }
  415. },
  416. tooltip: {
  417. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  418. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  419. '<td style="padding:0"><b>{point.y:.2f}</b></td></tr>',
  420. footerFormat: '</table>',
  421. shared: true,
  422. useHTML: true
  423. },
  424. plotOptions: {
  425. bar: {
  426. //grouping: false,
  427. shadow: false,
  428. borderWidth: 0,
  429. },
  430. series: {
  431. pointPadding: 0,
  432. groupPadding: 0.075
  433. },
  434. },
  435. series: [{
  436. name: 'Obtained Value',
  437. color: '#e70033',
  438. dataLabels: {
  439. enabled: true,
  440. fontSize: 8,
  441. color: '#fff',
  442. align: 'right',
  443. format: '{y:.1f}%',
  444. style: {
  445. //fontWeight: 'bold'
  446. },
  447. y:-1
  448. },
  449. data:[
  450. @foreach($outcomes as $index => $outcome)
  451. @if(
  452. is_array($outcomes_attempted)
  453. && array_key_exists($outcome->id, $outcomes_attempted)
  454. && $outcomes_attempted[$outcome->id]!=0)
  455. {{{ ($outcomes_achieved[$outcome->id]/$outcomes_attempted[$outcome->id])*100 }}},
  456. @else
  457. 0,
  458. @endif
  459. @endforeach
  460. ],
  461. pointPadding: 0,
  462. }, {
  463. name: 'Expected Value',
  464. color: '#555555',
  465. dataLabels: {
  466. enabled: true,
  467. fontSize: 8,
  468. color: '#fff',
  469. align: 'right',
  470. format: '{y:.1f}%',
  471. style: {
  472. //fontWeight: 'bold'
  473. },
  474. y:-1
  475. },
  476. data: [
  477. @foreach($outcomes as $index => $outcome)
  478. @if(
  479. is_array($outcomes_attempted)
  480. && array_key_exists($outcome->id, $outcomes_attempted)
  481. && $outcomes_attempted[$outcome->id]!=0)
  482. {{{ $outcome->expected_outcome }}},
  483. @else
  484. 0,
  485. @endif
  486. @endforeach
  487. ],
  488. pointPadding: 0,
  489. }]
  490. });
  491. var chart = $('#graph').highcharts();
  492. var titletext = $('#graph').highcharts().options.title.text;
  493. var newtitletext = titletext.replace("&#039;", "\'");
  494. chart.setTitle({text: newtitletext});
  495. // Include dummy graph for outcomes
  496. @include('global.dummy-outcomes')
  497. });
  498. @stop