[TASK] Move and Namespace classes
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / Classes / Controller / SelectImageController.php
1 <?php
2 namespace TYPO3\CMS\Rtehtmlarea\Controller;
3
4 /**
5 * Script class for the Element Browser window.
6 *
7 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
8 * @package TYPO3
9 * @subpackage core
10 */
11 class SelectImageController {
12
13 public $mode = 'rte';
14
15 public $button = 'image';
16
17 protected $content = '';
18
19 /**
20 * Main function, rendering the element browser in RTE mode.
21 *
22 * @return void
23 * @todo Define visibility
24 */
25 public function main() {
26 // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
27 $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
28 if ($altMountPoints) {
29 $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints);
30 foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
31 $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
32 }
33 $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
34 }
35 // Rendering type by user function
36 $browserRendered = FALSE;
37 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.php']['browserRendering'])) {
38 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.php']['browserRendering'] as $classRef) {
39 $browserRenderObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef);
40 if ((is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid')) && method_exists($browserRenderObj, 'render')) {
41 if ($browserRenderObj->isValid($this->mode, $this)) {
42 $this->content .= $browserRenderObj->render($this->mode, $this);
43 $browserRendered = TRUE;
44 break;
45 }
46 }
47 }
48 }
49 // If type was not rendered, use default rendering functions
50 if (!$browserRendered) {
51 $GLOBALS['SOBE']->browser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Rtehtmlarea\\SelectImage');
52 $GLOBALS['SOBE']->browser->init();
53 $modData = $GLOBALS['BE_USER']->getModuleData('select_image.php', 'ses');
54 list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
55 $GLOBALS['BE_USER']->pushModuleData('select_image.php', $modData);
56 $this->content = $GLOBALS['SOBE']->browser->main_rte();
57 }
58 }
59
60 /**
61 * Print module content
62 *
63 * @return void
64 * @todo Define visibility
65 */
66 public function printContent() {
67 echo $this->content;
68 }
69
70 }
71
72
73 ?>