Skip to content

Commit

Permalink
New feature: When filtering for text questions you can use now % and …
Browse files Browse the repository at this point in the history
…* as wildcards and use OR and ',' as separators matching vor multiple values at the same time - patch by ecaron

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@8486 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Mar 15, 2010
1 parent 5493126 commit 82e928d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 12 additions & 2 deletions admin/statistics_function.php
Expand Up @@ -377,8 +377,18 @@ function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0,
//Q - Multiple Short Text
elseif (($firstletter == "T" || $firstletter == "Q" ) && $_POST[$pv] != "")
{
$selects[]=db_quote_id(substr($pv, 1, strlen($pv)))." like '".$_POST[$pv]."'"; // Deleted the percentage. Makes no sense to me and causes trouble with T and Q questions.
}
$selectSubs = array();
//We intepret and * and % as wildcard matches, and use ' OR ' and , as the seperators
$pvParts = explode(",",str_replace('*','%', str_replace(' OR ',',',$_POST[$pv])));
if(is_array($pvParts) AND count($pvParts)){
foreach($pvParts AS $pvPart){
$selectSubs[]=db_quote_id(substr($pv, 1, strlen($pv)))." LIKE '".trim($pvPart)."'";
}
if(count($selectSubs)){
$selects[] = ' ('.implode(' OR ',$selectSubs).') ';
}
}
}

//D - Date
elseif ($firstletter == "D" && $_POST[$pv] != "")
Expand Down
5 changes: 0 additions & 5 deletions printanswers.php
Expand Up @@ -117,11 +117,6 @@
//Ensure script is not run directly, avoid path disclosure
if (!isset($rootdir) || isset($_REQUEST['$rootdir'])) {die("browse - Cannot run this script directly");}

//Select public language file
$query = "SELECT language FROM ".db_table_name("surveys")." WHERE sid=$surveyid";
$result = db_execute_assoc($query) or safe_die("Error selecting language: <br />".$query."<br />".$connect->ErrorMsg()); //Checked


// Set language for questions and labels to base language of this survey
$language = GetBaseLanguageFromSurveyID($surveyid);
$thissurvey = getSurveyInfo($surveyid);
Expand Down

0 comments on commit 82e928d

Please sign in to comment.