1.10.x
Yannick Warnier 10 years ago
commit 8ce5184f9e
  1. 0
      archive/.htaccess
  2. 2
      main/admin/skills_wheel.php
  3. 143
      main/css/base.css
  4. 36
      main/css/base_chamilo.css
  5. 4
      main/css/chamilo/default.css
  6. BIN
      main/img/icons/16/statistics.png
  7. BIN
      main/img/icons/16/statistics_na.png
  8. BIN
      main/img/icons/22/statistics.png
  9. BIN
      main/img/icons/22/survey.png
  10. 1
      main/inc/lib/add_course.lib.inc.php
  11. 26
      main/inc/lib/javascript/d3/d3.LICENSE
  12. 4
      main/inc/lib/javascript/d3/d3.v2.min.js
  13. 9504
      main/inc/lib/javascript/d3/d3.v3.5.4.js
  14. 5
      main/inc/lib/javascript/d3/d3.v3.5.4.min.js
  15. 3
      main/inc/lib/javascript/dimple.v2.1.2.min.js
  16. 5
      main/inc/lib/main_api.lib.php
  17. 5
      main/install/db_main.sql
  18. 4
      main/install/migrate-db-1.9.0-1.10.0-pre.sql
  19. 2
      main/social/skills_wheel.php
  20. 7
      main/survey/create_new_survey.php
  21. 20
      main/survey/fillsurvey.php
  22. 40
      main/survey/reporting.php
  23. 353
      main/survey/survey.lib.php

@ -20,7 +20,7 @@ if (api_get_setting('allow_skills_tool') != 'true') {
}
//Adds the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_js('d3/d3.v2.min.js');
$htmlHeadXtra[] = api_get_js('d3/d3.v3.5.4.min.js');
$htmlHeadXtra[] = api_get_js('d3/colorbrewer.js');
$htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js');

@ -5315,4 +5315,147 @@ i.size-32.icon-new-work{
#settings .span6:nth-child(2n+1) {
clear:left
/***** Survey *****/
#list-survey p{
display: inline-block;
margin-left: 10px;
}
.survey-block{
width: 100%;
margin: auto;
padding: 10px;
box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
}
.survey-block .table tbody tr:hover td{
background-color: #fff6d5 ;
}
.survey-block .table tbody tr:hover th,.survey-block .table tbody tr th {
background-color: #ececec ;
text-align: center;
}
.survey-block .table .center{
text-align: center;
}
.survey-block .title-survey-block{
padding-top: 10px;
padding-bottom: 10px;
}
.survey-block .title-survey-block h3{
display: inline-block;
margin-left: 10px;
}
#survey_title {
font-size: 24px;
font-weight: 500;
color:#666;
padding-top:10px;
padding-bottom: 10px;
padding-left: 15px;
padding-right: 15px;
background-color: #ececec;
}
#survey_subtitle {
background-color:#F7F7E3;
color:#666;
padding:10px;
font-size:14px ;
}
.survey_content {
color:#666;
padding:5px;
font-size: 13px;
margin-top: 4px;
margin-bottom: 10px;
}
.survey-block #question{
background-color: #ececec;
text-align: center;
}
.survey_question_wrapper {
border-top: 1px solid #DADADA;
background-color: #ffffff;
padding-top: 1em;
padding-bottom: 2em;
padding-left: 1em;
padding-right: 1em;
text-align: left;
}
.survey_question {
/* 264269 4271b5 E5EDF9 */
color:#666;
padding:5px;
font-size: 16px;
font-weight: bold;
}
.survey_question_options {
/* 264269 4271b5 E5EDF9 */
background-color:#FFF;
color:#000;
padding:5px;/*border: 1px solid #264269;*/
}
.survey-next.btn{
border:1px solid #319265; -webkit-border-radius: 3px; -moz-border-radius: 3px;border-radius: 3px;font-size:18px;font-family:arial, helvetica, sans-serif; padding: 10px 20px 10px 20px; text-decoration:none; display:inline-block;font-weight:bold; color: #FFFFFF;
background-color: #3FBC82; background-image: -webkit-gradient(linear, left top, left bottom, from(#3FBC82), to(#308E60));
background-image: -webkit-linear-gradient(top, #3FBC82, #308E60);
background-image: -moz-linear-gradient(top, #3FBC82, #308E60);
background-image: -ms-linear-gradient(top, #3FBC82, #308E60);
background-image: -o-linear-gradient(top, #3FBC82, #308E60);
background-image: linear-gradient(to bottom, #3FBC82, #308E60);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#3FBC82, endColorstr=#308E60);
text-shadow:none;
margin-top: 1em;
margin-bottom: 1em;
}
.survey-next.btn:hover{
border:1px solid #25704d;
background-color: #329668; background-image: -webkit-gradient(linear, left top, left bottom, from(#329668), to(#236846));
background-image: -webkit-linear-gradient(top, #329668, #236846);
background-image: -moz-linear-gradient(top, #329668, #236846);
background-image: -ms-linear-gradient(top, #329668, #236846);
background-image: -o-linear-gradient(top, #329668, #236846);
background-image: linear-gradient(to bottom, #329668, #236846);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#329668, endColorstr=#236846);
background-position: 0 0;
}
.survey-block .confirmation-message, .survey-block .error-message{
font-size: 16px;
text-align: center;
}
#question_report_questionnumbers.pagination .disabled a{
background-color:#F5F5F5;
color: #666;
}
.title-question{
font-size: 22px;
}
#display-survey.table tbody tr th, #display-survey.table tbody tr:hover th{
background-color:#666;
text-align: center;
font-size: 14px;
color: #FFFFFF;
}
#display-survey .total{
background-color: #EBF3F5;
text-align: center;
}
#display-survey .center{
text-align: center;
}
#display-survey{
border: 1px solid #ddd;
}
#display-survey.table tbody tr:hover td,#display-survey.table tbody tr:hover th{
background-color: none;
}
.answered-people{
padding: 10px;
border: 1px solid #ddd;
margin-bottom: 20px;
}
.answered-people h4{
margin-bottom: 10px;
font-size: 16px;
font-weight: normal;
}

@ -1003,41 +1003,7 @@ padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0p
.skip {
display: none;
}
/* Survey */
#survey_title {
background-color:#dcdcdc;
color:#000;
padding:2px;
}
#survey_subtitle {
background-color:#dcdcdc;
color:#000;
padding:2px;
}
.survey_content {
background-color:#a0e5fc;
color:#264269;
padding:5px;
border: 1px solid #999;
margin-top: 4px;
}
.survey_question_wrapper {
border: 1px solid #999;
margin-top:4px;
}
.survey_question {
/* 264269 4271b5 E5EDF9 */
background-color:#E5EDF9;
color:#999;
padding:5px;/*border: 1px solid #264269;*/
}
.survey_question_options {
/* 264269 4271b5 E5EDF9 */
background-color:#FFF;
color:#000;
padding:5px;/*border: 1px solid #264269;*/
}
/*
Added: to fit img and blocks in home page
*/
#hellomindfactory {

@ -7,7 +7,7 @@
/* the following for regular <a> elements */
body {
line-height: 25px;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
@ -625,7 +625,7 @@ a.thumbnail:hover{
* FOOTER STYLES *
*****************************************************/
footer {
height: 7em;
height: auto;
background: #00a9e0; /* Old browsers */
color:#ffffff;
border-top: none;

Binary file not shown.

After

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -1759,6 +1759,7 @@ function create_course_tables($course_db_name = null) {
show_form_profile int NOT NULL default 0,
form_fields TEXT NOT NULL,
session_id int unsigned NOT NULL default 0,
visible_results int unsigned DEFAULT 0,
PRIMARY KEY (c_id, survey_id)
)" . $charset_clause;
$result = Database::query($sql);

@ -0,0 +1,26 @@
Copyright (c) 2010-2015, Michael Bostock
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The name Michael Bostock may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -82,6 +82,11 @@ define('SUBSCRIBE_NOT_ALLOWED', 0);
define('UNSUBSCRIBE_ALLOWED', 1);
define('UNSUBSCRIBE_NOT_ALLOWED', 0);
// SURVEY VISIBILITY CONSTANTS
define('SURVEY_VISIBLE_TUTOR', 0);
define('SURVEY_VISIBLE_TUTOR_STUDENT', 1);
define('SURVEY_VISIBLE_PUBLIC', 2);
// CONSTANTS defining all tools, using the english version
/* When you add a new tool you must add it into function api_get_tools_lists() too */
define('TOOL_DOCUMENT','document');

@ -883,7 +883,7 @@ VALUES
('tool_visible_by_default_at_creation','forums','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Forums', 1),
('tool_visible_by_default_at_creation','quiz','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Quiz', 1),
('tool_visible_by_default_at_creation','gradebook','checkbox','Tools','true','ToolVisibleByDefaultAtCreationTitle','ToolVisibleByDefaultAtCreationComment',NULL,'Gradebook', 1),
('chamilo_database_version', NULL, 'textfield',NULL, '1.10.0.4','DatabaseVersion','', NULL, NULL, 0);
('chamilo_database_version', NULL, 'textfield',NULL, '1.10.0.5','DatabaseVersion','', NULL, NULL, 0);
UNLOCK TABLES;
/*!40000 ALTER TABLE settings_current ENABLE KEYS */;
@ -3036,6 +3036,7 @@ CREATE TABLE usergroup_rel_question (
);
-- 1.10.x-specific, non-course-related, database changes
<<<<<<< HEAD
-- some changes to previous structure might have been applied to the tables
-- creation statements above to increase efficiency
@ -3063,3 +3064,5 @@ CREATE TABLE IF NOT EXISTS hook_call(
PRIMARY KEY PK_hook_management_hook_call(id)
);
=======
>>>>>>> ilosada-BT9068a

@ -30,7 +30,9 @@ ALTER TABLE session ADD COLUMN duration int;
ALTER TABLE session_rel_user ADD COLUMN duration int;
-- Do not move this query
UPDATE settings_current SET selected_value = '1.10.0.4' WHERE variable = 'chamilo_database_version';
UPDATE settings_current SET selected_value = '1.10.0.5' WHERE variable = 'chamilo_database_version';
-- xxCOURSExx
ALTER TABLE c_survey ADD visible_results INT UNSIGNED DEFAULT 0;

@ -20,7 +20,7 @@ if (api_get_setting('allow_skills_tool') != 'true') {
api_block_anonymous_users();
//Adds the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_js('d3/d3.v2.min.js');
$htmlHeadXtra[] = api_get_js('d3/d3.v3.5.4.min.js');
$htmlHeadXtra[] = api_get_js('d3/colorbrewer.js');
$htmlHeadXtra[] = api_get_js('d3/jquery.xcolor.js');

@ -147,6 +147,13 @@ $form->addElement('date_picker', 'start_date', get_lang('StartDate'));
$form->addElement('date_picker', 'end_date', get_lang('EndDate'));
$form->addElement('checkbox', 'anonymous', null, get_lang('Anonymous'));
$visibleResults = array(
SURVEY_VISIBLE_TUTOR => get_lang('Coach'),
SURVEY_VISIBLE_TUTOR_STUDENT => get_lang('CoachAndStudent'),
SURVEY_VISIBLE_PUBLIC => get_lang('Everyone')
);
$form->addElement('select', 'visible_results', get_lang('ResultsVisibility'), $visibleResults);
//$defaults['visible_results'] = 0;
$form->addElement('html_editor', 'survey_introduction', get_lang('SurveyIntroduction'), null, array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '130', 'ToolbarStartExpanded' => false));
$form->addElement('html_editor', 'survey_thanks', get_lang('SurveyThanks'), null, array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '130', 'ToolbarStartExpanded' => false));

@ -81,7 +81,9 @@ Display :: display_header(get_lang('ToolSurvey'));
// First we check if the needed parameters are present
if ((!isset($_GET['course']) || !isset($_GET['invitationcode'])) && !isset($_GET['user_id'])) {
echo '<div class="survey-block';
Display :: display_error_message(get_lang('SurveyParametersMissingUseCopyPaste'), false);
echo '</div>';
Display :: display_footer();
exit;
}
@ -145,7 +147,9 @@ if ( !isset($_POST['finish_survey']) &&
($isAnonymous && isset($_SESSION['surveyuser'])) ||
($survey_invitation['answered'] == 1 && !isset($_GET['user_id']))
) {
echo '<div class="survey-block">';
Display :: display_error_message(get_lang('YouAlreadyFilledThisSurvey'), false);
echo '</div>';
Display :: display_footer();
exit;
}
@ -311,13 +315,17 @@ if (count($_POST) > 0) {
}
} else {
// In case it's another type than 0 or 1
die(get_lang('ErrorSurveyTypeUnknown'));
}
}
// Displaying the survey title and subtitle (appears on every page)
echo '<div id="survey_title">'.$survey_data['survey_title'].'</div>';
echo '<div id="survey_subtitle">'.$survey_data['survey_subtitle'].'</div>';
echo '<div class="survey-block">';
echo '<div id="survey_title">';
echo Display::return_icon('statistics.png', get_lang('CreateNewSurvey'),array('style'=>'display:inline-block; margin-right:5px;'),ICON_SIZE_SMALL);
echo strip_tags($survey_data['survey_title']).'</div>';
echo '<div id="survey_subtitle">'.strip_tags($survey_data['survey_subtitle']).'</div>';
// Checking time availability
check_time_availability($survey_data);
@ -1128,13 +1136,13 @@ if ($survey_data['survey_type'] === '0') {
// The normal survey as always
if (($show < $numberofpages) || !$_GET['show']) { //$show = $_GET['show'] + 1
if ($show == 0) {
echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('StartSurvey').'</button>';
echo '<button type="submit" name="next_survey_page" class="survey-next">'.get_lang('StartSurvey').'</button>';
} else {
echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('Next').'</button>';
echo '<button type="submit" name="next_survey_page" class="survey-next">'.get_lang('Next').'</button>';
}
}
if ($show >= $numberofpages && $_GET['show']) {
echo '<button type="submit" name="finish_survey" class="next">'.get_lang('FinishSurvey').'</button>';
echo '<button type="submit" name="finish_survey" class="survey-next">'.get_lang('FinishSurvey').'</button>';
}
} else {
// The normal survey as always but with the form profile
@ -1212,7 +1220,9 @@ if ($survey_data['survey_type'] === '0') {
echo '<button type="submit" name="next_survey_page" class="next">'.get_lang('Next').'</button>';
}
}
echo '</form>';
echo '</div>';
// Footer
Display :: display_footer();

@ -17,6 +17,7 @@ $language_file = 'survey';
require_once '../inc/global.inc.php';
require_once 'survey.lib.php';
$this_section = SECTION_COURSES;
$cidReq = api_get_cidreq();
$survey_id = intval($_GET['survey_id']);
$survey_data = survey_manager::get_survey($survey_id);
@ -77,17 +78,18 @@ $people_filled = survey_manager::get_people_who_filled_survey(
// Checking the parameters
SurveyUtil::check_parameters($people_filled);
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
api_get_user_id(),
api_get_course_info()
);
$survey_data = survey_manager::get_survey($survey_id);
/** @todo this has to be moved to a more appropriate place (after the display_header of the code)*/
if (!(api_is_allowed_to_edit(false, true) || $isDrhOfCourse)) {
Display :: display_header(get_lang('ToolSurvey'));
Display :: display_error_message(get_lang('NotAllowed'), false);
Display :: display_footer();
exit;
if (!api_is_allowed_to_edit(false, true)) {
Display :: display_header(get_lang('ToolSurvey'));
// Show error message if the survey can be seen only by tutors
if ($survey_data['visible_results'] != SURVEY_VISIBLE_TUTOR) {
SurveyUtil::handle_reporting_actions($survey_data, $people_filled);
} else {
Display :: display_error_message(get_lang('NotAllowed'), false);
}
Display :: display_footer();
exit;
}
// Database table definitions
@ -96,7 +98,7 @@ $table_user = Database:: get_main_table(TABLE_MAIN_USER);
// Getting the survey information
$survey_data = survey_manager::get_survey($survey_id);
//$survey_data = survey_manager::get_survey($survey_id);
if (empty($survey_data)) {
Display :: display_header(get_lang('ToolSurvey'));
Display :: display_error_message(get_lang('InvallidSurvey'), false);
@ -149,15 +151,13 @@ echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.$sur
echo '</div>';
// Content
if (!isset($_GET['action']) ||
isset($_GET['action']) &&
$_GET['action'] == 'overview'
) {
$myweb_survey_id = $survey_id;
echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&amp;survey_id='.$myweb_survey_id.'">'.Display::return_icon('survey_reporting_question.gif',get_lang('DetailedReportByQuestion')).' '.get_lang('DetailedReportByQuestion').'</a></div><div class="sectioncomment">'.get_lang('DetailedReportByQuestionDetail').' </div>';
echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&amp;survey_id='.$myweb_survey_id.'">'.Display::return_icon('survey_reporting_user.gif',get_lang('DetailedReportByUser')).' '.get_lang('DetailedReportByUser').'</a></div><div class="sectioncomment">'.get_lang('DetailedReportByUserDetail').'.</div>';
echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=comparativereport&amp;survey_id='.$myweb_survey_id.'">'.Display::return_icon('survey_reporting_comparative.gif',get_lang('ComparativeReport')).' '.get_lang('ComparativeReport').'</a></div><div class="sectioncomment">'.get_lang('ComparativeReportDetail').'.</div>';
echo '<div class="sectiontitle"><a href="reporting.php?action=completereport&amp;survey_id='.$myweb_survey_id.'">'.Display::return_icon('survey_reporting_complete.gif',get_lang('CompleteReport')).' '.get_lang('CompleteReport').'</a></div><div class="sectioncomment">'.get_lang('CompleteReportDetail').'</div>';
if (!isset($_GET['action']) || isset($_GET['action']) && $_GET['action'] == 'overview') {
$myweb_survey_id = $survey_id;
echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&amp;'.$cidReq.'&amp;survey_id='.$myweb_survey_id.'">'.Display::return_icon('survey_reporting_question.gif',get_lang('DetailedReportByQuestion')).' '.get_lang('DetailedReportByQuestion').'</a></div><div class="sectioncomment">'.get_lang('DetailedReportByQuestionDetail').' </div>';
echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&amp;'.$cidReq.'&amp;survey_id='.$myweb_survey_id.'">'.Display::return_icon('survey_reporting_user.gif',get_lang('DetailedReportByUser')).' '.get_lang('DetailedReportByUser').'</a></div><div class="sectioncomment">'.get_lang('DetailedReportByUserDetail').'.</div>';
echo '<div class="sectiontitle"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=comparativereport&amp;'.$cidReq.'&amp;survey_id='.$myweb_survey_id.'">'.Display::return_icon('survey_reporting_comparative.gif',get_lang('ComparativeReport')).' '.get_lang('ComparativeReport').'</a></div><div class="sectioncomment">'.get_lang('ComparativeReportDetail').'.</div>';
echo '<div class="sectiontitle"><a href="reporting.php?action=completereport&amp;'.$cidReq.'&amp;survey_id='.$myweb_survey_id.'">'.Display::return_icon('survey_reporting_complete.gif',get_lang('CompleteReport')).' '.get_lang('CompleteReport').'</a></div><div class="sectioncomment">'.get_lang('CompleteReportDetail').'</div>';
}
// Footer

@ -312,7 +312,24 @@ class survey_manager
}
}
$course_id = api_get_course_int_id();
$sql = "INSERT INTO $table_survey (c_id, code, title, subtitle, author, lang, avail_from, avail_till, is_shared, template, intro, surveythanks, creation_date, anonymous".$additional['columns'].", session_id) VALUES (
$sql = "INSERT INTO $table_survey(
c_id,
code,
title,
subtitle,
author,
lang,
avail_from,
avail_till,
is_shared,
template,
intro,
surveythanks,
creation_date,
anonymous".$additional['columns'].",
session_id,
visible_results
) VALUES (
$course_id,
'".Database::escape_string(strtolower(generate_course_code(api_substr($values['survey_code'],0))))."',
'".Database::escape_string($values['survey_title'])."',
@ -327,7 +344,8 @@ class survey_manager
'".Database::escape_string($values['survey_thanks'])."',
'".api_get_utc_datetime()."',
'".Database::escape_string($values['anonymous'])."'".$additional['values'].",
".api_get_session_id()."
'".api_get_session_id()."',
".Database::escape_string($values['visible_results'])."
)";
Database::query($sql);
$survey_id = Database::insert_id();
@ -408,8 +426,9 @@ class survey_manager
template = '".Database::escape_string('template')."',
intro = '".Database::escape_string($values['survey_introduction'])."',
surveythanks = '".Database::escape_string($values['survey_thanks'])."',
anonymous = '".Database::escape_string($values['anonymous'])."'".$additionalsets."
WHERE c_id = $course_id AND survey_id = '".intval($values['survey_id'])."'";
anonymous = '".Database::escape_string($values['anonymous'])."'".$additionalsets.",
visible_results = '".Database::escape_string($values['visible_results'])."'
WHERE c_id = $course_id AND survey_id = '".Database::escape_string($values['survey_id'])."'";
Database::query($sql);
// Update into item_property (update)
@ -858,6 +877,7 @@ class survey_manager
$sql = "SELECT * FROM $tbl_survey_question
WHERE c_id = $course_id AND survey_id='".intval($survey_id)."'";
$result = Database::query($sql);
$return = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
$return[$row['question_id']]['survey_id'] = $row['survey_id'];
$return[$row['question_id']]['question_id'] = $row['question_id'];
@ -872,7 +892,6 @@ class survey_manager
$sql = "SELECT * FROM $table_survey_question_option
WHERE c_id = $course_id AND survey_id='".intval($survey_id)."'";
$result = Database::query($sql);
$return = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
$return[$row['question_id']]['answers'][] = $row['option_text'];
}
@ -2488,6 +2507,7 @@ class SurveyUtil
$error = false;
while ($row = Database::fetch_array($result, 'ASSOC')) {
if ($counter == 1 && $row['type'] == 'pagebreak') {
Display::display_error_message(get_lang('PagebreakNotFirst'), false);
$error = true;
}
@ -2887,32 +2907,39 @@ class SurveyUtil
$table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER);
// Determining the offset of the sql statement (the n-th question of the survey)
if (!isset($_GET['question'])) {
$offset = 0;
} else {
$offset = intval($_GET['question']);
}
$currentQuestion = isset($_GET['question']) ? $_GET['question'] : 0;
$offset = !isset($_GET['question']) ? 0 : intval($_GET['question']);
$currentQuestion = isset($_GET['question']) ? intval($_GET['question']) : 0;
$question = array();
$surveyId = intval($_GET['survey_id']);
$action = Security::remove_XSS($_GET['action']);
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">'.
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'">'.
Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
if ($survey_data['number_of_questions'] > 0) {
echo '<div id="question_report_questionnumbers">'.get_lang('GoToQuestion').': ';
for ($i = 1; $i <= $survey_data['number_of_questions']; $i++) {
if ($offset != $i - 1) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&amp;survey_id='.Security::remove_XSS($_GET['survey_id']).'&amp;question='.($i-1).'">'.$i.'</a>';
} else {
echo $i;
}
if ($i < $survey_data['number_of_questions']) {
echo ' | ';
echo '<div id="question_report_questionnumbers" class="pagination">';
/* echo '<ul><li class="disabled"><a href="#">'.get_lang('Question').'</a></li>'; */
if ($currentQuestion != 0 ) {
echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&amp;'.api_get_cidreq().'&amp;survey_id='.$surveyId.'&amp;question='.($offset-1).'">'.get_lang('PreviousQuestion').'</a></li>';
}
for ($i = 1; $i <= $survey_data['number_of_questions']; $i++) {
if ($offset != $i - 1) {
echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&amp;' . api_get_cidreq() . '&amp;survey_id=' . $surveyId . '&amp;question=' . ($i - 1) . '">' . $i . '</a></li>';
} else {
echo '<li class="disabled"s><a href="#">' . $i . '</a></li>';
}
/*if ($i < $survey_data['number_of_questions']) {
echo ' | ';
}*/
}
if ($currentQuestion < ($survey_data['number_of_questions'] - 1)) {
echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&amp;'.api_get_cidreq().'&amp;survey_id='.$surveyId.'&amp;question='.($offset+1).'">'.get_lang('NextQuestion').'</li></a>';
}
echo '</ul>';
echo '</div>';
// Getting the question information
@ -2927,22 +2954,22 @@ class SurveyUtil
$question = Database::fetch_array($result);
// Navigate through the questions (next and previous)
if ($currentQuestion != 0 ) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.Security::remove_XSS($_GET['action']).'&amp;survey_id='.$_GET['survey_id'].'&amp;question='.Security::remove_XSS($offset-1).'">'.
/*if ($currentQuestion != 0 ) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.Security::remove_XSS($_GET['action']).'&amp;'.api_get_cidreq().'&amp;survey_id='.Security::remove_XSS($_GET['survey_id']).'&amp;question='.Security::remove_XSS($offset-1).'">'.
Display::return_icon('action_prev.png', get_lang('PreviousQuestion'), array('align' => 'middle')).' '.get_lang('PreviousQuestion').'</a> ';
} else {
echo Display::return_icon('action_prev.png', get_lang('PreviousQuestion'), array('align' => 'middle')).' '.get_lang('PreviousQuestion').' ';
}
echo ' | ';
if ($currentQuestion < ($survey_data['number_of_questions'] - 1)) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.Security::remove_XSS($_GET['action']).'&amp;survey_id='.Security::remove_XSS($_GET['survey_id']).'&amp;question='.Security::remove_XSS($offset+1).'">'.get_lang('NextQuestion').' '.Display::return_icon('action_next.png', get_lang('NextQuestion'), array('align' => 'middle')).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.Security::remove_XSS($_GET['action']).'&amp;'.api_get_cidreq().'&amp;survey_id='.Security::remove_XSS($_GET['survey_id']).'&amp;question='.Security::remove_XSS($offset+1).'">'.get_lang('NextQuestion').' '.Display::return_icon('action_next.png', get_lang('NextQuestion'), array('align' => 'middle')).'</a>';
} else {
echo get_lang('NextQuestion').' '.Display::return_icon('action_next.png', get_lang('NextQuestion'), array('align' => 'middle'));
}
}*/
}
echo isset($question['survey_question']) ? $question['survey_question'] : null;
echo '<div class="title-question">';
echo strip_tags(isset($question['survey_question']) ? $question['survey_question'] : null);
echo '</div>';
if ($question['type'] == 'score') {
/** @todo This function should return the options as this is needed further in the code */
$options = SurveyUtil::display_question_report_score($survey_data, $question, $offset);
@ -2983,8 +3010,25 @@ class SurveyUtil
$data[$row['option_id']] = $row;
}
$chartData = array();
foreach ($options as $option) {
$optionText = strip_tags($option['option_text']);
$optionText = html_entity_decode($optionText);
$votes = $data[$option['question_option_id']]['total'];
if (empty($votes)) {
$votes = '0';
}
array_push($chartData, array('option' => $optionText, 'votes' => $votes));
}
echo '<div id="chartContainer" class="span12">';
echo self::drawChart($chartData);
echo '</div>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
// displaying the table: headers
echo '<table class="data_table">';
echo '<table id="display-survey" class="table">';
echo ' <tr>';
echo ' <th>&nbsp;</th>';
echo ' <th>'.get_lang('AbsoluteTotal').'</th>';
@ -3008,31 +3052,43 @@ class SurveyUtil
$answers_number = $absolute_number/$number_of_answers*100;
}
echo ' <tr>';
echo ' <td>'.$value['option_text'].'</td>';
echo ' <td align="right"><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.Security::remove_XSS($_GET['action']).'&amp;survey_id='.Security::remove_XSS($_GET['survey_id']).'&amp;question='.Security::remove_XSS($offset).'&amp;viewoption='.$value['question_option_id'].'">'.$absolute_number.'</a></td>';
echo ' <td align="right">'.round($answers_number, 2).' %</td>';
echo ' <td align="right">';
echo ' <td class="center">'.$value['option_text'].'</td>';
echo ' <td class="center">';
if ($absolute_number!=0){
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&amp;survey_id='.$surveyId.'&amp;question='.$offset.'&amp;viewoption='.$value['question_option_id'].'">'.$absolute_number.'</a>';
}else{
echo '0';
}
echo ' </td>';
echo ' <td class="center">'.round($answers_number, 2).' %</td>';
echo ' <td class="center">';
$size = $answers_number*2;
if ($size > 0) {
echo '<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px">&nbsp;</div>';
}else{
echo '<div style="text-align: left;">'.get_lang("NoDataAvailable").'</div>';
}
echo ' </td>';
echo ' </tr>';
echo ' </td>';
echo ' </tr>';
}
}
// displaying the table: footer (totals)
echo ' <tr>';
echo ' <td style="border-top:1px solid black;"><b>'.get_lang('Total').'</b></td>';
echo ' <td style="border-top:1px solid black;" align="right"><b>'.($number_of_answers==0?'0':$number_of_answers).'</b></td>';
echo ' <td style="border-top:1px solid black;">&nbsp;</td>';
echo ' <td style="border-top:1px solid black;">&nbsp;</td>';
echo ' <td class="total"><b>'.get_lang('Total').'</b></td>';
echo ' <td class="total"><b>'.($number_of_answers==0?'0':$number_of_answers).'</b></td>';
echo ' <td class="total">&nbsp;</td>';
echo ' <td class="total">&nbsp;</td>';
echo ' </tr>';
echo '</table>';
}
if (isset($_GET['viewoption'])) {
echo get_lang('PeopleWhoAnswered').': '.$options[Security::remove_XSS($_GET['viewoption'])]['option_text'].'<br />';
echo '<div class="answered-people">';
echo '<h4>'.get_lang('PeopleWhoAnswered').': '.strip_tags($options[Security::remove_XSS($_GET['viewoption'])]['option_text']).'</h4>';
if (is_numeric($_GET['value'])) {
$sql_restriction = "AND value='".Database::escape_string($_GET['value'])."'";
@ -3040,10 +3096,13 @@ class SurveyUtil
$sql = "SELECT user FROM $table_survey_answer WHERE c_id = $course_id AND option_id = '".Database::escape_string($_GET['viewoption'])."' $sql_restriction";
$result = Database::query($sql);
echo '<ul>';
while ($row = Database::fetch_array($result)) {
$user_info = api_get_user_info($row['user']);
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&survey_id='.Security::remove_XSS($_GET['survey_id']).'&user='.$row['user'].'">'.$user_info['complete_name'].'</a><br />';
echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=userreport&survey_id='.$surveyId.'&user='.$row['user'].'">'.$user_info['complete_name'].'</a></li>';
}
echo '</ul>';
echo '</div>';
}
}
@ -3087,6 +3146,30 @@ class SurveyUtil
$number_of_answers += $row['total'];
$data[$row['option_id']][$row['value']] = $row;
}
$chartData = array();
foreach ($options as $option) {
$optionText = strip_tags($option['option_text']);
$optionText = html_entity_decode($optionText);
for ($i = 1; $i <= $question['max_value']; $i++) {
$votes = $data[$option['question_option_id']][$i]['total'];
if (empty($votes)) {
$votes = '0';
}
array_push(
$chartData,
array(
'serie' => $optionText,
'option' => $i,
'votes' => $votes
)
);
}
}
echo '<div id="chartContainer" class="span12">';
echo self::drawChart($chartData, true);
echo '</div>';
// Displaying the table: headers
echo '<table class="data_table">';
echo ' <tr>';
@ -3103,7 +3186,7 @@ class SurveyUtil
echo ' <tr>';
echo ' <td>'.$value['option_text'].'</td>';
echo ' <td>'.$i.'</td>';
echo ' <td><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.Security::remove_XSS($_GET['action']).'&amp;survey_id='.Security::remove_XSS($_GET['survey_id']).'&amp;question='.Security::remove_XSS($offset).'&amp;viewoption='.$value['question_option_id'].'&amp;value='.$i.'">'.$absolute_number.'</a></td>';
echo ' <td><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&amp;survey_id='.Security::remove_XSS($_GET['survey_id']).'&amp;question='.Security::remove_XSS($offset).'&amp;viewoption='.$value['question_option_id'].'&amp;value='.$i.'">'.$absolute_number.'</a></td>';
echo ' <td>'.round($absolute_number/$number_of_answers*100, 2).' %</td>';
echo ' <td>';
$size = ($absolute_number/$number_of_answers*100*2);
@ -3836,6 +3919,7 @@ class SurveyUtil
$questions = survey_manager::get_questions($_GET['survey_id']);
// Actions bar
echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
@ -3898,86 +3982,133 @@ class SurveyUtil
$answers_y = SurveyUtil::get_answers_of_question_by_user($_GET['survey_id'], $_GET['yaxis']);
// Displaying the table
echo '<table border="1" class="data_table">';
$tableHtml = '<table border="1" class="data_table">';
$xOptions = array();
// The header
echo ' <tr>';
$tableHtml .= ' <tr>';
for ($ii = 0; $ii <= count($question_x['answers']); $ii++) {
if ($ii == 0) {
echo ' <th>&nbsp;</th>';
$tableHtml .= ' <th>&nbsp;</th>';
} else {
if ($question_x['type'] == 'score') {
for ($x = 1; $x <= $question_x['maximum_score']; $x++) {
echo ' <th>'.$question_x['answers'][($ii-1)].'<br />'.$x.'</th>';
$tableHtml .= ' <th>'.$question_x['answers'][($ii-1)].'<br />'.$x.'</th>';
}
$x = '';
} else {
echo ' <th>'.$question_x['answers'][($ii-1)].'</th>';
$tableHtml .= ' <th>'.$question_x['answers'][($ii-1)].'</th>';
}
$optionText = strip_tags($question_x['answers'][$ii-1]);
$optionText = html_entity_decode($optionText);
array_push($xOptions, trim($optionText));
}
}
echo ' </tr>';
$tableHtml .= ' </tr>';
$chartData = array();
// The main part
for ($ij = 0; $ij < count($question_y['answers']); $ij++) {
$currentYQuestion = strip_tags($question_y['answers'][$ij]);
$currentYQuestion = html_entity_decode($currentYQuestion);
// The Y axis is a scoring question type so we have more rows than the options (actually options * maximum score)
if ($question_y['type'] == 'score') {
for ($y = 1; $y <= $question_y['maximum_score']; $y++) {
echo ' <tr>';
$tableHtml .= ' <tr>';
for ($ii = 0; $ii <= count($question_x['answers']); $ii++) {
if ($question_x['type'] == 'score') {
for ($x = 1; $x <= $question_x['maximum_score']; $x++) {
if ($ii == 0) {
echo ' <th>'.$question_y['answers'][($ij)].' '.$y.'</th>';
$tableHtml .= ' <th>'.$question_y['answers'][($ij)].' '.$y.'</th>';
break;
} else {
echo ' <td align="center">';
echo SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)], $x, $y);
echo '</td>';
$tableHtml .= ' <td align="center">';
$votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)], $x, $y);
$tableHtml .= $votes;
array_push(
$chartData,
array(
'serie' => array($currentYQuestion, $xOptions[$ii-1]),
'option' => $x,
'votes' => $votes
)
);
$tableHtml .= '</td>';
}
}
} else {
if ($ii == 0) {
echo ' <th>'.$question_y['answers'][($ij)].' '.$y.'</th>';
$tableHtml .= ' <th>'.$question_y['answers'][$ij].' '.$y.'</th>';
} else {
echo ' <td align="center">';
echo SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)], 0, $y);
echo '</td>';
$tableHtml .= ' <td align="center">';
$votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)], 0, $y);
$tableHtml .= $votes;
array_push(
$chartData,
array(
'serie' => array($currentYQuestion, $xOptions[$ii-1]),
'option' => $y,
'votes' => $votes
)
);
$tableHtml .= '</td>';
}
}
}
echo ' </tr>';
$tableHtml .= ' </tr>';
}
}
// The Y axis is NOT a score question type so the number of rows = the number of options
else {
echo ' <tr>';
$tableHtml .= ' <tr>';
for ($ii = 0; $ii <= count($question_x['answers']); $ii++) {
if ($question_x['type'] == 'score') {
for ($x = 1; $x <= $question_x['maximum_score']; $x++) {
if ($ii == 0) {
echo ' <th>'.$question_y['answers'][($ij)].'</th>';
$tableHtml .= ' <th>'.$question_y['answers'][$ij].'</th>';
break;
} else {
echo ' <td align="center">';
echo SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)], $x, 0);
echo '</td>';
$tableHtml .= ' <td align="center">';
$votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)], $x, 0);
$tableHtml .= $votes;
array_push(
$chartData,
array(
'serie' => array($currentYQuestion, $xOptions[$ii-1]),
'option' => $x,
'votes' => $votes
)
);
$tableHtml .= '</td>';
}
}
} else {
if ($ii == 0) {
echo ' <th>'.$question_y['answers'][($ij)].'</th>';
$tableHtml .= ' <th>'.$question_y['answers'][($ij)].'</th>';
} else {
echo ' <td align="center">';
echo SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)]);
echo '</td>';
$tableHtml .= ' <td align="center">';
$votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)]);
$tableHtml .= $votes;
array_push(
$chartData,
array(
'serie' => $xOptions[$ii-1],
'option' => $currentYQuestion,
'votes' => $votes
)
);
$tableHtml .= '</td>';
}
}
}
echo ' </tr>';
$tableHtml .= ' </tr>';
}
}
echo '</table>';
$tableHtml .= '</table>';
echo '<div id="chartContainer" class="span12">';
echo self::drawChart($chartData, true);
echo '</div>';
echo $tableHtml;
}
}
@ -4043,7 +4174,7 @@ class SurveyUtil
// Check if the user has given $option_x as answer
if (in_array($check_x, $answers)) {
// Check if the user has given $option_y as an answer
if (in_array($check_y, $answers_y[$user])) {
if (!is_null($answers_y[$user]) && in_array($check_y, $answers_y[$user])) {
$counter++;
}
}
@ -4941,7 +5072,11 @@ class SurveyUtil
break;
}
}
echo '<table class="data_table">';
echo '<div class="survey-block">';
echo '<div class="title-survey-block">';
echo Display::return_icon('survey.png', get_lang('CreateNewSurvey'),array('style'=>'inline-block'),ICON_SIZE_SMALL);
echo '<h3>'.get_lang('SurveyList').'</h3></div>';
echo '<table id="list-survey" class="table ">';
echo '<tr>';
echo ' <th>'.get_lang('SurveyName').'</th>';
echo ' <th>'.get_lang('Anonymous').'</th>';
@ -4970,11 +5105,16 @@ class SurveyUtil
$row_answer = Database::fetch_array($result_answer,'ASSOC');
echo '<tr>';
if ($row['answered'] == 0) {
echo '<td><a href="'.api_get_path(WEB_CODE_PATH).'survey/fillsurvey.php?course='.$_course['sysCode'].'&amp;invitationcode='.$row['invitation_code'].'&amp;cidReq='.$_course['sysCode'].'">'.$row['title'].'</a></td>';
echo '<td>';
echo Display::return_icon('statistics.png', get_lang('CreateNewSurvey'),array('style'=>'inline-block'),ICON_SIZE_TINY);
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/fillsurvey.php?course='.$_course['sysCode'].'&amp;invitationcode='.$row['invitation_code'].'&amp;cidReq='.$_course['sysCode'].'">'.$row['title'].'</a></td>';
} else {
echo '<td>'.$row['title'].'</td>';
//echo '<td>'.$row['title'].'</td>';
echo '<td>';
echo Display::return_icon('statistics_na.png', get_lang('CreateNewSurvey'),array('style'=>'inline-block'),ICON_SIZE_TINY);
echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&amp;cidReq='.$_course['sysCode'].'&amp;id_session='.$row['session_id'].'&amp;gidReq='.'0'.'&amp;origin='.''.'&amp;survey_id='.$row['survey_id'].'">'.$row['title'].'</a></td>';
}
echo '<td>';
echo '<td class="center">';
echo ($row['anonymous'] == 1) ? get_lang('Yes') : get_lang('No');
echo '</td>';
echo '</tr>';
@ -4990,6 +5130,7 @@ class SurveyUtil
}
}
echo '</table>';
echo '</div>';
}
/**
@ -5189,4 +5330,66 @@ class SurveyUtil
return false;
}
}
/**
* Display survey question chart
* @param array Chart data
* @param boolean Tells if the chart has a serie. False by default
* @return void (direct output)
*/
public static function drawChart($chartData, $hasSerie = false)
{
$htmlChart = '';
if (api_browser_support("svg")) {
$htmlChart .= api_get_js("d3/d3.v3.5.4.min.js");
$htmlChart .= api_get_js("dimple.v2.1.2.min.js") . '
<script type="text/javascript">
var svg = dimple.newSvg("#chartContainer", "100%", 400);
var data = [';
$serie = array();
$order = array();
foreach ($chartData as $chartDataElement) {
$htmlChart .= '{"';
if (!$hasSerie) {
$htmlChart .= get_lang("Option") . '":"' . $chartDataElement['option'] . '", "';
array_push($order, $chartDataElement['option']);
} else {
if (!is_array($chartDataElement['serie'])) {
$htmlChart .= get_lang("Option") . '":"' . $chartDataElement['serie'] . '", "' .
get_lang("Score") . '":"' . $chartDataElement['option'] . '", "';
array_push($serie, $chartDataElement['serie']);
} else {
$htmlChart .= get_lang("Serie") . '":"' . $chartDataElement['serie'][0] . '", "' .
get_lang("Option") . '":"' . $chartDataElement['serie'][1] . '", "' .
get_lang("Score") . '":"' . $chartDataElement['option'] . '", "';
}
}
$htmlChart .= get_lang("Votes") . '":"' . $chartDataElement['votes'] .
'"},';
}
rtrim($htmlChart, ",");
$htmlChart .= '];
var myChart = new dimple.chart(svg, data);
myChart.addMeasureAxis("y", "' . get_lang("Votes") . '");';
if (!$hasSerie) {
$htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", "' . get_lang("Option") . '");
xAxisCategory.addOrderRule(' . json_encode($order) . ');
myChart.addSeries("' . get_lang("Option") . '", dimple.plot.bar);';
} else {
if (!is_array($chartDataElement['serie'])) {
$serie = array_values(array_unique($serie));
$htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", ["' . get_lang("Option") . '","' . get_lang("Score") . '"]);
xAxisCategory.addOrderRule(' . json_encode($serie) . ');
xAxisCategory.addGroupOrderRule("' . get_lang("Score") . '");
myChart.addSeries("' . get_lang("Option") . '", dimple.plot.bar);';
} else {
$htmlChart .= 'myChart.addCategoryAxis("x", ["' . get_lang("Option") . '","' . get_lang("Score") . '"]);
myChart.addSeries("' . get_lang("Serie") . '", dimple.plot.bar);';
}
}
$htmlChart .= 'myChart.draw();
</script>';
}
return $htmlChart;
}
}

Loading…
Cancel
Save