00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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
00051
00052
00053
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 ?>