CMS
Version 3.9
survey_dashboard.inc
Go to the documentation of this file.
1
<?php
2
/**************************************************************
3
4
Copyright (c) 2007,2008 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
35
/* survey_dashboard.inc
36
*
37
* Description: Survey management dashboard; Survey tab
38
* of logged in user interface
39
*
40
* author: Janice Gallant for Sonjara, Inc.
41
*
42
* date: 6/3/2010
43
*/
44
45
Fakoli::using
(
"questionnaire"
,
"survey"
);
46
Fakoli::usingFeature
(
"data_view"
);
47
48
if
(!
$user
)
49
redirect(
"/login"
);
50
51
$constraint
=
"WHERE deleted=0 "
;
52
if
(!checkRole(
"admin"
))
53
{
54
$pk
=
$user
->getPrimaryKey();
55
$constraint
.=
"AND user_id={$user->$pk} "
;
56
}
57
58
// instance can be empty - script instantiates js class QuestionnaireDashboardManager
59
$mgr
=
new
SurveyDashboardManager
(
new
Survey
());
60
61
$surveys
= Query::create(
Survey
,
"$constraint ORDER BY status, start_date DESC"
)
62
->execute();
63
64
$table
=
new
DataListView(
$surveys
,
"surveys"
);
65
$table
->column(
"Survey Title"
, array(
$mgr
, formatTitleLink),
true
,
"width: 15%"
)
66
->column(
"Author"
,
"{User.first_name} {User.last_name}"
,
true
,
"width: 10%"
)
67
->column(
"Status"
,
"<span id='status_{survey_id}'>{status:prettify}</span>"
,
true
,
"width: 10%"
)
68
->column(
"Date Sent"
,
"{start_date|-- / -- / ----}"
,
true
,
"width: 12%"
)
69
->column(
"Percentage of Surveys Received"
, array(
$mgr
, getProgressBar),
true
,
"width: 20%"
)
70
->column(
"Actions"
, array(
$mgr
, formatActions),
true
,
"width: 20%"
);
71
;
72
73
$table
->emptyMessage =
"There are no surveys."
;
74
$table
->sortable =
true
;
75
$table
->pageSize = 10;
76
$table
->filter =
true
;
77
$table
->cssStyle =
"width: 98%"
;
78
79
$script
.=
$table
->writeScript();
80
$script
.=
$mgr
->writeScript();
81
82
$table
->drawView();
83
?>
84
<br>
85
<a
class
=
"button"
href=
"survey_form"
>Create a
Survey
</a>
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
SurveyDashboardManager
Definition:
survey_manager.inc:242
Survey
Definition:
survey.inc:53
$user
global $user
Definition:
comment_form.inc:16
$pk
$pk
Definition:
send_daily_digest.inc:127
$constraint
$constraint
Definition:
survey_dashboard.inc:51
$mgr
if(!checkRole("admin")) $mgr
Definition:
survey_dashboard.inc:59
$table
$table
Definition:
survey_dashboard.inc:64
$script
$script
Definition:
survey_dashboard.inc:79
$surveys
$surveys
Definition:
survey_dashboard.inc:61
code
cms.sonjara.com
cms
components
survey
pages
survey_dashboard.inc
Generated on Tue Mar 23 2021 15:36:14 for CMS by
1.9.1