CMS  Version 3.9
survey_results.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 /* survey_results.inc
35  *
36  * Description: Displays a table data list view of survey responses
37  * with aggregate data results.
38  *
39  * author: Janice Gallant for Sonjara, Inc.
40  *
41  * date: 5/13/10
42  */
43 
44 
45 Fakoli::using("questionnaire", "survey");
46 Fakoli::usingFeature("data_view");
47 
48 $survey_id = checkNumeric($_GET["survey_id"]);
49 
50 if(!$survey_id)
51  redirect("index");
52 
54 $page->page_title = "Survey Responses for {$survey->title}";
55 
56 $responses = $survey->Responses("ORDER BY last_modified DESC");
57 
60 
61 $table = new DataListView($responses, "surveyResponses");
62 $table->column("Token", array($mgr, formatResponseLink), true)
63  ->column("Status", "{status:prettify}", true)
64  ->column("Date Submitted", "{last_modified|N/A}", true)
65  ->column("Include In Results", array($mgr, formatIncludeInResultsLink), true, "text-align: center; width: 20px");
66 ;
67 
68 $table->emptyMessage = "There are no responses to this survey.";
69 $table->sortable = true;
70 $table->pageSize = 20;
71 $table->filter = false;
72 $table->cssStyle = "width: 100%";
73 $table->excelFile = "surveyResults.xls";
74 $table->rowId = true;
75 
77 
78 $script .= $table->writeScript();
79 $script .= $mgr->writeScript();
80 $script .= $sendMgr->writeScript();
81 
82 $tabs->writeHTML();
83 ?>
84 <div id="survey_tab_border">
85 <h3>Survey Responses</h3>
86 <?
87 echo "<h3>".$survey->getTitle() . "</h3>\n";
88 // Use to show result of reminders & sent param from preview/manage page.
89 echo "<p id='action_result' class='questionnaire_action_result' style='display: none'></p>\n";
90 
91 $table->drawView();
92 
93 // anonymous response and send reminders, if applicable
94 echo $sendMgr->getResultsPageButtons();
95 ?>
96 </div>
$page
Definition: help.inc:39
static usingFeature()
Uses the specified framework feature(s).
Definition: core.inc:388
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116
getTitle()
Definition: survey.inc:154
static surveyTabs($key="")
$sendMgr
$survey
$survey_id
$responses
$table
$script