64 public function id($format =
'n')
66 return $this->
getVar(
'avatar_id', $format);
78 return $this->
getVar(
'avatar_id', $format);
90 return $this->
getVar(
'avatar_file', $format);
102 return $this->
getVar(
'avatar_name', $format);
114 return $this->
getVar(
'avatar_mimetype', $format);
126 return $this->
getVar(
'avatar_created', $format);
138 return $this->
getVar(
'avatar_display', $format);
150 return $this->
getVar(
'avatar_weight', $format);
162 return $this->
getVar(
'avatar_type', $format);
174 $this->userCount = intval($value);
202 parent::__construct($db,
'avatars_avatar',
'AvatarsAvatar',
'avatar_id',
'avatar_name');
220 $criteria->setSort(
'avatar_weight, avatar_id');
221 $qb = $this->db2->createXoopsQueryBuilder();
222 $qb ->select(
'a.*',
'COUNT(u.user_id) AS count')
223 ->fromPrefix(
'avatars_avatar',
'a')
224 ->leftJoinPrefix(
'l',
'avatars_user_link',
'u',
'u.avatar_id=a.avatar_id');
230 while ($myrow =
$result->fetch(\PDO::FETCH_ASSOC)) {
233 $avatar->setUserCount($myrow[
'count']);
237 $ret[$myrow[
'avatar_id']] =
$avatar;
254 $avatar_id = intval($avatar_id);
256 if ($avatar_id < 1 ||
$user_id < 1) {
260 $qb = $this->db2->createXoopsQueryBuilder();
261 $qb ->deletePrefix(
'avatars_user_link',
'l')
262 ->where(
'l.user_id = :uid')
263 ->setParameter(
':uid',
$user_id, \PDO::PARAM_INT);
269 $qb = $this->db2->createXoopsQueryBuilder();
270 $qb ->insertPrefix(
'avatars_user_link')
273 'avatar_id' =>
':aid',
277 ->setParameter(
':aid', $avatar_id, \PDO::PARAM_INT)
278 ->setParameter(
':uid',
$user_id, \PDO::PARAM_INT);
297 $qb = $this->db2->createXoopsQueryBuilder();
298 $qb ->select(
'user_id')
299 ->fromPrefix(
'avatars_user_link',
'l')
300 ->where(
'l.avatar_id = :bid')
301 ->setParameter(
':bid', $avatar->
getVar(
'avatar_id'), \PDO::PARAM_INT);
306 while ($myrow =
$result->fetch(\PDO::FETCH_ASSOC)) {
307 $ret[] = $myrow[
'user_id'];
323 if (isset($avatar_type)) {
324 $avatar_type = ($avatar_type ==
'C') ?
'C' :
'S';
327 if (isset($avatar_display)) {
334 foreach (array_keys($avatars) as
$i) {
335 $ret[$avatars[
$i]->getVar(
'avatar_file')] = $avatars[
$i]->getVar(
'avatar_name');
getUser(AvatarsAvatar $avatar)
avatar_display($format= '')
__construct(Connection $db=null)
addUser($avatar_id, $user_id)
getListByType($avatar_type=null, $avatar_display=null)
getVar($key, $format= 's')
avatar_created($format= '')
avatar_weight($format= '')
getObjects(CriteriaElement $criteria=null, $id_as_key=false, $as_object=true)
avatar_mimetype($format= '')
getObjectsWithCount(CriteriaElement $criteria=null, $id_as_key=false)
initVar($key, $data_type, $value=null, $required=false, $maxlength=null, $options= '')