dbXapp 2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Loading...
Searching...
No Matches
dbxConfig.class.php
Go to the documentation of this file.
1<?php
2namespace dbx\dbxAdmin;
3
4Class dbxConfig {
5
6 Private function Get_ConfigModule() {
7 $xmodul = dbx()->get_modul_var('modul','undef');
8 $config = dbx()->get_config($xmodul);
9 $tpl ='Form-dbxConfig';
10 $oForm=dbx()->get_system_obj('dbxForm');
11 $oForm->_dbData =$config;
12 $content=$oForm->run('dbxConfig',$tpl);
13
14 return $content;
15 }
16
17 private function get_new_cfg() {
18 $config=array();
19 $config['active'] = 0;
20 $config['version'] = '1';
21 $config['groups'] = 'admin';
22 return $config;
23 }
24
25
26 public function edit_config() {
27 $xmodul=dbx()->get_modul_var('xmodul');
28 $data =dbx()->get_config($xmodul);
29 if (!is_array($data)) $data=$this->get_new_cfg();
30
31 //dbx_debug("GET CFG ($xmodul)=",$data);
32
33 $oForm=dbx()->get_system_obj('dbxForm');
34 $oForm->init('form-config-edit');
35 $oForm->_action='?dbx_modul=dbxAdmin&dbx_run1=config&dbx_run2=edit&xmodul='.$xmodul;
36 $oForm->_data=$data;
37 $oForm->_dd ='cfg:'.$xmodul;
38 $oForm->_fld_change_state='*';
39 $oForm->add_rep('bar_title', 'Konfiguration: ' . $xmodul);
40
41 foreach ($data as $fld => $value) {
42 $oForm->add_fld($fld);
43 }
44 $saveBtn = dbx()->get_system_obj('dbxTPL')->get_tpl('dbx|button-submit', array('label' => 'Modul (' . $xmodul . ') Config speichern'));
45 $oForm->add_obj('button','obj-value', $saveBtn);
46 $oForm->add_obj('bar_actions', 'obj-value', $saveBtn);
47
48 if ($oForm->submit()) {
49 $config=$oForm->_post;
50 $ok=dbx()->set_config($xmodul,$config);
51 }
52
53 $content=$oForm->run();
54
55 return $content;
56
57 // 'form-config-edit'
58 }
59
60
61 public function check_edit() {
62 $xmodul=dbx()->get_modul_var('xmodul');
63 $content='';
64
65 switch ($xmodul) {
66
67 case 'dbx':
68 $oForm=dbx()->get_include_obj('dbxConfig_dbx');
69 $content=$oForm->run();
70 break;
71
72 case 'dbxContent':
73 $oForm=dbx()->get_include_obj('dbxConfig_dbxContent');
74 $content=$oForm->run();
75 break;
76
77
78 default:
79 $content=$this->edit_config();
80
81 }
82 return $content;
83
84 }
85
86
87 public function run() {
88 $modul =dbx()->get_modul_var('dbx_modul');
89 $action=dbx()->get_modul_var('dbx_run1');
90 $work =dbx()->get_modul_var('dbx_run2');
91 $content="dbxAdmin->dbxConfig ($action) ($work) <br>";
92
93 switch ($work) {
94
95 case 'edit':
96 $content=$this->check_edit();
97 break;
98
99
100 default:
101 $oTPL=dbx()->get_system_obj('dbxTPL');
102 $msg['msg']="Modul=($modul) Action=($action) Work=($work) is undef!";
103 $content=$oTPL->get_tpl('dbx','alert-warning',$msg);
104
105 }
106 return $content;
107 }
108
109}
$config['version']
Definition config.php:2