root/trackback/files/lib/acp/page/TrackbackOutgoingPage.class.php @ 154

Revision 154, 2.0 kB (checked in by d0nut, 5 years ago)

releaded version 0.2 of trackback plugin

  • acp exists to view incoming/outgoing pings
  • some acp pages are missing
  • timestamps of incoming pings are saved
Line 
1<?php
2require_once(WCF_DIR.'lib/page/SortablePage.class.php');
3require_once(WCF_DIR.'lib/system/event/EventHandler.class.php');
4
5/**
6 * acp: outgoing trackbacks
7 *
8 * @author      Torben Brodt
9 * @package     de.easy-coding.wbb.trackback
10 * @license     GNU General Public License <http://opensource.org/licenses/gpl-3.0.html>
11 */
12class TrackbackOutgoingPage extends SortablePage {
13        public $templateName = 'trackbackOutgoing';
14        public $itemsPerPage = 10;
15        public $defaultSortField = 'timestamp';
16        public $trackbacks = array();
17       
18        /**
19         * @see Page::readParameters()
20         */
21        public function readParameters() {
22                parent::readParameters();
23        }
24       
25        /**
26         * @see Page::SortablePage()
27         */
28        public function validateSortField() {
29                parent::validateSortField();
30
31                switch ($this->sortField) {
32                        case 'trackbackLogID':
33                        case 'postID':
34                        case 'alienURL':
35                        case 'timestamp': break;
36                        default: $this->sortField = $this->defaultSortField;
37                }
38        }
39       
40        /**
41         * @see Page::readData()
42         */
43        public function readData() {
44                parent::readData();
45                $sql = "SELECT          trackbackLogID,
46                                        postID,
47                                        alienURL,
48                                        timestamp
49                        FROM            wbb".WBB_N."_trackbackLog
50                        ORDER BY        ".$this->sortField." ".$this->sortOrder."
51                        LIMIT           ".$this->itemsPerPage."
52                        OFFSET          ".(($this->pageNo - 1) * $this->itemsPerPage);
53                $result = WCF::getDB()->sendQuery($sql);
54                while ($row = WCF::getDB()->fetchArray($result)) {
55                        $this->trackbacks[] = $row;
56                }
57        }
58       
59        /**
60         * @see Page::assignVariables()
61         */
62        public function assignVariables() {
63                parent::assignVariables();
64
65                WCF::getTPL()->assign(array(
66                        'trackbacks' => $this->trackbacks,
67                        'trackbackscount' => $this->countItems()
68                ));
69        }
70       
71        /**
72         * @see Page::show()
73         */
74        public function show() {
75                // enable menu item
76                WCFACP::getMenu()->setActiveMenuItem('wcf.acp.menu.link.content.trackback.outgoing');
77               
78                parent::show();
79        }
80       
81        /**
82         * @see Page::countItems()
83         */
84        public function countItems() {
85                $sql = "SELECT          COUNT(trackbackLogID) AS c
86                        FROM            wbb".WBB_N."_trackbackLog";
87                $row = WCF::getDB()->getFirstRow($sql);
88
89                return $row['c'];
90        }
91}
92?>
Note: See TracBrowser for help on using the browser.