19 defined(
'XOOPS_ROOT_PATH') or die('Restricted access');
45 function id($format =
'N')
47 return $this->getVar(
'imgsetimg_id', $format);
53 function imgsetimg_id($format =
'')
55 return $this->getVar(
'imgsetimg_id', $format);
61 function imgsetimg_file($format =
'')
63 return $this->getVar(
'imgsetimg_file', $format);
69 function imgsetimg_body($format =
'')
71 return $this->getVar(
'imgsetimg_body', $format);
77 function imgsetimg_imgset($format =
'')
79 return $this->getVar(
'imgsetimg_imgset', $format);
106 $imgsetimg->setNew();
123 $sql =
'SELECT * FROM ' . $this->db->prefix(
'imgsetimg') .
' WHERE imgsetimg_id=' . $id;
127 $numrows = $this->db->getRowsNum(
$result);
130 $imgsetimg->assignVars($this->db->fetchArray(
$result));
147 if (!is_a($imgsetimg,
'xoopsimagesetimg')) {
151 if (!$imgsetimg->isDirty()) {
154 if (!$imgsetimg->cleanVars()) {
157 foreach ($imgsetimg->cleanVars as $k => $v) {
160 if ($imgsetimg->isNew()) {
161 $imgsetimg_id = $this->db->genId(
'imgsetimg_imgsetimg_id_seq');
162 $sql = sprintf(
"INSERT INTO %s (imgsetimg_id, imgsetimg_file, imgsetimg_body, imgsetimg_imgset) VALUES (%u, %s, %s, %s)", $this->db->prefix(
'imgsetimg'), $imgsetimg_id, $this->db->quoteString($imgsetimg_file), $this->db->quoteString($imgsetimg_body), $this->db->quoteString($imgsetimg_imgset));
164 $sql = sprintf(
"UPDATE %s SET imgsetimg_file = %s, imgsetimg_body = %s, imgsetimg_imgset = %s WHERE imgsetimg_id = %u", $this->db->prefix(
'imgsetimg'), $this->db->quoteString($imgsetimg_file), $this->db->quoteString($imgsetimg_body), $this->db->quoteString($imgsetimg_imgset), $imgsetimg_id);
169 if (empty($imgsetimg_id)) {
170 $imgsetimg_id = $this->db->getInsertId();
172 $imgsetimg->assignVar(
'imgsetimg_id', $imgsetimg_id);
182 function delete(&$imgsetimg)
187 if (!is_a($imgsetimg,
'xoopsimagesetimg')) {
191 $sql = sprintf(
"DELETE FROM %s WHERE imgsetimg_id = %u", $this->db->prefix(
'imgsetimg'), $imgsetimg->getVar(
'imgsetimg_id'));
210 $sql =
'SELECT DISTINCT i.* FROM ' . $this->db->prefix(
'imgsetimg') .
' i LEFT JOIN ' . $this->db->prefix(
'imgset_tplset_link') .
' l ON l.imgset_id=i.imgsetimg_imgset LEFT JOIN ' . $this->db->prefix(
'imgset') .
' s ON s.imgset_id=l.imgset_id';
221 while ($myrow = $this->db->fetchArray(
$result)) {
223 $imgsetimg->assignVars($myrow);
225 $ret[] =& $imgsetimg;
227 $ret[$myrow[
'imgsetimg_id']] =& $imgsetimg;
242 $sql =
'SELECT COUNT(i.imgsetimg_id) FROM ' . $this->db->prefix(
'imgsetimg') .
' i LEFT JOIN ' . $this->db->prefix(
'imgset_tplset_link') .
' l ON l.imgset_id=i.imgsetimg_imgset';
244 $sql .=
' ' .
$criteria->renderWhere() .
' GROUP BY i.imgsetimg_id';
249 list ($count) = $this->db->fetchRow(
$result);
262 return $this->
getObjects(
new Criteria(
'imgsetimg_imgset', intval($imgset_id)), $id_as_key);