1 | <?php |
---|
2 | |
---|
3 | /* ----------------------------------------------------------------------------- |
---|
4 | class name: public_integration |
---|
5 | class version: 1.0 |
---|
6 | date: 2007-10-31 |
---|
7 | ------------------------------------------------------------------------------ |
---|
8 | author: grum at grum.dnsalias.com |
---|
9 | << May the Little SpaceFrog be with you >> |
---|
10 | ------------------------------------------------------------------------------ |
---|
11 | |
---|
12 | this class provides base functions to manage an integration into main index |
---|
13 | page |
---|
14 | the class use plugin MenuBarManager function if installed |
---|
15 | |
---|
16 | - constructor public_integration($section) |
---|
17 | - (public) function init_events() |
---|
18 | - (public) function set_callback_page_function($value) |
---|
19 | - (private) function init_section() |
---|
20 | - (private) function call_page() |
---|
21 | |
---|
22 | use init_events() function to initialize needed triggers for updating menubar |
---|
23 | |
---|
24 | the "callback_page_function" is called everytime a specific page is displayed |
---|
25 | |
---|
26 | ----------------------------------------------------------------------------- */ |
---|
27 | |
---|
28 | class public_integration |
---|
29 | { |
---|
30 | var $section; //section applied to the page viewed |
---|
31 | var $callback_page_function; //called function to display page |
---|
32 | |
---|
33 | function public_integration($section) |
---|
34 | { |
---|
35 | $this->section=$section; |
---|
36 | $this->callback_page_function=''; |
---|
37 | } |
---|
38 | |
---|
39 | //initialize events to manage menu & page integration |
---|
40 | function init_events() |
---|
41 | { |
---|
42 | add_event_handler('loc_end_section_init', array(&$this, 'init_section')); |
---|
43 | add_event_handler('loc_end_index', array(&$this, 'call_page')); |
---|
44 | } |
---|
45 | |
---|
46 | function set_callback_page_function($value) |
---|
47 | { |
---|
48 | $this->callback_page_function=$value; |
---|
49 | } |
---|
50 | |
---|
51 | /* |
---|
52 | init section |
---|
53 | */ |
---|
54 | function init_section() |
---|
55 | { |
---|
56 | global $tokens, $page; |
---|
57 | |
---|
58 | if ($tokens[0] == $this->section) |
---|
59 | { $page['section'] = $this->section; } |
---|
60 | } |
---|
61 | |
---|
62 | /* |
---|
63 | loads a page |
---|
64 | */ |
---|
65 | function call_page() |
---|
66 | { |
---|
67 | global $page, $user; |
---|
68 | |
---|
69 | if($page['section'] == $this->section) |
---|
70 | { |
---|
71 | @call_user_func($this->callback_page_function); |
---|
72 | } |
---|
73 | } |
---|
74 | |
---|
75 | } //class public_integration |
---|
76 | |
---|
77 | |
---|
78 | ?> |
---|