TYPO3 API  SVNRelease
workspaceforms.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
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  * Module: Workspace manager
00029  *
00030  * $Id: workspaceforms.php 10222 2011-01-21 18:22:24Z tolleiv $
00031  *
00032  * @author  Dmitry Dulepov <typo3@accio.lv>
00033  */
00034 /**
00035  * [CLASS/FUNCTION INDEX of SCRIPT]
00036  *
00037  *
00038  *
00039  *   93: class SC_mod_user_ws_workspaceForms extends t3lib_SCbase
00040  *
00041  *              SECTION: PUBLIC MODULE METHODS
00042  *  123:     function init()
00043  *  158:     function main()
00044  *  233:     function printContent()
00045  *
00046  *              SECTION: PRIVATE FUNCTIONS
00047  *  257:     function initTCEForms()
00048  *  284:     function getModuleParameters()
00049  *  302:     function getTitle()
00050  *  321:     function buildForm()
00051  *  330:     function buildEditForm()
00052  *  395:     function buildNewForm()
00053  *  458:     function createButtons()
00054  *  484:     function getOwnerUser($uid)
00055  *  510:     function processData()
00056  *  554:     function fixVariousTCAFields()
00057  *  566:     function fixTCAUserField($fieldName)
00058  *  593:     function checkWorkspaceAccess()
00059  *
00060  *
00061  *  606: class user_SC_mod_user_ws_workspaceForms
00062  *  615:     function processUserAndGroups($conf, $tceforms)
00063  *
00064  * TOTAL FUNCTIONS: 16
00065  * (This index is automatically created/updated by the extension "extdeveval")
00066  *
00067  */
00068 
00069 
00070 // Initialize module:
00071 unset($MCONF);
00072 require('conf.php');
00073 require($BACK_PATH.'init.php');
00074 require($BACK_PATH.'template.php');
00075 $BE_USER->modAccess($MCONF,1);
00076 
00077 // Include libraries of various kinds used inside:
00078 $LANG->includeLLFile('EXT:lang/locallang_mod_user_ws.xml');
00079 
00080 /**
00081  * Module: Workspace forms for editing/creating workspaces.
00082  *
00083  * @author  Dmitry Dulepov <typo3@fm-world.ru>
00084  * @package TYPO3
00085  * @subpackage core
00086  */
00087 class SC_mod_user_ws_workspaceForms extends t3lib_SCbase {
00088 
00089     // Default variables for backend modules
00090     var $MCONF = array();               // Module configuration
00091     var $MOD_MENU = array();            // Module menu items
00092     var $MOD_SETTINGS = array();        // Module session settings
00093 
00094     /**
00095      * Document Template Object
00096      *
00097      * @var mediumDoc
00098      */
00099     var $doc;
00100     var $content;                       // Accumulated content
00101 
00102     // internal variables
00103     var $isEditAction = false;          // true if about to edit workspace
00104     var $workspaceId;                   // ID of the workspace that we will edit. Set only if $isEditAction is true.
00105 
00106     /**
00107      * An instance of t3lib_TCEForms
00108      *
00109      * @var t3lib_TCEforms
00110      */
00111     var $tceforms;
00112 
00113 
00114 
00115 
00116 
00117 
00118     /*************************
00119      *
00120      * PUBLIC MODULE METHODS
00121      *
00122      *************************/
00123 
00124     /**
00125      * Initializes the module. See <code>t3lib_SCbase::init()</code> for more information.
00126      *
00127      * @return  void
00128      */
00129     function init() {
00130         // Setting module configuration:
00131         $this->MCONF = $GLOBALS['MCONF'];
00132 
00133         // Initialize Document Template object:
00134         $this->doc = t3lib_div::makeInstance('template');
00135         $this->doc->backPath = $GLOBALS['BACK_PATH'];
00136         $this->doc->setModuleTemplate('templates/ws_forms.html');
00137         $this->doc->form = '<form action="' . t3lib_div::getIndpEnv('SCRIPT_NAME').'" method="post" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
00138 
00139         $this->doc->getContextMenuCode();
00140 
00141         // Parent initialization:
00142         t3lib_SCbase::init();
00143     }
00144 
00145 
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155     /**
00156      * Creates module content.
00157      *
00158      * @return  void
00159      */
00160     function main() {
00161         global  $LANG;
00162 
00163         // see what we have to do and get parameters (call before processing data!!!)
00164         $this->getModuleParameters();
00165 
00166         $hasAccess = (
00167             $GLOBALS['BE_USER']->isAdmin() ||
00168             0 != ($GLOBALS['BE_USER']->groupData['workspace_perms'] & 4) ||
00169             ($this->isEditAction && $this->checkWorkspaceAccess())
00170         );
00171 
00172         if (!$hasAccess) {
00173             $title = $this->getTitle();
00174             $this->content .= $this->doc->startPage($title);
00175             $this->content .= $this->doc->header($title);
00176             $this->content .= $this->doc->spacer(5);
00177             $this->content .= $LANG->getLL($this->isEditAction ? 'edit_workspace_no_permission' : 'create_workspace_no_permission');
00178             $this->content .= $this->doc->spacer(5);
00179             $goBack = $GLOBALS['LANG']->getLL('edit_workspace_go_back');
00180             $this->content .= t3lib_iconWorks::getSpriteIcon('actions-view-go-back') .
00181                         '<a href="javascript:history.back()" title="'. $goBack . '">' .
00182                         $goBack .
00183                         '</a>';
00184             $this->content .= $this->doc->endPage();
00185             return;
00186         }
00187 
00188         // process submission (this may override action and workspace ID!)
00189         if (t3lib_div::_GP('workspace_form_submited')) {
00190             $this->processData();
00191             // if 'Save&Close' was pressed, redirect to main module script
00192             if (t3lib_div::_GP('_saveandclosedok_x')) {
00193                 // `n` below is to prevent caching
00194                 t3lib_utility_Http::redirect('index.php?n=' . uniqid(''));
00195             }
00196         }
00197 
00198         $this->initTCEForms();
00199 
00200         //
00201         // start page
00202         //
00203         $this->content .= $this->doc->header($this->getTitle());
00204         $this->content .= $this->doc->spacer(5);
00205 
00206         //
00207         // page content
00208         //
00209         $this->content .= $this->tceforms->printNeededJSFunctions_top();
00210         $this->content .= $this->buildForm();
00211         $this->content .= $this->tceforms->printNeededJSFunctions();
00212 
00213             // Setting up the buttons and markers for docheader
00214         $docHeaderButtons = $this->getButtons();
00215         // $markers['CSH'] = $docHeaderButtons['csh'];
00216         $markers['CONTENT'] = $this->content;
00217 
00218             // Build the <body> for the module
00219         $this->content = $this->doc->startPage($this->getTitle());
00220         $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
00221         $this->content.= $this->doc->endPage();
00222         $this->content = $this->doc->insertStylesAndJS($this->content);
00223     }
00224 
00225     /**
00226      * Outputs module content to the browser.
00227      *
00228      * @return  void
00229      */
00230     function printContent() {
00231         echo $this->content;
00232     }
00233 
00234     /**
00235      * Create the panel of buttons for submitting the form or otherwise perform operations.
00236      *
00237      * @return  array   all available buttons as an assoc. array
00238      */
00239     protected function getButtons() {
00240         global $LANG;
00241 
00242         $buttons = array(
00243             'close' => '',
00244             'save' => '',
00245             'save_close' => ''
00246         );
00247 
00248             // Close,  `n` below is simply to prevent caching
00249         $buttons['close'] = '<a href="index.php?n=' . uniqid('wksp') . '" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-close') . '</a>';
00250             // Save
00251         $buttons['save'] = '<input type="image" class="c-inputButton" name="_savedok"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/savedok.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" value="_savedok" />';
00252             // Save & Close
00253         $buttons['save_close'] = '<input type="image" class="c-inputButton" name="_saveandclosedok"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/saveandclosedok.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc', 1) . '" value="_saveandclosedok" />';
00254 
00255         return $buttons;
00256     }
00257 
00258 
00259 
00260 
00261 
00262 
00263 
00264 
00265     /*************************
00266      *
00267      * PRIVATE FUNCTIONS
00268      *
00269      *************************/
00270 
00271     /**
00272      * Initializes <code>t3lib_TCEform</code> class for use in this module.
00273      *
00274      * @return  void
00275      */
00276     function initTCEForms() {
00277         $this->tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
00278         $this->tceforms->initDefaultBEMode();
00279         $this->tceforms->backPath = $GLOBALS['BACK_PATH'];
00280         $this->tceforms->doSaveFieldName = 'doSave';
00281         $this->tceforms->localizationMode = t3lib_div::inList('text,media',$this->localizationMode) ? $this->localizationMode : ''; // text,media is keywords defined in TYPO3 Core API..., see "l10n_cat"
00282         $this->tceforms->returnUrl = $this->R_URI;
00283         $this->tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes'];
00284         $this->tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00285         $this->tceforms->enableClickMenu = true;
00286         $this->tceforms->enableTabMenu = true;
00287 
00288             // Setting external variables:
00289         if ($GLOBALS['BE_USER']->uc['edit_showFieldHelp']!='text' && $this->MOD_SETTINGS['showDescriptions'])   $this->tceforms->edit_showFieldHelp='text';
00290     }
00291 
00292 
00293 
00294 
00295 
00296 
00297 
00298     /**
00299      * Retrieves module parameters from the <code>t3lib_div::_GP</code>. The following arguments are retrieved: <ul><li>action</li><li>workspace id (if action == 'edit')</li></ul>
00300      *
00301      * @return  void
00302      */
00303     function getModuleParameters(){
00304         $this->isEditAction = (t3lib_div::_GP('action') == 'edit');
00305         if ($this->isEditAction) {
00306             $this->workspaceId = intval(t3lib_div::_GP('wkspId'));
00307         }
00308     }
00309 
00310 
00311 
00312 
00313 
00314 
00315 
00316     /**
00317      * Retrieves a title of the module according to action.
00318      *
00319      * @return  string      A title for the module
00320      */
00321     function getTitle() {
00322         $label = ($this->isEditAction ? 'edit_workspace_title_edit' : 'edit_workspace_title_new');
00323         return $GLOBALS['LANG']->getLL($label);
00324     }
00325 
00326 
00327 
00328 
00329 
00330 
00331 
00332 
00333 
00334 
00335     /**
00336      * Creates form for workspace. This function is a wrapper around <code>buildEditForm()</code> and <code>buildNewForm()</code>.
00337      *
00338      * @return  string      Generated form
00339      */
00340     function buildForm() {
00341         return $this->isEditAction ? $this->buildEditForm() : $this->buildNewForm();
00342     }
00343 
00344     /**
00345      * Creates a form for editing workspace. Parts were adopted from <code>alt_doc.php</code>.
00346      *
00347      * @return  string      Generated form
00348      */
00349     function buildEditForm() {
00350         $content = '';
00351         $table = 'sys_workspace';
00352         $prevPageID = '';
00353         $trData = t3lib_div::makeInstance('t3lib_transferData');
00354         $trData->addRawData = TRUE;
00355         $trData->defVals = $this->defVals;
00356         $trData->lockRecords=1;
00357         $trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00358         $trData->prevPageID = $prevPageID;
00359         $trData->fetchRecord($table, $this->workspaceId, '');
00360         reset($trData->regTableItems_data);
00361         $rec = current($trData->regTableItems_data);
00362 
00363         // Setting variables in TCEforms object:
00364         $this->tceforms->hiddenFieldList = '';
00365         // Register default language labels, if any:
00366         $this->tceforms->registerDefaultLanguageData($table,$rec);
00367 
00368         $this->fixVariousTCAFields();
00369         if (!$GLOBALS['BE_USER']->isAdmin()) {
00370             // Non-admins cannot select users from the root. We "fix" it for them.
00371             $this->fixTCAUserField('adminusers');
00372             $this->fixTCAUserField('members');
00373             $this->fixTCAUserField('reviewers');
00374         }
00375 
00376         // Create form for the record (either specific list of fields or the whole record):
00377         $form = '';
00378         $form .= $this->tceforms->getMainFields($table,$rec);
00379         $form .= '<input type="hidden" name="data['.$table.']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />';
00380         $form .= '<input type="hidden" name="workspace_form_submited" value="1" />';
00381         $form .= '<input type="hidden" name="returnUrl" value="index.php" />';
00382         $form .= '<input type="hidden" name="action" value="edit" />';
00383         $form .= '<input type="hidden" name="closeDoc" value="0" />';
00384         $form .= '<input type="hidden" name="doSave" value="0" />';
00385         $form .= '<input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />';
00386         $form .= '<input type="hidden" name="_disableRTE" value="'.$this->tceforms->disableRTE.'" />';
00387         $form .= '<input type="hidden" name="wkspId" value="' . htmlspecialchars($this->workspaceId) . '" />';
00388         $form = $this->tceforms->wrapTotal($form, $rec, $table);
00389 
00390         // Combine it all:
00391         $content .= $form;
00392         return $content;
00393     }
00394 
00395 
00396 
00397 
00398 
00399 
00400 
00401 
00402 
00403 
00404 
00405 
00406     /**
00407      * Creates a form for new workspace. Parts are adopted from <code>alt_doc.php</code>.
00408      *
00409      * @return  string      Generated form
00410      */
00411     function buildNewForm() {
00412         $content = '';
00413         $table = 'sys_workspace';
00414         $prevPageID = '';
00415         $trData = t3lib_div::makeInstance('t3lib_transferData');
00416         $trData->addRawData = TRUE;
00417         $trData->defVals = $this->defVals;
00418         $trData->lockRecords=1;
00419         $trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
00420         $trData->prevPageID = $prevPageID;
00421         $trData->fetchRecord($table, 0, 'new');
00422         reset($trData->regTableItems_data);
00423         $rec = current($trData->regTableItems_data);
00424         $rec['uid'] = uniqid('NEW');
00425         $rec['pid'] = 0;
00426         $rec['adminusers'] = $this->getOwnerUser($rec['uid']);
00427 
00428         // Setting variables in TCEforms object:
00429         $this->tceforms->hiddenFieldList = '';
00430         // Register default language labels, if any:
00431         $this->tceforms->registerDefaultLanguageData($table,$rec);
00432 
00433         $this->fixVariousTCAFields();
00434         if (!$GLOBALS['BE_USER']->isAdmin()) {
00435             // Non-admins cannot select users from the root. We "fix" it for them.
00436             $this->fixTCAUserField('adminusers');
00437             $this->fixTCAUserField('members');
00438             $this->fixTCAUserField('reviewers');
00439         }
00440 
00441 
00442         // Create form for the record (either specific list of fields or the whole record):
00443         $form = '';
00444         $form .= $this->doc->spacer(5);
00445         $form .= $this->tceforms->getMainFields($table,$rec);
00446 
00447         $form .= '<input type="hidden" name="workspace_form_submited" value="1" />';
00448         $form .= '<input type="hidden" name="data['.$table.']['.$rec['uid'].'][pid]" value="'.$rec['pid'].'" />';
00449         $form .= '<input type="hidden" name="returnUrl" value="index.php" />';
00450         $form .= '<input type="hidden" name="action" value="new" />';
00451         $form .= '<input type="hidden" name="closeDoc" value="0" />';
00452         $form .= '<input type="hidden" name="doSave" value="0" />';
00453         $form .= '<input type="hidden" name="_serialNumber" value="'.md5(microtime()).'" />';
00454         $form .= '<input type="hidden" name="_disableRTE" value="'.$this->tceforms->disableRTE.'" />';
00455         $form = $this->tceforms->wrapTotal($form, $rec, $table);
00456 
00457         // Combine it all:
00458         $content .= $form;
00459         return $content;
00460     }
00461 
00462 
00463 
00464 
00465 
00466 
00467 
00468 
00469 
00470 
00471 
00472 
00473     /**
00474      * Returns owner user (i.e. current BE user) in the format suitable for TCE forms. This function uses <code>t3lib_loadDBGroup</code> to create value. Code is adopted from <code>t3lib_transferdata::renderRecord_groupProc()</code>.
00475      *
00476      * @param   string      $uid    UID of the record (as <code>NEW...</code>)
00477      * @return  string      User record formatted for TCEForms
00478      */
00479     function getOwnerUser($uid) {
00480         $loadDB = t3lib_div::makeInstance('t3lib_loadDBGroup');
00481         // Make sure that `sys_workspace` is in $TCA
00482         t3lib_div::loadTCA('sys_workspace');
00483         // shortcut to `config` of `adminusers` field -- shorter code and better PHP performance
00484         $config = &$GLOBALS['TCA']['sys_workspace']['columns']['adminusers']['config'];
00485         // Notice: $config['MM'] is not set in the current version of $TCA but
00486         // we still pass it to ensure compatibility with feature versions!
00487         $loadDB->start($GLOBALS['BE_USER']->user['uid'], $config['allowed'], $config['MM'], $uid, 'sys_workspace', $config);
00488         $loadDB->getFromDB();
00489         return $loadDB->readyForInterface();
00490     }
00491 
00492 
00493 
00494 
00495 
00496 
00497 
00498 
00499 
00500     /**
00501      * Processes submitted data. This function uses <code>t3lib_TCEmain::process_datamap()</code> to create/update records in the <code>sys_workspace</code> table. It will print error messages just like any other Typo3 module with similar functionality. Function also changes workspace ID and module mode to 'edit' if new record was just created.
00502      *
00503      * @return  void
00504      */
00505     function processData() {
00506         $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00507         $tce->stripslashes_values = 0;
00508 
00509         $TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
00510         if (is_array($TCAdefaultOverride))  {
00511             $tce->setDefaultsFromUserTS($TCAdefaultOverride);
00512         }
00513         $tce->stripslashes_values = 0;
00514 
00515             // The following is a security precaution; It makes sure that the input data array can ONLY contain data for the sys_workspace table and ONLY one record.
00516             // If this is not present it could be mis-used for nasty XSS attacks which can escalate rights to admin for even non-admin users.
00517         $inputData_tmp = t3lib_div::_GP('data');
00518         $inputData = array();
00519         if (is_array($inputData_tmp['sys_workspace']))  {
00520             reset($inputData_tmp['sys_workspace']);
00521             $inputData['sys_workspace'][key($inputData_tmp['sys_workspace'])] = current($inputData_tmp['sys_workspace']);
00522         }
00523 
00524         $tce->start($inputData, array(), $GLOBALS['BE_USER']);
00525         $tce->admin = 1;    // Bypass table restrictions
00526         $tce->bypassWorkspaceRestrictions = true;
00527         $tce->process_datamap();
00528 
00529             // print error messages (if any)
00530         $script = t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT');
00531         $tce->printLogErrorMessages($script . '?' .
00532             ($this->isEditAction ? 'action=edit&wkspId=' . $this->workspaceId : 'action=new'));
00533 
00534         // If there was saved any new items, load them and update mode and workspace id
00535         if (count($tce->substNEWwithIDs_table)) {
00536             reset($tce->substNEWwithIDs_table); // not really necessary but better be safe...
00537             $this->workspaceId = current($tce->substNEWwithIDs);
00538             $this->isEditAction = true;
00539         }
00540     }
00541 
00542 
00543 
00544     /**
00545      * Fixes various <code>$TCA</code> fields for better visual representation of workspace editor.
00546      *
00547      * @return  void
00548      */
00549     function fixVariousTCAFields() {
00550         // enable tabs
00551         $GLOBALS['TCA']['sys_workspace']['ctrl']['dividers2tabs'] = true;
00552     }
00553 
00554 
00555     /**
00556      * "Fixes" <code>$TCA</code> to enable blinding for users/groups for non-admin users only.
00557      *
00558      * @param   string      $fieldName  Name of the field to change
00559      * @return  void
00560      */
00561     function fixTCAUserField($fieldName) {
00562         // fix fields for non-admin
00563         if (!$GLOBALS['BE_USER']->isAdmin()) {
00564             // make a shortcut to field
00565             t3lib_div::loadTCA('sys_workspace');
00566             $field = &$GLOBALS['TCA']['sys_workspace']['columns'][$fieldName];
00567             $newField = array (
00568                 'label' => $field['label'],
00569                 'config' => Array (
00570                     'type' => 'select',
00571                     'itemsProcFunc' => 'user_SC_mod_user_ws_workspaceForms->processUserAndGroups',
00572                     //'iconsInOptionTags' => true,
00573                     'size' => 10,
00574                     'maxitems' => $field['config']['maxitems'],
00575                     'autoSizeMax' => $field['config']['autoSizeMax'],
00576                     'mod_ws_allowed' => $field['config']['allowed'] // let us know what we can use in itemProcFunc
00577                 )
00578             );
00579             $field = $newField;
00580         }
00581     }
00582 
00583     /**
00584      * Checks if use has editing access to the workspace.
00585      *
00586      * @return  boolean     Returns true if user can edit workspace
00587      */
00588     function checkWorkspaceAccess() {
00589         $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,title,adminusers,members,reviewers','sys_workspace','uid=' . intval($this->workspaceId) . ' AND pid=0'.t3lib_BEfunc::deleteClause('sys_workspace'));
00590         if (is_array($workspaces) && count($workspaces) != 0 && false !== ($rec = $GLOBALS['BE_USER']->checkWorkspace($workspaces[0]))) {
00591             return ($rec['_ACCESS'] == 'owner' || $rec['_ACCESS'] == 'admin');
00592         }
00593         return false;
00594     }
00595 }
00596 
00597 /**
00598  * This class contains Typo3 callback functions. Class name must start from <code>user_</code> thus we use a separate class.
00599  *
00600  */
00601 class user_SC_mod_user_ws_workspaceForms {
00602 
00603     /**
00604      * Callback function to blind user and group accounts. Used as <code>itemsProcFunc</code> in <code>$TCA</code>.
00605      *
00606      * @param   array       $conf   Configuration array. The following elements are set:<ul><li>items - initial set of items (empty in our case)</li><li>config - field config from <code>$TCA</code></li><li>TSconfig - this function name</li><li>table - table name</li><li>row - record row (???)</li><li>field - field name</li></ul>
00607      * @param   object      $tceforms   <code>t3lib_div::TCEforms</code> object
00608      * @return  void
00609      */
00610     function processUserAndGroups($conf, $tceforms) {
00611             // Get usernames and groupnames
00612         $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
00613         $groupArray = array_keys($be_group_Array);
00614 
00615         $be_user_Array = t3lib_BEfunc::getUserNames();
00616         $be_user_Array = t3lib_BEfunc::blindUserNames($be_user_Array,$groupArray,1);
00617 
00618         // users
00619         $title = $GLOBALS['LANG']->sL($GLOBALS['TCA']['be_users']['ctrl']['title']);
00620         foreach ($be_user_Array as $uid => $user) {
00621             $conf['items'][] = array(
00622                 $user['username'] . ' (' . $title . ')',
00623                 'be_users_' . $user['uid'],
00624                 t3lib_iconWorks::getIcon('be_users', $user)
00625             );
00626         }
00627 
00628         // Process groups only if necessary -- save time!
00629         if (strstr($conf['config']['mod_ws_allowed'], 'be_groups')) {
00630             // groups
00631 
00632             $be_group_Array = $be_group_Array_o = t3lib_BEfunc::getGroupNames();
00633             $be_group_Array = t3lib_BEfunc::blindGroupNames($be_group_Array_o,$groupArray,1);
00634 
00635             $title = $GLOBALS['LANG']->sL($GLOBALS['TCA']['be_groups']['ctrl']['title']);
00636             foreach ($be_group_Array as $uid => $group) {
00637                 $conf['items'][] = array(
00638                     $group['title'] . ' (' . $title . ')',
00639                     'be_groups_' . $group['uid'],
00640                     t3lib_iconWorks::getIcon('be_groups', $user)
00641                 );
00642             }
00643         }
00644     }
00645 }
00646 
00647 
00648 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/workspaceforms.php'])) {
00649     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/mod/user/ws/workspaceforms.php']);
00650 }
00651 
00652 // Make instance:
00653 $SOBE = t3lib_div::makeInstance('SC_mod_user_ws_workspaceForms');
00654 $SOBE->init();
00655 $SOBE->main();
00656 $SOBE->printContent();
00657 
00658 ?>