Gitlab CSE Unil

Commit 7d0ead4c authored by M. Chardon's avatar M. Chardon
Browse files

maj plugin pour compatibilité moodle 3.5

parent 80ee5635
<?php <?php
// This file is part of Moodle - http://moodle.org/ // This file is part of Moodle - http://moodle.org/
// //
// Moodle is free software: you can redistribute it and/or modify // Moodle is free software: you can redistribute it and/or modify
...@@ -51,7 +52,7 @@ class restore_assignfeedback_editpdfplus_subplugin extends restore_subplugin { ...@@ -51,7 +52,7 @@ class restore_assignfeedback_editpdfplus_subplugin extends restore_subplugin {
// Now we have the list of comments and annotations per grade. // Now we have the list of comments and annotations per grade.
$elename = $this->get_namefor('feedback_editpdfplus_annotation'); $elename = $this->get_namefor('feedback_editpdfplus_annotation');
$elepath = $this->get_pathfor('/feedback_editpdfplus_annotations/feedback_editpdfplus_annotation'); $elepath = $this->get_pathfor('/feedback_editpdfplus_annotations/feedback_editpdfplus_annotation');
$paths[] = new restore_path_element($elename, $elepath); $paths[] = new restore_path_element($elename, $elepath);
return $paths; return $paths;
...@@ -62,13 +63,11 @@ class restore_assignfeedback_editpdfplus_subplugin extends restore_subplugin { ...@@ -62,13 +63,11 @@ class restore_assignfeedback_editpdfplus_subplugin extends restore_subplugin {
* @param mixed $data * @param mixed $data
*/ */
public function process_assignfeedback_editpdfplus_files($data) { public function process_assignfeedback_editpdfplus_files($data) {
$data = (object)$data; $data = (object) $data;
// In this case the id is the old gradeid which will be mapped. // In this case the id is the old gradeid which will be mapped.
$this->add_related_files('assignfeedback_editpdfplus', $this->add_related_files('assignfeedback_editpdfplus', \assignfeedback_editpdfplus\document_services::FINAL_PDF_FILEAREA, 'grade', null, $data->gradeid);
\assignfeedback_editpdfplus\document_services::FINAL_PDF_FILEAREA, 'grade', null, $data->gradeid); $this->add_related_files('assignfeedback_editpdfplus', \assignfeedback_editpdfplus\document_services::PAGE_IMAGE_READONLY_FILEAREA, 'grade', null, $data->gradeid);
$this->add_related_files('assignfeedback_editpdfplus',
\assignfeedback_editpdfplus\document_services::PAGE_IMAGE_READONLY_FILEAREA, 'grade', null, $data->gradeid);
$this->add_related_files('assignfeedback_editpdfplus', 'stamps', 'grade', null, $data->gradeid); $this->add_related_files('assignfeedback_editpdfplus', 'stamps', 'grade', null, $data->gradeid);
} }
...@@ -79,14 +78,13 @@ class restore_assignfeedback_editpdfplus_subplugin extends restore_subplugin { ...@@ -79,14 +78,13 @@ class restore_assignfeedback_editpdfplus_subplugin extends restore_subplugin {
public function process_assignfeedback_editpdfplus_feedback_editpdfplus_annotation($data) { public function process_assignfeedback_editpdfplus_feedback_editpdfplus_annotation($data) {
global $DB; global $DB;
$data = (object)$data; $data = (object) $data;
$oldgradeid = $data->gradeid; $oldgradeid = $data->gradeid;
// The mapping is set in the restore for the core assign activity // The mapping is set in the restore for the core assign activity
// when a grade node is processed. // when a grade node is processed.
$data->gradeid = $this->get_mappingid('grade', $data->gradeid); $data->gradeid = $this->get_mappingid('grade', $data->gradeid);
$DB->insert_record('assignfeedback_editpp_annot', $data);
$DB->insert_record('assignfeedback_editpp_annot', $data);
} }
} }
...@@ -99,7 +99,7 @@ EOD; ...@@ -99,7 +99,7 @@ EOD;
require_once($CFG->dirroot . '/mod/assign/locallib.php'); require_once($CFG->dirroot . '/mod/assign/locallib.php');
if (!is_object($assignment)) { if (!is_object($assignment)) {
$cm = \get_coursemodule_from_instance('assign', $assignment, 0, false, MUST_EXIST); $cm = get_coursemodule_from_instance('assign', $assignment, 0, false, MUST_EXIST);
$context = \context_module::instance($cm->id); $context = \context_module::instance($cm->id);
$assignment = new \assign($context, null, null); $assignment = new \assign($context, null, null);
...@@ -166,7 +166,7 @@ EOD; ...@@ -166,7 +166,7 @@ EOD;
// Capability checks. // Capability checks.
if (!$assignment->can_view_submission($userid)) { if (!$assignment->can_view_submission($userid)) {
\print_error('nopermission'); print_error('nopermission');
} }
$files = array(); $files = array();
...@@ -196,7 +196,7 @@ EOD; ...@@ -196,7 +196,7 @@ EOD;
} else if ($convertedfile = $converter->start_conversion($file, 'pdf')) { } else if ($convertedfile = $converter->start_conversion($file, 'pdf')) {
$files[$filename] = $convertedfile; $files[$filename] = $convertedfile;
} }
} else { } else if ($converter->can_convert_format_to('html', 'pdf')) {
// Create a tmp stored_file from this html string. // Create a tmp stored_file from this html string.
$file = reset($file); $file = reset($file);
// Strip image tags, because they will not be resolvable. // Strip image tags, because they will not be resolvable.
...@@ -225,7 +225,6 @@ EOD; ...@@ -225,7 +225,6 @@ EOD;
$htmlfile = $fs->create_file_from_string($record, $file); $htmlfile = $fs->create_file_from_string($record, $file);
} }
//$convertedfile = $fs->get_converted_document($htmlfile, 'pdf');
$convertedfile = $converter->start_conversion($htmlfile, 'pdf'); $convertedfile = $converter->start_conversion($htmlfile, 'pdf');
if ($convertedfile) { if ($convertedfile) {
...@@ -315,131 +314,8 @@ EOD; ...@@ -315,131 +314,8 @@ EOD;
$document->combine_files($assignment->get_context()->id, $grade->id); $document->combine_files($assignment->get_context()->id, $grade->id);
return $document; return $document;
} }
/* global $USER, $DB;
$assignment = self::get_assignment_from_param($assignment);
// Capability checks.
if (!$assignment->can_view_submission($userid)) {
\print_error('nopermission');
}
$grade = $assignment->get_user_grade($userid, true, $attemptnumber);
if ($assignment->get_instance()->teamsubmission) {
$submission = $assignment->get_group_submission($userid, 0, false);
} else {
$submission = $assignment->get_user_submission($userid, false);
}
$contextid = $assignment->get_context()->id;
$component = 'assignfeedback_editpdfplus';
$filearea = self::COMBINED_PDF_FILEAREA;
$itemid = $grade->id;
$filepath = '/';
$filename = self::COMBINED_PDF_FILENAME;
$fs = \get_file_storage();
$combinedpdf = $fs->get_file($contextid, $component, $filearea, $itemid, $filepath, $filename);
if (!$combinedpdf ||
($submission && ($combinedpdf->get_timemodified() < $submission->timemodified))) {
return self::generate_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
}
return $combinedpdf; */
} }
/**
* This function will take all of the compatible files for a submission
* and combine them into one PDF.
*
* @param int|\assign $assignment
* @param int $userid
* @param int $attemptnumber (-1 means latest attempt)
* @return stored_file
*
* @deprecated since version 31
*/
/* public static function generate_combined_pdf_for_attempt($assignment, $userid, $attemptnumber) {
global $CFG;
require_once($CFG->libdir . '/pdflib.php');
$assignment = self::get_assignment_from_param($assignment);
if (!$assignment->can_view_submission($userid)) {
\print_error('nopermission');
}
$files = self::list_compatible_submission_files_for_attempt($assignment, $userid, $attemptnumber);
$pdf = new pdf();
if ($files) {
// Create a mega joined PDF.
$compatiblepdfs = array();
foreach ($files as $file) {
$compatiblepdf = pdf::ensure_pdf_compatible($file);
if ($compatiblepdf) {
array_push($compatiblepdfs, $compatiblepdf);
}
}
$tmpdir = \make_temp_directory('assignfeedback_editpdfplus/combined/' . self::hash($assignment, $userid, $attemptnumber));
$tmpfile = $tmpdir . '/' . self::COMBINED_PDF_FILENAME;
@unlink($tmpfile);
try {
$pagecount = $pdf->combine_pdfs($compatiblepdfs, $tmpfile);
} catch (\Exception $e) {
debugging('TCPDF could not process the pdf files:' . $e->getMessage(), DEBUG_DEVELOPER);
// TCPDF does not recover from errors so we need to re-initialise the class.
$pagecount = 0;
}
if ($pagecount == 0) {
// We at least want a single blank page.
debugging('TCPDF did not produce a valid pdf:' . $tmpfile . '. Replacing with a blank pdf.', DEBUG_DEVELOPER);
@unlink($tmpfile);
$files = false;
}
}
$pdf->Close(); // No real need to close this pdf, because it has been saved by combine_pdfs(), but for clarity.
$grade = $assignment->get_user_grade($userid, true, $attemptnumber);
$record = new \stdClass();
$record->contextid = $assignment->get_context()->id;
$record->component = 'assignfeedback_editpdfplus';
$record->filearea = self::COMBINED_PDF_FILEAREA;
$record->itemid = $grade->id;
$record->filepath = '/';
$record->filename = self::COMBINED_PDF_FILENAME;
$fs = \get_file_storage();
$fs->delete_area_files($record->contextid, $record->component, $record->filearea, $record->itemid);
// Detect corrupt generated pdfs and replace with a blank one.
if ($files) {
$verifypdf = new pdf();
$pagecount = $verifypdf->load_pdf($tmpfile);
if ($pagecount <= 0) {
$files = false;
}
$verifypdf->Close(); // PDF loaded and never saved/outputted needs to be closed.
}
if (!$files) {
$file = $fs->create_file_from_string($record, base64_decode(self::BLANK_PDF_BASE64));
} else {
// This was a combined pdf.
$file = $fs->create_file_from_pathname($record, $tmpfile);
@unlink($tmpfile);
// Test the generated file for correctness.
$compatiblepdf = pdf::ensure_pdf_compatible($file);
}
return $file;
} */
/** /**
* This function will return the number of pages of a pdf. * This function will return the number of pages of a pdf.
* *
...@@ -457,7 +333,7 @@ EOD; ...@@ -457,7 +333,7 @@ EOD;
$assignment = self::get_assignment_from_param($assignment); $assignment = self::get_assignment_from_param($assignment);
if (!$assignment->can_view_submission($userid)) { if (!$assignment->can_view_submission($userid)) {
\print_error('nopermission'); print_error('nopermission');
} }
// When in readonly we can return the number of images in the DB because they should already exist, // When in readonly we can return the number of images in the DB because they should already exist,
...@@ -475,26 +351,6 @@ EOD; ...@@ -475,26 +351,6 @@ EOD;
// Get a combined pdf file from all submitted pdf files. // Get a combined pdf file from all submitted pdf files.
$document = self::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber); $document = self::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
return $document->get_page_count(); return $document->get_page_count();
/* $file = self::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
if (!$file) {
\print_error('Could not generate combined pdf.');
}
// Store the combined pdf file somewhere to be opened by tcpdf.
$tmpdir = \make_temp_directory('assignfeedback_editpdfplus/pagetotal/'
. self::hash($assignment, $userid, $attemptnumber));
$combined = $tmpdir . '/' . self::COMBINED_PDF_FILENAME;
$file->copy_content_to($combined); // Copy the file.
// Get the total number of pages.
$pdf = new pdf();
$pagecount = $pdf->set_pdf($combined);
$pdf->Close(); // PDF loaded and never saved/outputted needs to be closed.
// Delete temporary folders and files.
@unlink($combined);
@rmdir($tmpdir);
return $pagecount; */
} }
/** /**
...@@ -512,15 +368,11 @@ EOD; ...@@ -512,15 +368,11 @@ EOD;
$assignment = self::get_assignment_from_param($assignment); $assignment = self::get_assignment_from_param($assignment);
if (!$assignment->can_view_submission($userid)) { if (!$assignment->can_view_submission($userid)) {
\print_error('nopermission'); print_error('nopermission');
} }
// Need to generate the page images - first get a combined pdf. // Need to generate the page images - first get a combined pdf.
$document = self::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber); $document = self::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
/* $file = self::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
if (!$file) {
throw new \moodle_exception('Could not generate combined pdf.');
} */
$status = $document->get_status(); $status = $document->get_status();
if ($status === combined_document::STATUS_FAILED) { if ($status === combined_document::STATUS_FAILED) {
...@@ -533,7 +385,6 @@ EOD; ...@@ -533,7 +385,6 @@ EOD;
$tmpdir = \make_temp_directory('assignfeedback_editpdfplus/pageimages/' . self::hash($assignment, $userid, $attemptnumber)); $tmpdir = \make_temp_directory('assignfeedback_editpdfplus/pageimages/' . self::hash($assignment, $userid, $attemptnumber));
$combined = $tmpdir . '/' . self::COMBINED_PDF_FILENAME; $combined = $tmpdir . '/' . self::COMBINED_PDF_FILENAME;
$document->get_combined_file()->copy_content_to($combined); // Copy the file. $document->get_combined_file()->copy_content_to($combined); // Copy the file.
//$file->copy_content_to($combined); // Copy the file.
$pdf = new pdf(); $pdf = new pdf();
...@@ -561,7 +412,6 @@ EOD; ...@@ -561,7 +412,6 @@ EOD;
// We catch only moodle_exception here as other exceptions indicate issue with setup not the pdf. // We catch only moodle_exception here as other exceptions indicate issue with setup not the pdf.
$image = pdf::get_error_image($tmpdir, $i); $image = pdf::get_error_image($tmpdir, $i);
} }
//$image = $pdf->get_image($i);
$record->filename = basename($image); $record->filename = basename($image);
$files[$i] = $fs->create_file_from_pathname($record, $tmpdir . '/' . $image); $files[$i] = $fs->create_file_from_pathname($record, $tmpdir . '/' . $image);
@unlink($tmpdir . '/' . $image); @unlink($tmpdir . '/' . $image);
...@@ -600,7 +450,7 @@ EOD; ...@@ -600,7 +450,7 @@ EOD;
$assignment = self::get_assignment_from_param($assignment); $assignment = self::get_assignment_from_param($assignment);
if (!$assignment->can_view_submission($userid)) { if (!$assignment->can_view_submission($userid)) {
\print_error('nopermission'); print_error('nopermission');
} }
if ($assignment->get_instance()->teamsubmission) { if ($assignment->get_instance()->teamsubmission) {
...@@ -649,7 +499,6 @@ EOD; ...@@ -649,7 +499,6 @@ EOD;
} }
} }
} }
//if (!$readonly && $first->get_timemodified() < $submission->timemodified) {
if (!$readonly && ($pagemodified < $submission->timemodified || $blankpage)) { if (!$readonly && ($pagemodified < $submission->timemodified || $blankpage)) {
// Image files are stale, we need to regenerate them, except in readonly mode. // Image files are stale, we need to regenerate them, except in readonly mode.
// We also need to remove the draft annotations and comments associated with this attempt. // We also need to remove the draft annotations and comments associated with this attempt.
......
...@@ -46,6 +46,7 @@ class page_editor { ...@@ -46,6 +46,7 @@ class page_editor {
*/ */
public static function get_tools($contextidlist) { public static function get_tools($contextidlist) {
global $DB; global $DB;
$tools = array(); $tools = array();
if ($contextidlist) { if ($contextidlist) {
$records = $DB->get_records_list('assignfeedback_editpp_tool', 'contextid', $contextidlist); $records = $DB->get_records_list('assignfeedback_editpp_tool', 'contextid', $contextidlist);
...@@ -285,12 +286,6 @@ class page_editor { ...@@ -285,12 +286,6 @@ class page_editor {
$newid = $DB->insert_record('assignfeedback_editpp_annot', $record); $newid = $DB->insert_record('assignfeedback_editpp_annot', $record);
$parentlink[$oldid] = $newid; $parentlink[$oldid] = $newid;
} }
/* $records = $DB->get_records('assignfeedback_editpp_cmnt', array('gradeid' => $gradeid, 'draft' => 1));
foreach ($records as $record) {
unset($record->id);
$record->draft = 0;
$DB->insert_record('assignfeedback_editpp_cmnt', $record);
} */
return true; return true;
} }
...@@ -334,12 +329,6 @@ class page_editor { ...@@ -334,12 +329,6 @@ class page_editor {
$record->draft = 0; $record->draft = 0;
$DB->insert_record('assignfeedback_editpp_annot', $record); $DB->insert_record('assignfeedback_editpp_annot', $record);
} }
/* $records = $DB->get_records('assignfeedback_editpp_cmnt', array('gradeid' => $gradeid, 'draft' => 0));
foreach ($records as $record) {
unset($record->id);
$record->draft = 0;
$DB->insert_record('assignfeedback_editpp_annot', $record);
} */
return true; return true;
} }
...@@ -384,11 +373,9 @@ class page_editor { ...@@ -384,11 +373,9 @@ class page_editor {
// Delete any existing annotations and comments from current user. // Delete any existing annotations and comments from current user.
$DB->delete_records('assignfeedback_editpp_annot', array('gradeid' => $grade->id)); $DB->delete_records('assignfeedback_editpp_annot', array('gradeid' => $grade->id));
//$DB->delete_records('assignfeedback_editpp_cmnt', array('gradeid' => $grade->id));
// Get gradeid, annotations and comments from sourceuserid. // Get gradeid, annotations and comments from sourceuserid.
$sourceusergrade = $assignment->get_user_grade($sourceuserid, true, $grade->attemptnumber); $sourceusergrade = $assignment->get_user_grade($sourceuserid, true, $grade->attemptnumber);
$annotations = $DB->get_records('assignfeedback_editpp_annot', array('gradeid' => $sourceusergrade->id, 'draft' => 1)); $annotations = $DB->get_records('assignfeedback_editpp_annot', array('gradeid' => $sourceusergrade->id, 'draft' => 1));
//$comments = $DB->get_records('assignfeedback_editpp_cmnt', array('gradeid' => $sourceusergrade->id, 'draft' => 1));
$contextid = $assignment->get_context()->id; $contextid = $assignment->get_context()->id;
$sourceitemid = $sourceusergrade->id; $sourceitemid = $sourceusergrade->id;
...@@ -397,10 +384,6 @@ class page_editor { ...@@ -397,10 +384,6 @@ class page_editor {
$annotation->gradeid = $grade->id; $annotation->gradeid = $grade->id;
$DB->insert_record('assignfeedback_editpp_annot', $annotation); $DB->insert_record('assignfeedback_editpp_annot', $annotation);
} }
/* foreach ($comments as $comment) {
$comment->gradeid = $grade->id;
$DB->insert_record('assignfeedback_editpp_cmnt', $comment);
} */
$fs = get_file_storage(); $fs = get_file_storage();
...@@ -472,13 +455,6 @@ class page_editor { ...@@ -472,13 +455,6 @@ class page_editor {
global $CFG; global $CFG;
switch ($newToolType->label) { switch ($newToolType->label) {
case 'highlightplus': case 'highlightplus':
/*if (isset($CFG->highlightplus_configurable) && (intval($CFG->highlightplus_configurable) == 0 || intval($CFG->highlightplus_configurable) == 1)) {
if (intval($CFG->highlightplus_configurable) == 0) {
$newToolType->configurable = 1;
} else {
$newToolType->configurable = 0;
}
}*/
if (isset($CFG->highlightplus_color) && $CFG->highlightplus_color != null && strlen($CFG->highlightplus_color) > 4) { if (isset($CFG->highlightplus_color) && $CFG->highlightplus_color != null && strlen($CFG->highlightplus_color) > 4) {
$newToolType->color = $CFG->highlightplus_color; $newToolType->color = $CFG->highlightplus_color;
} }
...@@ -494,26 +470,12 @@ class page_editor { ...@@ -494,26 +470,12 @@ class page_editor {
break; break;
case 'stampplus': case 'stampplus':
/*if (isset($CFG->stampplus_configurable) && (intval($CFG->stampplus_configurable) == 0 || intval($CFG->stampplus_configurable) == 1)) {
if (intval($CFG->stampplus_configurable) == 0) {
$newToolType->configurable = 1;
} else {
$newToolType->configurable = 0;
}
}*/
if (isset($CFG->stampplus_color) && $CFG->stampplus_color != null && strlen($CFG->stampplus_color) > 4) { if (isset($CFG->stampplus_color) && $CFG->stampplus_color != null && strlen($CFG->stampplus_color) > 4) {
$newToolType->color = $CFG->stampplus_color; $newToolType->color = $CFG->stampplus_color;
} }
break; break;
case 'frame': case 'frame':
/*if (isset($CFG->frame_configurable) && (intval($CFG->frame_configurable) == 0 || intval($CFG->frame_configurable) == 1)) {
if (intval($CFG->frame_configurable) == 0) {
$newToolType->configurable = 1;
} else {
$newToolType->configurable = 0;
}
}*/
if (isset($CFG->frame_cartridge_x) && (intval($CFG->frame_cartridge_x) || $CFG->frame_cartridge_x == '0')) { if (isset($CFG->frame_cartridge_x) && (intval($CFG->frame_cartridge_x) || $CFG->frame_cartridge_x == '0')) {
$newToolType->cartridge_x = intval($CFG->frame_cartridge_x); $newToolType->cartridge_x = intval($CFG->frame_cartridge_x);
} }
...@@ -523,13 +485,6 @@ class page_editor { ...@@ -523,13 +485,6 @@ class page_editor {
break; break;
case 'verticalline': case 'verticalline':
/*if (isset($CFG->verticalline_configurable) && (intval($CFG->verticalline_configurable) == 0 || intval($CFG->verticalline_configurable) == 1)) {
if (intval($CFG->verticalline_configurable) == 0) {
$newToolType->configurable = 1;
} else {
$newToolType->configurable = 0;
}
}*/
if (isset($CFG->verticalline_color) && $CFG->verticalline_color != null && strlen($CFG->verticalline_color) > 4) { if (isset($CFG->verticalline_color) && $CFG->verticalline_color != null && strlen($CFG->verticalline_color) > 4) {
$newToolType->color = $CFG->verticalline_color; $newToolType->color = $CFG->verticalline_color;
} }
...@@ -545,16 +500,6 @@ class page_editor { ...@@ -545,16 +500,6 @@ class page_editor {
break; break;
case 'stampcomment': case 'stampcomment':
/*if (isset($CFG->stampcomment_configurable) && (intval($CFG->stampcomment_configurable) == 0 || intval($CFG->stampcomment_configurable) == 1)) {
if (intval($CFG->stampcomment_configurable) == 0) {
$newToolType->configurable = 1;
} else {
$newToolType->configurable = 0;
}
}*/
/*if (isset($CFG->stampcomment_color) && $CFG->stampcomment_color != null && strlen($CFG->stampcomment_color) > 4) {
$newToolType->color = $CFG->stampcomment_color;
}*/
if (isset($CFG->stampcomment_cartridge_color) && $CFG->stampcomment_cartridge_color != null && strlen($CFG->stampcomment_cartridge_color) > 4) { if (isset($CFG->stampcomment_cartridge_color) && $CFG->stampcomment_cartridge_color != null && strlen($CFG->stampcomment_cartridge_color) > 4) {
$newToolType->cartridge_color = $CFG->stampcomment_cartridge_color; $newToolType->cartridge_color = $CFG->stampcomment_cartridge_color;
} }
...@@ -567,13 +512,6 @@ class page_editor { ...@@ -567,13 +512,6 @@ class page_editor {
break; break;
case 'commentplus': case 'commentplus':
/*if (isset($CFG->commentplus_configurable) && (intval($CFG->commentplus_configurable) == 0 || intval($CFG->commentplus_configurable) == 1)) {
if (intval($CFG->commentplus_configurable) == 0) {
$newToolType->configurable = 1;
} else {
$newToolType->configurable = 0;
}
}*/
if (isset($CFG->commentplus_cartridge_color) && $CFG->commentplus_cartridge_color != null && strlen($CFG->commentplus_cartridge_color) > 4) { if (isset($CFG->commentplus_cartridge_color) && $CFG->commentplus_cartridge_color != null && strlen($CFG->commentplus_cartridge_color) > 4) {
$newToolType->cartridge_color = $CFG->commentplus_cartridge_color; $newToolType->cartridge_color = $CFG->commentplus_cartridge_color;
} }
......
...@@ -83,7 +83,7 @@ class pdf extends \FPDI { ...@@ -83,7 +83,7 @@ class pdf extends \FPDI {
const MIN_ANNOTATION_HEIGHT = 5; const MIN_ANNOTATION_HEIGHT = 5;
/** Blank PDF file used during error. */ /** Blank PDF file used during error. */
const BLANK_PDF = '/mod/assign/feedback/editpdf/fixtures/blank.pdf'; const BLANK_PDF = '/mod/assign/feedback/editpdfplus/fixtures/blank.pdf';
/** /**
* Combine the given PDF files into a single PDF. Optionally add a coversheet and coversheet fields. * Combine the given PDF files into a single PDF. Optionally add a coversheet and coversheet fields.
...@@ -558,8 +558,8 @@ class pdf extends \FPDI { ...@@ -558,8 +558,8 @@ class pdf extends \FPDI {
/** /**
* Generate an image of the specified page in the PDF * Generate an image of the specified page in the PDF
* @param int $pageno the page to generate the image of * @param int $pageno the page to generate the image of
* @throws moodle_exception * @throws \moodle_exception
* @throws coding_exception * @throws \coding_exception
* @return string the filename of the generated image * @return string the filename of the generated image
*/ */
public function get_image($pageno) { public function get_image($pageno) {
...@@ -621,59 +621,12 @@ class pdf extends \FPDI { ...@@ -621,59 +621,12 @@ class pdf extends \FPDI {
public static function ensure_pdf_compatible(\stored_file $file) { public static function ensure_pdf_compatible(\stored_file $file) {
global $CFG; global $CFG;
//$temparea = make_temp_directory('assignfeedback_editpdfplus'); // Copy the stored_file to local disk for checking.
$temparea = make_request_directory(); $temparea = make_request_directory();
//$hash = $file->get_contenthash(); // Use the contenthash to make sure the temp files have unique names.
//$tempsrc = $temparea . "/src-$hash.pdf";