public function __construct() { parent::__construct(); $this->_deprecated = icms_core_Debug::setDeprecated('icms_image_category_Object', sprintf(_CORE_REMOVE_IN_VERSION, '1.4')); }
/** * retrieve array of {@link icms_image_category_Object}s meeting certain conditions * @param object $criteria {@link icms_db_criteria_Element} with conditions for the image categories * @param bool $id_as_key should the image category's imgcat_id be the key for the returned array? * @return array {@link icms_image_category_Object}s matching the conditions **/ public function getObjects($criteria = null, $id_as_key = false) { $ret = array(); $limit = $start = 0; $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')"; if (isset($criteria) && is_subclass_of($criteria, 'icms_db_criteria_Element')) { $where = $criteria->render(); $sql .= $where != '' ? ' AND ' . $where : ''; $limit = $criteria->getLimit(); $start = $criteria->getStart(); } $sql .= ' ORDER BY imgcat_weight, imgcat_id ASC'; $result = $this->db->query($sql, $limit, $start); if (!$result) { return $ret; } while ($myrow = $this->db->fetchArray($result)) { $imgcat = new icms_image_category_Object(); $imgcat->assignVars($myrow); if (!$id_as_key) { $ret[] =& $imgcat; } else { $ret[$myrow['imgcat_id']] =& $imgcat; } unset($imgcat); } return $ret; }