1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
16:
17:
18: include_once XOOPS_ROOT_PATH . '/kernel/user.php';
19:
20: 21: 22: 23: 24: 25:
26: class SystemUsers extends XoopsUser
27: {
28: 29: 30:
31: public function __construct()
32: {
33: parent::__construct();
34: }
35:
36: 37: 38:
39: public function getForm()
40: {
41: if ($this->isNew()) {
42: $blank_img = 'blank.gif';
43: } else {
44: $blank_img = $this->getVar('avatar_file', 'e');
45: }
46:
47:
48: $config_handler = xoops_getHandler('config');
49: $xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
50:
51: $form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', 'post', true);
52: $form->setExtra('enctype="multipart/form-data"');
53: $form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true);
54:
55: $maxpixel = '<div class="small basic italic">' . _US_MAXPIXEL . ' : ' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
56: $maxsize = '<div class="small basic italic">' . _US_MAXIMGSZ . ' : ' . $xoopsConfigUser['avatar_maxsize'] . '</div>';
57:
58: $uploadirectory_img = '';
59: $imgtray_img = new XoopsFormElementTray(_IMAGEFILE . '<br><br>' . $maxpixel . $maxsize, '<br>');
60: $imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH), 'avatar_file', $blank_img);
61: $image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH);
62: $imageselect_img->addOption("$blank_img", $blank_img);
63: foreach ($image_array_img as $image_img) {
64:
65: if (false !== strpos($image_img, 'avt')) {
66: $imageselect_img->addOption("$image_img", $image_img);
67: }
68: }
69: $imageselect_img->setExtra("onchange='showImgSelected(\"image_img\", \"avatar_file\", \"" . $uploadirectory_img . "\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
70: $imgtray_img->addElement($imageselect_img, false);
71: $imgtray_img->addElement(new XoopsFormLabel('', "<br><img src='" . XOOPS_UPLOAD_URL . '/' . $blank_img . "' name='image_img' id='image_img' alt='' />"));
72: $fileseltray_img = new XoopsFormElementTray('<br>', '<br><br>');
73: $fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false);
74: $imgtray_img->addElement($fileseltray_img);
75: $form->addElement($imgtray_img);
76:
77: $form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e')));
78: $form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO));
79: $form->addElement(new XoopsFormHidden('op', 'save'));
80: $form->addElement(new XoopsFormHidden('fct', 'avatars'));
81: $form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e')));
82: $form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit'));
83:
84: return $form;
85: }
86: }
87:
88: 89: 90: 91: 92: 93: 94: 95: 96: 97:
98: class SystemUsersHandler extends XoopsUserHandler
99: {
100: 101: 102:
103: public function __construct(XoopsDatabase $db)
104: {
105: parent::__construct($db);
106: $this->className = 'SystemUsers';
107: }
108: }
109: