--- /dev/null
+<?php\r
+/***************************************************************\r
+* Copyright notice\r
+*\r
+* (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)\r
+* (c) 2010 Georg Ringer (typo3@ringerge.org)\r
+* All rights reserved\r
+*\r
+* This script is part of the TYPO3 project. The TYPO3 project is\r
+* free software; you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation; either version 2 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* The GNU General Public License can be found at\r
+* http://www.gnu.org/copyleft/gpl.html.\r
+*\r
+* This script is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+*\r
+* This copyright notice MUST APPEAR in all copies of the script!\r
+***************************************************************/\r
+\r
+\r
+/**\r
+ * This class provides a textarea to save personal notes\r
+ *\r
+ * @author Kasper Skaarhoj <kasper@typo3.com>\r
+ * @author Georg Ringer <typo3@ringerge.org>\r
+ * @package TYPO3\r
+ * @subpackage impexp\r
+ *\r
+ */\r
+class tx_impexp_task implements tx_taskcenter_Task {\r
+ /**\r
+ * Back-reference to the calling reports module\r
+ *\r
+ * @var tx_reports_Module $taskObject\r
+ */\r
+ protected $taskObject;\r
+\r
+ /**\r
+ * Constructor\r
+ */\r
+ public function __construct(SC_mod_user_task_index $taskObject) {\r
+ $this->taskObject = $taskObject;\r
+ $GLOBALS['LANG']->includeLLFile('EXT:impexp/locallang_csh.xml');\r
+ }\r
+\r
+ /**\r
+ * This method renders the report\r
+ *\r
+ * @return string The status report as HTML\r
+ */\r
+ public function getTask() {\r
+ return $this->main();\r
+ }\r
+\r
+ /**\r
+ * Render an optional additional information for the 1st view in taskcenter.\r
+ * Empty for this task\r
+ *\r
+ * @return string Overview as HTML\r
+ */\r
+ public function getOverview() {\r
+ return '';\r
+ }\r
+\r
+\r
+\r
+ /**\r
+ * Main Task center module\r
+ *\r
+ * @return string HTML content.\r
+ */\r
+ public function main() {\r
+ $content = '';\r
+ $id = intval(t3lib_div::_GP('display'));\r
+\r
+ // if a preset is found, it is rendered using an iframe\r
+ if($id > 0) {\r
+ $url = $GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('impexp') . 'app/index.php?tx_impexp[action]=export&preset[load]=1&preset[select]=' . $id;\r
+ return $this->taskObject->urlInIframe($url, 1);\r
+ } else {\r
+ // header\r
+ $content .= $this->taskObject->description(\r
+ $GLOBALS['LANG']->getLL('.alttitle'),\r
+ $GLOBALS['LANG']->getLL('.description')\r
+ );\r
+\r
+ $thumbnails = $lines = array();\r
+\r
+ // Thumbnail folder and files:\r
+ $tempDir = $this->userTempFolder();\r
+ if ($tempDir) {\r
+ $thumbnails = t3lib_div::getFilesInDir($tempDir, 'png,gif,jpg', 1);\r
+ }\r
+\r
+ $clause = $GLOBALS['BE_USER']->getPagePermsClause(1);\r
+ $usernames = t3lib_BEfunc::getUserNames();\r
+\r
+ // Create preset links:\r
+ $presets = $this->getPresets();\r
+\r
+ // if any presets found\r
+ if (is_array($presets)) {\r
+ foreach($presets as $key => $presetCfg) {\r
+ $configuration = unserialize($presetCfg['preset_data']);\r
+ $thumbnailFile = $thumbnails[$configuration['meta']['thumbnail']];\r
+ $title = strlen($presetCfg['title']) ? $presetCfg['title'] : '['.$presetCfg['uid'].']';\r
+\r
+ if ($thumbnailFile && 1==2) {\r
+ // @todo: create icon or maybe completly remove it because where to display?\r
+ $src= '../' . $GLOBALS['BACK_PATH'] . substr($tempDir, strlen(PATH_site)) . basename($thumbnailFile);\r
+ $icon = $src;\r
+ } else {\r
+ $icon = 'EXT:impexp/export.gif';\r
+ }\r
+\r
+ $description = array();\r
+\r
+ // is public?\r
+ if ($presetCfg['public']) {\r
+ $description[] = $GLOBALS['LANG']->getLL('task.public') . ': ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes');\r
+ }\r
+\r
+ // owner\r
+ $description[] = $GLOBALS['LANG']->getLL('task.owner') . ': ' . (($presetCfg['user_uid'] === $GLOBALS['BE_USER']->user['uid']) ? $GLOBALS['LANG']->getLL('task.own') : '[' . htmlspecialchars($usernames[$presetCfg['user_uid']]['username']) . ']');\r
+\r
+ // page & path\r
+ if ($configuration['pagetree']['id']) {\r
+ $description[] = $GLOBALS['LANG']->getLL('task.page') . ': ' . $configuration['pagetree']['id'];\r
+ $description[] = $GLOBALS['LANG']->getLL('task.path') . ': ' . htmlspecialchars(t3lib_BEfunc::getRecordPath($configuration['pagetree']['id'], $clause, 20));\r
+ } else {\r
+ $description[] = $GLOBALS['LANG']->getLL('single-record');\r
+ }\r
+\r
+ // Meta information\r
+ if ($configuration['meta']['title'] || $configuration['meta']['description'] || $configuration['meta']['notes']) {\r
+ $metaInformation = '';\r
+ if ($configuration['meta']['title']) {\r
+ $metaInformation .= '<strong>' . htmlspecialchars($configuration['meta']['title']) . '</strong><br />';\r
+ }\r
+ if ($configuration['meta']['description']) {\r
+ $metaInformation .= htmlspecialchars($configuration['meta']['description']);\r
+ }\r
+ if ($configuration['meta']['notes']) {\r
+ $metaInformation .= '<br /><br />\r
+ <strong>' . $GLOBALS['LANG']->getLL('notes') . ': </strong>\r
+ <em>' . htmlspecialchars($configuration['meta']['notes']) . '</em>';\r
+ }\r
+\r
+ $description[] = '<br />' . $metaInformation;\r
+ }\r
+\r
+ // collect all preset information\r
+ $lines[$key] = array(\r
+ 'icon' => $icon,\r
+ 'title' => htmlspecialchars($title),\r
+ 'descriptionHtml' => implode('<br />', $description),\r
+ 'link' => 'mod.php?M=user_task&SET[function]=impexp.tasks&display=' . $presetCfg['uid']\r
+ );\r
+\r
+ }\r
+\r
+ // render preset list\r
+ $content .= $this->taskObject->renderListMenu($lines);\r
+ } else {\r
+ // no presets found\r
+ $flashMessage = t3lib_div::makeInstance(\r
+ 't3lib_FlashMessage',\r
+ $GLOBALS['LANG']->getLL('no-presets'),\r
+ '',\r
+ t3lib_FlashMessage::NOTICE\r
+\r
+ );\r
+ $content .= $flashMessage->render();\r
+ }\r
+ }\r
+\r
+ return $content;\r
+ }\r
+\r
+\r
+ /**\r
+ * Select presets for this user\r
+ *\r
+ * @return array Array of preset records\r
+ */\r
+ function getPresets() {\r
+ $presets = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(\r
+ '*',\r
+ 'tx_impexp_presets',\r
+ '(public > 0 OR user_uid=' . $GLOBALS['BE_USER']->user['uid'] . ')',\r
+ '',\r
+ 'item_uid DESC, title'\r
+ );\r
+\r
+ return $presets;\r
+ }\r
+\r
+ /**\r
+ * Returns first temporary folder of the user account (from $FILEMOUNTS)\r
+ *\r
+ * @return string Absolute path to first "_temp_" folder of the current user, otherwise blank.\r
+ */\r
+ function userTempFolder() {\r
+ foreach($GLOBALS['FILEMOUNTS'] as $filePathInfo) {\r
+ $tempFolder = $filePathInfo['path'] . '_temp_/';\r
+ if (@is_dir($tempFolder)) {\r
+ return $tempFolder;\r
+ }\r
+ }\r
+ }\r
+\r
+\r
+}\r
+\r
+\r
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/impexp/task/class.tx_impexp_task.php']) {\r
+ include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/impexp/task/class.tx_impexp_task.php']);\r
+}\r
+\r
+?>
\ No newline at end of file