Skip to content

Commit

Permalink
Fixed issue #4041: Unable to filter statistics by date range
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@8248 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Jan 13, 2010
1 parent 156146c commit 17a2214
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 16 deletions.
12 changes: 6 additions & 6 deletions admin/html.php
Expand Up @@ -982,7 +982,7 @@
. "<div class='menubar-left'>\n"
. "<img src='$imagefiles/blank.gif' alt='' width='55' height='20' />\n"
. "<img src='$imagefiles/seperator.gif' alt='' />\n"
. "<img src='$imagefiles/blank.gif' alt='' width='171' height='20' />\n"
. "<img src='$imagefiles/blank.gif' alt='' width='157' height='20' />\n"
. "<img src='$imagefiles/seperator.gif' alt='' />\n";

if(hasRight($surveyid,'define_questions'))
Expand Down Expand Up @@ -1016,7 +1016,7 @@
}
}
else {$questionsummary .= "<img src='$imagefiles/blank.gif' alt='' width='40' />\n";}
$questionsummary .= "<img src='$imagefiles/blank.gif' alt='' width='84' />\n";
$questionsummary .= "<img src='$imagefiles/blank.gif' alt='' width='40' />\n";

if(hasRight($surveyid,'export'))
{
Expand Down Expand Up @@ -2412,8 +2412,8 @@
$startdate=$datetimeobj->convert($dateformatdetails['phpdate'].' H:i');
}

$editsurvey .= "<li><label for='startdate_$surveyid'>".$clang->gT("Start date/time:")."</label>\n"
. "<input type='text' class='popupdatetime' id='startdate_$surveyid' size='20' name='startdate' value=\"{$startdate}\" /></li>\n";
$editsurvey .= "<li><label for='startdate'>".$clang->gT("Start date/time:")."</label>\n"
. "<input type='text' class='popupdatetime' id='startdate' size='20' name='startdate' value=\"{$startdate}\" /></li>\n";

// Expiration date
$expires='';
Expand All @@ -2422,8 +2422,8 @@
$datetimeobj = new Date_Time_Converter($esrow['expires'] , "Y-m-d H:i:s");
$expires=$datetimeobj->convert($dateformatdetails['phpdate'].' H:i');
}
$editsurvey .="<li><label for='enddate_$surveyid'>".$clang->gT("Expiry date/time:")."</label>\n"
. "<input type='text' class='popupdatetime' id='enddate_$surveyid' size='20' name='expires' value=\"{$expires}\" /></li>\n";
$editsurvey .="<li><label for='expires'>".$clang->gT("Expiry date/time:")."</label>\n"
. "<input type='text' class='popupdatetime' id='expires' size='20' name='expires' value=\"{$expires}\" /></li>\n";
//COOKIES
$editsurvey .= "<li><label for=''>".$clang->gT("Set cookie to prevent repeated participation?")."</label>\n"
. "<select name='usecookie'>\n"
Expand Down
6 changes: 3 additions & 3 deletions admin/statistics.php
Expand Up @@ -306,13 +306,13 @@

$statisticsoutput .= "<fieldset id='right'><legend>".$clang->gT("Submission date")."</legend><ul><li>"
."<label for='datestampE'>".$clang->gT("Equals:")."</label>\n"
."<input id='datestampE' name='datestampE' type='text' value='";
."<input class='popupdate' id='datestampE' name='datestampE' type='text' value='";
if (isset($_POST['datestampE'])) {$statisticsoutput .= $_POST['datestampE'];}
$statisticsoutput .= "' /></li><li><label for='datestampG'>\n"
."&nbsp;&nbsp;".$clang->gT("Later than:")."</label>\n"
."<input id='datestampG' name='datestampG' value='";
."<input class='popupdatetime' id='datestampG' name='datestampG' value='";
if (isset($_POST['datestampG'])) {$statisticsoutput .= $_POST['datestampG'];}
$statisticsoutput .= "' type='text' /></li><li><label for='datestampL'> ".$clang->gT("Earlier than:")."</label><input id='datestampL' name='datestampL' value='";
$statisticsoutput .= "' type='text' /></li><li><label for='datestampL'> ".$clang->gT("Earlier than:")."</label><input class='popupdatetime' id='datestampL' name='datestampL' value='";
if (isset($_POST['datestampL'])) {$statisticsoutput .= $_POST['datestampL'];}
$statisticsoutput .= "' type='text' /></li></ul></fieldset>\n";
$statisticsoutput .= "<input type='hidden' name='summary[]' value='datestampE' />";
Expand Down
14 changes: 11 additions & 3 deletions admin/statistics_function.php
Expand Up @@ -410,22 +410,30 @@ function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0,
elseif (substr($pv, 0, 9) == "datestamp")
{
//timestamp equals
$formatdata=getDateFormatData($_SESSION['dateformat']);
if (substr($pv, -1, 1) == "E" && !empty($_POST[$pv]))
{
$selects[] = db_quote_id('datestamp')." = '".$_POST[$pv]."'";
$datetimeobj = new Date_Time_Converter($_POST[$pv], $formatdata['phpdate'].' H:i');
$_POST[$pv]=$datetimeobj->convert("Y-m-d");

$selects[] = db_quote_id('datestamp')." >= '".$_POST[$pv]." 00:00:00' and ".db_quote_id('datestamp')." <= '".$_POST[$pv]." 23:59:59'";
}
else
{
//timestamp less than
if (substr($pv, -1, 1) == "L" && !empty($_POST[$pv]))
{
$selects[]= db_quote_id('datestamp')." > '".$_POST[$pv]."'";
$datetimeobj = new Date_Time_Converter($_POST[$pv], $formatdata['phpdate'].' H:i');
$_POST[$pv]=$datetimeobj->convert("Y-m-d H:i:s");
$selects[]= db_quote_id('datestamp')." < '".$_POST[$pv]."'";
}

//timestamp greater than
if (substr($pv, -1, 1) == "G" && !empty($_POST[$pv]))
{
$selects[]= db_quote_id('datestamp')." < '".$_POST[$pv]."'";
$datetimeobj = new Date_Time_Converter($_POST[$pv], $formatdata['phpdate'].' H:i');
$_POST[$pv]=$datetimeobj->convert("Y-m-d H:i:s");
$selects[]= db_quote_id('datestamp')." > '".$_POST[$pv]."'";
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions admin/styles/default/adminstyle.css
Expand Up @@ -1124,14 +1124,14 @@ margin:0 auto;
}
#statistics_general_filter #left
{
width:300px;
height:105px;
width:270px;
height:125px;
float:left;
}
#statistics_general_filter #right
{
width:300px;
height:105px;
width:330px;
height:125px;
float:right;
}

Expand Down

0 comments on commit 17a2214

Please sign in to comment.