1
|
|
|
<?php |
2
|
|
|
### ============================================================= |
3
|
|
|
### Mastop InfoDigital - Paixão por Internet |
4
|
|
|
### ============================================================= |
5
|
|
|
### Vazio |
6
|
|
|
### ============================================================= |
7
|
|
|
### Developer: Fernando Santos (topet05), [email protected] |
8
|
|
|
### Copyright: Mastop InfoDigital © 2003-2007 |
9
|
|
|
### ------------------------------------------------------------- |
10
|
|
|
### www.mastop.com.br |
11
|
|
|
### ============================================================= |
12
|
|
|
### |
13
|
|
|
### ============================================================= |
14
|
|
|
|
15
|
|
|
use XoopsModules\Mastopgo2\Common; |
16
|
|
|
|
17
|
|
|
require_once __DIR__ . '/admin_header.php'; |
18
|
|
|
xoops_cp_header(); |
19
|
|
|
|
20
|
|
|
$adminObject = \Xmf\Module\Admin::getInstance(); |
21
|
|
|
|
22
|
|
|
//check or upload folders |
23
|
|
|
$configurator = new Common\Configurator(); |
24
|
|
|
foreach (array_keys($configurator->uploadFolders) as $i) { |
25
|
|
|
$utility::createFolder($configurator->uploadFolders[$i]); |
26
|
|
|
$adminObject->addConfigBoxLine($configurator->uploadFolders[$i], 'folder'); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
$adminObject->displayNavigation(basename(__FILE__)); |
30
|
|
|
|
31
|
|
|
/* |
32
|
|
|
//check for latest release |
33
|
|
|
$newRelease = $utility->checkVerModule($helper); |
34
|
|
|
if (!empty($newRelease)) { |
35
|
|
|
$adminObject->addItemButton($newRelease[0], $newRelease[1], 'download', 'style="color : Red"'); |
36
|
|
|
} |
37
|
|
|
*/ |
38
|
|
|
|
39
|
|
|
//------------- Test Data ---------------------------- |
40
|
|
|
|
41
|
|
|
if ($helper->getConfig('displaySampleButton')) { |
42
|
|
|
$yamlFile = dirname(__DIR__) . '/config/admin.yml'; |
43
|
|
|
$config = loadAdminConfig($yamlFile); |
44
|
|
|
$displaySampleButton = $config['displaySampleButton']; |
45
|
|
|
|
46
|
|
|
if (1 == $displaySampleButton) { |
47
|
|
|
xoops_loadLanguage('admin/modulesadmin', 'system'); |
48
|
|
|
require __DIR__ . '/../testdata/index.php'; |
49
|
|
|
|
50
|
|
|
$adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=load', 'add'); |
51
|
|
|
$adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=save', 'add'); |
52
|
|
|
// $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), '__DIR__ . /../../testdata/index.php?op=exportschema', 'add'); |
53
|
|
|
$adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete'); |
54
|
|
|
} else { |
55
|
|
|
$adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add'); |
56
|
|
|
$displaySampleButton = $config['displaySampleButton']; |
57
|
|
|
} |
58
|
|
|
$adminObject->displayButton('left', ''); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
//------------- End Test Data ---------------------------- |
62
|
|
|
|
63
|
|
|
$adminObject->displayIndex(); |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param $yamlFile |
67
|
|
|
* @return array|bool |
68
|
|
|
*/ |
69
|
|
|
function loadAdminConfig($yamlFile) |
70
|
|
|
{ |
71
|
|
|
$config = \Xmf\Yaml::loadWrapped($yamlFile); // work with phpmyadmin YAML dumps |
72
|
|
|
return $config; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @param $yamlFile |
77
|
|
|
*/ |
78
|
|
|
function hideButtons($yamlFile) |
79
|
|
|
{ |
80
|
|
|
$app['displaySampleButton'] = 0; |
|
|
|
|
81
|
|
|
\Xmf\Yaml::save($app, $yamlFile); |
82
|
|
|
redirect_header('index.php', 0, ''); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @param $yamlFile |
87
|
|
|
*/ |
88
|
|
|
function showButtons($yamlFile) |
89
|
|
|
{ |
90
|
|
|
$app['displaySampleButton'] = 1; |
|
|
|
|
91
|
|
|
\Xmf\Yaml::save($app, $yamlFile); |
92
|
|
|
redirect_header('index.php', 0, ''); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
$op = \Xmf\Request::getString('op', 0, 'GET'); |
96
|
|
|
|
97
|
|
|
switch ($op) { |
98
|
|
|
case 'hide_buttons': |
99
|
|
|
hideButtons($yamlFile); |
100
|
|
|
break; |
101
|
|
|
case 'show_buttons': |
102
|
|
|
showButtons($yamlFile); |
103
|
|
|
break; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
echo $utility::getServerStats(); |
107
|
|
|
|
108
|
|
|
require __DIR__ . '/admin_footer.php'; |
109
|
|
|
|