1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16:
17:
18:
19:
20: 21: 22: 23: 24: 25:
26:
27: class SystemBanner extends XoopsObject
28: {
29: 30: 31:
32: public function __construct()
33: {
34: parent::__construct();
35: $this->initVar('bid', XOBJ_DTYPE_INT, null, false, 5);
36: $this->initVar('cid', XOBJ_DTYPE_INT, null, false, 3);
37: $this->initVar('imptotal', XOBJ_DTYPE_INT, null, false, 8);
38: $this->initVar('impmade', XOBJ_DTYPE_INT, null, false, 8);
39: $this->initVar('clicks', XOBJ_DTYPE_INT, null, false, 8);
40: $this->initVar('imageurl', XOBJ_DTYPE_TXTBOX, null, false);
41: $this->initVar('clickurl', XOBJ_DTYPE_TXTBOX, null, false);
42: $this->initVar('date', XOBJ_DTYPE_INT, null, false, 10);
43: $this->initVar('htmlbanner', XOBJ_DTYPE_INT, null, false, 1);
44: $this->initVar('htmlcode', XOBJ_DTYPE_TXTBOX, null, false);
45:
46:
47: }
48:
49: 50: 51: 52: 53:
54: public function getForm($action = false)
55: {
56: if ($action === false) {
57: $action = $_SERVER['REQUEST_URI'];
58: }
59:
60: $title = $this->isNew() ? sprintf(_AM_SYSTEM_BANNERS_ADDNWBNR) : sprintf(_AM_SYSTEM_BANNERS_EDITBNR);
61:
62: xoops_load('XoopsFormLoader');
63:
64: $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
65:
66: $banner_client_Handler = xoops_getModuleHandler('bannerclient', 'system');
67: $client_select = new XoopsFormSelect(_AM_SYSTEM_BANNERS_CLINAMET, 'cid', $this->getVar('cid'));
68: $client_select->addOptionArray($banner_client_Handler->getList());
69: $form->addElement($client_select, true);
70:
71: $form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_IMPPURCHT, 'imptotal', 20, 255, $this->getVar('imptotal')), true);
72: $form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_IMGURLT, 'imageurl', 80, 255, $this->getVar('imageurl')), false);
73: $form->addElement(new XoopsFormText(_AM_SYSTEM_BANNERS_CLICKURLT, 'clickurl', 80, 255, $this->getVar('clickurl')), false);
74:
75: $htmlbanner = $this->isNew() ? 0 : $this->getVar('htmlbanner');
76: $form->addElement(new XoopsFormRadioYN(_AM_SYSTEM_BANNERS_USEHTML, 'htmlbanner', $htmlbanner, _YES, _NO));
77:
78: $form->addElement(new xoopsFormTextArea(_AM_SYSTEM_BANNERS_CODEHTML, 'htmlcode', $this->getVar('htmlcode'), 5, 50), false);
79: if (!$this->isNew()) {
80: $form->addElement(new XoopsFormHidden('bid', $this->getVar('bid')));
81: }
82: $form->addElement(new XoopsFormHidden('op', 'banner_save'));
83: $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
84:
85:
86: return $form;
87: }
88: }
89:
90: 91: 92: 93: 94: 95: 96: 97: 98: 99:
100: class SystemBannerHandler extends XoopsPersistableObjectHandler
101: {
102: 103: 104:
105: public function __construct($db)
106: {
107: parent::__construct($db, 'banner', 'SystemBanner', 'bid', 'imageurl');
108: }
109: }
110: