Revision 219, 1.6 KB
(checked in by ralle030583, 15 years ago)
|
- moved the new navigation stuff from page in a new class and prepared for dynamic menuBox :-)
|
Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | class Navigation{ |
---|
4 | |
---|
5 | function Navigation() |
---|
6 | { |
---|
7 | $this->contracts_ = killboard::hasContracts(); |
---|
8 | $this->campaigns_ = killboard::hasCampaigns(); |
---|
9 | $this->sql_start = "SELECT * FROM kb3_navigation"; |
---|
10 | $this->sql_end = " AND KBSITE LIKE '" . KB_SITE . "' ORDER BY posnr"; |
---|
11 | $this->type_ = 'top'; |
---|
12 | } |
---|
13 | |
---|
14 | function execQuery() |
---|
15 | { |
---|
16 | $this->qry = new DBQuery(); |
---|
17 | $query = $this->sql_start; |
---|
18 | $query .= " WHERE nav_type LIKE '$this->type_'"; |
---|
19 | |
---|
20 | if (!$this->contracts_){ |
---|
21 | $query .= " AND url NOT LIKE '?a=contracts'"; |
---|
22 | } |
---|
23 | if (!$this->campaigns_){ |
---|
24 | $query .= " AND url NOT LIKE '?a=campaigns'"; |
---|
25 | } |
---|
26 | if (config::get('public_losses')) |
---|
27 | { |
---|
28 | $query .= " AND url NOT LIKE '?a=losses'"; |
---|
29 | } |
---|
30 | if (!config::get('show_standings')) |
---|
31 | { |
---|
32 | $query .= " AND url NOT LIKE '?a=standings'"; |
---|
33 | } |
---|
34 | if (config::get('public_stats')=='remove') |
---|
35 | { |
---|
36 | $query .= " AND url NOT LIKE '?a=stats'"; |
---|
37 | } |
---|
38 | $query .= " AND (page LIKE '$site' OR page LIKE 'ALL_PAGES')"; |
---|
39 | $query .= $this->sql_end; |
---|
40 | $this->qry->execute($query); |
---|
41 | } |
---|
42 | |
---|
43 | function getRow(){ |
---|
44 | return $this->qry->getRow(); |
---|
45 | } |
---|
46 | |
---|
47 | function setNavType($type) |
---|
48 | { |
---|
49 | $this->type_ = $type; |
---|
50 | } |
---|
51 | |
---|
52 | function setSite($site){ |
---|
53 | $this->site_ = $site; |
---|
54 | } |
---|
55 | |
---|
56 | function generateMenu() |
---|
57 | { |
---|
58 | $this->site_ = $site; |
---|
59 | $this->execQuery(); |
---|
60 | |
---|
61 | $menu = new Menu(); |
---|
62 | while ($row = $this->getRow()) |
---|
63 | { |
---|
64 | // i know thats a bad hack |
---|
65 | $url = $row['url'] .'" target="'.$row['target'].'"'; |
---|
66 | $menu->add($url , $row['descr']); |
---|
67 | } |
---|
68 | return $menu; |
---|
69 | } |
---|
70 | |
---|
71 | function generateMenuBox() |
---|
72 | { |
---|
73 | // TODO |
---|
74 | } |
---|
75 | } |
---|
76 | ?> |
---|