XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
banner.php
Go to the documentation of this file.
1 <?php
2 /*
3  * Banners Class Manager
4  *
5  * You may not change or alter any portion of this comment or credits
6  * of supporting developers from this source code or any supporting source code
7  * which is considered copyrighted (c) material of the original comment or credit authors.
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  *
12  * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
13  * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
14  * @author Gregory Mage (AKA Mage)
15  * @package system
16  * @version $Id: banner.php 8066 2011-11-06 05:09:33Z beckmi $
17  */
18 
19 defined('XOOPS_ROOT_PATH') or die('XOOPS root path not defined');
20 
28 {
29  function __construct()
30  {
31  parent::__construct();
32  $this->initVar( 'bid', XOBJ_DTYPE_INT, null, false, 5 );
33  $this->initVar( 'cid', XOBJ_DTYPE_INT, null, false,3 );
34  $this->initVar( 'imptotal', XOBJ_DTYPE_INT, null, false, 8 );
35  $this->initVar( 'impmade', XOBJ_DTYPE_INT, null, false, 8 );
36  $this->initVar( 'clicks', XOBJ_DTYPE_INT, null, false, 8 );
37  $this->initVar( 'imageurl', XOBJ_DTYPE_TXTBOX, null, false );
38  $this->initVar( 'clickurl', XOBJ_DTYPE_TXTBOX, null, false );
39  $this->initVar( 'date', XOBJ_DTYPE_INT, null, false, 10 );
40  $this->initVar( 'htmlbanner', XOBJ_DTYPE_INT, null, false, 1 );
41  $this->initVar( 'htmlcode', XOBJ_DTYPE_TXTBOX, null, false );
42  // For allow HTML
43  //$this->initVar( 'dohtml', XOBJ_DTYPE_INT, 1, false);
44  }
45 
46  function getForm($action = false)
47  {
48  if ($action === false) {
49  $action = $_SERVER['REQUEST_URI'];
50  }
51 
52  $title = $this->isNew() ? sprintf( _AM_SYSTEM_BANNERS_ADDNWBNR ) : sprintf( _AM_SYSTEM_BANNERS_EDITBNR );
53 
54  xoops_load('XoopsFormLoader');
55 
56  $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
57 
58  $banner_client_Handler =& xoops_getModuleHandler('bannerclient', 'system');
59  $client_select = new XoopsFormSelect( _AM_SYSTEM_BANNERS_CLINAMET, 'cid', $this->getVar('cid') );
60  $client_select->addOptionArray($banner_client_Handler->getList());
61  $form->addElement($client_select, true);
62 
63  $form->addElement(new XoopsFormText( _AM_SYSTEM_BANNERS_IMPPURCHT, 'imptotal', 20, 255, $this->getVar('imptotal') ), true );
64  $form->addElement(new XoopsFormText( _AM_SYSTEM_BANNERS_IMGURLT, 'imageurl', 80, 255, $this->getVar('imageurl') ), false );
65  $form->addElement(new XoopsFormText( _AM_SYSTEM_BANNERS_CLICKURLT, 'clickurl', 80, 255, $this->getVar('clickurl') ), false );
66 
67  $htmlbanner = $this->isNew() ? 0 : $this->getVar('htmlbanner');
68  $form->addElement(new XoopsFormRadioYN( _AM_SYSTEM_BANNERS_USEHTML, 'htmlbanner', $htmlbanner, _YES, _NO) );
69 
70  $form->addElement(new xoopsFormTextArea( _AM_SYSTEM_BANNERS_CODEHTML, 'htmlcode', $this->getVar('htmlcode'), 5, 50), false );
71  if (!$this->isNew()) {
72  $form->addElement(new XoopsFormHidden( 'bid', $this->getVar('bid') ) );
73  }
74  $form->addElement(new XoopsFormHidden( 'op', 'banner_save' ) );
75  $form->addElement(new XoopsFormButton( '', 'submit', _SUBMIT, 'submit' ) );
76  //$form->display();
77  return $form;
78  }
79 }
80 
92 {
93  function __construct( $db )
94  {
95  parent::__construct( $db, 'banner', 'SystemBanner', 'bid', 'imageurl' );
96  }
97 }
98 
99 ?>