CMS
Version 3.9
blog_article_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
(
"article"
,
"site"
,
"image"
,
"field_renderers"
,
"blog"
);
35
Fakoli::usingFile
(
"framework/auto_form.inc"
);
36
37
$article
=
new
Article
();
38
$article_id
= checkNumeric($_GET[
"article_id"
]);
39
$blog_id
= checkNumeric($_GET[
"blog_id"
]);
40
41
if
(!
$blog_id
) redirect(
"/index"
);
42
43
$blog
=
new
Blog
(
$blog_id
);
44
45
if
(
$article_id
)
46
{
47
$article
->load(
$article_id
);
48
}
49
else
50
{
51
$article
->created_date = now();
52
}
53
54
55
$article
->article_type =
$blog
->title;
56
57
$form
=
BlogManager::buildBlogArticleForm
(
$article
,
$blog
);
58
if
(!
$article
->article_id || !
$article
->published)
59
{
60
$form
->onSaveComplete =
onPublishArticle
;
61
}
62
63
if
(
$method
==
"POST"
)
64
{
65
if
(
$form
->save())
66
{
67
redirect(
"/blog_articles?blog_id={$blog->blog_id}"
);
68
}
69
}
70
71
if
(
$form
->data->article_id)
72
{
73
$page
->page_title =
"Edit Article"
;
74
}
75
else
76
{
77
$page
->page_title =
"Add Article"
;
78
79
if
(!
$article_id
)
$form
->hide(
"created_date"
);
80
}
81
82
$tabs
=
BlogManager::blogTabs
(
$blog_id
);
83
$tabs
->page =
"blog_articles"
;
84
85
$styles
.=
BlogManager::getStyles
();
86
87
$script
=
$form
->writeScript();
88
89
$tabs
->writeHTML();
90
?>
91
<div
id
=
"tab_border"
>
92
<?
93
$form
->drawForm();
94
95
function
onPublishArticle
(
$form
)
96
{
97
ArticleManager::onPublishArticle
(
$form
->data);
98
}
99
?>
100
</div>
101
<br/>
$form
$form
Definition:
blog_article_form.inc:60
onPublishArticle
onPublishArticle($form)
Definition:
blog_article_form.inc:99
$blog_id
$blog_id
Definition:
blog_article_form.inc:41
$blog
$blog
Definition:
blog_article_form.inc:46
$article
$article
Definition:
blog_article_form.inc:39
$article_id
$article_id
Definition:
blog_article_form.inc:40
$tabs
$tabs
Definition:
blog_article_form.inc:88
$script
$script
Definition:
blog_article_form.inc:91
$page
$page
Definition:
help.inc:39
Article
Defines the Article class.
Definition:
article.inc:45
ArticleManager\onPublishArticle
static onPublishArticle($article)
If an article is marked published but no publish date set (user may wish to set a future publish date...
Definition:
article_manager.inc:63
Blog
Definition:
blog.inc:41
BlogManager\buildBlogArticleForm
static buildBlogArticleForm($article, $blog)
Definition:
blog_manager.inc:168
BlogManager\getStyles
static getStyles()
Definition:
blog_manager.inc:189
BlogManager\blogTabs
static blogTabs($blog_id)
Definition:
blog_manager.inc:156
Fakoli\using
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition:
core.inc:116
Fakoli\usingFile
static usingFile()
Uses the specified framework file(s) from the framework directory.
Definition:
core.inc:369
$method
$method
Pull out a simple reference to the request method.
Definition:
core.inc:1573
$styles
$styles
Definition:
blog_article_form.inc:85
code
cms.sonjara.com
cms
components
blog
pages
blog_article_form.inc
Generated on Tue Mar 23 2021 15:36:12 for CMS by
1.9.1