Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

SC_mod_user_setup_index Class Reference

List of all members.

Public Member Functions

 storeIncomingData ()
 If settings are submitted to _POST[DATA], store them NOTICE: This method is called before the template.php is included.
 init ()
 Initializes the module for display of the settings form.
 main ()
 Generate the main settings formular:.
 printContent ()
 Prints the content / ends page.
 getRealScriptUserObj ()
 Returns the backend user object, either the global OR the $this->OLD_BE_USER which is set during simulate-user operation.
 simulateUser ()
 Will make the simulate-user selector if the logged in user is administrator.
 setLabel ($str, $key='')
 Returns the label $str from getLL() and grays out the value if the $str/$key is found in $this->overrideConf array Adds CSH as well if applicable.

Public Attributes

 $MCONF = array()
 $MOD_MENU = array()
 $MOD_SETTINGS = array()
 $doc
 $content
 $overrideConf
 $OLD_BE_USER

Member Function Documentation

SC_mod_user_setup_index::getRealScriptUserObj  ) 
 

Returns the backend user object, either the global OR the $this->OLD_BE_USER which is set during simulate-user operation.

Anyway: The REAL user is returned - the one logged in.

Returns:
object The REAL user is returned - the one logged in.

Definition at line 426 of file index.php.

Referenced by init().

00426                                     {
00427       return is_object($this->OLD_BE_USER) ? $this->OLD_BE_USER : $GLOBALS['BE_USER'];
00428    }

SC_mod_user_setup_index::init  ) 
 

Initializes the module for display of the settings form.

Returns:
void

Definition at line 215 of file index.php.

References getRealScriptUserObj(), and table().

00215                      {
00216       global $BE_USER,$BACK_PATH;
00217       $this->MCONF = $GLOBALS['MCONF'];
00218 
00219          // Returns the script user - that is the REAL logged in user! ($GLOBALS[BE_USER] might be another user due to simulation!)
00220       $scriptUser = $this->getRealScriptUserObj();
00221       $scriptUser->modAccess($this->MCONF,1);   // ... and checking module access for the logged in user.
00222 
00223          // Getting the 'override' values as set might be set in User TSconfig
00224       $this->overrideConf = $BE_USER->getTSConfigProp('setup.override');
00225 
00226          // Create instance of object for output of data
00227       $this->doc = t3lib_div::makeInstance('mediumDoc');
00228       $this->doc->backPath = $BACK_PATH;
00229       $this->doc->docType = 'xhtml_trans';
00230 
00231       $this->doc->form = '<form action="index.php" method="post" enctype="application/x-www-form-urlencoded">';
00232       $this->doc->tableLayout = Array (
00233          'defRow' => Array (
00234             '0' => Array('<td align="left" width="300">','</td>'),
00235             'defCol' => Array('<td valign="top">','</td>')
00236          )
00237       );
00238       $this->doc->table_TR = '<tr class="bgColor4">';
00239       $this->doc->table_TABLE = '<table border="0" cellspacing="1" cellpadding="2">';
00240    }

SC_mod_user_setup_index::main  ) 
 

Generate the main settings formular:.

Returns:
void

Definition at line 247 of file index.php.

References $LANG, $val, t3lib_BEfunc::cshItem(), icons(), t3lib_extMgm::isLoaded(), setLabel(), and TYPO3_languages.

00247                      {
00248       global $BE_USER,$LANG,$BACK_PATH;
00249 
00250          // Start page:
00251       $this->doc->JScode.= '<script language="javascript" type="text/javascript" src="'.$BACK_PATH.'md5.js"></script>';
00252       $this->content.= $this->doc->startPage($LANG->getLL('UserSettings'));
00253       $this->content.= $this->doc->header($LANG->getLL('UserSettings').' - ['.$BE_USER->user['username'].']');
00254 
00255          // CSH general:
00256       $this->content.= t3lib_BEfunc::cshItem('_MOD_user_setup', '', $GLOBALS['BACK_PATH'],'|');
00257 
00258          // If password is updated, output whether it failed or was OK.
00259       if ($this->PASSWORD_UPDATED)  {
00260          if ($this->PASSWORD_UPDATED>0)   {
00261             $this->content.=$this->doc->section($LANG->getLL('newPassword').':',$LANG->getLL('newPassword_ok'),1,0,1);
00262          } else {
00263             $this->content.=$this->doc->section($LANG->getLL('newPassword').':',$LANG->getLL('newPassword_failed'),1,0,2);
00264          }
00265          $this->content.=$this->doc->spacer(25);
00266       }
00267 
00268          // Simulate selector box:
00269       if ($this->simulateSelector)  {
00270          $this->content.=$this->doc->section($LANG->getLL('simulate').':',$this->simulateSelector.t3lib_BEfunc::cshItem('_MOD_user_setup', 'simuser', $GLOBALS['BACK_PATH'],'|'),1,0,($this->simUser?2:0));
00271       }
00272 
00273 
00274          // Languages:
00275       $opt = array();
00276       $opt['000000000']='
00277                <option value="">'.$LANG->getLL('lang_default',1).'</option>';
00278       $theLanguages = t3lib_div::trimExplode('|',TYPO3_languages);
00279 
00280          // Character set conversion object:
00281       $csConvObj = t3lib_div::makeInstance('t3lib_cs');
00282 
00283          // traverse the number of languages:
00284       foreach($theLanguages as $val)   {
00285          if ($val!='default') {
00286             if ($BE_USER->uc['lang']!='default')   {
00287                $localLabel = '  -  ['.htmlspecialchars($GLOBALS['LOCAL_LANG']['default']['lang_'.$val]).']';
00288             } else $localLabel='';
00289 
00290             $opt[$GLOBALS['LOCAL_LANG']['default']['lang_'.$val].'--'.$val]='
00291                <option value="'.$val.'"'.($BE_USER->uc['lang']==$val?' selected="selected"':'').'>'.$LANG->getLL('lang_'.$val,1).$localLabel.'</option>';
00292          }
00293       }
00294       ksort($opt);
00295       $code='
00296             <select name="data[lang]">'.
00297                implode('',$opt).'
00298             </select>'.
00299             t3lib_BEfunc::cshItem('_MOD_user_setup', 'language', $GLOBALS['BACK_PATH'],'|');
00300       $this->content.=$this->doc->section($LANG->getLL('language').':',$code,0,1);
00301 
00302 
00303          // 'Startup' section:
00304       $code = Array();
00305 
00306       $code[2][1] = $this->setLabel('condensedMode','condensedMode').':';
00307       $code[2][2] = '<input type="checkbox" name="data[condensedMode]"'.($BE_USER->uc['condensedMode']?' checked="checked"':'').' />';
00308       $code[3][1] = $this->setLabel('noMenuMode','noMenuMode').':';
00309       $code[3][2] = '<select name="data[noMenuMode]">
00310          <option value=""'.(!$BE_USER->uc['noMenuMode']?' selected="selected"':'').'>'.$this->setLabel('noMenuMode_def').'</option>
00311          <option value="1"'.($BE_USER->uc['noMenuMode'] && (string)$BE_USER->uc['noMenuMode']!="icons"?' selected="selected"':'').'>'.$this->setLabel('noMenuMode_sel').'</option>
00312          <option value="icons"'.((string)$BE_USER->uc['noMenuMode']=='icons'?' selected="selected"':'').'>'.$this->setLabel('noMenuMode_icons').'</option>
00313       </select>';
00314       if (t3lib_extMgm::isLoaded('taskcenter')) {
00315          $code[4][1] = $this->setLabel('startInTaskCenter','startInTaskCenter').':';
00316          $code[4][2] = '<input type="checkbox" name="data[startInTaskCenter]"'.($BE_USER->uc['startInTaskCenter']?' checked="checked"':'').' />';
00317       }
00318       $code[5][1] = $this->setLabel('showThumbs','thumbnailsByDefault').':';
00319       $code[5][2] = '<input type="checkbox" name="data[thumbnailsByDefault]"'.($BE_USER->uc['thumbnailsByDefault']?' checked="checked"':'').' />';
00320       $code[6][1] = $this->setLabel('helpText').':';
00321       $code[6][2] = '<input type="checkbox" name="data[helpText]"'.($BE_USER->uc['helpText']?' checked="checked"':'').' />';
00322       $code[7][1] = $this->setLabel('maxTitleLen','titleLen').':';
00323       $code[7][2] = '<input type="text" name="data[titleLen]" value="'.$BE_USER->uc['titleLen'].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(5).' maxlength="5" />';
00324 
00325       $this->content.=$this->doc->section($LANG->getLL('opening').':',$this->doc->table($code),0,1);
00326 
00327 
00328          // Advanced Operations:
00329       $code = Array();
00330       $code[1][1] = $this->setLabel('copyLevels').':';
00331       $code[1][2] = '<input type="text" name="data[copyLevels]" value="'.$BE_USER->uc['copyLevels'].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(5).' maxlength="5" /> '.$this->setLabel('levels','copyLevels');
00332       $code[2][1] = $this->setLabel('recursiveDelete').':';
00333       $code[2][2] = '<input type="checkbox" name="data[recursiveDelete]"'.($BE_USER->uc['recursiveDelete']?' checked="checked"':'').' />';
00334 
00335       $this->content.=$this->doc->section($LANG->getLL('functions').":",$this->doc->table($code),0,1);
00336 
00337 
00338          // Edit
00339       $code = Array();
00340       $code[2][1] = $this->setLabel('edit_wideDocument').':';
00341       $code[2][2] = '<input type="checkbox" name="data[edit_wideDocument]"'.($BE_USER->uc['edit_wideDocument']?' checked="checked"':'').' />';
00342       if ($GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled'])  {
00343          $code[3][1] = $this->setLabel('edit_RTE').':';
00344          $code[3][2] = '<input type="checkbox" name="data[edit_RTE]"'.($BE_USER->uc['edit_RTE']?' checked="checked"':'').' />';
00345       }
00346       $code[4][1] = $this->setLabel('edit_docModuleUpload').':';
00347       $code[4][2] = '<input type="checkbox" name="data[edit_docModuleUpload]"'.($BE_USER->uc['edit_docModuleUpload']?' checked="checked"':'').' />';
00348 
00349       $code[6][1] = $this->setLabel('edit_showFieldHelp').':';
00350       $code[6][2] = '<select name="data[edit_showFieldHelp]">
00351          <option value=""></option>
00352          <option value="icon"'.($BE_USER->uc['edit_showFieldHelp']=='icon'?' selected="selected"':'').'>'.$this->setLabel('edit_showFieldHelp_icon').'</option>
00353          <option value="text"'.($BE_USER->uc['edit_showFieldHelp']=='text'?' selected="selected"':'').'>'.$this->setLabel('edit_showFieldHelp_message').'</option>
00354       </select>';
00355 
00356       $code[7][1] = $this->setLabel('disableCMlayers').':';
00357       $code[7][2] = '<input type="checkbox" name="data[disableCMlayers]"'.($BE_USER->uc['disableCMlayers']?' checked="checked"':'').' />';
00358 
00359       $this->content.=$this->doc->section($LANG->getLL('edit_functions').":",$this->doc->table($code),0,1);
00360 
00361 
00362          // Personal data
00363       $code = Array();
00364       $code[1][1] = $this->setLabel('beUser_realName').':';
00365       $code[1][2] = '<input type="text" name="ext_beuser[realName]" value="'.htmlspecialchars($BE_USER->user['realName']).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />';
00366       $code[2][1] = $this->setLabel('beUser_email').':';
00367       $code[2][2] = '<input type="text" name="ext_beuser[email]" value="'.htmlspecialchars($BE_USER->user['email']).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />';
00368       $code[3][1] = $this->setLabel('emailMeAtLogin').' ('.$GLOBALS['BE_USER']->user['email'].'):';
00369       $code[3][2] = '<input type="checkbox" name="data[emailMeAtLogin]"'.($BE_USER->uc['emailMeAtLogin']?' checked="checked"':'').' />';
00370       $code[4][1] = $this->setLabel('newPassword').':';
00371       $code[4][2] = '<input type="password" name="ext_beuser[password1]" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\';" />';
00372       $code[5][1] = $this->setLabel('newPasswordAgain').':';
00373       $code[5][2] = '<input type="password" name="ext_beuser[password2]" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\'" />';
00374 
00375       $this->content.=$this->doc->section($LANG->getLL('personal_data').":",$this->doc->table($code),0,1);
00376 
00377 
00378          // Submit:
00379       $this->content.=$this->doc->spacer(20);
00380       $this->content.=$this->doc->section('','
00381          <input type="submit" name="submit" value="'.$LANG->getLL('save').'" />
00382           &nbsp; <b>'.$LANG->getLL('setToStandard').': </b><input type="checkbox" name="data[setValuesToDefault]" />'.
00383           t3lib_BEfunc::cshItem('_MOD_user_setup', 'reset', $GLOBALS['BACK_PATH'],'|').'
00384          <input type="hidden" name="simUser" value="'.$this->simUser.'" />');
00385 
00386 
00387          // Notice
00388       $this->content.=$this->doc->spacer(5);
00389       $this->content.=$this->doc->section('',$LANG->getLL('activateChanges'));
00390    }

SC_mod_user_setup_index::printContent  ) 
 

Prints the content / ends page.

Returns:
void

Definition at line 397 of file index.php.

00397                            {
00398       $this->content.= $this->doc->endPage();
00399       echo $this->content;
00400       exit;
00401    }

SC_mod_user_setup_index::setLabel str,
key = ''
 

Returns the label $str from getLL() and grays out the value if the $str/$key is found in $this->overrideConf array Adds CSH as well if applicable.

Parameters:
string Locallang key
string Alternative override-config key
Returns:
string HTML output.

Definition at line 482 of file index.php.

References $out, and t3lib_BEfunc::cshItem().

Referenced by main().

00482                                     {
00483       $out = $GLOBALS['LANG']->getLL($str);
00484       if (isset($this->overrideConf[($key?$key:$str)]))  {
00485          $out = '<span style="color:#999999">'.$out.'</span>';
00486       }
00487 
00488          // CSH:
00489       $out.= t3lib_BEfunc::cshItem('_MOD_user_setup', 'option_'.$str, $GLOBALS['BACK_PATH'],'|',FALSE,'margin-bottom:0px;');
00490 
00491          // Return value:
00492       return $out;
00493    }

SC_mod_user_setup_index::simulateUser  ) 
 

Will make the simulate-user selector if the logged in user is administrator.

It will also set the GLOBAL(!) BE_USER to the simulated user selected if any (and set $this->OLD_BE_USER to logged in user)

Returns:
void

Definition at line 436 of file index.php.

References t3lib_BEfunc::getUserNames().

00436                            {
00437       global $BE_USER,$LANG,$BACK_PATH;
00438 
00439       // *******************************************************************************
00440       // If admin, allow simulation of another user
00441       // *******************************************************************************
00442       $this->simUser = 0;
00443       $this->simulateSelector = '';
00444       unset($this->OLD_BE_USER);
00445       if ($BE_USER->isAdmin())   {
00446          $this->simUser = t3lib_div::_GP('simUser');
00447 
00448             // Make user-selector:
00449          $users = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,realName');
00450          $opt = array();
00451          reset($users);
00452          $opt[] = '<option></option>';
00453          while(list(,$rr)=each($users))   {
00454             if ($rr['uid']!=$BE_USER->user['uid']) {
00455                $opt[] = '<option value="'.$rr['uid'].'"'.($this->simUser==$rr['uid']?' selected="selected"':'').'>'.htmlspecialchars($rr['username'].' ('.$rr['realName'].')').'</option>';
00456             }
00457          }
00458          $this->simulateSelector = '<select name="simulateUser" onchange="document.location=\'index.php?simUser=\'+this.options[this.selectedIndex].value;">'.implode('',$opt).'</select>';
00459       }
00460 
00461       if ($this->simUser>0)   {  // This can only be set if the previous code was executed.
00462          $this->OLD_BE_USER = $BE_USER;   // Save old user...
00463          unset($BE_USER);  // Unset current
00464 
00465          $BE_USER = t3lib_div::makeInstance('t3lib_beUserAuth');  // New backend user object
00466          $BE_USER->OS = TYPO3_OS;
00467          $BE_USER->setBeUserByUid($this->simUser);
00468          $BE_USER->fetchGroupData();
00469          $BE_USER->backendSetUC();
00470          $GLOBALS['BE_USER'] = $BE_USER;  // Must do this, because unsetting $BE_USER before apparently unsets the reference to the global variable by this name!
00471       }
00472    }

SC_mod_user_setup_index::storeIncomingData  ) 
 

If settings are submitted to _POST[DATA], store them NOTICE: This method is called before the template.php is included.

See buttom of document

Returns:
void

Definition at line 114 of file index.php.

References t3lib_extMgm::isLoaded().

00114                                  {
00115       global $BE_USER;
00116 
00117 
00118          // First check if something is submittet in the data-array from POST vars
00119       $d = t3lib_div::_POST('data');
00120       if (is_array($d)) {
00121 
00122             // UC hashed before applying changes
00123          $save_before = md5(serialize($BE_USER->uc));
00124 
00125             // PUT SETTINGS into the ->uc array:
00126 
00127             // Language
00128          $BE_USER->uc['lang'] = $d['lang'];
00129 
00130             // Startup
00131          $BE_USER->uc['condensedMode'] = $d['condensedMode'];
00132          $BE_USER->uc['noMenuMode'] = $d['noMenuMode'];
00133          if (t3lib_extMgm::isLoaded('taskcenter')) $BE_USER->uc['startInTaskCenter'] = $d['startInTaskCenter'];
00134          $BE_USER->uc['thumbnailsByDefault'] = $d['thumbnailsByDefault'];
00135          $BE_USER->uc['helpText'] = $d['helpText'];
00136          $BE_USER->uc['titleLen'] = intval($d['titleLen']);
00137 
00138             // Advanced functions:
00139          $BE_USER->uc['copyLevels'] = t3lib_div::intInRange($d['copyLevels'],0,100);
00140          $BE_USER->uc['recursiveDelete'] = $d['recursiveDelete'];
00141 
00142             // Edit
00143          $BE_USER->uc['edit_wideDocument'] = $d['edit_wideDocument'];
00144          if ($GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled'])  { $BE_USER->uc['edit_RTE'] = $d['edit_RTE']; }
00145          $BE_USER->uc['edit_docModuleUpload'] = $d['edit_docModuleUpload'];
00146          $BE_USER->uc['edit_showFieldHelp'] = $d['edit_showFieldHelp'];
00147          $BE_USER->uc['disableCMlayers'] = $d['disableCMlayers'];
00148 
00149             // Personal:
00150          $BE_USER->uc['emailMeAtLogin'] = $d['emailMeAtLogin'];
00151 
00152 
00153          if ($d['setValuesToDefault']) {  // If every value should be default
00154             $BE_USER->resetUC();
00155          }
00156          $BE_USER->overrideUC(); // Inserts the overriding values.
00157 
00158          $save_after = md5(serialize($BE_USER->uc));
00159          if ($save_before!=$save_after)   {  // If something in the uc-array of the user has changed, we save the array...
00160             $BE_USER->writeUC($BE_USER->uc);
00161             $BE_USER->writelog(254,1,0,1,'Personal settings changed',Array());
00162          }
00163 
00164 
00165             // Personal data for the users be_user-record (email, name, password...)
00166             // If email and name is changed, set it in the users record:
00167          $be_user_data = t3lib_div::_GP('ext_beuser');
00168          $this->PASSWORD_UPDATED = strlen($be_user_data['password1'].$be_user_data['password2'])>0 ? -1 : 0;
00169          if ($be_user_data['email']!=$BE_USER->user['email']
00170                || $be_user_data['realName']!=$BE_USER->user['realName']
00171                || (strlen($be_user_data['password1'])==32
00172                      && !strcmp($be_user_data['password1'],$be_user_data['password2']))
00173                )  {
00174             $storeRec = array();
00175             $BE_USER->user['realName'] = $storeRec['be_users'][$BE_USER->user['uid']]['realName'] = substr($be_user_data['realName'],0,80);
00176             $BE_USER->user['email'] = $storeRec['be_users'][$BE_USER->user['uid']]['email'] = substr($be_user_data['email'],0,80);
00177             if (strlen($be_user_data['password1'])==32 && !strcmp($be_user_data['password1'],$be_user_data['password2']))  {
00178                $BE_USER->user['password'] = $storeRec['be_users'][$BE_USER->user['uid']]['password'] = $be_user_data['password1'];
00179                $this->PASSWORD_UPDATED = 1;
00180             }
00181 
00182                // Make instance of TCE for storing the changes.
00183             $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00184             $tce->stripslashes_values=0;
00185             $tce->start($storeRec,Array(),$BE_USER);
00186             $tce->admin = 1;
00187             $tce->process_datamap();
00188             unset($tce);
00189          }
00190       }
00191    }


Member Data Documentation

SC_mod_user_setup_index::$content
 

Definition at line 94 of file index.php.

SC_mod_user_setup_index::$doc
 

Definition at line 92 of file index.php.

SC_mod_user_setup_index::$MCONF = array()
 

Definition at line 89 of file index.php.

SC_mod_user_setup_index::$MOD_MENU = array()
 

Definition at line 90 of file index.php.

SC_mod_user_setup_index::$MOD_SETTINGS = array()
 

Definition at line 91 of file index.php.

SC_mod_user_setup_index::$OLD_BE_USER
 

Definition at line 96 of file index.php.

SC_mod_user_setup_index::$overrideConf
 

Definition at line 95 of file index.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 3 01:06:34 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913