|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00027 define('NO_MOODLE_COOKIES', true); // Session not used here 00028 define('NO_UPGRADE_CHECK', true); // Ignore upgrade check 00029 00030 require_once(dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))))) . '/config.php'); 00031 00032 $PAGE->set_context(get_system_context()); 00033 00034 $emoticonmanager = get_emoticon_manager(); 00035 $stringmanager = get_string_manager(); 00036 00037 $editor = get_texteditor('tinymce'); 00038 00039 ?> 00040 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 00041 <html xmlns="http://www.w3.org/1999/xhtml"> 00042 <head> 00043 <title><?php print_string('moodleemoticon:desc', 'editor_tinymce'); ?></title> 00044 <script type="text/javascript" src="../../tiny_mce_popup.js?v=<?php echo $editor->version ?>"></script> 00045 <script type="text/javascript" src="js/dialog.js?v=<?php echo $editor->version ?>"></script> 00046 </head> 00047 <body> 00048 00049 <table border="0" align="center" style="width:100%;"> 00050 <?php 00051 00052 $emoticons = $emoticonmanager->get_emoticons(); 00053 // this is tricky - we must somehow include the information about the original 00054 // emoticon text so that we can replace the image back with it on editor save. 00055 // so we are going to encode the index of the emoticon. this will break when the 00056 // admin changes the mapping table while the user has the editor opened 00057 // but I am not able to come with better solution at the moment :-/ 00058 $index = 0; 00059 foreach ($emoticons as $emoticon) { 00060 $txt = $emoticon->text; 00061 $img = $OUTPUT->render( 00062 $emoticonmanager->prepare_renderable_emoticon($emoticon, array('class' => 'emoticon emoticon-index-'.$index))); 00063 if ($stringmanager->string_exists($emoticon->altidentifier, $emoticon->altcomponent)) { 00064 $alt = get_string($emoticon->altidentifier, $emoticon->altcomponent); 00065 } else { 00066 $alt = ''; 00067 } 00068 echo html_writer::tag('tr', 00069 html_writer::tag('td', $img, array('style' => 'width:20%;text-align:center;')) . 00070 html_writer::tag('td', s($txt), array('style' => 'width:40%;text-align:center;font-family:monospace;')) . 00071 html_writer::tag('td', $alt), 00072 array( 00073 'class' => 'emoticoninfo emoticoninfo-index-'.$index, 00074 ) 00075 ); 00076 $index++; 00077 } 00078 00079 ?> 00080 </table> 00081 00082 <div class="mceActionPanel"> 00083 <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" /> 00084 </div> 00085 00086 </body> 00087 </html>