|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2011 Kasper Skårhøj (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 ***************************************************************/ 00027 /** 00028 * Export Preset listing 00029 * 00030 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00031 */ 00032 /** 00033 * [CLASS/FUNCTION INDEX of SCRIPT] 00034 * 00035 * 00036 * 00037 * 63: class tx_impexp_modfunc1 extends mod_user_task 00038 * 72: function overview_main() 00039 * 109: function main() 00040 * 00041 * SECTION: Helper functions 00042 * 192: function getPresets() 00043 * 209: function userTempFolder() 00044 * 00045 * TOTAL FUNCTIONS: 4 00046 * (This index is automatically created/updated by the extension "extdeveval") 00047 * 00048 */ 00049 00050 00051 00052 t3lib_extMgm::isLoaded('impexp',1); 00053 00054 00055 /** 00056 * Export Preset listing for the task center 00057 * 00058 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00059 * @package TYPO3 00060 * @subpackage tx_impexp 00061 */ 00062 class tx_impexp_modfunc1 extends mod_user_task { 00063 00064 /** 00065 * Create preset overview for task center overview. 00066 * 00067 * @param object Parent object 00068 * @return string HTML for the task center overview listing. 00069 */ 00070 function overview_main() { 00071 global $LANG; 00072 // Create preset links: 00073 $presets = $this->getPresets(); 00074 $opt = array(); 00075 if (is_array($presets)) { 00076 foreach($presets as $presetCfg) { 00077 $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '['.$presetCfg['uid'].']'; 00078 $opt[] = ' 00079 <tr class="bgColor4"> 00080 <td nowrap="nowrap"><a href="index.php?SET[function]=tx_impexp&display='.$presetCfg['uid'].'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($title,30)).'</a> </td> 00081 <td>'.($presetCfg['item_uid'] ? $presetCfg['item_uid'] : ' ').'</td> 00082 <td>'.($presetCfg['public'] ? '[Public]' : ' ').'</td> 00083 <td>'.($presetCfg['user_uid']===$GLOBALS['BE_USER']->user['uid'] ? '[Own]' : ' ').'</td> 00084 </tr>'; 00085 } 00086 if(sizeof($opt)>0) { 00087 $presets = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding">'.implode('',$opt).'</table>'; 00088 $presets .= '<a href="index.php?SET[function]=tx_impexp"><em>'.$LANG->getLL('link_allRecs').'</em></a>'; 00089 } else { 00090 $presets = ''; 00091 } 00092 00093 $icon = '<img src="'.$this->backPath.t3lib_extMgm::extRelPath('impexp').'export.gif" width="18" height="16" class="absmiddle" alt="" />'; 00094 $config= $this->mkMenuConfig($icon.$this->headLink('tx_impexp_modfunc1',1),'',$presets); 00095 } 00096 00097 return $config; 00098 } 00099 00100 00101 00102 /** 00103 * Main Task center module 00104 * 00105 * @return string HTML content. 00106 */ 00107 function main() { 00108 if($id = t3lib_div::_GP('display')) { 00109 return $this->urlInIframe($this->backPath.t3lib_extMgm::extRelPath('impexp').'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]='.$id,1); 00110 } else { 00111 // Thumbnail folder and files: 00112 $tempDir = $this->userTempFolder(); 00113 if ($tempDir) { 00114 $thumbnails = t3lib_div::getFilesInDir($tempDir,'png,gif,jpg',1); 00115 } 00116 00117 $clause = $GLOBALS['BE_USER']->getPagePermsClause(1); 00118 $usernames = t3lib_BEfunc::getUserNames(); 00119 00120 // Create preset links: 00121 $presets = $this->getPresets(); 00122 $opt = array(); 00123 $opt[] = ' 00124 <tr class="bgColor5 tableheader"> 00125 <td>Icon:</td> 00126 <td>Preset Title:</td> 00127 <td>Public</td> 00128 <td>Owner:</td> 00129 <td>Page:</td> 00130 <td>Path:</td> 00131 <td>Meta data:</td> 00132 </tr>'; 00133 if (is_array($presets)) { 00134 foreach($presets as $presetCfg) { 00135 $configuration = unserialize($presetCfg['preset_data']); 00136 $thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']]; 00137 $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '['.$presetCfg['uid'].']'; 00138 00139 $opt[] = ' 00140 <tr class="bgColor4"> 00141 <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> 00142 <td nowrap="nowrap"><a href="index.php?SET[function]=tx_impexp&display='.$presetCfg['uid'].'">'.htmlspecialchars(t3lib_div::fixed_lgd_cs($title,30)).'</a> </td> 00143 <td>'.($presetCfg['public'] ? 'Yes' : ' ').'</td> 00144 <td>'.($presetCfg['user_uid']===$GLOBALS['BE_USER']->user['uid'] ? 'Own' : '['.$usernames[$presetCfg['user_uid']]['username'].']').'</td> 00145 <td>'.($configuration['pagetree']['id'] ? $configuration['pagetree']['id'] : ' ').'</td> 00146 <td>'.htmlspecialchars($configuration['pagetree']['id'] ? t3lib_BEfunc::getRecordPath($configuration['pagetree']['id'],$clause,20) : '[Single Records]').'</td> 00147 <td> 00148 <strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />' . 00149 htmlspecialchars($configuration['meta']['description']). 00150 ($configuration['meta']['notes'] ? '<br /><br /><strong>Notes:</strong> <em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>' : '') . 00151 ' 00152 </td> 00153 </tr>'; 00154 } 00155 $content = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding">'.implode('',$opt).'</table>'; 00156 } 00157 } 00158 00159 // Output: 00160 $theOutput.= $this->pObj->doc->spacer(5); 00161 $theOutput.= $this->pObj->doc->section('Export presets',$content,0,1); 00162 00163 return $theOutput; 00164 } 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 /***************************** 00180 * 00181 * Helper functions 00182 * 00183 *****************************/ 00184 00185 /** 00186 * Select presets for this user 00187 * 00188 * @return array Array of preset records 00189 */ 00190 function getPresets() { 00191 $presets = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 00192 '*', 00193 'tx_impexp_presets', 00194 '(public>0 OR user_uid='.intval($GLOBALS['BE_USER']->user['uid']).')', 00195 '', 00196 'item_uid DESC, title' 00197 ); 00198 00199 return $presets; 00200 } 00201 00202 /** 00203 * Returns first temporary folder of the user account (from $FILEMOUNTS) 00204 * 00205 * @return string Absolute path to first "_temp_" folder of the current user, otherwise blank. 00206 */ 00207 function userTempFolder() { 00208 global $FILEMOUNTS; 00209 00210 foreach($FILEMOUNTS as $filePathInfo) { 00211 $tempFolder = $filePathInfo['path'].'_temp_/'; 00212 if (@is_dir($tempFolder)) { 00213 return $tempFolder; 00214 } 00215 } 00216 } 00217 } 00218 00219 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/impexp/modfunc1/class.tx_impexp_modfunc1.php'])) { 00220 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/impexp/modfunc1/class.tx_impexp_modfunc1.php']); 00221 } 00222 ?>
1.8.0