Documentation TYPO3 par Ameos |
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 ***************************************************************/ 00031 class tx_taskcenterrecent extends mod_user_task { 00032 var $numberOfRecent=6; 00033 var $numberOfRecentAll=20; 00034 var $logWhere=" AND sys_log.event_pid>0 AND sys_log.type=1 AND sys_log.action=2 AND sys_log.error=0"; 00035 00039 function overview_main(&$pObj) { 00040 $mC = $this->accessMod("web_layout") ? $this->renderRecentList() : ""; 00041 $icon = '<img src="'.$this->backPath.t3lib_extMgm::extRelPath('taskcenter_recent').'ext_icon.gif" width="18" height="16" class="absmiddle" alt="" />'; 00042 $content.=$pObj->doc->section($icon.' '.$this->headLink('tx_taskcenterrecent',0),$mC,1,1,0,1); 00043 return $content; 00044 } 00045 function main() { 00046 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS; 00047 00048 return $this->renderRecent(); 00049 } 00050 00051 00052 00053 // ************************ 00054 // RECENT 00055 // *********************** 00056 function renderRecentList() { 00057 global $LANG; 00058 00059 $res = $this->getRecentResPointer($this->BE_USER->user['uid']); 00060 $lines=array(); 00061 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00062 $pageRow = t3lib_BEfunc::getRecord('pages',$row['event_pid']); 00063 if (is_array($pageRow)) { 00064 $path = t3lib_BEfunc::getRecordPath ($pageRow['uid'],$this->perms_clause,$this->BE_USER->uc['titleLen']); 00065 $lines[]='<nobr>'.t3lib_iconworks::getIconImage('pages',$pageRow,$this->backPath,'hspace="2" align="top" title="'.htmlspecialchars($path).' - '.t3lib_BEfunc::titleAttribForPages($pageRow,"",0).'"').$this->recent_linkLayoutModule($this->fixed_lgd($pageRow["title"]),$pageRow["uid"]).'</nobr><br />'; 00066 } 00067 } 00068 $out = implode("",$lines); 00069 00070 return $out; 00071 } 00072 function renderRecent() { 00073 global $LANG, $TCA; 00074 $out = $this->pObj->doc->section($LANG->getLL("recent_allRecs"),$this->_renderRecent(),0,1); 00075 return $out; 00076 } 00077 function _renderRecent() { 00078 global $LANG, $TCA; 00079 00080 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 00081 'sys_log.*, max(sys_log.tstamp) AS tstamp_MAX', 00082 'sys_log,pages', 00083 'pages.uid=sys_log.event_pid AND sys_log.userid='.intval($this->BE_USER->user['uid']). 00084 $this->logWhere. 00085 ' AND '.$this->perms_clause, 00086 'tablename,recuid', 00087 'tstamp_MAX DESC', 00088 $this->numberOfRecentAll 00089 ); 00090 $lines = array(); 00091 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00092 $elRow = t3lib_BEfunc::getRecord($row['tablename'],$row['recuid']); 00093 if (is_array($elRow)) { 00094 $path = t3lib_BEfunc::getRecordPath ($elRow['pid'],$this->perms_clause,$this->BE_USER->uc['titleLen']); 00095 $lines[] = ' 00096 <tr> 00097 <td class="bgColor4">'.$this->recent_linkEdit('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/edit2.gif','width="11" height="12"').' alt="" />',$row['tablename'],$row['recuid']).'</td> 00098 <td class="bgColor4">'.$this->recent_linkEdit(t3lib_iconworks::getIconImage($row['tablename'],$elRow,$this->backPath,'class="c-recicon" title="'.htmlspecialchars($path).'"').htmlspecialchars($this->fixed_lgd($elRow[$TCA[$row['tablename']]['ctrl']['label']])),$row['tablename'],$row['recuid']).' </td> 00099 <td class="bgColor4">'.$this->dateTimeAge($row['tstamp_MAX']).'</td> 00100 </tr>'; 00101 } 00102 } 00103 $out = implode('',$lines); 00104 $out = ' 00105 00106 <!-- 00107 Table with a listing of recently edited records. 00108 The listing links to the editform loaded with each record 00109 --> 00110 <table border="0" cellpadding="1" cellspacing="1" class="typo3-recent-edited"> 00111 '.$out.' 00112 </table>'; 00113 00114 return $out; 00115 } 00116 function recent_linkLayoutModule($str,$id) { 00117 $str='<a href="'.$this->backPath.'sysext/cms/layout/db_layout.php?id='.$id.'" target="list_frame" onClick="this.blur();">'.htmlspecialchars($str).'</a>'; 00118 return $str; 00119 } 00120 function recent_linkEdit($str,$table,$id) { 00121 $params = '&edit['.$table.']['.$id.']=edit'; 00122 $str='<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$GLOBALS['BACK_PATH'])).'">'.$str.'</a>'; 00123 return $str; 00124 } 00125 function getRecentResPointer($be_user_id) { 00126 return $GLOBALS['TYPO3_DB']->exec_SELECTquery( 00127 'sys_log.*, max(sys_log.tstamp) AS tstamp_MAX', 00128 'sys_log,pages', 00129 'pages.uid=event_pid 00130 AND sys_log.userid='.intval($be_user_id). 00131 $this->logWhere.' 00132 AND pages.module="" 00133 AND pages.doktype < 200 00134 AND '.$this->perms_clause, 00135 'sys_log.event_pid', 00136 'tstamp_MAX DESC', 00137 $this->numberOfRecent 00138 ); 00139 } 00140 } 00141 00142 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/taskcenter_recent/class.tx_taskcenterrecent.php"]) { 00143 include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/taskcenter_recent/class.tx_taskcenterrecent.php"]); 00144 } 00145 00146 ?>