]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - actions/shownotice.php
b3204d0634fbbcb4634ab23cc9a189f7770f282d
[quix0rs-gnu-social.git] / actions / shownotice.php
1 <?php
2
3 class ShownoticeAction extends Action {
4
5         function handle($args) {
6                 parent::handle($args);
7                 $id = $this->arg('notice');
8                 $notice = Notice::staticGet($id);
9
10                 if (!$notice) {
11                         $this->no_such_notice();
12                 }
13
14                 if (!$notice->getProfile()) {
15                         $this->no_such_notice();
16                 }
17                 
18                 # Looks like we're good; show the header
19         
20                 common_show_header($profile->nickname);
21         
22                 $this->show_notice($notice);
23         
24                 common_show_footer();
25         }
26         
27         function no_such_notice() {
28                 common_user_error('No such notice.');
29         }
30         
31         function show_notice($notice) {
32                 $profile = $notice->getProfile();
33                 # XXX: RDFa
34                 common_start_element('div', array('class' => 'notice'));
35                 # FIXME: add the avatar
36                 common_start_element('a', array('href' => $profile->profileurl,
37                                                                                 'class' => 'nickname'),
38                                                          $profile->nickname);
39                 # FIXME: URL, image, video, audio
40                 common_element('span', array('class' => 'content'),
41                                            $notice->content);
42                 common_element('span', array('class' => 'date'),
43                                            common_date_string($notice->created));
44                 common_end_element('div');
45         }
46 }