MDL-30070 message: Optimised search for users over multiple courses
[moodle.git] / filter / tex / filtersettings.php
CommitLineData
4317f92f 1<?php
f7f0909c
PS
2// This file is part of Moodle - http://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17/**
18 * TeX filter settings
19 *
20 * @package filter
21 * @subpackage tex
22 * @copyright 2007 Petr Skoda {@link http://skodak.org}
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 */
220a90c5 25
dbf9e4ba
PS
26defined('MOODLE_INTERNAL') || die;
27
28if ($ADMIN->fulltree) {
29
30 require_once($CFG->dirroot.'/filter/tex/lib.php');
31
32 $items = array();
33 $items[] = new admin_setting_heading('filter_tex_latexheading', get_string('latexsettings', 'admin'), '');
34 $items[] = new admin_setting_configtextarea('filter_tex_latexpreamble', get_string('latexpreamble','admin'),
35 '', "\\usepackage[latin1]{inputenc}\n\\usepackage{amsmath}\n\\usepackage{amsfonts}\n\\RequirePackage{amsmath,amssymb,latexsym}\n");
36 $items[] = new admin_setting_configtext('filter_tex_latexbackground', get_string('backgroundcolour', 'admin'), '', '#FFFFFF');
37 $items[] = new admin_setting_configtext('filter_tex_density', get_string('density', 'admin'), '', '120', PARAM_INT);
38
39 if (PHP_OS=='Linux') {
40 $default_filter_tex_pathlatex = "/usr/bin/latex";
41 $default_filter_tex_pathdvips = "/usr/bin/dvips";
42 $default_filter_tex_pathconvert = "/usr/bin/convert";
43
44 } else if (PHP_OS=='Darwin') {
45 // most likely needs a fink install (fink.sf.net)
46 $default_filter_tex_pathlatex = "/sw/bin/latex";
47 $default_filter_tex_pathdvips = "/sw/bin/dvips";
48 $default_filter_tex_pathconvert = "/sw/bin/convert";
49
50 } else if (PHP_OS=='WINNT' or PHP_OS=='WIN32' or PHP_OS=='Windows') {
51 // note: you need Ghostscript installed (standard), miktex (standard)
52 // and ImageMagick (install at c:\ImageMagick)
53 $default_filter_tex_pathlatex = "\"c:\\texmf\\miktex\\bin\\latex.exe\" ";
54 $default_filter_tex_pathdvips = "\"c:\\texmf\\miktex\\bin\\dvips.exe\" ";
55 $default_filter_tex_pathconvert = "\"c:\\imagemagick\\convert.exe\" ";
56
57 } else {
58 $default_filter_tex_pathlatex = '';
59 $default_filter_tex_pathdvips = '';
60 $default_filter_tex_pathconvert = '';
61 }
62
63 $items[] = new admin_setting_configexecutable('filter_tex_pathlatex', get_string('pathlatex', 'admin'), '', $default_filter_tex_pathlatex);
64 $items[] = new admin_setting_configexecutable('filter_tex_pathdvips', get_string('pathdvips', 'admin'), '', $default_filter_tex_pathdvips);
65 $items[] = new admin_setting_configexecutable('filter_tex_pathconvert', get_string('pathconvert', 'admin'), '', $default_filter_tex_pathconvert);
66
67 // Even if we offer GIF and PNG formats here, in the update callback we check whether
68 // all the paths actually point to executables. If they don't, we force the setting
69 // to GIF, as that's the only format mimeTeX can produce.
70 $formats = array('gif' => 'GIF', 'png' => 'PNG');
71 $items[] = new admin_setting_configselect('filter_tex_convertformat', get_string('convertformat', 'admin'), get_string('configconvertformat', 'admin'), 'gif', $formats);
72
73 foreach ($items as $item) {
74 $item->set_updatedcallback('filter_tex_updatedcallback');
75 $settings->add($item);
76 }
77}