* Installer: added new option BE/RTE_imageStorageDir. related to issue #7185
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / modules / class.tx_install_module_base.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2006-2007 Thomas Hempel (thomas@work.de)
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 * $Id$
30 *
31 * @author Thomas Hempel <thomas@work.de>
32 * @author Ingo Renner <ingo@typo3.org>
33 */
34 class tx_install_module_base {
35
36 /**
37 * parent tx_install object
38 *
39 * @var tx_install
40 */
41 protected $pObj;
42
43 /**
44 * Global environment from installer
45 *
46 * @var array
47 */
48 protected $env;
49
50 /**
51 * A reference to the basics object from parent
52 *
53 * @var tx_install_basics
54 */
55 protected $basicsObject;
56
57 /*
58 * API FUNCTIONS
59 */
60
61 /**
62 * Instanciates the module object. The parent object is set here.
63 *
64 * @param mixed $pObj: The parent object
65 */
66 public function init($pObj) {
67 $this->pObj = &$pObj;
68 $this->basicsObject = &$this->pObj->getBasicsObject();
69 $this->env = $this->pObj->getEnvironment();
70 }
71
72 /**
73 * Simple wrapper method for basicsObj->getLabel
74 *
75 * @param string $index: The index of the requested label
76 *
77 * @return Locallang label or $index if no label was found
78 */
79 protected function get_LL($index, $alternative = '') {
80 return $this->basicsObject->getLabel($index, $alternative);
81 }
82
83
84 /**
85 * Adds an error to the basics object. This data can be used by the view later on.
86 *
87 * @param string $errorMsg: The error message itself
88 * @param integer $errorSeverity: The severity of the error (WARNING or FATAL) [default: WARNING]
89 * @param string $errorContext: The context in which the error occured. This can be "general" or "fields". [default: general]
90 * @param string $errorField: If the context is "fields" the fieldname has to be set here. So the error can be displayed aboce that specific field.
91 * @param boolean $getLL: If true, the errorMessage is treated as index in a locallang file
92 *
93 * @return void
94 */
95 protected function addError($errorMsg, $errorSeverity = WARNING, $errorContext = 'general', $errorField = NULL, $onTop = false) {
96 $this->basicsObject->addError($errorMsg, $errorSeverity, $errorContext, $errorField, $onTop);
97 }
98
99 /**
100 * Adds an array of errors to the general error-field. This uses the local addError method with default values
101 * for severity, context, field and onTop
102 *
103 * @param array $errors: Array with errormessages
104 */
105 protected function addErrors($errors) {
106 if (is_array($errors)) {
107 foreach ($errors as $error) {
108 $this->addError($error);
109 }
110 }
111 }
112 }
113
114 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/install/modules/class.tx_install_base.php']) {
115 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/install/modules/class.tx_install_base.php']);
116 }
117 ?>