1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13: class Wicked_Page_MostPopular extends Wicked_Page {
14:
15: 16: 17: 18: 19:
20: public $supportedModes = array(
21: Wicked::MODE_CONTENT => true,
22: Wicked::MODE_DISPLAY => true);
23:
24: 25: 26: 27: 28: 29: 30:
31: public function content($numPages = 10)
32: {
33: return $GLOBALS['wicked']->mostPopular($numPages);
34: }
35:
36: 37: 38: 39: 40: 41:
42: public function displayContents($isBlock)
43: {
44: $template = $GLOBALS['injector']->createInstance('Horde_Template');
45: $pages = array();
46: foreach ($this->content(10) as $page) {
47: $page = new Wicked_Page_StandardPage($page);
48: $pages[] = array('author' => $page->author(),
49: 'created' => $page->formatVersionCreated(),
50: 'name' => $page->pageName(),
51: 'context' => false,
52: 'hits' => $page->hits(),
53: 'url' => $page->pageUrl(),
54: 'version' => $page->version());
55: }
56: $template->set('pages', $pages, true);
57: $template->set('hits', true, true);
58: $hits = true;
59:
60: Horde::addScriptFile('tables.js', 'horde', true);
61:
62: ob_start();
63: require WICKED_TEMPLATES . '/pagelist/header.inc';
64: echo $template->fetch(WICKED_TEMPLATES . '/pagelist/pagelist.html');
65: require WICKED_TEMPLATES . '/pagelist/footer.inc';
66: $contents = ob_get_contents();
67: ob_end_clean();
68: return $contents;
69: }
70:
71: public function pageName()
72: {
73: return 'MostPopular';
74: }
75:
76: public function pageTitle()
77: {
78: return _("Most Popular");
79: }
80:
81: }
82: