function &getObjects($criteria = null, $id_as_key = false) { $ret = array(); $limit = $start = 0; $sql = 'SELECT a.*, COUNT(u.user_id) AS count FROM ' . $this->db->prefix('avatar') . ' a LEFT JOIN ' . $this->db->prefix('avatar_user_link') . ' u ON u.avatar_id=a.avatar_id'; if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { $sql .= ' ' . $criteria->renderWhere(); $sql .= ' GROUP BY a.avatar_id ORDER BY avatar_weight, avatar_id'; $limit = $criteria->getLimit(); $start = $criteria->getStart(); } $result = $this->db->query($sql, $limit, $start); if (!$result) { return $ret; } while ($myrow = $this->db->fetchArray($result)) { $avatar = new XoopsAvatar(); $avatar->assignVars($myrow); $avatar->setUserCount($myrow['count']); if (!$id_as_key) { $ret[] =& $avatar; } else { $ret[$myrow['avatar_id']] =& $avatar; } unset($avatar); } return $ret; }
/** * */ function __construct() { parent::__construct(); }