[BUGFIX] Fix PHP warning in EXT:beuser
[Packages/TYPO3.CMS.git] / typo3 / sysext / openid / class.tx_openid_mod_setup.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009-2011 Steffen Gebert <steffen@steffen-gebert.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 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * This class is the OpenID return script for the TYPO3 Backend (used in the user-settings module).
27 *
28 * @author Steffen Gebert <steffen@steffen-gebert.de>
29 */
30 class tx_openid_mod_setup {
31
32 /**
33 * Checks weather BE user has access to change its OpenID identifier
34 *
35 * @param array $config: Configuration of the field
36 * @return boolean Whether it is allowed to modify the given field
37 */
38 public function accessLevelCheck(array $config) {
39 $setupConfig = $GLOBALS['BE_USER']->getTSConfigProp('setup.fields');
40 if (isset($setupConfig['tx_openid_openid.']['disabled']) && $setupConfig['tx_openid_openid.']['disabled']) {
41 return FALSE;
42 }
43 return TRUE;
44 }
45
46 /**
47 * Render OpenID identifier field for user setup
48 *
49 * @param array $config: Configuration of the field
50 * @param SC_mod_user_setup_index $parent: The calling parent object
51 * @return string HTML input field to change the OpenId
52 */
53 public function renderOpenID(array $parameters, SC_mod_user_setup_index $parent) {
54 $openid = $GLOBALS['BE_USER']->user['tx_openid_openid'];
55 return '<input id="field_tx_openid_openid"' .
56 $GLOBALS['TBE_TEMPLATE']->formWidth(20) .
57 ' type="text" name="data[be_users][tx_openid_openid]"' .
58 ' value="' . htmlspecialchars($openid) . '" />';
59 }
60 }
61 ?>