CMS
Version 3.9
contact_us.inc
Go to the documentation of this file.
1
<?php
7
/**************************************************************
8
9
Copyright (c) 2010 Sonjara, Inc
10
11
Permission is hereby granted, free of charge, to any person
12
obtaining a copy of this software and associated documentation
13
files (the "Software"), to deal in the Software without
14
restriction, including without limitation the rights to use,
15
copy, modify, merge, publish, distribute, sublicense, and/or sell
16
copies of the Software, and to permit persons to whom the
17
Software is furnished to do so, subject to the following
18
conditions:
19
20
The above copyright notice and this permission notice shall be
21
included in all copies or substantial portions of the Software.
22
23
Except as contained in this notice, the name(s) of the above
24
copyright holders shall not be used in advertising or otherwise
25
to promote the sale, use or other dealings in this Software
26
without prior written authorization.
27
28
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
30
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
32
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
33
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
34
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35
OTHER DEALINGS IN THE SOFTWARE.
36
37
*****************************************************************/
38
39
class
ContactUs
extends
DataItem
40
{
41
var
$table
=
"contact_us"
;
42
var
$primary_key
=
"contact_us_id"
;
43
var
$pretty_class_name
=
"Contact Us Message"
;
44
45
var
$fields
= array(
46
"contact_us_id"
=> Number,
47
"full_name"
=> String,
48
"email"
=> String,
49
"contact_topic_id"
=> String,
50
"subject"
=> String,
51
"message"
=> Text,
52
"date_sent"
=> Timestamp
53
);
54
55
var
$relations
= array(
56
"ContactTopic"
=>
ContactTopic
57
);
58
59
function
ContactTopic
()
60
{
61
if
($this->contact_topic_id)
62
return
$this->getRelated(
ContactTopic
);
63
}
64
65
}
66
67
68
class
ContactTopic
extends
DataItem
69
{
70
var
$primary_key
=
"contact_topic_id"
;
71
var
$table
=
"contact_topic"
;
72
73
var
$fields
= array(
74
"contact_topic_id"
=> Number,
75
"topic"
=> String,
76
"recipients"
=> Text,
77
"sort_order"
=> Number
78
);
79
80
var
$relations
= array(
81
"Sites"
=>
Site
82
);
83
84
static
function
formatList
()
85
{
86
global
$page
;
87
$topicList
= array();
88
$siteCount = queryValue(
Site
,
"COUNT(1)"
,
""
);
89
if
($siteCount == 1)
90
{
91
$topics
= query(
ContactTopic
,
"ORDER BY sort_order"
);
92
}
93
else
94
{
95
$site
=
$page
->Site();
96
if
(!
$site
)
$site
=
Site::getSite
();
97
if
(
$site
)
98
{
99
$siteTopics = Query::create(
ContactTopicSiteXref
,
"WHERE site_id=:s"
)
100
->bind(
":s"
,
$site
->site_id)
101
->execute();
102
103
if
(count($siteTopics) > 0)
104
{
105
$topicKeyList = formatItems($siteTopics,
"{contact_topic_id}"
,
","
);
106
$topics
= query(
ContactTopic
,
"WHERE contact_topic_id IN ($topicKeyList) ORDER BY sort_order"
);
107
}
108
}
109
}
110
if
(count(
$topics
) > 0)
111
{
112
foreach
(
$topics
as
$topic
)
113
$topicList
[
$topic
->contact_topic_id] =
$topic
->topic;
114
}
115
116
return
$topicList
;
117
}
118
119
function
Sites
()
120
{
121
return
$this->crossReference(
Site
,
ContactTopicSiteXref
);
122
}
123
}
124
125
class
ContactTopicSiteXref
extends
DataItem
126
{
127
var
$primary_key
=
"contact_topic_site_xref_id"
;
128
var
$table
=
"contact_topic_site_xref"
;
129
130
var
$fields
= array(
131
"contact_topic_site_xref_id"
=> Number,
132
"contact_topic_id"
=> Number,
133
"site_id"
=> Number
134
);
135
}
136
137
?>
$page
$page
Definition:
help.inc:39
$site
$site
Definition:
menu_item_form.inc:58
ContactTopic
Definition:
contact_us.inc:69
ContactTopic\$primary_key
$primary_key
Definition:
contact_us.inc:70
ContactTopic\$fields
$fields
Definition:
contact_us.inc:73
ContactTopic\$table
$table
Definition:
contact_us.inc:71
ContactTopic\$relations
$relations
Definition:
contact_us.inc:80
ContactTopic\formatList
static formatList()
Definition:
contact_us.inc:84
ContactTopic\Sites
Sites()
Definition:
contact_us.inc:119
ContactTopicSiteXref
Definition:
contact_us.inc:126
ContactTopicSiteXref\$primary_key
$primary_key
Definition:
contact_us.inc:127
ContactTopicSiteXref\$fields
$fields
Definition:
contact_us.inc:130
ContactTopicSiteXref\$table
$table
Definition:
contact_us.inc:128
ContactUs
Definition:
contact_us.inc:40
ContactUs\$primary_key
$primary_key
Definition:
contact_us.inc:42
ContactUs\$table
$table
Definition:
contact_us.inc:41
ContactUs\$pretty_class_name
$pretty_class_name
Definition:
contact_us.inc:43
ContactUs\$relations
$relations
Definition:
contact_us.inc:55
ContactUs\ContactTopic
ContactTopic()
Definition:
contact_us.inc:59
ContactUs\$fields
$fields
Definition:
contact_us.inc:45
Site
Definition:
site.inc:40
Site\getSite
static getSite()
Returns the Site object that describes the currently active site (i.e.
Definition:
site.inc:103
$topics
$topics
Definition:
group_form.inc:52
$topicList
$topicList
Definition:
group_form.inc:53
$topic
$topic
Definition:
topic_form.inc:42
code
cms.sonjara.com
cms
components
email
datamodel
contact_us.inc
Generated on Tue Mar 23 2021 15:36:12 for CMS by
1.9.1