home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / CMS / xoops-2.0.18.1.exe / xoops-2.0.18.1 / htdocs / modules / system / admin / users / userform.php < prev    next >
Encoding:
PHP Script  |  2007-11-02  |  9.8 KB  |  181 lines

  1. <?php
  2. // $Id: userform.php 1137 2007-11-01 23:41:51Z dugris $
  3. //  ------------------------------------------------------------------------ //
  4. //                XOOPS - PHP Content Management System                      //
  5. //                    Copyright (c) 2000 XOOPS.org                           //
  6. //                       <http://www.xoops.org/>                             //
  7. //  ------------------------------------------------------------------------ //
  8. //  This program is free software; you can redistribute it and/or modify     //
  9. //  it under the terms of the GNU General Public License as published by     //
  10. //  the Free Software Foundation; either version 2 of the License, or        //
  11. //  (at your option) any later version.                                      //
  12. //                                                                           //
  13. //  You may not change or alter any portion of this comment or credits       //
  14. //  of supporting developers from this source code or any supporting         //
  15. //  source code which is considered copyrighted (c) material of the          //
  16. //  original comment or credit authors.                                      //
  17. //                                                                           //
  18. //  This program is distributed in the hope that it will be useful,          //
  19. //  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
  20. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
  21. //  GNU General Public License for more details.                             //
  22. //                                                                           //
  23. //  You should have received a copy of the GNU General Public License        //
  24. //  along with this program; if not, write to the Free Software              //
  25. //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
  26. //  ------------------------------------------------------------------------ //
  27. // Author: Kazumi Ono (AKA onokazu)                                          //
  28. // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
  29. // Project: The XOOPS Project                                                //
  30. // ------------------------------------------------------------------------- //
  31.  
  32. $uid_label = new XoopsFormLabel(_AM_USERID, $uid_value);
  33. $uname_text = new XoopsFormText(_AM_NICKNAME, "username", 25, 25, $uname_value);
  34. $name_text = new XoopsFormText(_AM_NAME, "name", 30, 60, $name_value);
  35. $email_tray = new XoopsFormElementTray(_AM_EMAIL, "<br />");
  36. $email_text = new XoopsFormText("", "email", 30, 60, $email_value);
  37. $email_tray->addElement($email_text, true);
  38. $email_cbox = new XoopsFormCheckBox("", "user_viewemail", $email_cbox_value);
  39. $email_cbox->addOption(1, _AM_AOUTVTEAD);
  40. $email_tray->addElement($email_cbox);
  41. $url_text = new XoopsFormText(_AM_URL, "url", 30, 100, $url_value);
  42. //  $avatar_select = new XoopsFormSelect("", "user_avatar", $avatar_value);
  43. //  $avatar_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/images/avatar/");
  44. //  $avatar_select->addOptionArray($avatar_array);
  45. //  $a_dirlist = XoopsLists::getDirListAsArray(XOOPS_ROOT_PATH."/images/avatar/");
  46. //  $a_dir_labels = array();
  47. //  $a_count = 0;
  48. //  $a_dir_link = "<a href=\"javascript:openWithSelfMain('".XOOPS_URL."/misc.php?action=showpopups&type=avatars&start=".$a_count."','avatars',600,400);\">XOOPS</a>";
  49. //  $a_count = $a_count + count($avatar_array);
  50. //  $a_dir_labels[] = new XoopsFormLabel("", $a_dir_link);
  51. //  foreach ($a_dirlist as $a_dir) {
  52. //      if ( $a_dir == "users" ) {
  53. //          continue;
  54. //      }
  55. //      $avatars_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/images/avatar/".$a_dir."/", $a_dir."/");
  56. //      $avatar_select->addOptionArray($avatars_array);
  57. //      $a_dir_link = "<a href=\"javascript:openWithSelfMain('".XOOPS_URL."/misc.php?action=showpopups&type=avatars&subdir=".$a_dir."&start=".$a_count."','avatars',600,400);\">".$a_dir."</a>";
  58. //      $a_dir_labels[] = new XoopsFormLabel("", $a_dir_link);
  59. //      $a_count = $a_count + count($avatars_array);
  60. //  }
  61. //  if (!empty($uid_value)) {
  62. //      $myavatar = avatarExists($uid_value);
  63. //      if ( $myavatar != false ) {
  64. //          $avatar_select->addOption($myavatar, _US_MYAVATAR);
  65. //      }
  66. //  }
  67. //  $avatar_select->setExtra("onchange='showImgSelected(\"avatar\", \"user_avatar\", \"images/avatar\", \"\", \"".XOOPS_URL."\")'");
  68. //  $avatar_label = new XoopsFormLabel("", "<img src='".XOOPS_URL."/images/avatar/".$avatar_value."' name='avatar' id='avatar' alt='' />");
  69. //  $avatar_tray = new XoopsFormElementTray(_AM_AVATAR, " ");
  70. //  $avatar_tray->addElement($avatar_select);
  71. //  $avatar_tray->addElement($avatar_label);
  72. //  foreach ($a_dir_labels as $a_dir_label) {
  73. //      $avatar_tray->addElement($a_dir_label);
  74. //  }
  75. //  $theme_select = new XoopsFormSelectTheme(_AM_THEME, "theme", $theme_value);
  76. $timezone_select = new XoopsFormSelectTimezone(_US_TIMEZONE, "timezone_offset", $timezone_value);
  77. $icq_text = new XoopsFormText(_AM_ICQ, "user_icq", 15, 15, $icq_value);
  78. $aim_text = new XoopsFormText(_AM_AIM, "user_aim", 18, 18, $aim_value);
  79. $yim_text = new XoopsFormText(_AM_YIM, "user_yim", 25, 25, $yim_value);
  80. $msnm_text = new XoopsFormText(_AM_MSNM, "user_msnm", 30, 100, $msnm_value);
  81. $location_text = new XoopsFormText(_AM_LOCATION, "user_from", 30, 100, $location_value);
  82. $occupation_text = new XoopsFormText(_AM_OCCUPATION, "user_occ", 30, 100, $occ_value);
  83. $interest_text = new XoopsFormText(_AM_INTEREST, "user_intrest", 30, 150, $interest_value);
  84. $sig_tray = new XoopsFormElementTray(_AM_SIGNATURE, "<br />");
  85. $sig_tarea = new XoopsFormTextArea("", "user_sig", $sig_value);
  86. $sig_tray->addElement($sig_tarea);
  87. $sig_cbox = new XoopsFormCheckBox("", "attachsig", $sig_cbox_value);
  88. $sig_cbox->addOption(1, _US_SHOWSIG);
  89. $sig_tray->addElement($sig_cbox);
  90. $umode_select = new XoopsFormSelect(_US_CDISPLAYMODE, "umode", $umode_value);
  91. $umode_select->addOptionArray(array("nest"=>_NESTED, "flat"=>_FLAT, "thread"=>_THREADED));
  92. $uorder_select = new XoopsFormSelect(_US_CSORTORDER, "uorder", $uorder_value);
  93. $uorder_select->addOptionArray(array("0"=>_OLDESTFIRST, "1"=>_NEWESTFIRST));
  94. // RMV-NOTIFY
  95. include_once XOOPS_ROOT_PATH. '/language/' . $xoopsConfig['language'] . '/notification.php';
  96. include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
  97. $notify_method_select = new XoopsFormSelect(_NOT_NOTIFYMETHOD, 'notify_method', $notify_method_value);
  98. $notify_method_select->addOptionArray(array(XOOPS_NOTIFICATION_METHOD_DISABLE=>_NOT_METHOD_DISABLE, XOOPS_NOTIFICATION_METHOD_PM=>_NOT_METHOD_PM, XOOPS_NOTIFICATION_METHOD_EMAIL=>_NOT_METHOD_EMAIL));
  99. $notify_mode_select = new XoopsFormSelect(_NOT_NOTIFYMODE, 'notify_mode', $notify_mode_value);
  100. $notify_mode_select->addOptionArray(array(XOOPS_NOTIFICATION_MODE_SENDALWAYS=>_NOT_MODE_SENDALWAYS, XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE=>_NOT_MODE_SENDONCE, XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT=>_NOT_MODE_SENDONCEPERLOGIN));
  101. $bio_tarea = new XoopsFormTextArea(_US_EXTRAINFO, "bio", $bio_value);
  102. $rank_select = new XoopsFormSelect(_AM_RANK, "rank", $rank_value);
  103. $ranklist = XoopsLists::getUserRankList();
  104. if ( count($ranklist) > 0 ) {
  105.     $rank_select->addOption(0, "--------------");
  106.     $rank_select->addOptionArray($ranklist);
  107. } else {
  108.     $rank_select->addOption(0, _AM_NSRID);
  109. }
  110. $pwd_text = new XoopsFormPassword(_AM_PASSWORD, "password", 10, 32);
  111. $pwd_text2 = new XoopsFormPassword(_AM_RETYPEPD, "pass2", 10, 32);
  112. $mailok_radio = new XoopsFormRadioYN(_US_MAILOK, 'user_mailok', $mailok_value);
  113.  
  114. // Groups administration addition XOOPS 2.0.9: Mith
  115. global $xoopsUser;
  116. $gperm_handler =& xoops_gethandler('groupperm');
  117. //If user has admin rights on groups
  118. if ($gperm_handler->checkRight("system_admin", XOOPS_SYSTEM_GROUP, $xoopsUser->getGroups(), 1)) {
  119.     //add group selection
  120.     $group_select[] = new XoopsFormSelectGroup(_US_GROUPS, 'groups', false, $groups, 5, true);
  121. }
  122. else {
  123.     //add each user groups
  124.     foreach ($groups as $key => $group) {
  125.         $group_select[] = new XoopsFormHidden('groups[' . $key . ']', $group);
  126.     }
  127. }
  128.  
  129. $fct_hidden = new XoopsFormHidden("fct", "users");
  130. $op_hidden = new XoopsFormHidden("op", $op_value);
  131. $submit_button = new XoopsFormButton("", "submit", _SUBMIT, "submit");
  132.  
  133. $form = new XoopsThemeForm($form_title, "userinfo", "admin.php", "post", true);
  134. $form->addElement($uname_text, true);
  135. $form->addElement($name_text);
  136. $form->addElement($email_tray, true);
  137. $form->addElement($url_text);
  138. //  $form->addElement($avatar_tray);
  139. //  $form->addElement($theme_select);
  140. $form->addElement($timezone_select);
  141. $form->addElement($icq_text);
  142. $form->addElement($aim_text);
  143. $form->addElement($yim_text);
  144. $form->addElement($msnm_text);
  145. $form->addElement($location_text);
  146. $form->addElement($occupation_text);
  147. $form->addElement($interest_text);
  148. $form->addElement($sig_tray);
  149. $form->addElement($umode_select);
  150. $form->addElement($uorder_select);
  151. // RMV-NOTIFY
  152. $form->addElement($notify_method_select);
  153. $form->addElement($notify_mode_select);
  154. $form->addElement($bio_tarea);
  155. $form->addElement($rank_select);
  156. // adding a new user requires password fields
  157. if (!$form_isedit) {
  158.     $form->addElement($pwd_text, true);
  159.     $form->addElement($pwd_text2, true);
  160. } else {
  161.     $form->addElement($pwd_text);
  162.     $form->addElement($pwd_text2);
  163. }
  164. $form->addElement($mailok_radio);
  165.  
  166. foreach ($group_select as $group) {
  167.     $form->addElement($group);
  168.     unset($group);
  169. }
  170.  
  171. $form->addElement($fct_hidden);
  172. $form->addElement($op_hidden);
  173. $form->addElement($submit_button);
  174. if ( !empty($uid_value) ) {
  175.     $uid_hidden = new XoopsFormHidden("uid", $uid_value);
  176.     $form->addElement($uid_hidden);
  177. }
  178. //$form->setRequired($uname_text);
  179. //$form->setRequired($email_text);
  180. $form->display();
  181. ?>