source: extensions/database_migration/admin.php @ 29488

Last change on this file since 29488 was 6222, checked in by nikrou, 15 years ago

Database migration plugin : first public version

File size: 3.1 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | database_migration - a plugin for Piwigo                              |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2010 Nicolas Roudaire             http://www.nikrou.net  |
6// +-----------------------------------------------------------------------+
7// | This program is free software; you can redistribute it and/or modify  |
8// | it under the terms of the GNU General Public License version 2 as     |
9// | published by the Free Software Foundation                             |
10// |                                                                       |
11// | This program is distributed in the hope that it will be useful, but   |
12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
14// | General Public License for more details.                              |
15// |                                                                       |
16// | You should have received a copy of the GNU General Public License     |
17// | along with this program; if not, write to the Free Software           |
18// | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,            |
19// | MA 02110-1301 USA                                                     |
20// +-----------------------------------------------------------------------+
21
22if (!defined('PHPWG_ROOT_PATH')) {
23  die('Hacking attempt!');
24}
25
26include_once PHPWG_ROOT_PATH .'admin/include/tabsheet.class.php';
27
28$me = get_plugin_data($plugin_id);
29$dm_base_url = get_admin_plugin_menu_link(__FILE__);
30
31if ($GLOBALS['conf']['dblayer']=='mysql') {
32  $Tabs = array('config' => l10n('Configuration'),
33                'export' => l10n('Export'),
34                'import' => l10n('Import'),
35                'migration' => l10n('Migration'));
36  $default_tab = 'config';
37} else {
38  $Tabs = array('restore' => l10n('Restore'));
39  $default_tab = 'restore';
40}
41
42if (!empty($_GET['tab']) && isset($Tabs[$_GET['tab']])) {
43  $page['tab'] = $_GET['tab'];
44} else {
45  $page['tab'] = $default_tab;
46}
47
48if (!empty($_SESSION['dm_messages']['infos'])) {
49  array_push($GLOBALS['page']['infos'], $_SESSION['dm_messages']['infos']);
50  unset($_SESSION['dm_messages']);
51} elseif (!empty($_SESSION['dm_messages']['errors'])) {
52  array_push($GLOBALS['page']['errors'], $_SESSION['dm_messages']['errors']);
53  unset($_SESSION['dm_messages']);
54}
55
56$tabsheet = new tabsheet();
57foreach ($Tabs as $key => $label) {
58  $tabsheet->add($key, $label, $dm_base_url.'&amp;tab='.$key); 
59}
60$tabsheet->select($page['tab']);
61$tabsheet->assign();
62
63include_once DM_PLUGIN_ROOT . '/include/tab_'.$page['tab'].'.inc.php';
64
65$GLOBALS['template']->set_filename('plugin_admin_content',  DM_TEMPLATE . '/admin.tpl');
66$GLOBALS['template']->assign('DM_TPL', DM_TEMPLATE);
67$GLOBALS['template']->assign('DM_CSS', DM_CSS);
68$GLOBALS['template']->assign('DM_JS', DM_JS);
69$GLOBALS['template']->assign('tab_content', DM_TEMPLATE . '/admin_' . $page['tab'] . '.tpl');
70$GLOBALS['template']->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
71?>
Note: See TracBrowser for help on using the repository browser.