• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilExcelUtils.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 /*
00025 * Utilities for Microsoft Excel Import/Export
00026 *
00027 * @author Helmut Schottmüller <hschottm@gmx.de>
00028 * @version $Id: class.ilExcelUtils.php 7559 2005-05-16 17:38:40Z hschottm $
00029 *
00030 * @package ilias-core
00031 */
00032 
00033 define ("CHARSET_LATIN1", "latin1");
00034 define ("CHARSET_MACOS", "macos");
00035 
00036 class ilExcelUtils
00037 {
00038         function _convert_text($a_text, $a_target = CHARSET_LATIN1)
00039         {
00040                 switch ($a_target)
00041                 {
00042                         case CHARSET_LATIN1:
00043                                 $charmap_latin1 = array(
00044                                         utf8_decode("ß") => chr(0xDF),
00045                                         utf8_decode("à") => chr(0xE0),
00046                                         utf8_decode("á") => chr(0xE1),
00047                                         utf8_decode("â") => chr(0xE2),
00048                                         utf8_decode("ã") => chr(0xE3),
00049                                         utf8_decode("ä") => chr(0xE4),
00050                                         utf8_decode("å") => chr(0xE5),
00051                                         utf8_decode("æ") => chr(0xE6),
00052                                         utf8_decode("À") => chr(0xC0),
00053                                         utf8_decode("Á") => chr(0xC1),
00054                                         utf8_decode("Â") => chr(0xC2),
00055                                         utf8_decode("Ã") => chr(0xC3),
00056                                         utf8_decode("Ä") => chr(0xC4),
00057                                         utf8_decode("Å") => chr(0xC5),
00058                                         utf8_decode("Æ") => chr(0xC6),
00059                                         utf8_decode("ç") => chr(0xE7),
00060                                         utf8_decode("Ç") => chr(0xC7),
00061                                         utf8_decode("ð") => chr(0xF0),
00062                                         utf8_decode("è") => chr(0xE8),
00063                                         utf8_decode("é") => chr(0xE9),
00064                                         utf8_decode("ê") => chr(0xEA),
00065                                         utf8_decode("ë") => chr(0xEB),
00066                                         utf8_decode("È") => chr(0xC8),
00067                                         utf8_decode("É") => chr(0xC9),
00068                                         utf8_decode("Ê") => chr(0xCA),
00069                                         utf8_decode("Ë") => chr(0xCB),
00070                                         utf8_decode("ì") => chr(0xEC),
00071                                         utf8_decode("í") => chr(0xED),
00072                                         utf8_decode("î") => chr(0xEE),
00073                                         utf8_decode("ï") => chr(0xEF),
00074                                         utf8_decode("Ì") => chr(0xCC),
00075                                         utf8_decode("Í") => chr(0xCD),
00076                                         utf8_decode("Î") => chr(0xCE),
00077                                         utf8_decode("Ï") => chr(0xCF),
00078                                         utf8_decode("ñ") => chr(0xF1),
00079                                         utf8_decode("Ñ") => chr(0xD1),
00080                                         utf8_decode("ò") => chr(0xF2),
00081                                         utf8_decode("ó") => chr(0xF3),
00082                                         utf8_decode("ô") => chr(0xF4),
00083                                         utf8_decode("õ") => chr(0xF5),
00084                                         utf8_decode("ö") => chr(0xF6),
00085                                         utf8_decode("ø") => chr(0xF8),
00086                                         utf8_decode("Ò") => chr(0xD2),
00087                                         utf8_decode("Ó") => chr(0xD3),
00088                                         utf8_decode("Ô") => chr(0xD4),
00089                                         utf8_decode("Õ") => chr(0xD5),
00090                                         utf8_decode("Ö") => chr(0xD6),
00091                                         utf8_decode("Ø") => chr(0xD8),
00092                                         utf8_decode("ù") => chr(0xF9),
00093                                         utf8_decode("ú") => chr(0xFA),
00094                                         utf8_decode("û") => chr(0xFB),
00095                                         utf8_decode("ü") => chr(0xFC),
00096                                         utf8_decode("Ù") => chr(0xD9),
00097                                         utf8_decode("Ú") => chr(0xDA),
00098                                         utf8_decode("Û") => chr(0xDB),
00099                                         utf8_decode("Ü") => chr(0xDC),
00100                                         utf8_decode("ý") => chr(0xFD),
00101                                         utf8_decode("ÿ") => chr(0xFF),
00102                                         utf8_decode("Ý") => chr(0xDD),
00103                                         utf8_decode("þ") => chr(0xFE),
00104                                         utf8_decode("Þ") => chr(0xDE)
00105                                 );
00106                                 return strtr(utf8_decode($a_text), $charmap_latin1);
00107                                 break;
00108                         case CHARSET_MACOS:
00109                                 $charmap_macos = array(
00110                                         utf8_decode("ß") => chr(0xA7),
00111                                         utf8_decode("à") => chr(0x88),
00112                                         utf8_decode("á") => chr(0x87),
00113                                         utf8_decode("â") => chr(0x89),
00114                                         utf8_decode("ã") => chr(0x8B),
00115                                         utf8_decode("ä") => chr(0x8A),
00116                                         utf8_decode("å") => chr(0x8C),
00117                                         utf8_decode("æ") => chr(0xBE),
00118                                         utf8_decode("À") => chr(0xCB),
00119                                         utf8_decode("Á") => chr(0xE7),
00120                                         utf8_decode("Â") => chr(0xE5),
00121                                         utf8_decode("Ã") => chr(0xCC),
00122                                         utf8_decode("Ä") => chr(0x80),
00123                                         utf8_decode("Å") => chr(0x81),
00124                                         utf8_decode("Æ") => chr(0xAE),
00125                                         utf8_decode("ç") => chr(0x8D),
00126                                         utf8_decode("Ç") => chr(0x82),
00127                                         utf8_decode("ð") => chr(0xB6),
00128                                         utf8_decode("è") => chr(0x8F),
00129                                         utf8_decode("é") => chr(0x8E),
00130                                         utf8_decode("ê") => chr(0x90),
00131                                         utf8_decode("ë") => chr(0x91),
00132                                         utf8_decode("È") => chr(0xE9),
00133                                         utf8_decode("É") => chr(0x83),
00134                                         utf8_decode("Ê") => chr(0xE6),
00135                                         utf8_decode("Ë") => chr(0xE8),
00136                                         utf8_decode("ì") => chr(0x93),
00137                                         utf8_decode("í") => chr(0x92),
00138                                         utf8_decode("î") => chr(0x94),
00139                                         utf8_decode("ï") => chr(0x95),
00140                                         utf8_decode("Ì") => chr(0xED),
00141                                         utf8_decode("Í") => chr(0xEA),
00142                                         utf8_decode("Î") => chr(0xEB),
00143                                         utf8_decode("Ï") => chr(0xEC),
00144                                         utf8_decode("ñ") => chr(0x96),
00145                                         utf8_decode("Ñ") => chr(0x84),
00146                                         utf8_decode("ò") => chr(0x98),
00147                                         utf8_decode("ó") => chr(0x97),
00148                                         utf8_decode("ô") => chr(0x99),
00149                                         utf8_decode("õ") => chr(0x9B),
00150                                         utf8_decode("ö") => chr(0x9A),
00151                                         utf8_decode("ø") => chr(0xBF),
00152                                         utf8_decode("Ò") => chr(0xF1),
00153                                         utf8_decode("Ó") => chr(0xEE),
00154                                         utf8_decode("Ô") => chr(0xEF),
00155                                         utf8_decode("Õ") => chr(0xCD),
00156                                         utf8_decode("Ö") => chr(0x85),
00157                                         utf8_decode("Ø") => chr(0xAF),
00158                                         utf8_decode("ù") => chr(0x9D),
00159                                         utf8_decode("ú") => chr(0x9C),
00160                                         utf8_decode("û") => chr(0x9E),
00161                                         utf8_decode("ü") => chr(0x9F),
00162                                         utf8_decode("Ù") => chr(0xF4),
00163                                         utf8_decode("Ú") => chr(0xF2),
00164                                         utf8_decode("Û") => chr(0xF3),
00165                                         utf8_decode("Ü") => chr(0x86),
00166                                         utf8_decode("ý") => chr(0x79),
00167                                         utf8_decode("ÿ") => chr(0xD8),
00168                                         utf8_decode("Ý") => chr(0x59),
00169                                         utf8_decode("þ") => chr(0x20),
00170                                         utf8_decode("Þ") => chr(0x20)
00171                                 );
00172                                 return strtr(utf8_decode($a_text), $charmap_macos);
00173                                 break;
00174                         case "unknown":
00175                         default:
00176                                 return $a_text;
00177                 }
00178         }
00179 
00180 } // END class.ilExcelUtils.php
00181 ?>

Generated on Fri Dec 13 2013 09:06:33 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1