X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fprofilelist.php;h=11ed8945e9b0c60195561b15ffa8bec15351bab4;hb=ad264b70e109f9fc6c8a9038a64fed125aee1fa6;hp=90e1c743a5e063da7cfea5fa3d633f0852967fa2;hpb=f6430ea131a5f08d995e0c6bf0b4fba2ee621697;p=quix0rs-gnu-social.git diff --git a/lib/profilelist.php b/lib/profilelist.php index 90e1c743a5..11ed8945e9 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -85,14 +85,13 @@ class ProfileList extends Widget function showProfiles() { - $cnt = 0; + $cnt = $this->profile->N; + $profiles = $this->profile->fetchAll(); - while ($this->profile->fetch()) { - $cnt++; - if($cnt > PROFILES_PER_PAGE) { - break; - } - $pli = $this->newListItem($this->profile); + $max = min($cnt, $this->maxProfiles()); + + for ($i = 0; $i < $max; $i++) { + $pli = $this->newListItem($profiles[$i]); $pli->show(); } @@ -101,7 +100,17 @@ class ProfileList extends Widget function newListItem($profile) { - return new ProfileListItem($this->profile, $this->action); + return new ProfileListItem($profile, $this->action); + } + + function maxProfiles() + { + return PROFILES_PER_PAGE; + } + + function avatarSize() + { + return AVATAR_STREAM_SIZE; } } @@ -183,10 +192,10 @@ class ProfileListItem extends Widget function showAvatar() { - $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE); + $avatarUrl = $this->profile->avatarUrl(AVATAR_STREAM_SIZE); $aAttrs = $this->linkAttributes(); $this->out->elementStart('a', $aAttrs); - $this->out->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), + $this->out->element('img', array('src' => $avatarUrl, 'class' => 'photo avatar', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE,