| [0] | 1 | <?php |
|---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
|---|
| 3 | # |
|---|
| [840] | 4 | # This file is part of importExport, a plugin for DotClear2. |
|---|
| [0] | 5 | # |
|---|
| [840] | 6 | # Copyright (c) 2003-2012 Olivier Meunier & Association Dotclear |
|---|
| [0] | 7 | # Licensed under the GPL version 2.0 license. |
|---|
| 8 | # See LICENSE file or |
|---|
| 9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
|---|
| 10 | # |
|---|
| 11 | # -- END LICENSE BLOCK ----------------------------------------- |
|---|
| 12 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
|---|
| 13 | |
|---|
| [840] | 14 | function listImportExportModules($core,$modules) |
|---|
| 15 | { |
|---|
| 16 | $res = ''; |
|---|
| 17 | foreach ($modules as $id) |
|---|
| 18 | { |
|---|
| 19 | $o = new $id($core); |
|---|
| [2566] | 20 | |
|---|
| 21 | $res .= |
|---|
| [840] | 22 | '<dt><a href="'.$o->getURL(true).'">'.html::escapeHTML($o->name).'</a></dt>'. |
|---|
| 23 | '<dd>'.html::escapeHTML($o->description).'</dd>'; |
|---|
| [2566] | 24 | |
|---|
| [840] | 25 | unset($o); |
|---|
| 26 | } |
|---|
| 27 | return '<dl class="modules">'.$res.'</dl>'; |
|---|
| 28 | } |
|---|
| [0] | 29 | |
|---|
| [840] | 30 | $modules = new ArrayObject(array('import' => array(),'export' => array())); |
|---|
| [0] | 31 | |
|---|
| 32 | # --BEHAVIOR-- importExportModules |
|---|
| [2095] | 33 | $core->callBehavior('importExportModules', $modules, $core); |
|---|
| [0] | 34 | |
|---|
| 35 | $type = null; |
|---|
| [840] | 36 | if (!empty($_REQUEST['type']) && in_array($_REQUEST['type'],array('export','import'))) { |
|---|
| 37 | $type = $_REQUEST['type']; |
|---|
| [0] | 38 | } |
|---|
| 39 | |
|---|
| [840] | 40 | $module = null; |
|---|
| 41 | if ($type && !empty($_REQUEST['module'])) { |
|---|
| 42 | |
|---|
| 43 | if (isset($modules[$type]) && in_array($_REQUEST['module'],$modules[$type])) { |
|---|
| [2566] | 44 | |
|---|
| [840] | 45 | $module = new $_REQUEST['module']($core); |
|---|
| 46 | $module->init(); |
|---|
| [0] | 47 | } |
|---|
| 48 | } |
|---|
| 49 | |
|---|
| [840] | 50 | if ($type && $module !== null && !empty($_REQUEST['do'])) |
|---|
| [0] | 51 | { |
|---|
| 52 | try { |
|---|
| [840] | 53 | $module->process($_REQUEST['do']); |
|---|
| [0] | 54 | } catch (Exception $e) { |
|---|
| 55 | $core->error->add($e->getMessage()); |
|---|
| 56 | } |
|---|
| 57 | } |
|---|
| [840] | 58 | |
|---|
| 59 | $title = __('Import/Export'); |
|---|
| 60 | |
|---|
| 61 | echo ' |
|---|
| [0] | 62 | <html> |
|---|
| 63 | <head> |
|---|
| [3021] | 64 | <title>'.$title.'</title>'. |
|---|
| 65 | dcPage::cssLoad(dcPage::getPF('importExport/style.css')). |
|---|
| 66 | dcPage::jsLoad(dcPage::getPF('importExport/js/script.js')). |
|---|
| 67 | '<script type="text/javascript"> |
|---|
| [0] | 68 | //<![CDATA[ |
|---|
| [840] | 69 | '.dcPage::jsVar('dotclear.msg.please_wait',__('Please wait...')).' |
|---|
| [0] | 70 | //]]> |
|---|
| 71 | </script> |
|---|
| 72 | </head> |
|---|
| [840] | 73 | <body>'; |
|---|
| [0] | 74 | |
|---|
| [840] | 75 | if ($type && $module !== null) { |
|---|
| [1358] | 76 | echo dcPage::breadcrumb( |
|---|
| [1339] | 77 | array( |
|---|
| 78 | __('Plugins') => '', |
|---|
| 79 | $title => $p_url, |
|---|
| [2166] | 80 | html::escapeHTML($module->name) => '' |
|---|
| [2477] | 81 | )). |
|---|
| 82 | dcPage::notices(); |
|---|
| [1339] | 83 | |
|---|
| [840] | 84 | echo |
|---|
| 85 | '<div id="ie-gui">'; |
|---|
| [2566] | 86 | |
|---|
| [840] | 87 | $module->gui(); |
|---|
| [2566] | 88 | |
|---|
| [0] | 89 | echo '</div>'; |
|---|
| 90 | } |
|---|
| [840] | 91 | else { |
|---|
| [1358] | 92 | echo dcPage::breadcrumb( |
|---|
| [1339] | 93 | array( |
|---|
| 94 | __('Plugins') => '', |
|---|
| [2166] | 95 | $title => '' |
|---|
| [2477] | 96 | )). |
|---|
| 97 | dcPage::notices(); |
|---|
| [1339] | 98 | |
|---|
| [2045] | 99 | echo '<h3>'.__('Import').'</h3>'.listImportExportModules($core,$modules['import']); |
|---|
| [2476] | 100 | |
|---|
| 101 | echo |
|---|
| 102 | '<h3>'.__('Export').'</h3>'. |
|---|
| 103 | '<p class="info">'.sprintf( |
|---|
| 104 | __('Export functions are in the page %s.'), |
|---|
| [2852] | 105 | '<a href="'.$core->adminurl->get('admin.plugin.maintenance',array('tab' => 'backup')).'#backup">'.__('Maintenance').'</a>' |
|---|
| [2476] | 106 | ).'</p>'; |
|---|
| [0] | 107 | } |
|---|
| 108 | |
|---|
| [2322] | 109 | dcPage::helpBlock('import'); |
|---|
| 110 | |
|---|
| 111 | echo '</body></html>'; |
|---|