exercise_report.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Exercise list: This script shows the list of exercises for administrators and students.
  5. * @package chamilo.exercise
  6. * @author Julio Montoya <gugli100@gmail.com> jqgrid integration
  7. * Modified by hubert.borderiou (question category)
  8. *
  9. * @todo fix excel export
  10. *
  11. */
  12. /**
  13. * Code
  14. */
  15. // name of the language file that needs to be included
  16. $language_file = array('exercice');
  17. // including the global library
  18. require_once '../inc/global.inc.php';
  19. require_once '../gradebook/lib/be.inc.php';
  20. // Setting the tabs
  21. $this_section = SECTION_COURSES;
  22. $htmlHeadXtra[] = api_get_jqgrid_js();
  23. // Access control
  24. api_protect_course_script(true, false, true);
  25. // including additional libraries
  26. require_once 'exercise.class.php';
  27. require_once 'exercise.lib.php';
  28. require_once 'question.class.php';
  29. require_once 'answer.class.php';
  30. require_once 'hotpotatoes.lib.php';
  31. // need functions of statsutils lib to display previous exercices scores
  32. require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php';
  33. // document path
  34. $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path']."/document";
  35. /* Constants and variables */
  36. $is_allowedToEdit = api_is_allowed_to_edit(null, true) || api_is_drh();
  37. $is_tutor = api_is_allowed_to_edit(true);
  38. $TBL_QUESTIONS = Database :: get_course_table(TABLE_QUIZ_QUESTION);
  39. $TBL_TRACK_EXERCICES = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
  40. $TBL_TRACK_ATTEMPT = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
  41. $TBL_TRACK_ATTEMPT_RECORDING = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
  42. $TBL_LP_ITEM_VIEW = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
  43. $course_id = api_get_course_int_id();
  44. $exercise_id = isset($_REQUEST['exerciseId']) ? intval($_REQUEST['exerciseId']) : null;
  45. $filter_user = isset($_REQUEST['filter_by_user']) ? intval($_REQUEST['filter_by_user']) : null;
  46. $locked = api_resource_is_locked_by_gradebook($exercise_id, LINK_EXERCISE);
  47. if (empty($exercise_id)) {
  48. api_not_allowed(true);
  49. }
  50. if (!$is_allowedToEdit) {
  51. api_not_allowed(true);
  52. }
  53. if (!empty($exercise_id)) {
  54. $parameters['exerciseId'] = $exercise_id;
  55. }
  56. if (!empty($_GET['path'])) {
  57. $parameters['path'] = Security::remove_XSS($_GET['path']);
  58. }
  59. if (!empty($_REQUEST['export_report']) && $_REQUEST['export_report'] == '1') {
  60. if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
  61. $load_extra_data = false;
  62. if (isset($_REQUEST['extra_data']) && $_REQUEST['extra_data'] == 1) {
  63. $load_extra_data = true;
  64. }
  65. require_once 'exercise_result.class.php';
  66. switch ($_GET['export_format']) {
  67. case 'xls' :
  68. $export = new ExerciseResult();
  69. $export->exportCompleteReportXLS(
  70. $documentPath,
  71. null,
  72. $load_extra_data,
  73. null,
  74. $_GET['exerciseId'],
  75. $_GET['hotpotato_name']
  76. );
  77. exit;
  78. break;
  79. case 'csv' :
  80. default :
  81. $export = new ExerciseResult();
  82. $export->exportCompleteReportCSV(
  83. $documentPath,
  84. null,
  85. $load_extra_data,
  86. null,
  87. $_GET['exerciseId'],
  88. $_GET['hotpotato_name']
  89. );
  90. exit;
  91. break;
  92. }
  93. } else {
  94. api_not_allowed(true);
  95. }
  96. }
  97. //Send student email @todo move this code in a class, library
  98. if (isset($_REQUEST['comments']) && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit || $is_tutor) && $_GET['exeid'] == strval(
  99. intval($_GET['exeid'])
  100. )
  101. ) {
  102. $id = intval($_GET['exeid']); //filtered by post-condition
  103. $track_exercise_info = get_exercise_track_exercise_info($id);
  104. if (empty($track_exercise_info)) {
  105. api_not_allowed();
  106. }
  107. $test = $track_exercise_info['title'];
  108. $student_id = $track_exercise_info['exe_user_id'];
  109. $session_id = $track_exercise_info['session_id'];
  110. $lp_id = $track_exercise_info['orig_lp_id'];
  111. //$lp_item_id = $track_exercise_info['orig_lp_item_id'];
  112. $lp_item_view_id = $track_exercise_info['orig_lp_item_view_id'];
  113. $course_info = api_get_course_info();
  114. // Teacher data
  115. $teacher_info = api_get_user_info(api_get_user_id());
  116. $from_name = api_get_person_name(
  117. $teacher_info['firstname'],
  118. $teacher_info['lastname'],
  119. null,
  120. PERSON_NAME_EMAIL_ADDRESS
  121. );
  122. $url = api_get_path(WEB_CODE_PATH).'exercice/result.php?id='.$track_exercise_info['exe_id'].'&'.api_get_cidreq(
  123. ).'&show_headers=1&id_session='.$session_id;
  124. $my_post_info = array();
  125. $post_content_id = array();
  126. $comments_exist = false;
  127. foreach ($_POST as $key_index => $key_value) {
  128. $my_post_info = explode('_', $key_index);
  129. $post_content_id[] = $my_post_info[1];
  130. if ($my_post_info[0] == 'comments') {
  131. $comments_exist = true;
  132. }
  133. }
  134. $loop_in_track = ($comments_exist === true) ? (count($_POST) / 2) : count($_POST);
  135. $array_content_id_exe = array();
  136. if ($comments_exist === true) {
  137. $array_content_id_exe = array_slice($post_content_id, $loop_in_track);
  138. } else {
  139. $array_content_id_exe = $post_content_id;
  140. }
  141. for ($i = 0; $i < $loop_in_track; $i++) {
  142. $my_marks = Database::escape_string($_POST['marks_'.$array_content_id_exe[$i]]);
  143. $contain_comments = Database::escape_string($_POST['comments_'.$array_content_id_exe[$i]]);
  144. if (isset($contain_comments)) {
  145. $my_comments = Database::escape_string($_POST['comments_'.$array_content_id_exe[$i]]);
  146. } else {
  147. $my_comments = '';
  148. }
  149. $my_questionid = intval($array_content_id_exe[$i]);
  150. $sql = "SELECT question from $TBL_QUESTIONS WHERE c_id = $course_id AND id = '$my_questionid'";
  151. $result = Database::query($sql);
  152. Database::result($result, 0, "question");
  153. $query = "UPDATE $TBL_TRACK_ATTEMPT SET marks = '$my_marks', teacher_comment = '$my_comments' WHERE question_id = ".$my_questionid." AND exe_id=".$id;
  154. Database::query($query);
  155. //Saving results in the track recording table
  156. $recording_changes = 'INSERT INTO '.$TBL_TRACK_ATTEMPT_RECORDING.' (exe_id, question_id, marks, insert_date, author, teacher_comment)
  157. VALUES ('."'$id','".$my_questionid."','$my_marks','".api_get_utc_datetime(
  158. )."','".api_get_user_id()."'".',"'.$my_comments.'")';
  159. Database::query($recording_changes);
  160. }
  161. $qry = 'SELECT DISTINCT question_id, marks FROM '.$TBL_TRACK_ATTEMPT.' WHERE exe_id = '.$id.' GROUP BY question_id';
  162. $res = Database::query($qry);
  163. $tot = 0;
  164. while ($row = Database :: fetch_array($res, 'ASSOC')) {
  165. $tot += $row['marks'];
  166. }
  167. $totquery = "UPDATE $TBL_TRACK_EXERCICES SET exe_result = '".floatval($tot)."' WHERE exe_id = ".$id;
  168. Database::query($totquery);
  169. if (isset($_POST['send_notification'])) {
  170. //@todo move this somewhere else
  171. $subject = get_lang('ExamSheetVCC');
  172. $message = '<p>'.get_lang('DearStudentEmailIntroduction').'</p><p>'.get_lang('AttemptVCC');
  173. $message .= '<h3>'.get_lang('CourseName').'</h3><p>'.Security::remove_XSS($course_info['name']).'';
  174. $message .= '<h3>'.get_lang('Exercise').'</h3><p>'.Security::remove_XSS($test);
  175. //Only for exercises not in a LP
  176. if ($lp_id == 0) {
  177. $message .= '<p>'.get_lang('ClickLinkToViewComment').' <a href="#url#">#url#</a><br />';
  178. }
  179. $message .= '<p>'.get_lang('Regards').'</p>';
  180. $message .= $from_name;
  181. $message = str_replace("#test#", Security::remove_XSS($test), $message);
  182. $message = str_replace("#url#", $url, $message);
  183. MessageManager::send_message_simple($student_id, $subject, $message, api_get_user_id());
  184. }
  185. //Updating LP score here
  186. if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) {
  187. $sql_update_score = "UPDATE $TBL_LP_ITEM_VIEW SET score = '".floatval(
  188. $tot
  189. )."' WHERE c_id = ".$course_id." AND id = ".$lp_item_view_id;
  190. Database::query($sql_update_score);
  191. if ($origin == 'tracking_course') {
  192. //Redirect to the course detail in lp
  193. header('location: exercice.php?course='.Security :: remove_XSS($_GET['course']));
  194. exit;
  195. } else {
  196. //Redirect to the reporting
  197. header(
  198. 'location: ../mySpace/myStudents.php?origin='.$origin.'&student='.$student_id.'&details=true&course='.$course_id.'&session_id='.$session_id
  199. );
  200. exit;
  201. }
  202. }
  203. }
  204. $actions = null;
  205. if (isset($origin) && $origin == 'learnpath') {
  206. $actions .= '<a href="exercice.php">'.Display :: return_icon(
  207. 'back.png',
  208. get_lang('GoBackToQuestionList'),
  209. '',
  210. ICON_SIZE_MEDIUM
  211. ).'</a>';
  212. } else {
  213. if ($is_allowedToEdit) {
  214. // the form
  215. if (api_is_platform_admin() || api_is_course_admin() || api_is_course_tutor() || api_is_course_coach()) {
  216. $actions .= '<a href="admin.php?exerciseId='.intval($_GET['exerciseId']).'">'.Display :: return_icon(
  217. 'back.png',
  218. get_lang('GoBackToQuestionList'),
  219. '',
  220. ICON_SIZE_MEDIUM
  221. ).'</a>';
  222. $actions .= '<a href="live_stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon(
  223. 'activity_monitor.png',
  224. get_lang('LiveResults'),
  225. '',
  226. ICON_SIZE_MEDIUM
  227. ).'</a>';
  228. $actions .= '<a href="stats.php?'.api_get_cidreq().'&exerciseId='.$exercise_id.'">'.Display :: return_icon(
  229. 'statistics.png',
  230. get_lang('ReportByQuestion'),
  231. '',
  232. ICON_SIZE_MEDIUM
  233. ).'</a>';
  234. $actions .= '<a id="export_opener" href="'.api_get_self(
  235. ).'?export_report=1&hotpotato_name='.Security::remove_XSS($_GET['path']).'&exerciseId='.intval(
  236. $_GET['exerciseId']
  237. ).'" >'.
  238. Display::return_icon('save.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>';
  239. }
  240. }
  241. }
  242. //Deleting an attempt
  243. if (($is_allowedToEdit || $is_tutor || api_is_coach()) && $_GET['delete'] == 'delete' && !empty ($_GET['did']) && $locked == false
  244. ) {
  245. $exe_id = intval($_GET['did']);
  246. if (!empty($exe_id)) {
  247. $sql = 'DELETE FROM '.$TBL_TRACK_EXERCICES.' WHERE exe_id = '.$exe_id;
  248. Database::query($sql);
  249. $sql = 'DELETE FROM '.$TBL_TRACK_ATTEMPT.' WHERE exe_id = '.$exe_id;
  250. Database::query($sql);
  251. header(
  252. 'Location: exercise_report.php?cidReq='.Security::remove_XSS($_GET['cidReq']).'&exerciseId='.$exercise_id
  253. );
  254. exit;
  255. }
  256. }
  257. if ($is_allowedToEdit || $is_tutor) {
  258. $nameTools = get_lang('StudentScore');
  259. $interbreadcrumb[] = array("url" => "exercice.php?gradebook=$gradebook", "name" => get_lang('Exercices'));
  260. $objExerciseTmp = new Exercise();
  261. if ($objExerciseTmp->read($exercise_id)) {
  262. $interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$exercise_id, "name" => $objExerciseTmp->name);
  263. }
  264. } else {
  265. $interbreadcrumb[] = array("url" => "exercice.php?gradebook=$gradebook", "name" => get_lang('Exercices'));
  266. $objExerciseTmp = new Exercise();
  267. if ($objExerciseTmp->read($exercise_id)) {
  268. $nameTools = get_lang('Results').': '.$objExerciseTmp->name;
  269. }
  270. }
  271. Display :: display_header($nameTools);
  272. $actions = Display::div($actions, array('class' => 'actions'));
  273. $extra = '<script>
  274. $(document).ready(function() {
  275. $( "#dialog:ui-dialog" ).dialog( "destroy" );
  276. $( "#dialog-confirm" ).dialog({
  277. autoOpen: false,
  278. show: "blind",
  279. resizable: false,
  280. height:300,
  281. modal: true
  282. });
  283. $("#export_opener").click(function() {
  284. var targetUrl = $(this).attr("href");
  285. $( "#dialog-confirm" ).dialog({
  286. width:400,
  287. height:300,
  288. buttons: {
  289. "'.addslashes(get_lang('Download')).'": function() {
  290. var export_format = $("input[name=export_format]:checked").val();
  291. var extra_data = $("input[name=load_extra_data]:checked").val();
  292. location.href = targetUrl+"&export_format="+export_format+"&extra_data="+extra_data;
  293. $( this ).dialog( "close" );
  294. },
  295. }
  296. });
  297. $( "#dialog-confirm" ).dialog("open");
  298. return false;
  299. });
  300. });
  301. </script>';
  302. $extra .= '<div id="dialog-confirm" title="'.get_lang("ConfirmYourChoice").'">';
  303. $form = new FormValidator('report', 'post', null, null, array('class' => 'form-vertical'));
  304. $form->addElement(
  305. 'radio',
  306. 'export_format',
  307. null,
  308. get_lang('ExportAsCSV'),
  309. 'csv',
  310. array('id' => 'export_format_csv_label')
  311. );
  312. $form->addElement(
  313. 'radio',
  314. 'export_format',
  315. null,
  316. get_lang('ExportAsXLS'),
  317. 'xls',
  318. array('id' => 'export_format_xls_label')
  319. );
  320. $form->addElement(
  321. 'checkbox',
  322. 'load_extra_data',
  323. null,
  324. get_lang('LoadExtraData'),
  325. '0',
  326. array('id' => 'export_format_xls_label')
  327. );
  328. $form->setDefaults(array('export_format' => 'csv'));
  329. $extra .= $form->return_form();
  330. $extra .= '</div>';
  331. if ($is_allowedToEdit) {
  332. echo $extra;
  333. }
  334. echo $actions;
  335. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_results&exerciseId='.$exercise_id.'&filter_by_user='.$filter_user;
  336. $action_links = '';
  337. //Generating group list
  338. $group_list = GroupManager::get_group_list();
  339. $group_parameters = array('group_all:'.get_lang('All'), 'group_none:'.get_lang('None'));
  340. foreach ($group_list as $group) {
  341. $group_parameters[] = $group['id'].':'.$group['name'];
  342. }
  343. if (!empty($group_parameters)) {
  344. $group_parameters = implode(';', $group_parameters);
  345. }
  346. if ($is_allowedToEdit || $is_tutor) {
  347. //The order is important you need to check the the $column variable in the model.ajax.php file
  348. $columns = array(
  349. get_lang('FirstName'),
  350. get_lang('LastName'),
  351. get_lang('LoginName'),
  352. get_lang('Group'),
  353. get_lang('Duration').' ('.get_lang('MinMinute').')',
  354. get_lang('StartDate'),
  355. get_lang('EndDate'),
  356. get_lang('Score'),
  357. get_lang('Status'),
  358. get_lang('ToolLearnpath'),
  359. get_lang('Actions')
  360. );
  361. //Column config
  362. $column_model = array(
  363. array('name' => 'firstname', 'index' => 'firstname', 'width' => '50', 'align' => 'left', 'search' => 'true'),
  364. array(
  365. 'name' => 'lastname',
  366. 'index' => 'lastname',
  367. 'width' => '50',
  368. 'align' => 'left',
  369. 'formatter' => 'action_formatter',
  370. 'search' => 'true'
  371. ),
  372. array(
  373. 'name' => 'login',
  374. 'index' => 'username',
  375. 'width' => '40',
  376. 'align' => 'left',
  377. 'search' => 'true',
  378. 'hidden' => 'true'
  379. ),
  380. array(
  381. 'name' => 'group_name',
  382. 'index' => 'group_id',
  383. 'width' => '40',
  384. 'align' => 'left',
  385. 'search' => 'true',
  386. 'stype' => 'select',
  387. //for the bottom bar
  388. 'searchoptions' => array(
  389. 'defaultValue' => 'group_all',
  390. 'value' => $group_parameters
  391. ),
  392. //for the top bar
  393. 'editoptions' => array('value' => $group_parameters)
  394. ),
  395. array('name' => 'duration', 'index' => 'exe_duration', 'width' => '30', 'align' => 'left', 'search' => 'true'),
  396. array('name' => 'start_date', 'index' => 'start_date', 'width' => '60', 'align' => 'left', 'search' => 'true'),
  397. array('name' => 'exe_date', 'index' => 'exe_date', 'width' => '60', 'align' => 'left', 'search' => 'true'),
  398. array('name' => 'score', 'index' => 'exe_result', 'width' => '50', 'align' => 'left', 'search' => 'true'),
  399. array(
  400. 'name' => 'status',
  401. 'index' => 'revised',
  402. 'width' => '40',
  403. 'align' => 'left',
  404. 'search' => 'true',
  405. 'stype' => 'select',
  406. //for the bottom bar
  407. 'searchoptions' => array(
  408. 'defaultValue' => '',
  409. 'value' => ':'.get_lang('All').';1:'.get_lang('Validated').';0:'.get_lang('NotValidated')
  410. ),
  411. //for the top bar
  412. 'editoptions' => array(
  413. 'value' => ':'.get_lang('All').';1:'.get_lang('Validated').';0:'.get_lang(
  414. 'NotValidated'
  415. )
  416. )
  417. ),
  418. array('name' => 'lp', 'index' => 'lp', 'width' => '60', 'align' => 'left', 'search' => 'false'),
  419. array('name' => 'actions', 'index' => 'actions', 'width' => '60', 'align' => 'left', 'search' => 'false')
  420. );
  421. $action_links = '
  422. // add username as title in lastname filed - ref 4226
  423. function action_formatter(cellvalue, options, rowObject) {
  424. // rowObject is firstname,lastname,login,... get the third word
  425. var loginx = "'.api_htmlentities(sprintf(get_lang("LoginX"), ":::"), ENT_QUOTES).'";
  426. var tabLoginx = loginx.split(/:::/);
  427. // tabLoginx[0] is before and tabLoginx[1] is after :::
  428. // may be empty string but is defined
  429. return "<span title=\""+tabLoginx[0]+rowObject[2]+tabLoginx[1]+"\">"+cellvalue+"</span>";
  430. }';
  431. }
  432. //Autowidth
  433. $extra_params['autowidth'] = 'true';
  434. //height auto
  435. $extra_params['height'] = 'auto';
  436. ?>
  437. <script>
  438. function setSearchSelect(columnName) {
  439. $("#results").jqGrid('setColProp', columnName, {
  440. searchoptions:{
  441. dataInit:function (el) {
  442. $("option[value='1']", el).attr("selected", "selected");
  443. setTimeout(function () {
  444. $(el).trigger('change');
  445. }, 1000);
  446. }
  447. }
  448. });
  449. }
  450. function exportExcel() {
  451. var mya = new Array();
  452. mya = $("#results").getDataIDs(); // Get All IDs
  453. var data = $("#results").getRowData(mya[0]); // Get First row to get the labels
  454. var colNames = new Array();
  455. var ii = 0;
  456. for (var i in data) {
  457. colNames[ii++] = i;
  458. } // capture col names
  459. var html = "";
  460. for (i = 0; i < mya.length; i++) {
  461. data = $("#results").getRowData(mya[i]); // get each row
  462. for (j = 0; j < colNames.length; j++) {
  463. html = html + data[colNames[j]] + ","; // output each column as tab delimited
  464. }
  465. html = html + "\n"; // output each row with end of line
  466. }
  467. html = html + "\n"; // end of line at the end
  468. var form = $("#export_report_form");
  469. $("#csvBuffer").attr('value', html);
  470. form.target = '_blank';
  471. form.submit();
  472. }
  473. $(function () {
  474. <?php
  475. echo Display::grid_js('results', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
  476. if ($is_allowedToEdit || $is_tutor) {
  477. ?>
  478. //setSearchSelect("status");
  479. //
  480. //view:true, del:false, add:false, edit:false, excel:true}
  481. $("#results").jqGrid('navGrid', '#results_pager', {view:true, edit:false, add:false, del:false, excel:false},
  482. {height:280, reloadAfterSubmit:false}, // view options
  483. {height:280, reloadAfterSubmit:false}, // edit options
  484. {height:280, reloadAfterSubmit:false}, // add options
  485. {reloadAfterSubmit:false}, // del options
  486. {width:500} // search options
  487. );
  488. /*
  489. // add custom button to export the data to excel
  490. jQuery("#results").jqGrid('navButtonAdd','#results_pager',{
  491. caption:"",
  492. onClickButton : function () {
  493. //exportExcel();
  494. }
  495. });*/
  496. /*
  497. jQuery('#sessions').jqGrid('navButtonAdd','#sessions_pager',{id:'pager_csv',caption:'',title:'Export To CSV',onClickButton : function(e)
  498. {
  499. try {
  500. jQuery("#sessions").jqGrid('excelExport',{tag:'csv', url:'grid.php'});
  501. } catch (e) {
  502. window.location= 'grid.php?oper=csv';
  503. }
  504. },buttonicon:'ui-icon-document'})
  505. */
  506. //Adding search options
  507. var options = {
  508. 'stringResult': true,
  509. 'autosearch' : true,
  510. 'searchOnEnter':false
  511. }
  512. jQuery("#results").jqGrid('filterToolbar', options);
  513. var sgrid = $("#results")[0];
  514. sgrid.triggerToolbar();
  515. <?php } ?>
  516. });
  517. </script>
  518. <form id="export_report_form" method="post" action="exercise_report.php">
  519. <input type="hidden" name="csvBuffer" id="csvBuffer" value=""/>
  520. <input type="hidden" name="export_report" id="export_report" value="1"/>
  521. <input type="hidden" name="exerciseId" id="exerciseId" value="<?php echo $exercise_id ?>"/>
  522. </form>
  523. <?php
  524. echo Display::grid_html('results');
  525. Display :: display_footer();