source: extensions/GMaps/gmaps_aip.class.inc.php @ 7054

Last change on this file since 7054 was 7054, checked in by grum, 14 years ago

First commit

  • Property svn:executable set to *
File size: 5.2 KB
Line 
1<?php
2/* -----------------------------------------------------------------------------
3  Plugin     : GMaps
4  Author     : Grum
5    email    : grum@piwigo.org
6    website  : http://photos.grum.fr
7
8    << May the Little SpaceFrog be with you ! >>
9  ------------------------------------------------------------------------------
10  See main.inc.php for release information
11
12  GMaps_AIP : classe to manage plugin admin pages
13
14  --------------------------------------------------------------------------- */
15
16include_once('gmaps_root.class.inc.php');
17include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php');
18include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTabSheet.class.inc.php');
19include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
20
21class GMaps_AIP extends GMaps_root
22{
23  protected $tabsheet;
24
25  public function __construct($prefixeTable, $filelocation)
26  {
27    parent::__construct($prefixeTable, $filelocation);
28    $this->loadConfig();
29    $this->configForTemplate();
30    $this->initEvents();
31
32    $this->tabsheet = new tabsheet();
33    $this->tabsheet->add('maps',
34                          l10n('gmaps_maps'),
35                          $this->getAdminLink()."&amp;fGMaps_tabsheet=maps");
36    $this->tabsheet->add('category_maps',
37                          l10n('gmaps_associate_category_maps'),
38                          $this->getAdminLink()."&amp;fGMaps_tabsheet=category_maps");
39    $this->tabsheet->add('help',
40                          l10n('gmaps_help'),
41                          $this->getAdminLink()."&amp;fGMaps_tabsheet=help");
42  }
43
44  public function __destruct()
45  {
46    unset($this->tabsheet);
47    parent::__destruct();
48  }
49
50  /**
51   * initialize events call for the plugin
52   */
53  public function initEvents()
54  {
55    add_event_handler('loc_end_page_header', array(&$this->css, 'applyCSS'));
56    GPCCss::applyGpcCss();
57
58    parent::initEvents();
59  }
60
61  /**
62   * display the administration page
63   */
64  public function manage()
65  {
66    global $template;
67
68    $this->initRequest();
69
70    $template->set_filename('plugin_admin_content', dirname(__FILE__)."/admin/gmaps_admin.tpl");
71
72    switch($_REQUEST['fGMaps_tabsheet'])
73    {
74      case 'maps':
75        $this->displayMaps();
76        break;
77      case 'category_maps':
78        $this->displayCategoryMaps();
79        break;
80      case 'help':
81        $this->displayHelp();
82        break;
83    }
84
85    $this->tabsheet->select($_REQUEST['fGMaps_tabsheet']);
86    $this->tabsheet->assign();
87    $selected_tab=$this->tabsheet->get_selected();
88    $template->assign($this->tabsheet->get_titlename(), "[".$selected_tab['caption']."]");
89
90    $template_plugin["GMAPS_VERSION"] = "<i>".$this->getPluginName()."</i> ".l10n('gmaps_release').GMAPS_VERSION;
91    $template_plugin["GMAPS_PAGE"] = $_REQUEST['fGMaps_tabsheet'];
92    $template_plugin["GMAPS_TITLE"] = "";
93
94    $template->assign('plugin', $template_plugin);
95    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
96
97  }
98
99
100
101
102  /**
103   * if empty, initialize the $_REQUEST var
104   *
105   * if not empty, check validity for the request values
106   *
107   */
108  private function initRequest()
109  {
110    //initialise $REQUEST values if not defined
111
112    if(!isset($_REQUEST['fGMaps_tabsheet']))
113    {
114      $_REQUEST['fGMaps_tabsheet']="maps";
115    }
116
117    if(!($_REQUEST['fGMaps_tabsheet']!="maps" or
118         $_REQUEST['fGMaps_tabsheet']!="category_maps")) $_REQUEST['fGMaps_tabsheet']="maps";
119  }
120
121
122
123
124
125  /**
126   * display de maps page
127   *
128   */
129  protected function displayMaps()
130  {
131    global $template;
132
133    $template->set_filename('body_page',
134                dirname($this->getFileLocation()).'/admin/gmaps_maps.tpl');
135
136    $mapTabsheet = new GPCTabSheet('mapTabsheet', $this->tabsheet->get_titlename(), 'tabsheet2 gcBorder', 'itab2');
137    $mapTabsheet->add('general',
138                          l10n('gmaps_properties_general'),
139                          '', true, "udm.displayProp('general');");
140    $mapTabsheet->add('dimensions',
141                          l10n('gmaps_dimensions'),
142                          '', false, "udm.displayProp('dimensions');");
143    $mapTabsheet->add('mapType',
144                          l10n('gmaps_properties_mapType'),
145                          '', false, "udm.displayProp('mapType');");
146    $mapTabsheet->add('zoomLevel',
147                          l10n('gmaps_properties_zoomLevel'),
148                          '', false, "udm.displayProp('zoomLevel');");
149    $mapTabsheet->assign();
150
151
152    $datas=Array(
153      'urlRequest' => $this->getAdminLink('ajax')
154    );
155    $template->assign('datas', $datas);
156
157    $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page');
158  }
159
160
161  /**
162   * display the category_maps page
163   *
164   */
165  protected function displayCategoryMaps()
166  {
167    global $template;
168
169    /*$template->set_filename('body_page',
170                dirname($this->getFileLocation()).'/admin/plugin_admin_maps.tpl');
171
172
173    $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page');*/
174  }
175
176  /**
177   * display the help page
178   *
179   */
180  protected function displayHelp()
181  {
182    global $template;
183
184    /*$template->set_filename('body_page',
185                dirname($this->getFileLocation()).'/admin/plugin_admin_maps.tpl');
186
187
188    $template->assign_var_from_handle('GMAPS_BODY_PAGE', 'body_page');*/
189  }
190
191} //class
192
193
194?>
Note: See TracBrowser for help on using the repository browser.