Documentation TYPO3 par Ameos

class.t3lib_bedisplaylog.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2004 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00081 class t3lib_BEDisplayLog {
00082         var $lastTimeLabel = '';
00083         var $lastUserLabel = '';
00084         var $lastTypeLabel = '';
00085         var $lastActionLabel = '';
00086 
00087         var $detailsOn = 1;     // If detailsOn, %s is substituted with values from the data-array (see getDetails())
00088         var $stripPath = 1;     // This strips the path from any value in the data-array when the data-array is parsed through stripPath()
00089         var $errorSign = Array(
00090                 1 => '!',
00091                 2 => 'Sys!',
00092                 3 => 'Secur!'
00093         );
00094 
00095         var $be_user_Array = array();           // Username array (set externally)
00096 
00102         function initArray()    {
00103                 $codeArr=Array();
00104                 $codeArr[0][]='Time';   // Time
00105                 $codeArr[0][]='User';
00106                 $codeArr[0][]='Type';
00107                 $codeArr[0][]='E';
00108                 $codeArr[0][]='Action';
00109                 $codeArr[0][]='Details';
00110                 return $codeArr;
00111         }
00112 
00119         function getTimeLabel($code)    {
00120                 $t=$GLOBALS['SOBE']->doc->formatTime($code,1);
00121                 if ($this->lastTimeLabel!=$t)   {
00122                         $this->lastTimeLabel=$t;
00123                         return $t;
00124                 } else return '.';
00125 
00126         }
00127 
00134         function getUserLabel($code)    {
00135                 if ($this->lastUserLabel!=$code)        {
00136                         $this->lastUserLabel=$code;
00137                         $label = $this->be_user_Array[$code]['username'];
00138                         return $label ? $label : '['.$code.']';
00139                 } else return '.';
00140         }
00141 
00148         function getTypeLabel($code)    {
00149                 if ($this->lastTypeLabel!=$code)        {
00150                         $this->lastTypeLabel=$code;
00151                         $label=$GLOBALS['LANG']->getLL('type_'.$code);
00152                         return $label ? $label : '['.$code.']';
00153                 } else return '.';
00154         }
00155 
00162         function getActionLabel($code)  {
00163                 if ($this->lastActionLabel!=$code)      {
00164                         $this->lastActionLabel=$code;
00165                         $label=$GLOBALS['LANG']->getLL('action_'.$code);
00166                         return $label ? $label : '['.$code.']';
00167                 } else return '.';
00168         }
00169 
00180         function getDetails($code,$text,$data,$sys_log_uid=0)   {
00181                         // $code is used later on to substitute errormessages with language-corrected values...
00182                 if (is_array($data))    {
00183                         if ($this->detailsOn)   {
00184                                 if (is_object($GLOBALS['LANG']))        {
00185                                         $label = $GLOBALS['LANG']->getLL('msg_'.$code);
00186                                 } else {
00187                                         list($label) = explode(',',$text);
00188                                 }
00189                                 if ($label)     {$text=$label;}
00190                                 $text = sprintf($text, htmlspecialchars($data[0]),htmlspecialchars($data[1]),htmlspecialchars($data[2]),htmlspecialchars($data[3]),htmlspecialchars($data[4]));
00191                         } else {
00192                                 $text = str_replace('%s','',$text);
00193                         }
00194                 }
00195 
00196                         // Finding the history for the record
00197                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,fieldlist', 'sys_history', 'sys_log_uid='.intval($sys_log_uid));
00198                 $newRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00199                 if (is_array($newRow))  {
00200                         $text.=' Changes in fields: <em>'.$newRow['fieldlist'].'</em>.';
00201                         $text.=' <a href="'.htmlspecialchars($GLOBALS['BACK_PATH'].'show_rechis.php?sh_uid='.$newRow['uid'].'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))).'"><b>->His</b></a>';
00202                 }
00203 
00204                 return $text;
00205         }
00206 
00212         function reset()        {
00213                 $this->lastTimeLabel='';
00214                 $this->lastUserLabel='';
00215                 $this->lastTypeLabel='';
00216                 $this->lastActionLabel='';
00217         }
00218 
00226         function getErrorFormatting($sign)      {
00227                 return '<font color="red"><b>'.$sign.'</b></font>';
00228         }
00229 
00236         function formatDetailsForList($row)     {
00237                 $data = unserialize($row['log_data']);
00238                 if ($row['type']==2)    {
00239                         $data=$this->stripPath($data);
00240                 }
00241 
00242                 return $this->getDetails($row['type'].'_'.$row['action'].'_'.$row['details_nr'],$row['details'],$data,$row['uid']).' ('.$row['details_nr'].')';
00243         }
00244 
00253         function stripPath($inArr)      {
00254                 if ($this->stripPath && is_array($inArr))       {
00255                         while(list($key,$val)=each($inArr))     {
00256                                 $inArr[$key]=basename($val);
00257                         }
00258                 }
00259                 return $inArr;
00260         }
00261 }
00262 
00263 
00264 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_bedisplaylog.php'])      {
00265         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_bedisplaylog.php']);
00266 }
00267 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6