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