Exemplo n.º 1
0
 function showContent()
 {
     $notice = $this->nli->notice;
     $out = $this->nli->out;
     $entry = Blog_entry::fromNotice($notice);
     if (empty($entry)) {
         throw new Exception('BlogEntryListItem used for non-blog notice.');
     }
     $out->elementStart('h4', array('class' => 'blog-entry-title'));
     $out->element('a', array('href' => $notice->bestUrl()), $entry->title);
     $out->elementEnd('h4');
     // XXX: kind of a hack
     $actionName = $out->trimmed('action');
     if ($actionName == 'shownotice' || $actionName == 'showblogentry' || $actionName == 'conversation') {
         $out->elementStart('div', 'blog-entry-content');
         $out->raw($entry->content);
         $out->elementEnd('div');
     } else {
         if (!empty($entry->summary)) {
             $out->elementStart('div', 'blog-entry-summary');
             $out->raw($entry->summary);
             $out->elementEnd('div');
         }
         $url = $entry->url ? $entry->url : $notice->bestUrl();
         $out->element('a', array('href' => $url, 'class' => 'blog-entry-link'), _('More...'));
     }
 }
 function showContent()
 {
     $notice = $this->nli->notice;
     $out = $this->nli->out;
     $entry = Blog_entry::fromNotice($notice);
     if (empty($entry)) {
         throw new Exception('BlogEntryListItem used for non-blog notice.');
     }
     $out->elementStart('h4', array('class' => 'blog-entry-title'));
     $out->element('a', array('href' => $notice->bestUrl()), $entry->title);
     $out->elementEnd('h4');
     if (!empty($entry->summary)) {
         $out->elementStart('div', 'blog-entry-summary');
         $out->raw($entry->summary);
         $out->elementEnd('div');
     } else {
         // XXX: hide content initially; click More... for full text.
         $out->elementStart('div', 'blog-entry-content');
         $out->raw($entry->content);
         $out->elementEnd('div');
     }
 }
Exemplo n.º 3
0
 function deleteRelated($notice)
 {
     if ($notice->object_type == Blog_entry::TYPE) {
         $entry = Blog_entry::fromNotice($notice);
         if (exists($entry)) {
             $entry->delete();
         }
     }
 }