[CLEANUP] Rework/simplify copyright header and remove @package
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / ViewHelpers / Be / Buttons / ShortcutViewHelper.php
index c14cdc8..b38c9b0 100644 (file)
@@ -1,25 +1,21 @@
 <?php
 namespace TYPO3\CMS\Fluid\ViewHelpers\Be\Buttons;
 
-/*                                                                        *
- * This script is backported from the FLOW3 package "TYPO3.Fluid".        *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- *  of the License, or (at your option) any later version.                *
- *                                                                        *
- *                                                                        *
- * This script is distributed in the hope that it will be useful, but     *
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
- * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
- * General Public License for more details.                               *
- *                                                                        *
- * You should have received a copy of the GNU Lesser General Public       *
- * License along with the script.                                         *
- * If not, see http://www.gnu.org/licenses/lgpl.html                      *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is backported from the TYPO3 Flow package "TYPO3.Fluid".
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
 /**
  * View helper which returns shortcut button with icon
  * Note: This view helper is experimental!
@@ -55,20 +51,22 @@ class ShortcutViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackend
         * @see template::makeShortcutIcon()
         */
        public function render(array $getVars = array(), array $setVars = array()) {
-               $doc = $this->getDocInstance();
-               $currentRequest = $this->controllerContext->getRequest();
-               $extensionName = $currentRequest->getControllerExtensionName();
-               $moduleName = $currentRequest->getPluginName();
-               if (count($getVars) === 0) {
-                       $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
-                       $getVars = array('id', 'M', $modulePrefix);
+               $mayMakeShortcut = $GLOBALS['BE_USER']->mayMakeShortcut();
+
+               if ($mayMakeShortcut) {
+                       $doc = $this->getDocInstance();
+                       $currentRequest = $this->controllerContext->getRequest();
+                       $extensionName = $currentRequest->getControllerExtensionName();
+                       $moduleName = $currentRequest->getPluginName();
+                       if (count($getVars) === 0) {
+                               $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
+                               $getVars = array('id', 'M', $modulePrefix);
+                       }
+                       $getList = implode(',', $getVars);
+                       $setList = implode(',', $setVars);
+                       return $doc->makeShortcutIcon($getList, $setList, $moduleName);
                }
-               $getList = implode(',', $getVars);
-               $setList = implode(',', $setVars);
-               return $doc->makeShortcutIcon($getList, $setList, $moduleName);
-       }
+               return '';
 
+       }
 }
-
-
-?>
\ No newline at end of file