[svn r20470] FS#306 - The "Surveys" tool: Improvements for better encoding support.

skala
Ivan Tcholakov 17 years ago
parent 033880b8cb
commit 3b6c998c83
  1. 10
      main/survey/create_new_survey.php
  2. 4
      main/survey/fillsurvey.php
  3. 6
      main/survey/preview.php
  4. 8
      main/survey/question.php
  5. 10
      main/survey/reporting.php
  6. 73
      main/survey/survey.lib.php
  7. 24
      main/survey/survey.php
  8. 6
      main/survey/survey_invitation.php
  9. 4
      main/survey/survey_invite.php

@ -25,7 +25,7 @@
* @author unknown, the initial survey that did not make it in 1.8 because of bad code
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts (if not all) of the code
* @author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code
* @version $Id: create_new_survey.php 20345 2009-05-05 21:06:43Z cfasanando $
* @version $Id: create_new_survey.php 20470 2009-05-11 09:46:59Z ivantcholakov $
*
* @todo only the available platform languages should be used => need an api get_languages and and api_get_available_languages (or a parameter)
*/
@ -85,8 +85,8 @@ if (!api_is_allowed_to_edit())
$survey_id = Security::remove_XSS($_GET['survey_id']);
$survey_data = survey_manager::get_survey($survey_id);
$urlname =strip_tags(substr(html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
if (strlen(strip_tags($survey_data['title'])) > 40) {
$urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
if (api_strlen(strip_tags($survey_data['title'])) > 40) {
$urlname .= '...';
}
@ -151,7 +151,7 @@ $form->applyFilter('survey_code', 'html_filter');
if ($_GET['action'] == 'edit') {
$survey_code->freeze();
$form->applyFilter('survey_code', 'strtoupper');
$form->applyFilter('survey_code', 'api_strtoupper');
}
$fck_attribute['Width'] = '100%';
@ -338,4 +338,4 @@ if( $form->validate() )
}
// Footer
Display :: display_footer();
?>
?>

@ -325,7 +325,7 @@ if ($survey_data['form_fields']!='' && $survey_data['anonymous'] == 0 && is_arra
$field_value = explode(':', $field);
if ($field_value[1] == 1) {
if ($field_value[0] != '') {
$val = substr($field_value[0], 8, strlen($field_value[0]));
$val = api_substr($field_value[0], 8, api_strlen($field_value[0]));
$list[$val] = 1;
}
}
@ -1355,4 +1355,4 @@ function check_time_availability($surv_data){
}
}
?>
?>

@ -65,8 +65,8 @@ if (empty($survey_data)) {
exit;
}
$urlname = strip_tags(substr(html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
if (strlen(strip_tags($survey_data['title'])) > 40) {
$urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
if (api_strlen(strip_tags($survey_data['title'])) > 40) {
$urlname .= '...';
}
@ -204,4 +204,4 @@ else
// Footer
Display :: display_footer();
?>
?>

@ -23,7 +23,7 @@
* @package dokeos.survey
* @author unknown, the initial survey that did not make it in 1.8 because of bad code
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @version $Id: question.php 20424 2009-05-08 20:40:27Z herodoto $
* @version $Id: question.php 20470 2009-05-11 09:46:59Z ivantcholakov $
*/
// name of the language file that needs to be included
@ -61,8 +61,8 @@ if (empty($survey_data)) {
}
$urlname = substr(html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40);
if (strlen(strip_tags($survey_data['title'])) > 40) {
$urlname = api_substr(api_html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40);
if (api_strlen(strip_tags($survey_data['title'])) > 40) {
$urlname .= '...';
}
@ -177,4 +177,4 @@ if (empty($_POST['save_question']) && in_array($_GET['type'],$possible_types)) {
// Footer
Display :: display_footer();
?>
?>

@ -1,4 +1,4 @@
<?php // $Id: reporting.php 19004 2009-03-12 18:04:08Z juliomontoya $
<?php // $Id: reporting.php 20470 2009-05-11 09:46:59Z ivantcholakov $
/*
==============================================================================
Dokeos - elearning and course management software
@ -26,7 +26,7 @@
* @package dokeos.survey
* @author unknown, the initial survey that did not make it in 1.8 because of bad code
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @version $Id: reporting.php 19004 2009-03-12 18:04:08Z juliomontoya $
* @version $Id: reporting.php 20470 2009-05-11 09:46:59Z ivantcholakov $
*
* @todo The question has to be more clearly indicated (same style as when filling the survey)
*/
@ -120,8 +120,8 @@ if (empty($survey_data)) {
Display :: display_footer();
exit;
}
$urlname = strip_tags(substr(html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
if (strlen(strip_tags($survey_data['title'])) > 40)
$urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
if (api_strlen(strip_tags($survey_data['title'])) > 40)
{
$urlname .= '...';
}
@ -168,4 +168,4 @@ if (!$_GET['action'] OR $_GET['action'] == 'overview') {
// Footer
Display :: display_footer();
Display :: display_footer();

@ -24,7 +24,7 @@
* @package dokeos.survey
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts (if not all) of the code
@author Julio Montoya Armas <gugli100@gmail.com>, Dokeos: Personality Test modification and rewriting large parts of the code
* @version $Id: survey.lib.php 20377 2009-05-06 20:25:41Z juliomontoya $
* @version $Id: survey.lib.php 20470 2009-05-11 09:46:59Z ivantcholakov $
*
* @todo move this file to inc/lib
* @todo use consistent naming for the functions (save vs store for instance)
@ -217,7 +217,7 @@ class survey_manager
else
{
$row = Database::fetch_array($rs,ASSOC);
$pos = strpos($row['survey_version']);
$pos = api_strpos($row['survey_version']);
if($pos===false)
{
//$new_version= substr($row['survey_version'],$pos, count())
@ -226,7 +226,7 @@ class survey_manager
}
else
{
$getlast= split('\.',$row['survey_version']);
$getlast = api_split('\.',$row['survey_version']);
$lastversion = array_pop($getlast);
$lastversion = $lastversion + 1;
$add=implode('.',$getlast);
@ -1332,6 +1332,7 @@ class question
*/
function create_form($form_content)
{
global $charset;
global $fck_attribute;
global $survey_data;
@ -1343,8 +1344,8 @@ class question
if ($_GET['action'] == 'edit') {
$tool_name .= get_lang('EditQuestion');
}
$tool_name .= ': '.get_lang(ucfirst($_GET['type']));
$tool_name .= ': '.get_lang(api_ucfirst($_GET['type']));
$this->html .= '<div class="row"><div class="form_header">'.$tool_name.'</div></div>';
$this->html .= '<form id="question_form" name="question_form" method="post" action="'.api_get_self().'?action='.$_GET['action'].'&type='.$_GET['type'].'&survey_id='.$_GET['survey_id'].'&question_id='.$_GET['question_id'].'">';
$this->html .= ' <input type="hidden" name="survey_id" id="survey_id" value="'.$_GET['survey_id'].'"/>';
@ -1362,7 +1363,7 @@ class question
$this->html .= ' <span class="form_required">*</span> '.get_lang('Question');
$this->html .= ' </div>';
$this->html .= ' <div class="formw">';
$this->html .= api_return_html_area('question', html_entity_decode(stripslashes($form_content['question'])));
$this->html .= api_return_html_area('question', api_html_entity_decode(stripslashes($form_content['question']), ENT_QUOTES, $charset));
$this->html .= ' </div>';
$this->html .= ' </div>';
@ -1703,6 +1704,8 @@ class multiplechoice extends question
*/
function create_form($form_content)
{
global $charset;
$this->html = parent::create_form($form_content);
// Horizontal or vertical
$this->html .= ' <div class="row">';
@ -1737,7 +1740,7 @@ class multiplechoice extends question
$this->html .= ' <tr>';
$this->html .= ' <td align="right"><label for="answers['.$key.']">'.($key+1).'</label></td>';
//$this->html .= ' <td><input type="text" name="answers['.$key.']" id="answers['.$key.']" value="'.$form_content['answers'][$key].'" /></td>';
$this->html .= ' <td width="550">'.api_return_html_area('answers['.$key.']', html_entity_decode(stripslashes($form_content['answers'][$key]))).'</td>';
$this->html .= ' <td width="550">'.api_return_html_area('answers['.$key.']', api_html_entity_decode(stripslashes($form_content['answers'][$key]), ENT_QUOTES, $charset)).'</td>';
$this->html .= ' <td>';
if ($key<$total_number_of_answers-1)
{
@ -1895,6 +1898,8 @@ class multipleresponse extends question
*/
function create_form($form_content)
{
global $charset;
$this->html = parent::create_form($form_content);
// Horizontal or vertical
$this->html .= ' <div class="row">';
@ -1930,7 +1935,7 @@ class multipleresponse extends question
$this->html .= ' <tr>';
$this->html .= ' <td align="right"><label for="answers['.$key.']">'.($key+1).'</label></td>';
//$this->html .= ' <td><input type="text" name="answers['.$key.']" id="answers['.$key.']" value="'.$form_content['answers'][$key].'" /></td>';
$this->html .= ' <td width="550">'.api_return_html_area('answers['.$key.']', html_entity_decode(stripslashes($form_content['answers'][$key]))).'</td>';
$this->html .= ' <td width="550">'.api_return_html_area('answers['.$key.']', api_html_entity_decode(stripslashes($form_content['answers'][$key]), ENT_QUOTES, $charset)).'</td>';
$this->html .= ' <td>';
if ($key<$total_number_of_answers-1)
{
@ -2002,6 +2007,8 @@ class dropdown extends question
*/
function create_form($form_content)
{
global $charset;
$this->html = parent::create_form($form_content);
// The answers
$this->html .= ' <div class="row">';
@ -2015,7 +2022,7 @@ class dropdown extends question
{
$this->html .= ' <tr>';
$this->html .= ' <td align="right"><label for="answers['.$key.']">'.($key+1).'</label></td>';
$this->html .= ' <td><input type="text" name="answers['.$key.']" id="answers['.$key.']" value="'.stripslashes(htmlentities($form_content['answers'][$key])).'" /></td>';
$this->html .= ' <td><input type="text" name="answers['.$key.']" id="answers['.$key.']" value="'.stripslashes(api_htmlentities($form_content['answers'][$key], ENT_QUOTES, $charset)).'" /></td>';
$this->html .= ' <td>';
if ($key<$total_number_of_answers-1)
{
@ -3232,6 +3239,8 @@ class SurveyUtil {
*/
function export_complete_report($user_id=0)
{
global $charset;
// Database table definitions
$table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
$table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
@ -3271,13 +3280,13 @@ class SurveyUtil {
{
if($row['number_of_options'] == 0 && $row['type']=='open')
{
$return .= str_replace("\r\n",' ',html_entity_decode(strip_tags($row['survey_question']))).';';
$return .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES, $charset)).';';
}
else
{
for ($ii = 0; $ii < $row['number_of_options']; $ii ++)
{
$return .= str_replace("\r\n",' ',html_entity_decode(strip_tags($row['survey_question']))).';';
$return .= str_replace("\r\n",' ',api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES, $charset)).';';
}
}
}
@ -3294,7 +3303,7 @@ class SurveyUtil {
//show the fields names for user fields
foreach($extra_user_fields as $field)
{
$return .= '"'.str_replace("\r\n",' ',html_entity_decode(strip_tags($field[3]))).'";';
$return .= '"'.str_replace("\r\n",' ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset)).'";';
}
}
@ -3319,7 +3328,7 @@ class SurveyUtil {
if ($row['type'] <> 'comment' AND $row['type'] <> 'pagebreak')
{
$row['option_text'] = str_replace(array("\r","\n"),array('',''),$row['option_text']);
$return .= html_entity_decode(strip_tags($row['option_text'])).';';
$return .= api_html_entity_decode(strip_tags($row['option_text']), ENT_QUOTES, $charset).';';
$possible_answers[$row['question_id']][$row['question_option_id']] =$row['question_option_id'];
$possible_answers_type[$row['question_id']] = $row['type'];
}
@ -3376,6 +3385,8 @@ class SurveyUtil {
*/
function export_complete_report_row($possible_options, $answers_of_user, $user, $display_extra_user_fields=false)
{
global $charset;
global $survey_data;
$return = '';
if ($survey_data['anonymous'] == 0)
@ -3412,7 +3423,7 @@ class SurveyUtil {
$user_fields_values = UserManager::get_extra_user_data(intval($user),false,false);
foreach($user_fields_values as $value)
{
$return .= '"'.str_replace('"','""',html_entity_decode(strip_tags($value))).'";';
$return .= '"'.str_replace('"','""',api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset)).'";';
}
}
@ -3429,7 +3440,7 @@ class SurveyUtil {
$key = array_keys($my_answer_of_user);
if(substr($key[0],0,4)=='open')
{
$return .= '"'.str_replace('"','""',html_entity_decode(strip_tags($answers_of_user[$question_id][$key[0]]['option_id']))).'"';
$return .= '"'.str_replace('"','""',api_html_entity_decode(strip_tags($answers_of_user[$question_id][$key[0]]['option_id']), ENT_QUOTES, $charset)).'"';
}
elseif (!empty($answers_of_user[$question_id][$option_id]))
{
@ -3461,6 +3472,8 @@ class SurveyUtil {
*/
function export_complete_report_xls($filename, $user_id=0)
{
global $charset;
require_once(api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php');
$workbook = new Spreadsheet_Excel_Writer();
$workbook->send($filename);
@ -3508,14 +3521,14 @@ class SurveyUtil {
{
if($row['number_of_options'] == 0 && $row['type']=='open')
{
$worksheet->write($line,$column,html_entity_decode(strip_tags($row['survey_question'])));
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES, $charset));
$column ++;
}
else
{
for ($ii = 0; $ii < $row['number_of_options']; $ii ++)
{
$worksheet->write($line,$column,html_entity_decode(strip_tags($row['survey_question'])));
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES, $charset));
$column ++;
}
}
@ -3531,7 +3544,7 @@ class SurveyUtil {
//show the fields names for user fields
foreach($extra_user_fields as $field)
{
$worksheet->write($line,$column,html_entity_decode(strip_tags($field[3])));
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES, $charset));
$column++;
}
}
@ -3557,7 +3570,7 @@ class SurveyUtil {
// we do not show comment and pagebreak question types
if ($row['type'] <> 'comment' AND $row['type'] <> 'pagebreak')
{
$worksheet->write($line,$column,html_entity_decode(strip_tags($row['option_text'])));
$worksheet->write($line,$column,api_html_entity_decode(strip_tags($row['option_text']), ENT_QUOTES, $charset));
$possible_answers[$row['question_id']][$row['question_option_id']] =$row['question_option_id'];
$possible_answers_type[$row['question_id']] = $row['type'];
$column++;
@ -3629,6 +3642,8 @@ class SurveyUtil {
*/
function export_complete_report_row_xls($possible_options, $answers_of_user, $user, $display_extra_user_fields=false)
{
global $charset;
$return = array();
global $survey_data;
if ($survey_data['anonymous'] == 0)
@ -3665,7 +3680,7 @@ class SurveyUtil {
$user_fields_values = UserManager::get_extra_user_data(intval($user),false,false);
foreach($user_fields_values as $value)
{
$return[] = html_entity_decode(strip_tags($value));
$return[] = api_html_entity_decode(strip_tags($value), ENT_QUOTES, $charset);
}
}
@ -3681,7 +3696,7 @@ class SurveyUtil {
$key = array_keys($my_answers_of_user);
if(substr($key[0],0,4)=='open')
{
$return[] = html_entity_decode(strip_tags($answers_of_user[$question_id][$key[0]]['option_id']));
$return[] = api_html_entity_decode(strip_tags($answers_of_user[$question_id][$key[0]]['option_id']), ENT_QUOTES, $charset);
}
elseif (!empty($answers_of_user[$question_id][$option_id]))
{
@ -3747,7 +3762,7 @@ class SurveyUtil {
{
echo ' selected="selected"';
}
echo '">'.substr(strip_tags($question['question']), 0, 50).'</option>';
echo '">'.api_substr(strip_tags($question['question']), 0, 50).'</option>';
}
}
@ -3766,7 +3781,7 @@ class SurveyUtil {
{
echo ' selected="selected"';
}
echo '">'.substr(strip_tags($question['question']), 0, 50).'</option>';
echo '">'.api_substr(strip_tags($question['question']), 0, 50).'</option>';
}
}
echo '</select><br /><br />';
@ -4171,7 +4186,7 @@ class SurveyUtil {
$text_link = '<a href="'.$survey_link.'">'.get_lang('ClickHereToAnswerTheSurvey')."</a><br />\r\n<br />\r\n".get_lang('OrCopyPasteTheFollowingUrl')." <br />\r\n ".$survey_link;
$replace_count = 0;
$full_invitation_text = str_ireplace('**link**', $text_link ,$invitation_text, $replace_count);
$full_invitation_text = api_str_ireplace('**link**', $text_link ,$invitation_text, $replace_count);
if ($replace_count < 1) {
$full_invitation_text = $full_invitation_text . "<br />\r\n<br />\r\n".$text_link;
}
@ -4454,8 +4469,8 @@ class SurveyUtil {
if(api_is_allowed_to_edit() || api_is_element_in_the_session(TOOL_SURVEY, $survey_id))
{
$return .= '<a href="create_new_survey.php?'.api_get_cidreq().'&amp;action=edit&amp;survey_id='.$survey_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>&nbsp;';
$return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurvey").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>&nbsp;';
$return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=empty&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("EmptySurvey").'?')).'\')) return false;">'.Display::return_icon('clean_group.gif', get_lang('EmptySurvey')).'</a>&nbsp;';
$return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurvey").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>&nbsp;';
$return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=empty&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?')).'\')) return false;">'.Display::return_icon('clean_group.gif', get_lang('EmptySurvey')).'</a>&nbsp;';
}
//$return .= '<a href="create_survey_in_another_language.php?id_survey='.$survey_id.'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>';
//$return .= '<a href="survey.php?survey_id='.$survey_id.'">'.Display::return_icon('add.gif', get_lang('Add')).'</a>';
@ -4471,12 +4486,12 @@ class SurveyUtil {
global $charset;
$survey_id = Security::remove_XSS($survey_id);
// $return = '<a href="create_new_survey.php?'.api_get_cidreq().'&amp;action=edit&amp;survey_id='.$survey_id.'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
//$return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurvey").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
//$return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurvey").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
//$return .= '<a href="create_survey_in_another_language.php?id_survey='.$survey_id.'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>';
//$return .= '<a href="survey.php?survey_id='.$survey_id.'">'.Display::return_icon('add.gif', get_lang('Add')).'</a>';
$return .= '<a href="preview.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('preview.gif', get_lang('Preview')).'</a>&nbsp;';
$return .= '<a href="survey_invite.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('survey_publish.gif', get_lang('Publish')).'</a>&nbsp;';
$return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=empty&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("EmptySurvey").'?')).'\')) return false;">'.Display::return_icon('clean_group.gif', get_lang('EmptySurvey')).'</a>&nbsp;';
$return .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=empty&amp;survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?', ENT_QUOTES, $charset)).'\')) return false;">'.Display::return_icon('clean_group.gif', get_lang('EmptySurvey')).'</a>&nbsp;';
//$return .= '<a href="reporting.php?'.api_get_cidreq().'&amp;survey_id='.$survey_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>';
return $return;
}
@ -5066,4 +5081,4 @@ class SurveyUtil {
}
}
?>
?>

@ -1,4 +1,4 @@
<?php // $Id: survey.php 19829 2009-04-17 13:49:47Z pcool $
<?php // $Id: survey.php 20470 2009-05-11 09:46:59Z ivantcholakov $
/*
==============================================================================
Dokeos - elearning and course management software
@ -23,7 +23,7 @@
* @package dokeos.survey
* @author unknown
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup, refactoring and rewriting large parts of the code
* @version $Id: survey.php 19829 2009-04-17 13:49:47Z pcool $
* @version $Id: survey.php 20470 2009-05-11 09:46:59Z ivantcholakov $
*
* @todo use quickforms for the forms
*/
@ -65,13 +65,13 @@ $interbreadcrumb[] = array ("url" => "survey_list.php", "name" => get_lang('Surv
// getting the survey information
$survey_data = survey_manager::get_survey($_GET['survey_id']);
if (substr($survey_data['title'],0,3)!='<p>'){
$tool_name = strip_tags(substr(html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
if (api_substr($survey_data['title'],0,3)!='<p>'){
$tool_name = strip_tags(api_substr(api_html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
}else{
$tool_name = strip_tags(substr(html_entity_decode(substr($survey_data['title'],3,-4),ENT_QUOTES,$charset), 0, 40));
$tool_name = strip_tags(api_substr(api_html_entity_decode(substr($survey_data['title'],3,-4),ENT_QUOTES,$charset), 0, 40));
}
$is_survey_type_1 = ($survey_data['survey_type']==1)?true:false;
if (strlen(strip_tags($survey_data['title'])) > 40)
if (api_strlen(strip_tags($survey_data['title'])) > 40)
{
$tool_name .= '...';
}
@ -142,7 +142,7 @@ SurveyUtil::check_first_last_question($_GET['survey_id']);
// Action links
$survey_actions = '<a href="create_new_survey.php?'.api_get_cidreq().'&amp;action=edit&amp;survey_id='.$_GET['survey_id'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).' '.get_lang('EditSurvey').'</a>';
$survey_actions .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$_GET['survey_id'].'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurvey").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).' '.get_lang('DeleteSurvey').'</a>';
$survey_actions .= '<a href="survey_list.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$_GET['survey_id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurvey").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).' '.get_lang('DeleteSurvey').'</a>';
//$survey_actions .= '<a href="create_survey_in_another_language.php?id_survey='.$_GET['survey_id'].'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>';
$survey_actions .= '<a href="preview.php?'.api_get_cidreq().'&amp;survey_id='.$_GET['survey_id'].'">'.Display::return_icon('preview.gif', get_lang('Preview')).' '.get_lang('Preview').'</a>';
$survey_actions .= '<a href="survey_invite.php?'.api_get_cidreq().'&amp;survey_id='.$_GET['survey_id'].'">'.Display::return_icon('survey_publish.gif', get_lang('Publish')).' '.get_lang('Publish').'</a>';
@ -202,8 +202,8 @@ while ($row = Database::fetch_array($result,'ASSOC')) {
echo '<tr>';
echo ' <td>'.$question_counter.'</td>';
echo ' <td>';
if (strlen($row['survey_question']) > 100) {
echo substr(strip_tags($row['survey_question']),0, 100).' ... ';
if (api_strlen($row['survey_question']) > 100) {
echo api_substr(strip_tags($row['survey_question']),0, 100).' ... ';
} else {
echo $row['survey_question'];
}
@ -212,7 +212,7 @@ while ($row = Database::fetch_array($result,'ASSOC')) {
echo ' <td>'.$row['number_of_options'].'</td>';
echo ' <td>';
echo ' <a href="question.php?'.api_get_cidreq().'&amp;action=edit&amp;type='.$row['type'].'&amp;survey_id='.$_GET['survey_id'].'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
echo ' <a href="survey.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$_GET['survey_id'].'&amp;question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang("DeleteSurveyQuestion").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
echo ' <a href="survey.php?'.api_get_cidreq().'&amp;action=delete&amp;survey_id='.$_GET['survey_id'].'&amp;question_id='.$row['question_id'].'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurveyQuestion").'?',ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>';
if ($question_counter > 1)
{
echo ' <a href="survey.php?'.api_get_cidreq().'&amp;action=moveup&amp;survey_id='.$_GET['survey_id'].'&amp;question_id='.$row['question_id'].'">'.Display::return_icon('up.gif', get_lang('MoveUp')).'</a>';
@ -282,7 +282,7 @@ if($is_survey_type_1)
$grouplist .= '<tr><td>'.$row['name'].'</td><td>'.$row['description'].'</td><td>'.
'<a href="survey.php?survey_id='.(int)$_GET['survey_id'].'&gid='.$row['id'].'&action=editgroup">'.
Display::return_icon('edit.gif', get_lang('Edit')).'</a> '.
'<a href="survey.php?survey_id='.(int)$_GET['survey_id'].'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(sprintf(get_lang('DeleteSurveyGroup'),$row['name']).'?',ENT_QUOTES,$charset)).'\')) return false;">'.
'<a href="survey.php?survey_id='.(int)$_GET['survey_id'].'&gid='.$row['id'].'&action=deletegroup" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('DeleteSurveyGroup'),$row['name']).'?',ENT_QUOTES,$charset)).'\')) return false;">'.
Display::return_icon('delete.gif', get_lang('Delete')).'</a>'.
'</td></tr>';
}
@ -291,4 +291,4 @@ if($is_survey_type_1)
// Footer
Display :: display_footer();
?>
?>

@ -75,8 +75,8 @@ if (empty($survey_data)) {
Display :: display_footer();
exit;
}
$urlname =strip_tags(substr(html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
if (strlen(strip_tags($survey_data['title'])) > 40) {
$urlname =strip_tags(api_substr(api_html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
if (api_strlen(strip_tags($survey_data['title'])) > 40) {
$urlname .= '...';
}
@ -186,4 +186,4 @@ $table->set_header(2, get_lang('InvitationDate'));
$table->set_header(3, get_lang('Answered'));
$table->set_column_filter(3, 'SurveyUtil::modify_filter');
$table->display();
*/
*/

@ -72,8 +72,8 @@ if (empty($survey_data)) {
}
$urlname =strip_tags(substr(html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
if (strlen(strip_tags($survey_data['title'])) > 40)
$urlname =strip_tags(api_substr(api_html_entity_decode($survey_data['title'],ENT_QUOTES,$charset), 0, 40));
if (api_strlen(strip_tags($survey_data['title'])) > 40)
{
$urlname .= '...';
}

Loading…
Cancel
Save