dbXapp
2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Toggle main menu visibility
Loading...
Searching...
No Matches
dbxContent_edit.class.php
Go to the documentation of this file.
1
<?php
2
namespace
dbx\dbxContent_admin;
3
4
use dbx\dbxContent\dbxContent_permalink;
5
6
require_once dirname(__DIR__, 2) .
'/dbxContent/include/dbxContent_bootstrap_sync.php'
;
7
8
class
dbxContent_edit
{
9
10
public
function
run
() {
11
12
13
$content=
''
; $ok=
false
;
14
$rid =
dbx
()->get_modul_var(
'rid'
,0,
'int'
);
15
$obs =
dbx
()->get_modul_var(
'dbx_obs_fld'
);
16
$obv =
dbx
()->get_modul_var(
'dbx_obs_val'
);
17
$view=
dbx
()->get_modul_var(
'dbx_view'
);
18
19
20
//dbx_debug("#Observ rid=($rid) obs=($obs) obv=($obv)");
21
if
(!$rid) {
22
if
($obs && $obv) $rid=$obv;
23
}
24
//dbx_debug("EDIT-RID=($rid) ");
25
$oForm=
dbx
()->get_system_obj(
'dbxForm'
);
26
$oForm->init(
'dbxContent_edit'
,
'form-content'
);
27
$oForm->_action=
"?dbx_modul=dbxContent_admin&dbx_run1=content&dbx_run2=edit&dbx_view=$view&rid=$rid"
;
28
if
($rid) {
29
30
$db
=
dbx
()->get_system_obj(
'dbxDB'
);
31
$lng =
dbx
()->get_system_var(
'dbx_lng'
,
'de'
);
32
33
$tab_content = dbx_lng_name(
'content'
, $lng);
34
$tab_folder = $tab_content.
'_folder'
;
35
36
$oForm->_data=
$db
->select1($tab_content,$rid);
37
// All fields must be def bevore save !
38
$oForm->add_fld(
'title'
,
'text-label'
,rules:
'words|min=1'
,title:
'Titel'
,errormsg:
'Der Title darf keine Sonderzeichen beinhalten. '
);
// #+
39
$oForm->add_fld(
'content'
,
'textarea-label'
,
''
,rules:
'*'
,title:
'Content'
);
// #+
40
//$oForm->add_js_call('content','editor-ace'); //don´t work #todo
41
42
43
//dbx_debug("CONTENT-CONTENT");
44
if
($oForm->submit()) {
45
//dbx_debug("SUBMIT");
46
if
(!$oForm->errors()) {
// submit && no errors // we ignore warnings
47
//dbx_debug("NO-ERRORS");
48
$change=$oForm->changed();
49
$post_values = array();
50
if
(dbxContent_permalink::normalize($oForm->_data[
'permalink'
] ??
''
) ===
''
) {
51
$post_values[
'permalink'
] = dbxContent_permalink::build(
$db
, $tab_folder, (
int
)($oForm->_data[
'folder'
] ?? 0), $_POST[
'title'
] ?? ($oForm->_data[
'title'
] ??
''
));
52
$oForm->set_post(
'permalink'
, $post_values[
'permalink'
]);
53
$change = 1;
54
}
55
//dbx_debug("CHANGE=($change)");
56
if
($change) {
57
//dbx_debug("CHANGE=($change)");
58
$ok=$oForm->save_post($tab_content,$rid,$post_values);
59
if
( $ok) $oForm->_msg_success =
'Daten gespeichert'
;
60
if
(!$ok) $oForm->_msg_error =
'Daten konnten nicht gespeichert werden'
;
61
}
else
{
62
$oForm->_msg_success =
'Keine Änderung'
;
63
}
64
}
65
if
($oForm->errors()) {
66
$oForm->_msg_error =
'Prüfen sie bitte ihre Eingaben'
;
67
}
68
}
69
70
$oForm->_msg_info=
'Content bearbeiten'
;
71
72
}
// rid
73
74
if
(!$rid) {
75
$oForm->_msg_info=
'Content bearbeiten - warte -'
;
76
$oForm->_tpl=
'form-content_wait'
;
77
$oForm->add_obj(
'msg'
,
'dbx|alert-warning'
,
'msg=Der Content kann erst nach dem Speichern der Systemdaten vom Content bearbeitet werden.'
);
78
79
$observer=
'obs_content_rid'
;
80
$observ[
'name'
] = $observer;
81
$observ[
'form'
] =
'dbx_form_{i}'
;
82
$observ[
'observ'
] =
'content_rid'
;
// field must be dev inside one form of the view
83
$observ[
'value'
] = $rid;
// $img_src
84
$observ[
'old'
] = $rid;
85
86
$oForm->add_obj($observer,
'dbx|observer'
,$observ);
87
$oForm->add_js_observe($observer,1500);
// watch rid from content->sysdata
88
89
90
91
}
92
93
$content= $oForm->run();
94
95
return
$content;
96
}
// run()
97
98
99
100
}
// class
101
102
?>
dbx\dbxContent_admin\dbxContent_edit
Definition
dbxContent_edit.class.php:8
dbx\dbxContent_admin\dbxContent_edit\run
run()
Definition
dbxContent_edit.class.php:10
dbx
DBX schema administration.
$db
$db
Definition
run_context_help_provision.php:38
dbx
modules
dbxContent_admin
include
dbxContent_edit.class.php
Generated by
1.17.0