Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/filter/tex/filtersettings.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00026 defined('MOODLE_INTERNAL') || die;
00027 
00028 if ($ADMIN->fulltree) {
00029 
00030     require_once($CFG->dirroot.'/filter/tex/lib.php');
00031 
00032     $items = array();
00033     $items[] = new admin_setting_heading('filter_tex_latexheading', get_string('latexsettings', 'admin'), '');
00034     $items[] = new admin_setting_configtextarea('filter_tex_latexpreamble', get_string('latexpreamble','admin'),
00035                    '', "\\usepackage[latin1]{inputenc}\n\\usepackage{amsmath}\n\\usepackage{amsfonts}\n\\RequirePackage{amsmath,amssymb,latexsym}\n");
00036     $items[] = new admin_setting_configtext('filter_tex_latexbackground', get_string('backgroundcolour', 'admin'), '', '#FFFFFF');
00037     $items[] = new admin_setting_configtext('filter_tex_density', get_string('density', 'admin'), '', '120', PARAM_INT);
00038 
00039     if (PHP_OS=='Linux') {
00040         $default_filter_tex_pathlatex   = "/usr/bin/latex";
00041         $default_filter_tex_pathdvips   = "/usr/bin/dvips";
00042         $default_filter_tex_pathconvert = "/usr/bin/convert";
00043 
00044     } else if (PHP_OS=='Darwin') {
00045         // most likely needs a fink install (fink.sf.net)
00046         $default_filter_tex_pathlatex   = "/sw/bin/latex";
00047         $default_filter_tex_pathdvips   = "/sw/bin/dvips";
00048         $default_filter_tex_pathconvert = "/sw/bin/convert";
00049 
00050     } else if (PHP_OS=='WINNT' or PHP_OS=='WIN32' or PHP_OS=='Windows') {
00051         // note: you need Ghostscript installed (standard), miktex (standard)
00052         // and ImageMagick (install at c:\ImageMagick)
00053         $default_filter_tex_pathlatex   = "\"c:\\texmf\\miktex\\bin\\latex.exe\" ";
00054         $default_filter_tex_pathdvips   = "\"c:\\texmf\\miktex\\bin\\dvips.exe\" ";
00055         $default_filter_tex_pathconvert = "\"c:\\imagemagick\\convert.exe\" ";
00056 
00057     } else {
00058         $default_filter_tex_pathlatex   = '';
00059         $default_filter_tex_pathdvips   = '';
00060         $default_filter_tex_pathconvert = '';
00061     }
00062 
00063     $items[] = new admin_setting_configexecutable('filter_tex_pathlatex', get_string('pathlatex', 'admin'), '', $default_filter_tex_pathlatex);
00064     $items[] = new admin_setting_configexecutable('filter_tex_pathdvips', get_string('pathdvips', 'admin'), '', $default_filter_tex_pathdvips);
00065     $items[] = new admin_setting_configexecutable('filter_tex_pathconvert', get_string('pathconvert', 'admin'), '', $default_filter_tex_pathconvert);
00066 
00067     // Even if we offer GIF and PNG formats here, in the update callback we check whether
00068     // all the paths actually point to executables. If they don't, we force the setting
00069     // to GIF, as that's the only format mimeTeX can produce.
00070     $formats = array('gif' => 'GIF', 'png' => 'PNG');
00071     $items[] = new admin_setting_configselect('filter_tex_convertformat', get_string('convertformat', 'admin'), get_string('configconvertformat', 'admin'), 'gif', $formats);
00072 
00073     foreach ($items as $item) {
00074         $item->set_updatedcallback('filter_tex_updatedcallback');
00075         $settings->add($item);
00076     }
00077 }
 All Data Structures Namespaces Files Functions Variables Enumerations