19 defined(
'XOOPS_ROOT_PATH') or die('Restricted access');
58 function id($format =
'N')
60 return $this->getVar(
'imgcat_id', $format);
66 function imgcat_id($format =
'')
68 return $this->getVar(
'imgcat_id', $format);
74 function imgcat_name($format =
'')
76 return $this->getVar(
'imgcat_name', $format);
82 function imgcat_display($format =
'')
84 return $this->getVar(
'imgcat_display', $format);
90 function imgcat_weight($format =
'')
92 return $this->getVar(
'imgcat_weight', $format);
98 function imgcat_maxsize($format =
'')
100 return $this->getVar(
'imgcat_maxsize', $format);
106 function imgcat_maxwidth($format =
'')
108 return $this->getVar(
'imgcat_maxwidth', $format);
114 function imgcat_maxheight($format =
'')
116 return $this->getVar(
'imgcat_maxheight', $format);
122 function imgcat_type($format =
'')
124 return $this->getVar(
'imgcat_type', $format);
130 function imgcat_storetype($format =
'')
132 return $this->getVar(
'imgcat_storetype', $format);
140 function setImageCount($value)
142 $this->_imageCount = intval($value);
150 function getImageCount()
152 return $this->_imageCount;
195 $sql =
'SELECT * FROM ' . $this->db->prefix(
'imagecategory') .
' WHERE imgcat_id=' . $id;
199 $numrows = $this->db->getRowsNum(
$result);
202 $imgcat->assignVars($this->db->fetchArray(
$result));
219 if (!is_a($imgcat,
'xoopsimagecategory')) {
223 if (!$imgcat->isDirty()) {
226 if (!$imgcat->cleanVars()) {
229 foreach ($imgcat->cleanVars as $k => $v) {
232 if ($imgcat->isNew()) {
233 $imgcat_id = $this->db->genId(
'imgcat_imgcat_id_seq');
234 $sql = sprintf(
"INSERT INTO %s (imgcat_id, imgcat_name, imgcat_display, imgcat_weight, imgcat_maxsize, imgcat_maxwidth, imgcat_maxheight, imgcat_type, imgcat_storetype) VALUES (%u, %s, %u, %u, %u, %u, %u, %s, %s)", $this->db->prefix(
'imagecategory'), $imgcat_id, $this->db->quoteString($imgcat_name), $imgcat_display, $imgcat_weight, $imgcat_maxsize, $imgcat_maxwidth, $imgcat_maxheight, $this->db->quoteString($imgcat_type), $this->db->quoteString($imgcat_storetype));
236 $sql = sprintf(
"UPDATE %s SET imgcat_name = %s, imgcat_display = %u, imgcat_weight = %u, imgcat_maxsize = %u, imgcat_maxwidth = %u, imgcat_maxheight = %u, imgcat_type = %s WHERE imgcat_id = %u", $this->db->prefix(
'imagecategory'), $this->db->quoteString($imgcat_name), $imgcat_display, $imgcat_weight, $imgcat_maxsize, $imgcat_maxwidth, $imgcat_maxheight, $this->db->quoteString($imgcat_type), $imgcat_id);
241 if (empty($imgcat_id)) {
242 $imgcat_id = $this->db->getInsertId();
244 $imgcat->assignVar(
'imgcat_id', $imgcat_id);
254 function delete(&$imgcat)
259 if (!is_a($imgcat,
'xoopsimagecategory')) {
263 $sql = sprintf(
"DELETE FROM %s WHERE imgcat_id = %u", $this->db->prefix(
'imagecategory'), $imgcat->getVar(
'imgcat_id'));
281 $sql =
'SELECT DISTINCT c.* FROM ' . $this->db->prefix(
'imagecategory') .
' c LEFT JOIN ' . $this->db->prefix(
'group_permission') .
" l ON l.gperm_itemid=c.imgcat_id WHERE (l.gperm_name = 'imgcat_read' OR l.gperm_name = 'imgcat_write')";
284 $sql .= ($where !=
'') ?
' AND ' . $where :
'';
288 $sql .=
' ORDER BY imgcat_weight, imgcat_id ASC';
293 while ($myrow = $this->db->fetchArray(
$result)) {
295 $imgcat->assignVars($myrow);
299 $ret[$myrow[
'imgcat_id']] =& $imgcat;
314 $sql =
'SELECT COUNT(*) FROM ' . $this->db->prefix(
'imagecategory') .
' i LEFT JOIN ' . $this->db->prefix(
'group_permission') .
" l ON l.gperm_itemid=i.imgcat_id WHERE (l.gperm_name = 'imgcat_read' OR l.gperm_name = 'imgcat_write')";
317 $sql .= ($where !=
'') ?
' AND ' . $where :
'';
322 list ($count) = $this->db->fetchRow(
$result);
333 function getList(
$groups = array(), $perm =
'imgcat_read', $display = null, $storetype = null)
339 $criteriaTray->add(
new Criteria(
'gperm_groupid', $gid),
'OR');
342 if ($perm ==
'imgcat_read' || $perm ==
'imgcat_write') {
347 if (isset($display)) {
350 if (isset($storetype)) {
355 foreach (array_keys($categories) as
$i) {
356 $ret[
$i] = $categories[
$i]->getVar(
'imgcat_name');