CMS
Version 3.9
scroll_part_form.inc
Go to the documentation of this file.
1
<?php
2
Fakoli::using
(
"scroll"
,
"field_renderers"
);
3
4
$menu_item
=
"Scrolls"
;
5
6
$scroll_id
= checkNumeric($_GET[
"scroll_id"
]);
7
$scroll_part_id
= checkNumeric($_GET[
"scroll_part_id"
]);
8
$content_type
= checkIdentifier($_GET[
"content_type"
]);
9
10
if
(
$scroll_part_id
)
11
{
12
$part =
new
ScrollPart
(
$scroll_part_id
);
13
if
(
$scroll_id
!= $part->scroll_id)
14
{
15
throw
new
FakoliException
(
"Parameter Mismatch"
);
16
}
17
}
18
else
19
{
20
if
(!
$scroll_id
)
21
{
22
throw
new
FakoliException
(
"Scroll Mismatch"
);
23
}
24
25
if
(
$content_type
!=
'HTML'
&&
$content_type
!=
'Code'
)
26
{
27
throw
new
Exception(
"Invalid Content Type"
);
28
}
29
30
$part =
new
ScrollPart
();
31
$part->scroll_id =
$scroll_id
;
32
$part->content_type =
$content_type
;
33
}
34
35
$form
=
new
AutoForm($part);
36
$form
->allowDelete =
true
;
37
38
$scrollSelect
=
$form
->related(
Scroll
,
""
,
"{title}"
,
"scroll_id"
,
"Scroll"
);
39
$form
->alias(
"css_class"
,
"CSS Class"
);
40
$form
->readonly(
"content_type"
,
"scroll_id"
);
41
42
VersionedContentManager::enableVersioning
(
$form
);
43
44
$form
->onInsertPreProcess =
function
(
$form
)
45
{
46
$form
->data->sort_order = Query::create(
ScrollPart
,
"WHERE scroll_id=:s"
)
47
->bind(
":s"
,
$form
->data->scroll_id)
48
->executeValue(
"MAX(sort_order) + 1"
);
49
};
50
51
$tabs
=
ScrollManager::scrollTabs
($part->scroll_id);
52
$tabs
->page =
"scroll_parts"
;
53
54
if
($part->content_type ==
"HTML"
)
55
{
56
$form
->hide(
"php_code_file"
);
57
}
58
else
59
{
60
$form
->hide(
"content"
);
61
$codeSelect
=
new
CodeFileSelectFieldRenderer
(
$form
,
"php_code_file"
,
"PHP Code File"
,
"modules"
);
62
}
63
64
if
(
$method
==
"POST"
)
65
{
66
if
(
$form
->save())
67
{
68
Fakoli::notify
(
"Changes Saved"
);
69
}
70
}
71
72
$script
.=
$form
->writeScript();
73
74
$tabs
->writeHTML();
75
?>
76
<div
class
=
'tab_border'
>
77
<?php
78
$form
->drawForm();
79
?>
80
</div>
CodeFileSelectFieldRenderer
Definition:
code_file_select_field_renderer.inc:43
FakoliException
FakoliException is the base exception class for all Fakoli errors.
Definition:
core.inc:53
Fakoli\using
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition:
core.inc:116
Fakoli\notify
static notify($message, $blocking=false, $button="OK", $onClick="null")
Utility method to display a notification message to the user when the page has finished loading.
Definition:
core.inc:1198
Scroll
Definition:
scroll.inc:8
ScrollManager\scrollTabs
static scrollTabs($key)
Definition:
scroll_manager.inc:31
ScrollPart
Definition:
scroll_part.inc:8
VersionedContentManager\enableVersioning
static enableVersioning($form)
Definition:
versioned_content_manager.inc:32
$method
$method
Pull out a simple reference to the request method.
Definition:
core.inc:1573
$form
$form
Definition:
scroll_part_form.inc:35
$scroll_part_id
$scroll_part_id
Definition:
scroll_part_form.inc:7
$scrollSelect
$scrollSelect
Definition:
scroll_part_form.inc:38
$tabs
$tabs
Definition:
scroll_part_form.inc:51
$menu_item
$menu_item
Definition:
scroll_part_form.inc:4
$content_type
$content_type
Definition:
scroll_part_form.inc:8
$scroll_id
$scroll_id
Definition:
scroll_part_form.inc:6
$codeSelect
$codeSelect
Definition:
scroll_part_form.inc:61
$script
if($method=="POST") $script
Definition:
scroll_part_form.inc:72
code
cms.sonjara.com
cms
components
scroll
admin
scroll_part_form.inc
Generated on Tue Mar 23 2021 15:36:14 for CMS by
1.9.1