diff --git a/classes/coversheet/create_coversheet.php b/classes/coversheet/create_coversheet.php index ed7481d..4c4f02f 100644 --- a/classes/coversheet/create_coversheet.php +++ b/classes/coversheet/create_coversheet.php @@ -154,14 +154,25 @@ public static function get_possible_placeholders(): array { $placeholders = []; $dir = $CFG->dirroot . "/mod/quiz/report/archiver/classes/coversheet/placeholder"; $basenames = self::get_all_files_in_directory($dir); + $i = 1; foreach ($basenames as $basename) { + $active = ''; + $show = ''; + if($i == 1) { + $show = 'show'; + $active = 'active'; + } $placeholders[] = [ 'placeholders' => self::get_placeholders($basename, "\quiz_archiver\coversheet\placeholder\\$basename"), 'metadata' => [ 'tabid' => 'qa_' . $basename . '_tab', 'tab' => get_string($basename, 'quiz_archiver'), + 'active' => $active, + 'show' => $show, ], ]; + + $i++; } return $placeholders; diff --git a/classes/coversheet/placeholder/common.php b/classes/coversheet/placeholder/common.php new file mode 100644 index 0000000..380c1e0 --- /dev/null +++ b/classes/coversheet/placeholder/common.php @@ -0,0 +1,49 @@ +. + +/** + * Handles everything that is needed for coversheet creation. + * + * @package quiz_archiver + * @copyright ISB Bayern, 2024 + * @author Dr. Peter Mayer + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace quiz_archiver\coversheet\placeholder; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Handles everything that is needed for coversheet creation. + * + * @package quiz_archiver + * @copyright ISB Bayern, 2024 + * @author Dr. Peter Mayer + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class common { + + /** + * Get user date. + * @param object $params + * @return string + */ + public static function date(): string { + return date(get_string('dateformat', 'quiz_archiver'), time()); + } + +} diff --git a/lang/de/quiz_archiver.php b/lang/de/quiz_archiver.php index 2f629d3..8ecc18f 100644 --- a/lang/de/quiz_archiver.php +++ b/lang/de/quiz_archiver.php @@ -95,6 +95,10 @@ $string['pdf_coversheet_html_area_help'] = 'Platzhalter für dynamische Deckblattinhalte verwenden'; $string['pdfcoversheet_heading'] = 'PDF-Deckblatt'; $string['define_pdfcoversheet'] = 'Deckblatt definieren'; +$string['profile'] = 'Profil'; +$string['course'] = 'Kurs'; +$string['common'] = 'Allgemein'; +$string['dateformat'] = 'd.m.Y'; // Job creation form: Filename pattern $string['archive_filename_pattern'] = 'Archivname'; diff --git a/lang/en/quiz_archiver.php b/lang/en/quiz_archiver.php index fde5522..3583ce7 100644 --- a/lang/en/quiz_archiver.php +++ b/lang/en/quiz_archiver.php @@ -99,6 +99,8 @@ $string['exiting_placeholders_desc'] = 'You can use the placeholder by writing {{placeholder}} e.g. {{profile_userfullname}} to the template above.'; $string['profile'] = 'Profile'; $string['course'] = 'Course'; +$string['common'] = 'Common'; +$string['dateformat'] = 'd/m/Y'; // Job creation form: Filename pattern $string['archive_filename_pattern'] = 'Archive name'; diff --git a/templates/define_pdfcoversheet.mustache b/templates/define_pdfcoversheet.mustache index 1441e75..15f2a84 100644 --- a/templates/define_pdfcoversheet.mustache +++ b/templates/define_pdfcoversheet.mustache @@ -44,14 +44,14 @@
{{#placeholderdata}} -
+
    {{#placeholders}}
  • {{.}}