class Peopletag extends PeopletagListItem
{
+ protected $avatarSize = AVATAR_PROFILE_SIZE;
+
function showStart()
{
$mode = $this->peopletag->private ? 'private' : 'public';
{
$this->out->elementEnd('div');
}
-
- function showAvatar()
- {
- parent::showAvatar(AVATAR_PROFILE_SIZE);
- }
}
function showProfile()
{
$this->startProfile();
- $this->showAvatar();
+ $this->showAvatar($this->profile);
$this->showFullName();
$this->showLocation();
$this->showHomepage();
}
}
- function avatar()
- {
- return $this->profile->avatarUrl(AVATAR_PROFILE_SIZE);
- }
-
function name()
{
return $this->profile->getBestName();
{
parent::__construct($out);
$this->group = $group;
+ $this->profile = $this->group->getProfile();
}
- function avatar()
- {
- return ($this->group->homepage_logo) ?
- $this->group->homepage_logo : User_group::defaultLogo(AVATAR_PROFILE_SIZE);
+ protected function showAvatar(Profile $profile, $size=null)
+ {
+ $avatar_url = $profile->getGroup()->homepage_logo ?: User_group::defaultLogo($size ?: $this->avatarSize());
+ $this->out->element('img', array('src' => $avatar_url,
+ 'class' => 'avatar u-photo',
+ 'width' => $this->avatarSize(),
+ 'height' => $this->avatarSize(),
+ 'alt' => $profile->getBestName()));
}
function name()
'title' => $this->profile->nickname);
$this->out->elementStart('a', $attrs);
- $this->showAvatar();
- $this->out->text(' ');
- $this->out->element('span',array('class' => 'fn'), $this->profile->getStreamName());
+ $this->showAvatar($this->profile);
+ $this->out->text($this->profile->getStreamName());
$this->out->elementEnd('a');
$this->out->elementEnd('span');
return $this->notice->getReplyProfiles();
}
- /**
- * show the avatar of the notice's author
- *
- * This will use the default avatar if no avatar is assigned for the author.
- * It makes a link to the author's profile.
- *
- * @return void
- */
- function showAvatar()
- {
- $avatar_size = $this->avatarSize();
-
- $avatarUrl = $this->profile->avatarUrl($avatar_size);
-
- $this->out->element('img', array('src' => $avatarUrl,
- 'class' => 'avatar photo',
- 'width' => $avatar_size,
- 'height' => $avatar_size,
- 'alt' =>
- ($this->profile->fullname) ?
- $this->profile->fullname :
- $this->profile->nickname));
- }
-
- function avatarSize()
- {
- return AVATAR_STREAM_SIZE;
- }
-
/**
* show the nickname of the author
*
$attrs['title'] = $this->profile->fullname . ' (' . $this->profile->nickname . ')';
}
$this->out->elementStart('a', $attrs);
- $this->showAvatar();
- $this->out->text(' ');
- $this->out->element('span', 'nickname fn',
- htmlspecialchars($this->profile->nickname));
-
+ $this->showAvatar($this->profile);
+ $this->out->text($this->profile->getNickname());
$this->out->elementEnd('a');
$this->out->elementEnd('span');
}
$this->out->elementEnd('span');
}
- /**
- * show the avatar of the peopletag's creator
- *
- * This will use the default avatar if no avatar is assigned for the author.
- * It makes a link to the author's profile.
- *
- * @return void
- */
-
- function showAvatar($size=AVATAR_STREAM_SIZE)
- {
- $avatarUrl = $this->profile->avatarUrl($size);
-
- $this->out->element('img', array('src' => $avatarUrl,
- 'class' => 'avatar photo',
- 'width' => $size,
- 'height' => $size,
- 'alt' =>
- ($this->profile->fullname) ?
- $this->profile->fullname :
- $this->profile->nickname));
- }
-
function showActions()
{
$this->out->elementStart('div', 'entity_actions');
*/
class PeopletagSection extends Section
{
+ protected $avatarSize = AVATAR_MINI_SIZE;
+
function showContent()
{
$tags = $this->getPeopletags();
htmlspecialchars($this->peopletag->tag));
$this->out->elementEnd('span');
}
-
- function showAvatar()
- {
- parent::showAvatar(AVATAR_MINI_SIZE);
- }
}
abstract class ProfileBlock extends Widget
{
- abstract function avatar();
+ protected $avatarSize = AVATAR_PROFILE_SIZE;
+
abstract function name();
abstract function url();
abstract function location();
function show()
{
$this->showActions();
- $this->showAvatar();
+ $this->showAvatar($this->profile);
$this->showName();
$this->showLocation();
$this->showHomepage();
$this->showTags();
}
- function showAvatar()
- {
- $size = $this->avatarSize();
-
- $this->out->element(
- 'img',
- array(
- 'src' => $this->avatar(),
- 'class' => 'ur_face',
- 'alt' => $this->name(),
- 'width' => $size,
- 'height' => $size
- )
- );
- }
-
function showName()
{
$name = $this->name();
}
}
- function avatarSize()
- {
- return AVATAR_PROFILE_SIZE;
- }
-
function showTags()
{
}
exit(1);
}
-require_once INSTALLDIR.'/lib/widget.php';
require_once INSTALLDIR.'/lib/peopletags.php';
/**
{
return PROFILES_PER_PAGE;
}
-
- function avatarSize()
- {
- return AVATAR_STREAM_SIZE;
- }
}
class ProfileListItem extends Widget
$this->startProfile();
if (Event::handle('StartProfileListItemProfileElements', array($this))) {
if (Event::handle('StartProfileListItemAvatar', array($this))) {
+ $aAttrs = $this->linkAttributes();
+ $this->out->elementStart('a', $aAttrs);
$this->showAvatar();
+ $this->out->elementEnd('a');
Event::handle('EndProfileListItemAvatar', array($this));
}
if (Event::handle('StartProfileListItemFullName', array($this))) {
$this->out->elementStart('div', 'entity_profile vcard entry-content');
}
- function showAvatar()
- {
- $avatarUrl = $this->profile->avatarUrl(AVATAR_STREAM_SIZE);
- $aAttrs = $this->linkAttributes();
- $this->out->elementStart('a', $aAttrs);
- $this->out->element('img', array('src' => $avatarUrl,
- 'class' => 'photo avatar',
- 'width' => AVATAR_STREAM_SIZE,
- 'height' => AVATAR_STREAM_SIZE,
- 'alt' =>
- ($this->profile->fullname) ? $this->profile->fullname :
- $this->profile->nickname));
- $this->out->text(' ');
- $hasFN = (!empty($this->profile->fullname)) ? 'nickname' : 'fn nickname';
- $this->out->elementStart('span', $hasFN);
- $this->out->raw($this->highlight($this->profile->nickname));
- $this->out->elementEnd('span');
- $this->out->elementEnd('a');
- }
-
function showFullName()
{
if (!empty($this->profile->fullname)) {
function showProfile()
{
$this->startProfile();
- $this->showAvatar();
+ $this->showAvatar($this->profile);
$this->showFullName();
$this->showLocation();
$this->showHomepage();
class Widget
{
+ protected $avatarSize = AVATAR_STREAM_SIZE;
+
/**
* HTMLOutputter to use for output
*/
{
return call_user_func_array(array($this->out, $name), $arguments);
}
+
+ /**
+ * Default avatar size for this widget.
+ */
+ public function avatarSize()
+ {
+ return $this->avatarSize;
+ }
+
+ protected function showAvatar(Profile $profile, $size=null)
+ {
+ $avatar_url = $profile->avatarUrl($size ?: $this->avatarSize());
+ $this->out->element('img', array('src' => $avatar_url,
+ 'class' => 'avatar u-photo',
+ 'width' => $this->avatarSize(),
+ 'height' => $this->avatarSize(),
+ 'alt' => $profile->getBestName()));
+ }
}
}
- function showAvatar()
+ function showAvatar(Profile $profile, $size=null)
{
- $logo = ($this->profile->stream_logo) ?
- $this->profile->stream_logo : User_group::defaultLogo(AVATAR_STREAM_SIZE);
-
- $this->out->elementStart(
- 'a',
- array(
- 'href' => $this->profile->homeUrl(),
- 'class' => 'url entry-title',
- 'rel' => 'contact group'
- )
- );
- $this->out->element(
- 'img',
- array(
- 'src' => $logo,
- 'class' => 'photo avatar',
- 'width' => AVATAR_STREAM_SIZE,
- 'height' => AVATAR_STREAM_SIZE,
- 'alt' => ($this->profile->fullname)
- ? $this->profile->fullname : $this->profile->nickname
- )
- );
+ $logo = $profile->getGroup()->stream_logo ?: User_group::defaultLogo($size ?: $this->avatarSize());
- $this->out->text(' ');
- $hasFN = ($this->profile->fullname) ? 'nickname' : 'fn org nickname';
- $this->out->elementStart('span', $hasFN);
- $this->out->raw($this->highlight($this->profile->nickname));
- $this->out->elementEnd('span');
- $this->out->elementEnd('a');
+ $this->out->element('img', array('src' => $logo,
+ 'class' => 'photo avatar',
+ 'width' => AVATAR_STREAM_SIZE,
+ 'height' => AVATAR_STREAM_SIZE,
+ 'alt' => $profile->getBestName()));
}
function show()
function showProfile()
{
$this->startProfile();
- $this->showAvatar();
+
+ $hasFN = ($this->profile->fullname) ? 'nickname' : 'fn org nickname';
+ $this->out->elementStart('a', array('href' => $this->profile->homeUrl(),
+ 'class' => 'h-card org nickname',
+ 'rel' => 'contact group'));
+ // getProfile here is because $this->profile is a User_group, which it should stop
+ // being by making sure the group listing runs a ->getGroup when it's necessary.
+ $this->showAvatar($this->profile->getProfile());
+ $this->out->text($this->profile->getNickname());
+ $this->out->elementEnd('a');
+
$this->showFullName();
$this->showLocation();
$this->showHomepage();