mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Merging the Limesurvey 1.91+ branch of queXS in to the trunk
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
class dFunctionIfIn implements dFunctionInterface
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function run($args)
|
||||
{
|
||||
global $connect, $dbprefix;
|
||||
$field = array_shift($args);
|
||||
$valueForTrue = array_shift($args); // value that will'be inserted if user's answer hits one of our options
|
||||
$srid = $_SESSION['srid'];
|
||||
$sid = $_POST['sid'];
|
||||
$query = "SELECT $field FROM {$dbprefix}survey_$sid WHERE id = $srid";
|
||||
if(!$result = $connect->Execute($query)){
|
||||
throw new Exception("Couldn't get question '$field' answer<br />".$connect->ErrorMsg()); //Checked
|
||||
}
|
||||
$row = $result->fetchRow();
|
||||
$value = $row[$field];
|
||||
|
||||
if(in_array($value, $args))
|
||||
return $valueForTrue;
|
||||
else
|
||||
return "";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user