diff options
author | Robin Millette <millette@controlyourself.ca> | 2009-05-17 22:06:08 -0400 |
---|---|---|
committer | Robin Millette <millette@controlyourself.ca> | 2009-05-17 22:06:08 -0400 |
commit | 5897dfa4c37d6a44bcde5dc7569c8b0d30f21b84 (patch) | |
tree | 6e882a25153ec071b4aa119bfdbd705ff51e2c90 /actions | |
parent | a325144fa0ba769de1cdb554cac04e0116912b66 (diff) |
Refactored new sections code to proper classes and added notice link to links in notice sections.
Diffstat (limited to 'actions')
-rw-r--r-- | actions/attachment.php | 53 | ||||
-rw-r--r-- | actions/tag.php | 13 |
2 files changed, 8 insertions, 58 deletions
diff --git a/actions/attachment.php b/actions/attachment.php index 981882a5b..b9187ff08 100644 --- a/actions/attachment.php +++ b/actions/attachment.php @@ -54,18 +54,6 @@ class AttachmentAction extends Action var $attachment = null; /** - * Profile of the notice object - */ - -// var $profile = null; - - /** - * Avatar of the profile of the notice object - */ - -// var $avatar = null; - - /** * Load attributes based on database arguments * * Loads all the DB stuff @@ -112,8 +100,6 @@ class AttachmentAction extends Action return $a->title(); } - - /** * Last-modified date for page * @@ -213,38 +199,11 @@ class AttachmentAction extends Action * * @return void */ - - function showAside() { - $notice = new Notice; - $f2p = new File_to_post; - $f2p->file_id = $this->attachment->id; - $notice->joinAdd($f2p); - $notice->orderBy('created desc'); - $x = $notice->find(); - $this->elementStart('ol'); - while($notice->fetch()) { - $this->elementStart('li'); - $profile = $notice->getProfile(); - $this->element('a', array('href' => $notice->uri), $profile->nickname . ' on ' . $notice->created); - $this->elementEnd('li'); - } - $this->elementEnd('ol'); - $notice->free(); - $f2p->free(); - - $notice_tag = new Notice_tag; - $attachment = new File; - - $query = 'select tag,count(tag) as c from notice_tag join file_to_post on (notice_tag.notice_id=post_id) join notice on notice_id = notice.id where file_id=' . $notice_tag->escape($this->attachment->id) . ' group by tag order by c desc'; - - $notice_tag->query($query); - $this->elementStart('ol'); - while($notice_tag->fetch()) { - $this->elementStart('li'); - $href = common_local_url('tag', array('tag' => $notice_tag->tag)); - $this->element('a', array('href' => $href), $notice_tag->tag . ' (' . $notice_tag->c . ')'); - $this->elementEnd('li'); - } - $this->elementEnd('ol'); + function showSections() { + $ns = new AttachmentNoticeSection($this); + $ns->show(); + $atcs = new AttachmentTagCloudSection($this); + $atcs->show(); } } + diff --git a/actions/tag.php b/actions/tag.php index 2202f9bb0..47420e4c3 100644 --- a/actions/tag.php +++ b/actions/tag.php @@ -49,17 +49,8 @@ class TagAction extends Action { $pop = new PopularNoticeSection($this); $pop->show(); - - $notice_tag = new Notice_tag; - $query = 'select file_id, count(file_id) as c from notice_tag join file_to_post on post_id = notice_id where tag="' . $notice_tag->escape($this->tag) . '" group by file_id order by c desc'; - $notice_tag->query($query); - $this->elementStart('ol'); - while ($notice_tag->fetch()) { - $this->elementStart('li'); - $this->element('a', array('class' => 'attachment', 'href' => common_local_url('attachment', array('attachment' => $notice_tag->file_id))), "Attachment tagged {$notice_tag->c} times"); - $this->elementEnd('li'); - } - $this->elementEnd('ol'); + $freqatt = new FrequentAttachmentSection($this); + $freqatt->show(); } function title() |