20 defined(
'XOOPS_ROOT_PATH') or die('Restricted access');
48 function id($format =
'N')
50 return $this->getVar(
'tplset_id', $format);
56 function tplset_id($format =
'')
58 return $this->getVar(
'tplset_id', $format);
64 function tplset_name($format =
'')
66 return $this->getVar(
'tplset_name', $format);
72 function tplset_desc($format =
'')
74 return $this->getVar(
'tplset_desc', $format);
80 function tplset_credits($format =
'')
82 return $this->getVar(
'tplset_credits', $format);
88 function tplset_created($format =
'')
90 return $this->getVar(
'tplset_created', $format);
132 $sql =
'SELECT * FROM ' . $this->db->prefix(
'tplset') .
' WHERE tplset_id=' . $id;
136 $numrows = $this->db->getRowsNum(
$result);
139 $tplset->assignVars($this->db->fetchArray(
$result));
155 $tplset_name = trim($tplset_name);
156 if ($tplset_name !=
'') {
157 $sql =
'SELECT * FROM ' . $this->db->prefix(
'tplset') .
' WHERE tplset_name=' . $this->db->quoteString($tplset_name);
161 $numrows = $this->db->getRowsNum(
$result);
164 $tplset->assignVars($this->db->fetchArray(
$result));
181 if (!is_a($tplset,
'xoopstplset')) {
184 if (!$tplset->isDirty()) {
187 if (!$tplset->cleanVars()) {
190 foreach ($tplset->cleanVars as $k => $v) {
193 if ($tplset->isNew()) {
194 $tplset_id = $this->db->genId(
'tplset_tplset_id_seq');
195 $sql = sprintf(
"INSERT INTO %s (tplset_id, tplset_name, tplset_desc, tplset_credits, tplset_created) VALUES (%u, %s, %s, %s, %u)", $this->db->prefix(
'tplset'), $tplset_id, $this->db->quoteString($tplset_name), $this->db->quoteString($tplset_desc), $this->db->quoteString($tplset_credits), $tplset_created);
197 $sql = sprintf(
"UPDATE %s SET tplset_name = %s, tplset_desc = %s, tplset_credits = %s, tplset_created = %u WHERE tplset_id = %u", $this->db->prefix(
'tplset'), $this->db->quoteString($tplset_name), $this->db->quoteString($tplset_desc), $this->db->quoteString($tplset_credits), $tplset_created, $tplset_id);
202 if (empty($tplset_id)) {
203 $tplset_id = $this->db->getInsertId();
205 $tplset->assignVar(
'tplset_id', $tplset_id);
215 function delete(&$tplset)
220 if (!is_a($tplset,
'xoopstplset')) {
223 $sql = sprintf(
"DELETE FROM %s WHERE tplset_id = %u", $this->db->prefix(
'tplset'), $tplset->getVar(
'tplset_id'));
227 $sql = sprintf(
"DELETE FROM %s WHERE tplset_name = %s", $this->db->prefix(
'imgset_tplset_link'), $this->db->quoteString($tplset->getVar(
'tplset_name')));
228 $this->db->query(
$sql);
243 $sql =
'SELECT * FROM ' . $this->db->prefix(
'tplset');
245 $sql .=
' ' .
$criteria->renderWhere() .
' ORDER BY tplset_id';
253 while ($myrow = $this->db->fetchArray(
$result)) {
255 $tplset->assignVars($myrow);
259 $ret[$myrow[
'tplset_id']] =& $tplset;
274 $sql =
'SELECT COUNT(*) FROM ' . $this->db->prefix(
'tplset');
281 list ($count) = $this->db->fetchRow(
$result);
295 foreach(array_keys($tplsets) as
$i) {
296 $ret[$tplsets[
$i]->getVar(
'tplset_name')] = $tplsets[
$i]->getVar(
'tplset_name');