start.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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('SurveyName'));
  19. $table->set_header(2, get_lang('SurveyCode'), true, ['class' => 'text-center'], ['class' => 'text-center']);
  20. $table->set_header(3, get_lang('NumberOfQuestions'), true, ['class' => 'text-right'], ['class' => 'text-right']);
  21. $table->set_header(4, get_lang('Author'));
  22. $table->set_header(5, get_lang('AvailableFrom'), true, ['class' => 'text-center'], ['class' => 'text-center']);
  23. $table->set_header(6, get_lang('AvailableUntil'), 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('IsMandatory'), 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();