XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
users.php
Go to the documentation of this file.
1 <?php
17 defined('XOOPS_ROOT_PATH') or die('Restricted access');
18 
19 include_once XOOPS_ROOT_PATH . '/kernel/user.php';
20 
27 class SystemUsers extends XoopsUser
28 {
29  function __construct()
30  {
31  parent::__construct();
32  }
33 
34  function getForm()
35  {
36  if ($this->isNew()) {
37  $blank_img = 'blank.gif';
38  } else {
39  $blank_img = $this->getVar('avatar_file', 'e');
40  }
41  // Get User Config
42  $config_handler =& xoops_gethandler('config');
44 
45  $form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', "post", true);
46  $form->setExtra('enctype="multipart/form-data"');
47  $form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true);
48 
49  $maxpixel = '<div class="small basic italic">' . _US_MAXPIXEL . '&nbsp;:&nbsp;' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
50  $maxsize = '<div class="small basic italic">' . _US_MAXIMGSZ . '&nbsp;:&nbsp;' . $xoopsConfigUser['avatar_maxsize'] . '</div>';
51 
52  $uploadirectory_img = '';
53  $imgtray_img = new XoopsFormElementTray(_IMAGEFILE . '<br /><br />' . $maxpixel . $maxsize, '<br />');
54  $imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH), 'avatar_file', $blank_img);
55  $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH);
56  $imageselect_img->addOption("$blank_img", $blank_img);
57  foreach ($image_array_img as $image_img) {
58  if (preg_match('#avt#', $image_img)) {
59  $imageselect_img->addOption("$image_img", $image_img);
60  }
61  }
62  $imageselect_img->setExtra("onchange='showImgSelected(\"image_img\", \"avatar_file\", \"".$uploadirectory_img."\", \"\", \"".XOOPS_UPLOAD_URL."\")'");
63  $imgtray_img->addElement($imageselect_img, false);
64  $imgtray_img->addElement(new XoopsFormLabel('', "<br /><img src='" . XOOPS_UPLOAD_URL . "/" . $blank_img . "' name='image_img' id='image_img' alt='' />"));
65  $fileseltray_img = new XoopsFormElementTray('<br />','<br /><br />');
66  $fileseltray_img->addElement(new XoopsFormFile( _AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false);
67  $imgtray_img->addElement($fileseltray_img);
68  $form->addElement($imgtray_img);
69 
70  $form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e')));
71  $form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO));
72  $form->addElement(new XoopsFormHidden('op', 'save'));
73  $form->addElement(new XoopsFormHidden('fct', 'avatars'));
74  $form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e')));
75  $form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit'));
76 
77  return $form;
78  }
79 
80 }
81 
93 {
94  function __construct($db)
95  {
96  parent::__construct($db);
97  $this->className = 'SystemUsers';
98  }
99 
100 }
101 
102 ?>