. /** * Certificate module data generator. * * @package mod_certificate * @copyright 2014 Totara Learning Solutions Ltd {@link http://www.totaralms.com/} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @author Petr Skoda */ defined('MOODLE_INTERNAL') || die(); require_once($CFG->libdir.'/adminlib.php'); class mod_certificate_admin_setting_font extends admin_setting_configselect { /** * Constructor * @param string $name unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting' for ones in config_plugins. * @param string $visiblename localised * @param string $description long localised info * @param string|int $defaultsetting */ public function __construct($name, $visiblename, $description, $defaultsetting) { parent::__construct($name, $visiblename, $description, $defaultsetting, null); } /** * Lazy load the font options. * * @return bool true if loaded, false if error */ public function load_choices() { global $CFG; if (is_array($this->choices)) { return true; } require_once("$CFG->libdir/pdflib.php"); $doc = new pdf(); if (method_exists($doc, 'get_font_families')) { $this->choices = array(); $fontfamilies = $doc->get_font_families(); foreach ($fontfamilies as $family => $fonts) { $this->choices[$family] = $family; } } else { $this->choices = array( 'freeserif' => 'freeserif', 'freesans' => 'freesans', ); } return true; } }