public function __construct() { parent::__construct(); $this->_deprecated = icms_core_Debug::setDeprecated('icms_image_Object', sprintf(_CORE_REMOVE_IN_VERSION, '1.4')); }
/** * Load {@link icms_image_Object}s from the database * * @param object $criteria {@link icms_db_criteria_Element} * @param boolean $id_as_key Use the ID as key into the array * @param boolean $getbinary * @return array Array of {@link icms_image_Object} objects **/ public function getObjects($criteria = null, $id_as_key = false, $getbinary = false) { $ret = array(); $limit = $start = 0; if ($getbinary) { $sql = "SELECT i.*, b.image_body FROM " . $this->db->prefix('image') . " i LEFT JOIN " . $this->db->prefix('imagebody') . " b ON b.image_id=i.image_id"; } else { $sql = "SELECT * FROM " . $this->db->prefix('image'); } if (isset($criteria) && is_subclass_of($criteria, 'icms_db_criteria_Element')) { $sql .= " " . $criteria->renderWhere(); $sort = !in_array($criteria->getSort(), array('image_id', 'image_created', 'image_mimetype', 'image_display', 'image_weight')) ? 'image_weight' : $criteria->getSort(); $sql .= " ORDER BY " . $sort . " " . $criteria->getOrder(); $limit = $criteria->getLimit(); $start = $criteria->getStart(); } $result = $this->db->query($sql, $limit, $start); if (!$result) { return $ret; } while ($myrow = $this->db->fetchArray($result)) { $image = new icms_image_Object(); $image->assignVars($myrow); if (!$id_as_key) { $ret[] =& $image; } else { $ret[$myrow['image_id']] =& $image; } unset($image); } return $ret; }