Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2005 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 ***************************************************************/ 00052 require_once(PATH_t3lib.'class.t3lib_extobjbase.php'); 00053 t3lib_extMgm::isLoaded('impexp',1); 00054 00055 00063 class tx_impexp_modfunc1 extends mod_user_task { 00064 00065 00072 function overview_main() { 00073 global $LANG; 00074 // Create preset links: 00075 $presets = $this->getPresets(); 00076 $opt = array(); 00077 if (is_array($presets)) { 00078 foreach($presets as $presetCfg) { 00079 $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '['.$presetCfg['uid'].']'; 00080 $opt[] = ' 00081 <tr class="bgColor4"> 00082 <td nowrap="nowrap"><a href="index.php?SET[function]=tx_impexp&display='.$presetCfg['uid'].'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($title,30)).'</a> </td> 00083 <td>'.($presetCfg['item_uid'] ? $presetCfg['item_uid'] : ' ').'</td> 00084 <td>'.($presetCfg['public'] ? '[Public]' : ' ').'</td> 00085 <td>'.($presetCfg['user_uid']===$GLOBALS['BE_USER']->user['uid'] ? '[Own]' : ' ').'</td> 00086 </tr>'; 00087 } 00088 if(sizeof($opt)>0) { 00089 $presets = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding">'.implode('',$opt).'</table>'; 00090 $presets .= '<a href="index.php?SET[function]=tx_impexp"><em>'.$LANG->getLL('link_allRecs').'</em></a>'; 00091 } else { 00092 $presets = ''; 00093 } 00094 00095 $icon = '<img src="'.$this->backPath.t3lib_extMgm::extRelPath('impexp').'export.gif" width="18" height="16" class="absmiddle" alt="" />'; 00096 $config= $this->mkMenuConfig($icon.$this->headLink('tx_impexp_modfunc1',1),'',$presets); 00097 } 00098 00099 return $config; 00100 } 00101 00102 00103 00109 function main() { 00110 if($id = t3lib_div::_GP('display')) { 00111 return $this->urlInIframe($this->backPath.t3lib_extMgm::extRelPath('impexp').'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]='.$id,1); 00112 } else { 00113 // Thumbnail folder and files: 00114 $tempDir = $this->userTempFolder(); 00115 if ($tempDir) { 00116 $thumbnails = t3lib_div::getFilesInDir($tempDir,'png,gif,jpg',1); 00117 } 00118 00119 $clause = $GLOBALS['BE_USER']->getPagePermsClause(1); 00120 $usernames = t3lib_BEfunc::getUserNames(); 00121 00122 // Create preset links: 00123 $presets = $this->getPresets(); 00124 $opt = array(); 00125 $opt[] = ' 00126 <tr class="bgColor5 tableheader"> 00127 <td>Icon:</td> 00128 <td>Preset Title:</td> 00129 <td>Public</td> 00130 <td>Owner:</td> 00131 <td>Page:</td> 00132 <td>Path:</td> 00133 <td>Meta data:</td> 00134 </tr>'; 00135 if (is_array($presets)) { 00136 foreach($presets as $presetCfg) { 00137 $configuration = unserialize($presetCfg['preset_data']); 00138 $thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']]; 00139 $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '['.$presetCfg['uid'].']'; 00140 00141 $opt[] = ' 00142 <tr class="bgColor4"> 00143 <td>'.($thumbnailFile ? '<img src="'.$this->backPath.'../'.substr($tempDir,strlen(PATH_site)).basename($thumbnailFile).'" hspace="2" width="70" style="border: solid black 1px;" alt="" /><br/>' : ' ').'</td> 00144 <td nowrap="nowrap"><a href="index.php?SET[function]=tx_impexp&display='.$presetCfg['uid'].'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($title,30)).'</a> </td> 00145 <td>'.($presetCfg['public'] ? 'Yes' : ' ').'</td> 00146 <td>'.($presetCfg['user_uid']===$GLOBALS['BE_USER']->user['uid'] ? 'Own' : '['.$usernames[$presetCfg['user_uid']]['username'].']').'</td> 00147 <td>'.($configuration['pagetree']['id'] ? $configuration['pagetree']['id'] : ' ').'</td> 00148 <td>'.htmlspecialchars($configuration['pagetree']['id'] ? t3lib_BEfunc::getRecordPath($configuration['pagetree']['id'],$clause,20) : '[Single Records]').'</td> 00149 <td> 00150 <b>'.htmlspecialchars($configuration['meta']['title']).'</b><br/>'. 00151 htmlspecialchars($configuration['meta']['description']). 00152 ($configuration['meta']['notes'] ? '<br/><br/><b>Notes:</b> <em>'.htmlspecialchars($configuration['meta']['notes']).'</em>' : ''). 00153 ' 00154 </td> 00155 </tr>'; 00156 } 00157 $content = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding">'.implode('',$opt).'</table>'; 00158 } 00159 } 00160 00161 // Output: 00162 $theOutput.= $this->pObj->doc->spacer(5); 00163 $theOutput.= $this->pObj->doc->section('Export presets',$content,0,1); 00164 00165 return $theOutput; 00166 } 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 /***************************** 00182 * 00183 * Helper functions 00184 * 00185 *****************************/ 00186 00192 function getPresets() { 00193 $presets = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 00194 '*', 00195 'tx_impexp_presets', 00196 '(public>0 || user_uid='.intval($GLOBALS['BE_USER']->user['uid']).')', 00197 '', 00198 'item_uid DESC, title' 00199 ); 00200 00201 return $presets; 00202 } 00203 00209 function userTempFolder() { 00210 global $FILEMOUNTS; 00211 00212 foreach($FILEMOUNTS as $filePathInfo) { 00213 $tempFolder = $filePathInfo['path'].'_temp_/'; 00214 if (@is_dir($tempFolder)) { 00215 return $tempFolder; 00216 } 00217 } 00218 } 00219 } 00220 00221 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/impexp/modfunc1/class.tx_impexp_modfunc1.php']) { 00222 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/impexp/modfunc1/class.tx_impexp_modfunc1.php']); 00223 } 00224 ?>