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();
}
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;
}
}
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,