Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All classes from classes folder ported except - phpmailer(not require…
…d anymore), pchart(will be used as it is now, no need for any change), inputfilter(not required) . In dTexts class, all its functions dFunctions have been ported as a helper not as a library(which ideally they should be, but not working when we port them as library), datetimeconverter class require adodb-time.inc.php (date time library) so wrapped this file as well. Made some models that were required and a view. git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_ci@10046 b72ed6b6-b9f8-46b5-92b4-906544132732
- Loading branch information
1 parent
24f9bd7
commit 82792e4
Showing
15 changed files
with
3,074 additions
and
0 deletions.
There are no files selected for viewing
1,426 changes: 1,426 additions & 0 deletions
1,426
application/helpers/adodb/adodb-time.inc_helper.php
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
class dFunctionHide | ||
{ | ||
public function __construct() | ||
{ | ||
} | ||
|
||
public function run($args) | ||
{ | ||
|
||
$funcName=array_shift($args); | ||
try | ||
{ | ||
//$func = dTexts::loadFunction($funcName); | ||
$CI =& get_instance(); | ||
$CI->load->helper('dTexts/dFunction'.$funcName); | ||
$className='dFunction'.$funcName; | ||
$func = new $className(); | ||
$newStr = $func->run($args); | ||
if(strtolower($newStr)=='true'){ | ||
$id=time().rand(0,100); | ||
$data['id'] = $id; | ||
$hideJS=$CI->load->view('libraries/dTexts/hideJS_view.php',$data,true); | ||
return $hideJS; | ||
} | ||
} | ||
catch(Exception $e) | ||
{ | ||
throw $e; | ||
} | ||
return ''; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
class dFunctionIfCount | ||
{ | ||
public function __construct() | ||
{ | ||
} | ||
|
||
public function run($args) | ||
{ | ||
//global $connect, $dbprefix; | ||
list($field, $min, $max, $valueForTrue, $valueForFalse) = $args; | ||
if($valueForTrue === null) | ||
$valueForTrue = 'true'; // deafult value | ||
if($valueForFalse === null) | ||
$valueForFalse = 'false'; // deafult value | ||
if($max == 0) // if field with $max is empty '::' | ||
$max = PHP_INT_MAX; | ||
|
||
$srid = $this->session->userdata('srid'); | ||
$sid = $this->input->post('sid'); | ||
$CI =& get_instance(); | ||
$CI->load->model('surveys_dynamic_model'); | ||
$result = $CI->surveys_dynamic_model->getSomeRecords($field,$sid,'WHERE id = '.$srid); | ||
//$query = "SELECT * FROM {$dbprefix}survey_$sid WHERE id = $srid"; | ||
if(!$result){ | ||
//throw new Exception("Couldn't get question '$field' answer<br />".$connect->ErrorMsg()); //Checked | ||
throw new Exception("Couldn't get question '$field' answer<br />"); //Checked | ||
} | ||
$row = $result->row_array(); | ||
|
||
$hits = 0; | ||
while($e = each($row)) | ||
if(stripos($e['key'], $field) !== false) // we're checking only fields containing answer to our question | ||
if(($e['value'] !== "")) // increase hits if user answered that question | ||
++$hits; | ||
|
||
if($hits >= $min && $hits <= $max) | ||
return $valueForTrue; | ||
else | ||
return $valueForFalse; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
class dFunctionIfIn | ||
{ | ||
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 = $this->session->userdata('srid'); | ||
$sid = $this->input->post('sid'); | ||
$CI =& get_instance(); | ||
$CI->load->model('surveys_dynamic_model'); | ||
$result = $CI->surveys_dynamic_model->getSomeRecords($field,$sid,'WHERE id = '.$srid); | ||
//$query = "SELECT $field FROM {$dbprefix}survey_$sid WHERE id = $srid"; | ||
if(!$result){ | ||
//throw new Exception("Couldn't get question '$field' answer<br />".$connect->ErrorMsg()); //Checked | ||
throw new Exception("Couldn't get question '$field' answer<br />"); //Checked | ||
} | ||
$row = $result->row_array(); | ||
$value = $row[$field]; | ||
|
||
if(in_array($value, $args)) | ||
return $valueForTrue; | ||
else | ||
return ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
class dFunctionIf | ||
{ | ||
public function __construct() | ||
{ | ||
} | ||
|
||
public function run($args) | ||
{ | ||
//global $connect, $dbprefix; | ||
list($field, $value, $valueForTrue, $valueForFalse) = $args; | ||
if($valueForTrue === null) | ||
$valueForTrue = 'true'; // deafult value | ||
if($valueForFalse === null) | ||
$valueForFalse = 'false'; // deafult value | ||
$srid = $this->session->userdata('srid'); | ||
$sid = $this->input->post('sid'); | ||
$CI =& get_instance(); | ||
$CI->load->model('surveys_dynamic_model'); | ||
$result = $CI->surveys_dynamic_model->getSomeRecords($field,$sid,'WHERE id = '.$srid); | ||
//$query = "SELECT $field FROM {$dbprefix}survey_$sid WHERE id = $srid"; | ||
if(!$result){ | ||
//throw new Exception("Couldn't get question '$field' answer<br />".$connect->ErrorMsg()); //Checked | ||
throw new Exception("Couldn't get question '$field' answer<br />"); //Checked | ||
} | ||
$row = $result->row_array(); | ||
|
||
if ($row[$field] == $value) | ||
{ | ||
return $valueForTrue; | ||
} | ||
else | ||
{ | ||
return $valueForFalse; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
class dFunctionInsertAns | ||
{ | ||
public function __construct() | ||
{ | ||
} | ||
|
||
public function run($args) | ||
{ | ||
//global $connect; | ||
$field = $args[0]; | ||
if ($this->session->userdata('srid')) $srid = $this->session->userdata('srid'); | ||
$sid = returnglobal('sid'); | ||
$dateformats = $this->session->userdata('dateformats'); | ||
return retrieve_Answer($field, $dateformats['phpdate']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
class dFunctionSwitch | ||
{ | ||
public function __construct() | ||
{ | ||
} | ||
|
||
public function run($args) | ||
{ | ||
//global $connect, $dbprefix; | ||
$field = $args[0]; | ||
$srid = $this->session->userdata('srid'); | ||
$sid = $this->input->post('sid'); | ||
$CI =& get_instance(); | ||
$CI->load->model('surveys_dynamic_model'); | ||
$result = $CI->surveys_dynamic_model->getSomeRecords($field,$sid,'WHERE id = '.$srid); | ||
//$query = "SELECT $field FROM {$dbprefix}survey_$sid WHERE id = $srid"; | ||
if(!$result){ | ||
//throw new Exception("Couldn't get question '$field' answer<br />".$connect->ErrorMsg()); //Checked | ||
throw new Exception("Couldn't get question '$field' answer<br />"); //Checked | ||
} | ||
$row = $result->row_array(); | ||
$value = $row[$field]; | ||
|
||
$found = array_keys($args, $value); | ||
if(count($found)) | ||
{ | ||
while($e = each($found)) | ||
if($e['value'] % 2 != 0) // we check this, as only at odd indexes there are 'cases' | ||
return $args[$e['value']+1]; // returns value associated with found 'case' | ||
} | ||
// return empty string if none of cases matches user's answer | ||
return ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
class dFunctionToken | ||
{ | ||
public function __construct() | ||
{ | ||
} | ||
|
||
public function run($args) | ||
{ | ||
global $surveyid; | ||
if ($this->session->userdata('token') != '') | ||
{ | ||
//Gather survey data for tokenised surveys, for use in presenting questions | ||
$currenttoken=getTokenData($surveyid,$this->session->userdata('token')); | ||
//add data to session | ||
$newdata = array( | ||
'thistoken' => $currenttoken | ||
); | ||
$this->session->set_userdata($newdata); | ||
} | ||
$currenttoken = $this->session->userdata('thistoken'); | ||
if ($currenttoken) | ||
{ | ||
if (!strcmp(strtolower($args[0]),'firstname')) | ||
{ | ||
return $currenttoken['firstname']; | ||
} | ||
//return $_SESSION['thistoken']['firstname']; | ||
if (!strcmp(strtolower($args[0]),'lastname')) | ||
{ | ||
return $currenttoken['lastname']; | ||
} | ||
//return $_SESSION['thistoken']['lastname']; | ||
if (!strcmp(strtolower($args[0]),'email')) | ||
{ | ||
return $currenttoken['email']; | ||
} | ||
//return $_SESSION['thistoken']['email']; | ||
} | ||
else | ||
{ | ||
return ""; | ||
} | ||
|
||
if(stripos($args[0],'attribute_')!==FALSE){ | ||
$attr_no=(int)str_replace('ATTRIBUTE_','',$args[0]); | ||
if (isset($currenttoken['attribute_'.$attr_no])) return $currenttoken['attribute_'.$attr_no]; | ||
} | ||
|
||
throw new Exception('TOKEN incorrect!'); | ||
} | ||
} |
Oops, something went wrong.