/** * Check the ghostscript path is valid to see if the plugin should be enabled. * @return bool */ public function is_enabled() { global $CFG; static $gspathok = null; if (is_null($gspathok)) { require_once $CFG->dirroot . '/mod/assign/feedback/pdf/mypdflib.php'; $result = AssignPDFLib::test_gs_path(false); $gspathok = $result->status == AssignPDFLib::GSPATH_OK; if (!$gspathok && $this->is_visible()) { // Setting 'gspath' is invalid, so the plugin should be globally disabled. set_config('disabled', true, $this->get_subtype() . '_' . $this->get_type()); } } if (!parent::is_enabled()) { return false; } return $gspathok; }
/** * If blind marking is enabled then disable this plugin (it shows names) * * @return bool */ public function is_enabled() { if ($this->assignment->has_instance() && $this->assignment->is_blind_marking()) { return false; } return parent::is_enabled(); }
/** * Automatically hide the setting for the submission plugin. * * @return bool */ public function is_configurable() { if ($this->isonfrontpage() === true) { return false; } return parent::is_configurable(); }