/[pkg-tikiwiki]/trunk/tiki-survey_stats_survey.php
ViewVC logotype

Contents of /trunk/tiki-survey_stats_survey.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations) (download)
Tue Jul 11 06:27:24 2006 UTC (6 years, 11 months ago) by marcusb-guest
File size: 3235 byte(s)
Imported into trunk (integration branch).
1 <?php
2
3 // $Header: /cvsroot/tikiwiki/tiki/tiki-survey_stats_survey.php,v 1.10.2.3 2005/01/05 19:45:28 jburleyebuilt Exp $
4
5 // Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
6 // All Rights Reserved. See copyright.txt for details and a complete list of authors.
7 // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
8
9 // Initialization
10 require_once ('tiki-setup.php');
11
12 include_once ('lib/surveys/surveylib.php');
13
14 if ($feature_surveys != 'y') {
15 $smarty->assign('msg', tra("This feature is disabled").": feature_surveys");
16
17 $smarty->display("error.tpl");
18 die;
19 }
20
21 $smarty->assign('individual', 'n');
22
23 if ($userlib->object_has_one_permission($_REQUEST["surveyId"], 'survey')) {
24 $smarty->assign('individual', 'y');
25
26 if ($tiki_p_admin != 'y') {
27 $perms = $userlib->get_permissions(0, -1, 'permName_desc', '', 'surveys');
28
29 foreach ($perms["data"] as $perm) {
30 $permName = $perm["permName"];
31
32 if ($userlib->object_has_permission($user, $_REQUEST["surveyId"], 'survey', $permName)) {
33 $$permName = 'y';
34
35 $smarty->assign("$permName", 'y');
36 } else {
37 $$permName = 'n';
38
39 $smarty->assign("$permName", 'n');
40 }
41 }
42 }
43 }
44
45 if ($tiki_p_view_survey_stats != 'y') {
46 $smarty->assign('msg', tra("You do not have permission to use this feature"));
47
48 $smarty->display("error.tpl");
49 die;
50 }
51
52 if (!isset($_REQUEST["surveyId"])) {
53 $smarty->assign('msg', tra("No survey indicated"));
54
55 $smarty->display("error.tpl");
56 die;
57 }
58
59 $smarty->assign('surveyId', $_REQUEST["surveyId"]);
60 $survey_info = $srvlib->get_survey($_REQUEST["surveyId"]);
61 $smarty->assign('survey_info', $survey_info);
62
63 if (isset($_REQUEST["clear"]) && $tiki_p_admin_surveys == 'y') {
64 $area = 'delsurveystats';
65 if ($feature_ticketlib2 != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
66 key_check($area);
67 $srvlib->clear_survey_stats($_REQUEST["clear"]);
68 } else {
69 key_get($area);
70 }
71 }
72
73 if (!isset($_REQUEST["sort_mode"])) {
74 $sort_mode = 'position_asc';
75 } else {
76 $sort_mode = $_REQUEST["sort_mode"];
77 }
78
79 if (!isset($_REQUEST["offset"])) {
80 $offset = 0;
81 } else {
82 $offset = $_REQUEST["offset"];
83 }
84
85 $smarty->assign_by_ref('offset', $offset);
86
87 if (isset($_REQUEST["find"])) {
88 $find = $_REQUEST["find"];
89 } else {
90 $find = '';
91 }
92
93 $smarty->assign('find', $find);
94
95 $smarty->assign_by_ref('sort_mode', $sort_mode);
96
97 $channels = $srvlib->list_survey_questions($_REQUEST["surveyId"], 0, -1, $sort_mode, $find);
98 $cant_pages = ceil($channels["cant"] / $maxRecords);
99 $smarty->assign_by_ref('cant_pages', $cant_pages);
100 $smarty->assign('actual_page', 1 + ($offset / $maxRecords));
101
102 if ($channels["cant"] > ($offset + $maxRecords)) {
103 $smarty->assign('next_offset', $offset + $maxRecords);
104 } else {
105 $smarty->assign('next_offset', -1);
106 }
107
108 // If offset is > 0 then prev_offset
109 if ($offset > 0) {
110 $smarty->assign('prev_offset', $offset - $maxRecords);
111 } else {
112 $smarty->assign('prev_offset', -1);
113 }
114
115 $smarty->assign_by_ref('channels', $channels["data"]);
116
117 $section = 'surveys';
118 include_once ('tiki-section_options.php');
119
120 ask_ticket('survey-stats-survey');
121
122 // Display the template
123 $smarty->assign('mid', 'tiki-survey_stats_survey.tpl');
124 $smarty->display("tiki.tpl");
125
126 ?>

  ViewVC Help
Powered by ViewVC 1.1.5