[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 namespace dokuwiki\Ui; 4 5 use dokuwiki\Extension\AuthPlugin; 6 use dokuwiki\Form\Form; 7 8 /** 9 * DokuWiki User Profile Interface 10 * 11 * @package dokuwiki\Ui 12 */ 13 class UserProfile extends Ui 14 { 15 /** 16 * Display the User Profile Form Panel 17 * 18 * @author Andreas Gohr <andi@splitbrain.org> 19 * 20 * @return void 21 */ 22 public function show() 23 { 24 global $lang; 25 global $conf; 26 global $INPUT; 27 global $INFO; 28 /** @var AuthPlugin $auth */ 29 global $auth; 30 31 // print intro 32 print p_locale_xhtml('updateprofile'); 33 print '<div class="centeralign">'; 34 35 $fullname = $INPUT->post->str('fullname', $INFO['userinfo']['name'], true); 36 $email = $INPUT->post->str('email', $INFO['userinfo']['mail'], true); 37 38 // create the updateprofile form 39 $form = new Form(['id' => 'dw__register']); 40 $form->addTagOpen('div')->addClass('no'); 41 $form->addFieldsetOpen($lang['profile']); 42 $form->setHiddenField('do', 'profile'); 43 $form->setHiddenField('save', '1'); 44 45 $attr = array('size' => '50', 'disabled' => 'disabled'); 46 $input = $form->addTextInput('login', $lang['user'])->attrs($attr)->addClass('edit') 47 ->val($INPUT->server->str('REMOTE_USER')); 48 $input->getLabel()->attr('class', 'block'); 49 $form->addHTML("<br>\n"); 50 51 $attr = array('size' => '50'); 52 if (!$auth->canDo('modName')) $attr['disabled'] = 'disabled'; 53 $input = $form->addTextInput('fullname', $lang['fullname'])->attrs($attr)->addClass('edit') 54 ->val($fullname); 55 $input->getLabel()->attr('class', 'block'); 56 $form->addHTML("<br>\n"); 57 58 $attr = array('type' => 'email', 'size' => '50'); 59 if (!$auth->canDo('modMail')) $attr['disabled'] = 'disabled'; 60 $input = $form->addTextInput('email', $lang['email'])->attrs($attr)->addClass('edit') 61 ->val($email); 62 $input->getLabel()->attr('class', 'block'); 63 $form->addHTML("<br>\n"); 64 65 if ($auth->canDo('modPass')) { 66 $attr = array('size'=>'50'); 67 $input = $form->addPasswordInput('newpass', $lang['newpass'])->attrs($attr)->addClass('edit'); 68 $input->getLabel()->attr('class', 'block'); 69 $form->addHTML("<br>\n"); 70 71 $input = $form->addPasswordInput('passchk', $lang['passchk'])->attrs($attr)->addClass('edit'); 72 $input->getLabel()->attr('class', 'block'); 73 $form->addHTML("<br>\n"); 74 } 75 76 if ($conf['profileconfirm']) { 77 $form->addHTML("<br>\n"); 78 $attr = array('size' => '50', 'required' => 'required'); 79 $input = $form->addPasswordInput('oldpass', $lang['oldpass'])->attrs($attr)->addClass('edit'); 80 $input->getLabel()->attr('class', 'block'); 81 $form->addHTML("<br>\n"); 82 } 83 84 $form->addButton('', $lang['btn_save'])->attr('type', 'submit'); 85 $form->addButton('', $lang['btn_reset'])->attr('type', 'reset'); 86 87 $form->addFieldsetClose(); 88 $form->addTagClose('div'); 89 90 print $form->toHTML('UpdateProfile'); 91 92 93 if ($auth->canDo('delUser') && actionOK('profile_delete')) { 94 95 // create the profiledelete form 96 $form = new Form(['id' => 'dw__profiledelete']); 97 $form->addTagOpen('div')->addClass('no'); 98 $form->addFieldsetOpen($lang['profdeleteuser']); 99 $form->setHiddenField('do', 'profile_delete'); 100 $form->setHiddenField('delete', '1'); 101 102 $form->addCheckbox('confirm_delete', $lang['profconfdelete']) 103 ->attrs(['required' => 'required']) 104 ->id('dw__confirmdelete') 105 ->val('1'); 106 107 if ($conf['profileconfirm']) { 108 $form->addHTML("<br>\n"); 109 $attr = array('size' => '50', 'required' => 'required'); 110 $input = $form->addPasswordInput('oldpass', $lang['oldpass'])->attrs($attr) 111 ->addClass('edit'); 112 $input->getLabel()->attr('class', 'block'); 113 $form->addHTML("<br>\n"); 114 } 115 116 $form->addButton('', $lang['btn_deleteuser'])->attr('type', 'submit'); 117 $form->addFieldsetClose(); 118 $form->addTagClose('div'); 119 120 print $form->toHTML('ProfileDelete'); 121 } 122 123 print '</div>'; 124 } 125 126 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body