--- a/mod/assign/feedback/editpdf/locallib.php +++ b/mod/assign/feedback/editpdf/locallib.php @@ -332,11 +332,34 @@ } /** + * Pre-check to determine whether we (Unil) thinks we should use annotation + * If the user is using the editpdfplus submission plugin (capability check), + * deactivate annotation (from $this plugin). + * + * @return bool activate or not + */ + private function is_enabled_precheck() { + global $CFG; + if (file_exists($CFG->dirroot . '/mod/assign/feedback/editpdfplus/version.php')) { + if ($this->assignment->get_context()) { + return !has_capability('assignfeedback/editpdfplus:use', $this->assignment->get_context(), null, false); + } + } + return true; + } + + /** * Determine if ghostscript is available and working. * * @return bool */ public function is_enabled() { + if (!$this->is_enabled_precheck()) { + return false; + } if ($this->enabledcache === null) { $testpath = assignfeedback_editpdf\pdf::test_gs_path(false); $this->enabledcache = ($testpath->status == assignfeedback_editpdf\pdf::GSPATH_OK);