[BUGFIX] Make class name consistent
[Packages/TYPO3.CMS.git] / typo3 / sysext / workspaces / Classes / ExtDirect / AbstractHandler.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010-2011 Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 /**
29 * @author Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)
30 * @package Workspaces
31 * @subpackage ExtDirect
32 */
33 abstract class Tx_Workspaces_ExtDirect_AbstractHandler {
34 /**
35 * Gets the current workspace ID.
36 *
37 * @return integer The current workspace ID
38 */
39 protected function getCurrentWorkspace() {
40 return $this->getWorkspaceService()->getCurrentWorkspace();
41 }
42
43 /**
44 * Gets an error response to be shown in the grid component.
45 *
46 * @param string $errorLabel Name of the label in the locallang.xml file
47 * @param integer $errorCode The error code to be used
48 * @param boolean $successFlagValue Value of the success flag to be delivered back (might be FALSE in most cases)
49 * @return array
50 */
51 protected function getErrorResponse($errorLabel, $errorCode = 0, $successFlagValue = FALSE) {
52 $localLangFile = 'LLL:EXT:workspaces/Resources/Private/Language/locallang.xml';
53
54 $response = array(
55 'error' => array(
56 'code' => $errorCode,
57 'message' => $GLOBALS['LANG']->sL($localLangFile . ':' . $errorLabel),
58 ),
59 'success' => $successFlagValue,
60 );
61
62 return $response;
63 }
64
65 /**
66 * Gets an instance of the workspaces service.
67 *
68 * @return Tx_Workspaces_Service_Workspaces
69 */
70 protected function getWorkspaceService() {
71 return t3lib_div::makeInstance('Tx_Workspaces_Service_Workspaces');
72 }
73 }
74
75
76 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/workspaces/Classes/ExtDirect/AbstractHandler.php'])) {
77 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/workspaces/Classes/ExtDirect/AbstractHandler.php']);
78 }
79 ?>