|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 Steffen Kamper <steffen@typo3.org> 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 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00027 00028 /** 00029 * ExtDirect DataProvider for ContextHelp 00030 */ 00031 class extDirect_DataProvider_ContextHelp { 00032 00033 /** 00034 * Fetch the context help for the given table/field parameters 00035 * 00036 * @param string $table table identifier 00037 * @param string $field field identifier 00038 * @return array complete help information 00039 */ 00040 public function getContextHelp($table, $field) { 00041 $helpTextArray = t3lib_befunc::helpTextArray($table, $field); 00042 $moreIcon = $helpTextArray['moreInfo'] ? t3lib_iconWorks::getSpriteIcon('actions-view-go-forward') : ''; 00043 return array( 00044 'title' => $helpTextArray['title'], 00045 'description' => '<p class="t3-help-short' . ($moreIcon ? ' tipIsLinked' : '') . '">' . 00046 $helpTextArray['description'] . $moreIcon . '</p>', 00047 'id' => $table . '.' . $field, 00048 'moreInfo' => $helpTextArray['moreInfo'] 00049 ); 00050 } 00051 00052 /** 00053 * Fetch the context help for the given table 00054 * 00055 * @param string $table table identifier 00056 * @return array complete help information 00057 */ 00058 public function getTableContextHelp($table) { 00059 $output = array(); 00060 if (!isset($GLOBALS['TCA_DESCR'][$table]['columns'])) { 00061 $GLOBALS['LANG']->loadSingleTableDescription($table); 00062 } 00063 if (is_array($GLOBALS['TCA_DESCR'][$table]) && is_array($GLOBALS['TCA_DESCR'][$table]['columns'])) { 00064 foreach ($GLOBALS['TCA_DESCR'][$table]['columns'] as $field => $data) { 00065 $output[$field] = array( 00066 'description' => NULL, 00067 'title' => NULL, 00068 'moreInfo' => FALSE, 00069 'id' => $table . '.' . $field, 00070 ); 00071 00072 // add alternative title, if defined 00073 if ($data['alttitle']) { 00074 $output[$field]['title'] = $data['alttitle']; 00075 } 00076 00077 // if we have more information to show 00078 if ($data['image_descr'] || $data['seeAlso'] || $data['details'] || $data['syntax']) { 00079 $output[$field]['moreInfo'] = TRUE; 00080 } 00081 00082 // add description 00083 if ($data['description']) { 00084 $output[$field]['description'] = $data['description']; 00085 } 00086 } 00087 } 00088 00089 return $output; 00090 } 00091 } 00092 00093 ?>
1.8.0