start.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once __DIR__.'/../../main/inc/global.inc.php';
  4. api_protect_course_script(true);
  5. api_protect_teacher_script();
  6. $plugin = SurveyExportCsvPlugin::create();
  7. $courseCode = api_get_course_id();
  8. // Create a sortable table with survey-data
  9. $table = new SortableTable(
  10. 'surveys',
  11. ['SurveyUtil', 'get_number_of_surveys'],
  12. ['SurveyUtil', 'get_survey_data'],
  13. 2
  14. );
  15. $table->set_additional_parameters(['cidReq' => $courseCode]);
  16. $table->set_header(0, '', false);
  17. $table->setHideColumn(0);
  18. $table->set_header(1, get_lang('Survey name'));
  19. $table->set_header(2, get_lang('Code'), true, ['class' => 'text-center'], ['class' => 'text-center']);
  20. $table->set_header(3, get_lang('Questions'), true, ['class' => 'text-right'], ['class' => 'text-right']);
  21. $table->set_header(4, get_lang('Author'));
  22. $table->set_header(5, get_lang('Available from'), true, ['class' => 'text-center'], ['class' => 'text-center']);
  23. $table->set_header(6, get_lang('Until'), true, ['class' => 'text-center'], ['class' => 'text-center']);
  24. $table->set_header(7, get_lang('Invite'), true, ['class' => 'text-right'], ['class' => 'text-right']);
  25. $table->set_header(8, get_lang('Anonymous'), true, ['class' => 'text-center'], ['class' => 'text-center']);
  26. $table->set_column_filter(8, ['SurveyUtil', 'anonymous_filter']);
  27. if (api_get_configuration_value('allow_mandatory_survey')) {
  28. $table->set_header(9, get_lang('Mandatory?'), true, ['class' => 'text-center'], ['class' => 'text-center']);
  29. $table->set_header(10, get_lang('Export'), false, ['class' => 'text-center'], ['class' => 'text-center']);
  30. $table->set_column_filter(10, ['SurveyExportCsvPlugin', 'filterModify']);
  31. } else {
  32. $table->set_header(9, get_lang('Export'), false, ['class' => 'text-center'], ['class' => 'text-center']);
  33. $table->set_column_filter(9, ['SurveyExportCsvPlugin', 'filterModify']);
  34. }
  35. $pageTitle = $plugin->get_title();
  36. $template = new Template($pageTitle);
  37. $content = $table->return_table();
  38. $template->assign('header', $pageTitle);
  39. $template->assign('content', $content);
  40. $template->display_one_col_template();