CMS
Version 3.9
blog_form.inc
Go to the documentation of this file.
1
<?php
2
/**************************************************************
3
4
Copyright (c) 2010 Sonjara, Inc
5
6
Permission is hereby granted, free of charge, to any person
7
obtaining a copy of this software and associated documentation
8
files (the "Software"), to deal in the Software without
9
restriction, including without limitation the rights to use,
10
copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the
12
Software is furnished to do so, subject to the following
13
conditions:
14
15
The above copyright notice and this permission notice shall be
16
included in all copies or substantial portions of the Software.
17
18
Except as contained in this notice, the name(s) of the above
19
copyright holders shall not be used in advertising or otherwise
20
to promote the sale, use or other dealings in this Software
21
without prior written authorization.
22
23
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
25
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30
OTHER DEALINGS IN THE SOFTWARE.
31
32
*****************************************************************/
33
34
Fakoli::using
(
"blog"
,
"field_renderers"
,
"taxonomy"
);
35
Fakoli::usingFeature
(
"auto_form"
);
36
37
require_once
"include/blog_tabs.inc"
;
38
39
$blog_id
= checkNumeric($_GET[
"blog_id"
]);
40
41
$blog
=
new
Blog
();
42
43
$menu_item
=
"Blogs"
;
44
45
if
(
$blog_id
)
46
{
47
$blog
->load(
$blog_id
);
48
$title
=
"Editing Blog Definition for $blog->title"
;
49
}
50
else
51
{
52
$title
=
"Add a new Blog"
;
53
54
$_POST
[
"owner_id"
] =
$user
->get(
$user
->getPrimaryKey());
55
$_POST
[
"created_date"
] = now();
56
}
57
58
$redirect
=
"/admin/blogs"
;
59
60
$tabs
=
blogTabs
(
$blog_id
);
61
62
$blogView
=
new
BlogView
(
$blog
);
63
$form
=
BlogManager::buildBlogForm
(
$blog
,
$redirect
,
$blogView
);
64
$form
->unique(
"identifier"
);
65
66
TaxonomyManager::addTaxonomyFieldRenderers
(
$form
);
67
68
$form
->allowDelete =
$blog
->allowDelete();
69
$form
->onDelete =
onDeleteCascade
;
70
71
if
(
$method
==
"POST"
)
72
{
73
if
(
$form
->save())
74
{
75
redirect(
$redirect
);
76
}
77
}
78
79
$script
.=
$form
->writeScript();
80
81
$tabs
->writeHTML();
82
?>
83
<div
id
=
"tab_border"
>
84
<?
85
$form
->drawForm();
86
87
function
onDeleteCascade
(
$blog
)
88
{
89
$blog
->delete();
90
redirect(
"/admin/blogs"
);
91
}
92
?>
93
<br/>
94
</div>
$form
$form
Definition:
blog_form.inc:63
$blog_id
$blog_id
Definition:
blog_form.inc:39
$blog
$blog
Definition:
blog_form.inc:41
$_POST
$_POST["owner_id"]
Definition:
blog_form.inc:54
$redirect
$redirect
Definition:
blog_form.inc:58
onDeleteCascade
onDeleteCascade($blog)
Definition:
blog_form.inc:87
$tabs
$tabs
Definition:
blog_form.inc:60
$menu_item
$menu_item
Definition:
blog_form.inc:43
$blogView
$blogView
Definition:
blog_form.inc:62
$script
if($method=="POST") $script
Definition:
blog_form.inc:79
$title
$title
Definition:
session_details.inc:11
blogTabs
blogTabs($blog_id)
Definition:
blog_tabs.inc:36
Blog
Definition:
blog.inc:41
BlogManager\buildBlogForm
static buildBlogForm($blog, $redirect, $blogView)
Definition:
blog_manager.inc:129
BlogView
Definition:
blog_view.inc:371
Fakoli\usingFeature
static usingFeature()
Uses the specified framework feature(s).
Definition:
core.inc:388
Fakoli\using
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition:
core.inc:116
TaxonomyManager\addTaxonomyFieldRenderers
static addTaxonomyFieldRenderers($form, $showSelectAll=true, $group=null, $limitTo=null)
Definition:
taxonomy_manager.inc:217
$user
global $user
Definition:
comment_form.inc:16
$method
$method
Pull out a simple reference to the request method.
Definition:
core.inc:1573
code
cms.sonjara.com
cms
components
blog
admin
blog_form.inc
Generated on Tue Mar 23 2021 15:36:12 for CMS by
1.9.1