XOOPS  2.6.0
tplset.php
Go to the documentation of this file.
1 <?php
24 
32 class XoopsTplset extends XoopsObject
33 {
34 
38  public function __construct()
39  {
40  $this->initVar('tplset_id', XOBJ_DTYPE_INT, null, false);
41  $this->initVar('tplset_name', XOBJ_DTYPE_OTHER, null, false);
42  $this->initVar('tplset_desc', XOBJ_DTYPE_TXTBOX, null, false, 255);
43  $this->initVar('tplset_credits', XOBJ_DTYPE_TXTAREA, null, false);
44  $this->initVar('tplset_created', XOBJ_DTYPE_INT, 0, false);
45  }
46 
51  public function id($format = 'n')
52  {
53  return $this->getVar('tplset_id', $format);
54  }
55 
60  public function tplset_id($format = '')
61  {
62  return $this->getVar('tplset_id', $format);
63  }
64 
69  public function tplset_name($format = '')
70  {
71  return $this->getVar('tplset_name', $format);
72  }
73 
78  public function tplset_desc($format = '')
79  {
80  return $this->getVar('tplset_desc', $format);
81  }
82 
87  public function tplset_credits($format = '')
88  {
89  return $this->getVar('tplset_credits', $format);
90  }
91 
96  public function tplset_created($format = '')
97  {
98  return $this->getVar('tplset_created', $format);
99  }
100 }
101 
110 {
111 
117  public function __construct(Connection $db = null)
118  {
119  parent::__construct($db, 'tplset', 'XoopsTplset', 'tplset_id', 'tplset_name');
120  }
121 
129  public function getByName($tplset_name)
130  {
131  $qb = $this->db2->createXoopsQueryBuilder();
132  $eb = $qb->expr();
133 
134  $tplset = false;
135  $tplset_name = trim($tplset_name);
136  if ($tplset_name != '') {
137  $qb->select('*')
138  ->fromPrefix('tplset', null)
139  ->where($eb->eq('tplset_name', ':tplsetname'))
140  ->setParameter(':tplsetname', $tplset_name, \PDO::PARAM_STR);
141  $result = $qb->execute();
142  if (!$result) {
143  return false;
144  }
145  $allrows = $result->fetchAll();
146  if (count($allrows) == 1) {
147  $tplset = new XoopsTplset();
148  $tplset->assignVars(reset($allrows));
149  }
150  }
151  return $tplset;
152  }
153 
161  public function getNameList(CriteriaElement $criteria = null)
162  {
163  $ret = array();
164  $tplsets = $this->getObjects($criteria, true);
165  foreach (array_keys($tplsets) as $i) {
166  $ret[$tplsets[$i]->getVar('tplset_name')] = $tplsets[$i]->getVar('tplset_name');
167  }
168  return $ret;
169  }
170 }
id($format= 'n')
Definition: tplset.php:51
getNameList(CriteriaElement $criteria=null)
Definition: tplset.php:161
$i
Definition: dialog.php:68
$result
Definition: pda.php:33
tplset_desc($format= '')
Definition: tplset.php:78
tplset_name($format= '')
Definition: tplset.php:69
getVar($key, $format= 's')
tplset_id($format= '')
Definition: tplset.php:60
__construct()
Definition: tplset.php:38
tplset_credits($format= '')
Definition: tplset.php:87
tplset_created($format= '')
Definition: tplset.php:96
getObjects(CriteriaElement $criteria=null, $id_as_key=false, $as_object=true)
getByName($tplset_name)
Definition: tplset.php:129
const XOBJ_DTYPE_TXTAREA
Definition: XoopsObject.php:21
__construct(Connection $db=null)
Definition: tplset.php:117
$criteria
initVar($key, $data_type, $value=null, $required=false, $maxlength=null, $options= '')