XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
category.php
Go to the documentation of this file.
1 <?php
21 defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined");
22 
28 {
29  function __construct()
30  {
31  $this->initVar('cat_id', XOBJ_DTYPE_INT, null, true);
32  $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX);
33  $this->initVar('cat_description', XOBJ_DTYPE_TXTAREA);
34  $this->initVar('cat_weight', XOBJ_DTYPE_INT);
35  }
36 
37  function ProfileCategory()
38  {
39  $this->__construct();
40  }
41 
49  function getForm($action = false)
50  {
51  if ($action === false) {
52  $action = $_SERVER['REQUEST_URI'];
53  }
54  $title = $this->isNew() ? sprintf(_PROFILE_AM_ADD, _PROFILE_AM_CATEGORY) : sprintf(_PROFILE_AM_EDIT, _PROFILE_AM_CATEGORY);
55 
56  include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
57 
58  $form = new XoopsThemeForm($title, 'form', $action, 'post', true);
59  $form->addElement(new XoopsFormText(_PROFILE_AM_TITLE, 'cat_title', 35, 255, $this->getVar('cat_title')));
60  if (!$this->isNew()) {
61  //Load groups
62  $form->addElement(new XoopsFormHidden('id', $this->getVar('cat_id')));
63  }
64  $form->addElement(new XoopsFormTextArea(_PROFILE_AM_DESCRIPTION, 'cat_description', $this->getVar('cat_description', 'e')));
65  $form->addElement(new XoopsFormText(_PROFILE_AM_WEIGHT, 'cat_weight', 35, 35, $this->getVar('cat_weight', 'e')));
66 
67  $form->addElement(new XoopsFormHidden('op', 'save') );
68  $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
69 
70  return $form;
71  }
72 }
73 
79 {
81  {
82  $this->__construct($db);
83  }
84 
85  function __construct(&$db)
86  {
87  parent::__construct($db, "profile_category", "profilecategory", "cat_id", 'cat_title');
88  }
89 }
90 ?>