TYPO3 API  SVNRelease
class.tx_openid_mod_setup.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 2009-2011 Steffen Gebert <steffen@steffen-gebert.de>
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *
00017 *  This script is distributed in the hope that it will be useful,
00018 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 *  GNU General Public License for more details.
00021 *
00022 *  This copyright notice MUST APPEAR in all copies of the script!
00023 ***************************************************************/
00024 /**
00025  * [CLASS/FUNCTION INDEX of SCRIPT]
00026  */
00027 
00028 /**
00029  * This class is the OpenID return script for the TYPO3 Backend (used in the user-settings module).
00030  *
00031  * $Id: class.tx_openid_mod_setup.php 10120 2011-01-18 20:03:36Z ohader $
00032  *
00033  * @author  Steffen Gebert <steffen@steffen-gebert.de>
00034  */
00035 class tx_openid_mod_setup {
00036 
00037     /**
00038      * Checks weather BE user has access to change its OpenID identifier
00039      *
00040      * @param   array       $config: Configuration of the field
00041      * @return  boolean     Whether it is allowed to modify the given field
00042      */
00043     public function accessLevelCheck(array $config) {
00044         $setupConfig = $GLOBALS['BE_USER']->getTSConfigProp('setup.fields');
00045         if (isset($setupConfig['tx_openid_openid.']['disabled']) && $setupConfig['tx_openid_openid.']['disabled']) {
00046             return FALSE;
00047         }
00048         return TRUE;
00049     }
00050 
00051     /**
00052      * Render OpenID identifier field for user setup
00053      *
00054      * @param   array                   $config: Configuration of the field
00055      * @param   SC_mod_user_setup_index $parent: The calling parent object
00056      * @return  string                  HTML input field to change the OpenId
00057      */
00058     public function renderOpenID(array $parameters, SC_mod_user_setup_index $parent) {
00059         $openid = $GLOBALS['BE_USER']->user['tx_openid_openid'];
00060         return '<input id="field_tx_openid_openid"' .
00061             $GLOBALS['TBE_TEMPLATE']->formWidth(20) .
00062             ' type="text" name="data[be_users][tx_openid_openid]"' .
00063             ' value="' . htmlspecialchars($openid) . '" />';
00064     }
00065 }
00066 
00067 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/openid/class.tx_openid_mod_setup.php'])) {
00068     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/openid/class.tx_openid_mod_setup.php']);
00069 }
00070 ?>