- if ($user) {
- if ($user->hasFave($this->notice)) {
- common_disfavor_form($this->notice);
- } else {
- common_favor_form($this->notice);
- }
- }
- }
-
- function show_author() {
- common_element_start('span', 'vcard author');
- $this->show_avatar();
- $this->show_nickname();
- common_element_end('span');
- }
-
- function show_avatar() {
- $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
- common_element_start('a', array('href' => $this->profile->profileurl));
- common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
- 'class' => 'avatar stream photo',
- 'width' => AVATAR_STREAM_SIZE,
- 'height' => AVATAR_STREAM_SIZE,
- 'alt' =>
- ($this->profile->fullname) ? $this->profile->fullname :
- $this->profile->nickname));
- common_element_end('a');
- }
-
- function show_nickname() {
- common_element('a', array('href' => $this->profile->profileurl,
- 'class' => 'nickname fn url'),
- $this->profile->nickname);
- }
-
- function show_content() {
- # FIXME: URL, image, video, audio
- common_element_start('p', array('class' => 'content entry-title'));
- if ($this->notice->rendered) {
- common_raw($this->notice->rendered);
- } else {
- # XXX: may be some uncooked notices in the DB,
- # we cook them right now. This should probably disappear in future
- # versions (>> 0.4.x)
- common_raw(common_render_content($this->notice->content, $this->notice));
- }
- common_element_end('p');
- }
-
- function show_start_time_section() {
- common_element_start('p', 'time');
- }
-
- function show_notice_link() {
- $noticeurl = common_local_url('shownotice', array('notice' => $this->notice->id));
- # XXX: we need to figure this out better. Is this right?
- if (strcmp($this->notice->uri, $this->noticeurl) != 0 && preg_match('/^http/', $this->notice->uri)) {
- $noticeurl = $this->notice->uri;
- }
- common_element_start('a', array('class' => 'permalink',
- 'rel' => 'bookmark',
- 'href' => $noticeurl));
- common_element('abbr', array('class' => 'published',
- 'title' => common_date_iso8601($this->notice->created)),
- common_date_string($this->notice->created));
- common_element_end('a');
- }
-
- function show_notice_source() {
- if ($this->notice->source) {
- common_text(_(' from '));
+ if ($user) {
+ if ($user->hasFave($this->notice)) {
+ $disfavor = new DisfavorForm($this->out, $this->notice);
+ $disfavor->show();
+ } else {
+ $favor = new FavorForm($this->out, $this->notice);
+ $favor->show();
+ }
+ }
+ }
+
+ /**
+ * show the author of a notice
+ *
+ * By default, this shows the avatar and (linked) nickname of the author.
+ *
+ * @return void
+ */
+
+ function showAuthor()
+ {
+ $this->out->elementStart('span', 'vcard author');
+ $this->out->elementStart('a', array('href' => $this->profile->profileurl,
+ 'class' => 'url'));
+ $this->showAvatar();
+ $this->showNickname();
+ $this->out->elementEnd('a');
+ $this->out->elementEnd('span');
+ }
+
+ /**
+ * 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 = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
+
+ $this->out->element('img', array('src' => ($avatar) ?
+ common_avatar_display_url($avatar) :
+ common_default_avatar(AVATAR_STREAM_SIZE),
+ 'class' => 'avatar photo',
+ 'width' => AVATAR_STREAM_SIZE,
+ 'height' => AVATAR_STREAM_SIZE,
+ 'alt' =>
+ ($this->profile->fullname) ?
+ $this->profile->fullname :
+ $this->profile->nickname));
+ }
+
+ /**
+ * show the nickname of the author
+ *
+ * Links to the author's profile page
+ *
+ * @return void
+ */
+
+ function showNickname()
+ {
+ $this->out->element('span', array('class' => 'nickname fn'),
+ $this->profile->nickname);
+ }
+
+ /**
+ * show the content of the notice
+ *
+ * Shows the content of the notice. This is pre-rendered for efficiency
+ * at save time. Some very old notices might not be pre-rendered, so
+ * they're rendered on the spot.
+ *
+ * @return void
+ */
+
+ function showContent()
+ {
+ // FIXME: URL, image, video, audio
+ $this->out->elementStart('p', array('class' => 'entry-content'));
+ if ($this->notice->rendered) {
+ $this->out->raw($this->notice->rendered);
+ } else {
+ // XXX: may be some uncooked notices in the DB,
+ // we cook them right now. This should probably disappear in future
+ // versions (>> 0.4.x)
+ $this->out->raw(common_render_content($this->notice->content, $this->notice));
+ }
+ $this->out->elementEnd('p');
+ }
+
+ /**
+ * show the link to the main page for the notice
+ *
+ * Displays a link to the page for a notice, with "relative" time. Tries to
+ * get remote notice URLs correct, but doesn't always succeed.
+ *
+ * @return void
+ */
+
+ function showNoticeLink()
+ {
+ $noticeurl = common_local_url('shownotice',
+ array('notice' => $this->notice->id));
+ // XXX: we need to figure this out better. Is this right?
+ if (strcmp($this->notice->uri, $noticeurl) != 0 &&
+ preg_match('/^http/', $this->notice->uri)) {
+ $noticeurl = $this->notice->uri;
+ }
+ $this->out->elementStart('dl', 'timestamp');
+ $this->out->element('dt', _('Published'));
+ $this->out->elementStart('dd', null);
+ $this->out->elementStart('a', array('rel' => 'bookmark',
+ 'href' => $noticeurl));
+ $dt = common_date_iso8601($this->notice->created);
+ $this->out->element('abbr', array('class' => 'published',
+ 'title' => $dt),
+ common_date_string($this->notice->created));
+ $this->out->elementEnd('a');
+ $this->out->elementEnd('dd');
+ $this->out->elementEnd('dl');
+ }
+
+ /**
+ * Show the source of the notice
+ *
+ * Either the name (and link) of the API client that posted the notice,
+ * or one of other other channels.
+ *
+ * @return void
+ */
+
+ function showNoticeSource()
+ {
+ if ($this->notice->source) {
+ $this->out->elementStart('dl', 'device');
+ $this->out->element('dt', null, _('From'));