1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: 13: 14: 15: 16: 17: 18: 19: 20: 21:
22:
23: class BannersBannerclientForm extends Xoops\Form\ThemeForm
24: {
25: 26: 27:
28: public function __construct(BannersBannerClient $obj)
29: {
30: $title = $obj->isNew() ? sprintf(_AM_BANNERS_CLIENTS_ADD) : sprintf(_AM_BANNERS_CLIENTS_EDIT);
31:
32: parent::__construct($title, 'form', 'clients.php', 'post', true);
33:
34: $this->addElement(new Xoops\Form\Text(_AM_BANNERS_CLIENTS_NAME, 'name', 5, 255, $obj->getVar('bannerclient_name')), true);
35:
36: if ($obj->isNew()) {
37: $user = 'N';
38: } else {
39: if ($obj->getVar('bannerclient_uid') == 0) {
40: $user = 'N';
41: } else {
42: $user = 'Y';
43: }
44: }
45: $uname = new Xoops\Form\ElementTray(_AM_BANNERS_CLIENTS_UNAME, '');
46: $type = new Xoops\Form\Radio('', 'user', $user);
47: $options = array('N' =>_AM_BANNERS_CLIENTS_UNAME_NO, 'Y' => _AM_BANNERS_CLIENTS_UNAME_YES);
48: $type->addOptionArray($options);
49: $uname->addElement($type);
50: $uname->addElement(new Xoops\Form\SelectUser('', 'uid', false, $obj->getVar('bannerclient_uid'), 1, false));
51: $this->addElement($uname);
52: $this->addElement(new Xoops\Form\TextArea(_AM_BANNERS_CLIENTS_EXTRAINFO, 'extrainfo', $obj->getVar('bannerclient_extrainfo'), 5, 5), false);
53: if (!$obj->isNew()) {
54: $this->addElement(new Xoops\Form\Hidden('cid', $obj->getVar('bannerclient_cid')));
55: }
56: $this->addElement(new Xoops\Form\Hidden('op', 'save'));
57: $this->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
58: }
59: }
60: