Skip to content

Commit

Permalink
fix: page format letter not working properly (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippImhof committed Nov 11, 2024
1 parent f3670b2 commit 07a9544
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions essaydownload_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ protected function standard_preference_fields(MoodleQuickForm $mform) {
* @return void
*/
protected function pdf_layout_fields(MoodleQuickForm $mform) {
$mform->addElement('select', 'page', get_string('page', 'quiz_essaydownload'), [
$mform->addElement('select', 'pageformat', get_string('page', 'quiz_essaydownload'), [
'a4' => get_string('pagea4', 'quiz_essaydownload'),
'letter' => get_string('pageletter', 'quiz_essaydownload'),
]);
$mform->setType('page', PARAM_ALPHA);
$mform->setDefault('page', 'a4');
$mform->disabledIf('page', 'fileformat', 'neq', 'pdf');
$mform->setType('pageformat', PARAM_ALPHANUM);
$mform->setDefault('pageformat', 'a4');
$mform->disabledIf('pageformat', 'fileformat', 'neq', 'pdf');

$margingroup = [];
$margingroup[] = $mform->createElement('text', 'marginleft', '', ['size' => 3]);
Expand Down
2 changes: 1 addition & 1 deletion report.php
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ protected function generate_pdf(string $text, string $header = '', string $subhe
$text = $this->workaround_atto_font_size_issue($text);
}

$doc = new customTCPDF('P', 'mm', $this->options->pageformat);
$doc = new customTCPDF('P', 'mm', strtoupper($this->options->pageformat));

$doc->SetCreator('quiz_essaydownload plugin for Moodle LMS');
$doc->SetAuthor($author);
Expand Down
2 changes: 1 addition & 1 deletion tests/behat/form.feature
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Feature: Validation and display of the form
When I set the field "fileformat" to "txt"
Then the "source" "select" should be disabled
And the "fixremfontsize" "field" should be disabled
And the "page" "select" should be disabled
And the "pageformat" "select" should be disabled
And the "marginleft" "field" should be disabled
And the "marginright" "field" should be disabled
And the "margintop" "field" should be disabled
Expand Down

0 comments on commit 07a9544

Please sign in to comment.