Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2004 Kasper Skaarhoj (kasper@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() { 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 return $this->mkMenuConfig($icon.' '.$this->headLink('tx_taskcenterrecent',1),'',$mC); 00043 } 00044 function main() { 00045 global $BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS; 00046 00047 return $this->renderRecent(); 00048 } 00049 00050 //TODO: linkene skal kalde tilbage til modulet med en parameter der får den til at åbne editering i en iframe. 00051 00052 // ************************ 00053 // RECENT 00054 // *********************** 00055 function renderRecentList() { 00056 global $LANG; 00057 00058 $res = $this->getRecentResPointer($this->BE_USER->user['uid']); 00059 $lines=array(); 00060 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00061 $pageRow = t3lib_BEfunc::getRecord('pages',$row['event_pid']); 00062 if (is_array($pageRow)) { 00063 $path = t3lib_BEfunc::getRecordPath ($pageRow['uid'],$this->perms_clause,$this->BE_USER->uc['titleLen']); 00064 $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 />'; 00065 } 00066 } 00067 $lines[] = $this->recent_linkLayoutModule('<em>'.$LANG->getLL('link_allRecs').'</em>','').'</nobr><br />';; 00068 00069 00070 $out = implode("",$lines); 00071 00072 return $out; 00073 } 00074 function renderRecent() { 00075 global $LANG, $TCA; 00076 $out = $this->pObj->doc->section($LANG->getLL("recent_allRecs"),$this->_renderRecent(),0,1); 00077 return $out; 00078 } 00079 function _renderRecent() { 00080 global $LANG, $TCA; 00081 if($id = t3lib_div::_GP('display')) { 00082 return $this->urlInIframe($this->backPath.'sysext/cms/layout/db_layout.php?id='.$id,1); 00083 } else { 00084 $id = t3lib_div::_GP('display'); 00085 $iframe .= $this->urlInIframe(''); 00086 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 00087 'sys_log.*, max(sys_log.tstamp) AS tstamp_MAX', 00088 'sys_log,pages', 00089 'pages.uid=sys_log.event_pid AND sys_log.userid='.intval($this->BE_USER->user['uid']). 00090 $this->logWhere. 00091 ' AND '.$this->perms_clause, 00092 'tablename,recuid', 00093 'tstamp_MAX DESC', 00094 $this->numberOfRecentAll 00095 ); 00096 $lines = array(); 00097 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 00098 $elRow = t3lib_BEfunc::getRecord($row['tablename'],$row['recuid']); 00099 if (is_array($elRow)) { 00100 $path = t3lib_BEfunc::getRecordPath ($elRow['pid'],$this->perms_clause,$this->BE_USER->uc['titleLen']); 00101 $lines[] = ' 00102 <tr> 00103 <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> 00104 <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> 00105 <td class="bgColor4">'.$this->dateTimeAge($row['tstamp_MAX']).'</td> 00106 </tr>'; 00107 } 00108 } 00109 00110 $out = implode('',$lines); 00111 $out = ' 00112 00113 <!-- 00114 Table with a listing of recently edited records. 00115 The listing links to the editform loaded with each record 00116 --> 00117 <table id="record-table" border="0" cellpadding="1" cellspacing="1" class="typo3-recent-edited"> 00118 '.$out.' 00119 </table>'; 00120 return $out.$iframe; 00121 } 00122 } 00123 function recent_linkLayoutModule($str,$id) { 00124 $str = '<a href="index.php?SET[function]=tx_taskcenterrecent&display='.$id.'" onClick="this.blur();">'.$str.'</a>'; 00125 00126 # $str='<a href="'.$this->backPath.'sysext/cms/layout/db_layout.php?id='.$id.'" onClick="this.blur();">'.htmlspecialchars($str).'</a>'; 00127 return $str; 00128 } 00129 function recent_linkEdit($str,$table,$id) { 00130 $params = '&edit['.$table.']['.$id.']=edit'; 00131 # $str = '<a href="index.php?SET[function]=tx_taskcenterrecent&display='.$id.'" onClick="this.blur();">'.$str.'</a>'; 00132 $str='<a href="#" onclick="list_frame.'.htmlspecialchars(t3lib_BEfunc::editOnClick($params,$GLOBALS['BACK_PATH'],'dummy.php')).'">'.$str.'</a>'; 00133 return $str; 00134 } 00135 function getRecentResPointer($be_user_id) { 00136 return $GLOBALS['TYPO3_DB']->exec_SELECTquery( 00137 'sys_log.*, max(sys_log.tstamp) AS tstamp_MAX', 00138 'sys_log,pages', 00139 'pages.uid=event_pid 00140 AND sys_log.userid='.intval($be_user_id). 00141 $this->logWhere.' 00142 AND pages.module="" 00143 AND pages.doktype < 200 00144 AND '.$this->perms_clause, 00145 'sys_log.event_pid', 00146 'tstamp_MAX DESC', 00147 $this->numberOfRecent 00148 ); 00149 } 00150 } 00151 00152 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/taskcenter_recent/class.tx_taskcenterrecent.php"]) { 00153 include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/taskcenter_recent/class.tx_taskcenterrecent.php"]); 00154 } 00155 00156 ?>