Skip to content

Commit

Permalink
Remove unused option from createFieldMap.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronschmitz committed Aug 15, 2012
1 parent 66c398a commit db5f6f1
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion application/controllers/UploaderController.php
Expand Up @@ -108,7 +108,7 @@ function run()
$maxfilesize = (int) $_POST['max_filesize'];
$preview = $_POST['preview'];
$fieldname = $_POST['fieldname'];
$aFieldMap = createFieldMap($surveyid,'short',false,false,$_SESSION['survey_'.$surveyid]['s_lang']); //AJS#
$aFieldMap = createFieldMap($surveyid,false,false,$_SESSION['survey_'.$surveyid]['s_lang']);
if (!isset($aFieldMap[$fieldname])) die();
$q=$aFieldMap[$fieldname];
$aAttributes=$q->getAttributeValues();
Expand Down
10 changes: 5 additions & 5 deletions application/controllers/admin/dataentry.php
Expand Up @@ -172,7 +172,7 @@ private function _handleFileUpload($surveyid, $aData)
$aFieldnames = array_map('dbQuoteID', $aFieldnames);

// Find out which fields are datefields, these have to be null if the imported string is empty
$fieldmap = createFieldMap($surveyid,'full',false,false,getBaseLanguageFromSurveyID($surveyid)); //AJS#
$fieldmap = createFieldMap($surveyid,false,false,getBaseLanguageFromSurveyID($surveyid));

foreach ($aFileContents as $row)
{
Expand Down Expand Up @@ -534,7 +534,7 @@ public function editdata($subaction, $id, $surveyid, $language='')
$q->group_name="";
$fnames['completed'] = $q;

$fnames=array_merge($fnames,createFieldMap($surveyid,'full',false,false,$sDataEntryLanguage)); //AJS#
$fnames=array_merge($fnames,createFieldMap($surveyid,false,false,$sDataEntryLanguage));

//SHOW INDIVIDUAL RECORD

Expand Down Expand Up @@ -578,7 +578,7 @@ public function editdata($subaction, $id, $surveyid, $language='')
$responses[$svrow['fieldname']] = $svrow['value'];
} // while

$fieldmap = createFieldMap($surveyid,'full',false,false,getBaseLanguageFromSurveyID($surveyid)); //AJS#
$fieldmap = createFieldMap($surveyid,false,false,getBaseLanguageFromSurveyID($surveyid));
foreach($fieldmap as $q)
{
if (isset($responses[$q->fieldname]))
Expand Down Expand Up @@ -763,7 +763,7 @@ public function update()

$aDataentryoutput = "<div class='header ui-widget-header'>".$clang->gT("Data entry")."</div>\n";

$fieldmap = createFieldMap($surveyid,'full',false,false,getBaseLanguageFromSurveyID($surveyid)); //AJS#
$fieldmap = createFieldMap($surveyid,false,false,getBaseLanguageFromSurveyID($surveyid));

$thissurvey = getSurveyInfo($surveyid);
$updateqr = "UPDATE $surveytable SET \n";
Expand Down Expand Up @@ -971,7 +971,7 @@ public function insert()

//BUILD THE SQL TO INSERT RESPONSES
$baselang = Survey::model()->findByPk($surveyid)->language;
$fieldmap = createFieldMap($surveyid,'full',false,false,getBaseLanguageFromSurveyID($surveyid)); //AJS#
$fieldmap = createFieldMap($surveyid,false,false,getBaseLanguageFromSurveyID($surveyid));
$insert_data = array();

$_POST['startlanguage'] = $baselang;
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/export.php
Expand Up @@ -188,7 +188,7 @@ public function exportresults()
if ( ! $exportstyle )
{
//FIND OUT HOW MANY FIELDS WILL BE NEEDED - FOR 255 COLUMN LIMIT
$aFieldMap = createFieldMap($iSurveyID,'full',false,false,getBaseLanguageFromSurveyID($iSurveyID)); //AJS#
$aFieldMap = createFieldMap($iSurveyID,false,false,getBaseLanguageFromSurveyID($iSurveyID));
$iFieldCount = count($aFieldMap);

$selecthide = "";
Expand Down Expand Up @@ -914,7 +914,7 @@ public function vvexport()

$s="\t";

$fieldmap = createFieldMap($iSurveyID,'full',false,false,getBaseLanguageFromSurveyID($iSurveyID)); //AJS#
$fieldmap = createFieldMap($iSurveyID,false,false,getBaseLanguageFromSurveyID($iSurveyID));
$surveytable = "{{survey_$iSurveyID}}";

Survey::model()->findByPk($iSurveyID)->language;
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/limereplacementfields.php
Expand Up @@ -47,7 +47,7 @@ public function index()
}

//2: Get all other questions that occur before this question that are pre-determined answer types
$fieldmap = createFieldMap($surveyid,'full',false,false,getBaseLanguageFromSurveyID($surveyid)); //AJS#
$fieldmap = createFieldMap($surveyid,'full',false,false,getBaseLanguageFromSurveyID($surveyid));

$surveyInfo = getSurveyInfo($surveyid);
$surveyformat = $surveyInfo['format']; // S, G, A
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/question.php
Expand Up @@ -1051,7 +1051,7 @@ public function preview($surveyid, $qid, $lang = null)

// Use $_SESSION instead of $this->session for frontend features.
$_SESSION['survey_'.$surveyid]['s_lang'] = $language;
$_SESSION['survey_'.$surveyid]['fieldmap'] = createFieldMap($surveyid, 'full', true, $qid, $language); //AJS#
$_SESSION['survey_'.$surveyid]['fieldmap'] = createFieldMap($surveyid, true, $qid, $language);


// Prefill question/answer from defaultvalues
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/remotecontrol.php
Expand Up @@ -2057,7 +2057,7 @@ public function export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLan
Yii::app()->loadHelper('admin/exportresults');
if (!hasSurveyPermission($iSurveyID, 'responses', 'export')) return array('status' => 'No permission');
if (is_null($sLanguageCode)) $sLanguageCode=getBaseLanguageFromSurveyID($iSurveyID);
if (is_null($aFields)) $aFields=array_keys(createFieldMap($iSurveyID,'full',true,false,$sLanguageCode)); //AJS#
if (is_null($aFields)) $aFields=array_keys(createFieldMap($iSurveyID,true,false,$sLanguageCode));
if($sDocumentType=='xls'){
// Cut down to the first 255 fields
$aFields=array_slice($aFields,0,255);
Expand Down
12 changes: 6 additions & 6 deletions application/controllers/admin/responses.php
Expand Up @@ -121,7 +121,7 @@ public function view($iSurveyId, $iId, $sBrowseLang = '')
$aViewUrls = array();

$fncount = 0;
$fieldmap = createFieldMap($iSurveyId, 'full', false, false, $aData['language']); //AJS#
$fieldmap = createFieldMap($iSurveyId, false, false, $aData['language']);

//add token to top of list if survey is not private
if ($aData['surveyinfo']['anonymized'] == "N" && tableExists('tokens_' . $iSurveyId))
Expand Down Expand Up @@ -317,7 +317,7 @@ function browse($iSurveyId)
$iResponseID = (int) Yii::app()->request->getPost('deleteanswer'); // sanitize the value
// delete the files as well if its a fuqt

$fieldmap = createFieldMap($iSurveyId,'full',false,false,$oBrowseLanguage->langcode); //AJS#
$fieldmap = createFieldMap($iSurveyId,false,false,$oBrowseLanguage->langcode);
$fuqtquestions = array();
// find all fuqt questions
foreach ($fieldmap as $q)
Expand Down Expand Up @@ -356,7 +356,7 @@ function browse($iSurveyId)
// Delete the marked responses - checked
if (Yii::app()->request->getPost('deleteanswer') && Yii::app()->request->getPost('deleteanswer') === 'marked')
{
$fieldmap = createFieldMap($iSurveyId,'full',false,false,$oBrowseLanguage->langcode); //AJS#
$fieldmap = createFieldMap($iSurveyId,false,false,$oBrowseLanguage->langcode);
$fuqtquestions = array();
// find all fuqt questions
foreach ($fieldmap as $q)
Expand Down Expand Up @@ -462,7 +462,7 @@ function browse($iSurveyId)
}

$fnames[] = array("submitdate", $clang->gT("Completed"), $clang->gT("Completed"), "0", 'D');
$fields = createFieldMap($iSurveyId, 'full', false, false, $aData['language']); //AJS#
$fields = createFieldMap($iSurveyId, false, false, $aData['language']);

foreach ($fields as $q)
{
Expand Down Expand Up @@ -621,7 +621,7 @@ public function time($iSurveyId)
}
}

$fields = createFieldMap($iSurveyId, 'full',true,false,$aData['language']); //AJS#
$fields = createFieldMap($iSurveyId, true,false,$aData['language']);

$clang = $aData['clang'];
$fnames = array('interviewtime' => $clang->gT('Total time'));
Expand Down Expand Up @@ -841,7 +841,7 @@ private function _zipFiles($responseIds, $zipfilename)
$tmpdir = Yii::app()->getConfig('uploaddir') . "/surveys/" . $iSurveyId . "/files/";

$filelist = array();
$fieldmap = createFieldMap($iSurveyId, 'full' ,false, false, Yii::app()->session['browselang']); //AJS#
$fieldmap = createFieldMap($iSurveyId, false, false, Yii::app()->session['browselang']);

foreach ($fieldmap as $q)
{
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/survey/index.php
Expand Up @@ -532,7 +532,7 @@ function sendreq(surveyid)
$result= dbExecuteAssoc('DELETE FROM {{survey_'.$surveyid.'}} WHERE id='.$_SESSION['survey_'.$surveyid]['srid']." AND submitdate IS NULL");
if($result->count()>0){
// find out if there are any fuqt questions - checked
$fieldmap = createFieldMap($surveyid,'short',false,false,$s_lang); //AJS#
$fieldmap = createFieldMap($surveyid,false,false,$s_lang);
foreach ($fieldmap as $q)
{
if ($q->fileUpload() && !strpos($q->fieldname, "_filecount"))
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -541,7 +541,7 @@ function run($surveyid,$args) {
doFooter();
exit;
}
createFieldMap($surveyid,'full',false,false,$_SESSION[$LEMsessid]['s_lang']); //AJS#
createFieldMap($surveyid,false,false,$_SESSION[$LEMsessid]['s_lang']);
//GET GROUP DETAILS

if ($surveyMode == 'group' && $previewgrp)
Expand Down
6 changes: 3 additions & 3 deletions application/helpers/admin/activate_helper.php
Expand Up @@ -203,7 +203,7 @@ function checkQuestions($postsid, $iSurveyID)
}

//CHECK THAT ALL THE CREATED FIELDS WILL BE UNIQUE
$fieldmap = createFieldMap($iSurveyID,'full',false,false,getBaseLanguageFromSurveyID($iSurveyID)); //AJS#
$fieldmap = createFieldMap($iSurveyID,false,false,getBaseLanguageFromSurveyID($iSurveyID));
if (isset($fieldmap))
{
foreach($fieldmap as $q)
Expand Down Expand Up @@ -251,7 +251,7 @@ function activateSurvey($iSurveyID, $simulate = false)
$prow = Survey::model()->findByAttributes(array('sid' => $iSurveyID));

//Get list of questions for the base language
$fieldmap = createFieldMap($iSurveyID,'full',true,false,getBaseLanguageFromSurveyID($iSurveyID)); //AJS#
$fieldmap = createFieldMap($iSurveyID,true,false,getBaseLanguageFromSurveyID($iSurveyID));

$createsurvey = array();
foreach ($fieldmap as $q) //With each question, create the appropriate field(s)
Expand Down Expand Up @@ -354,7 +354,7 @@ function activateSurvey($iSurveyID, $simulate = false)

if ($prow->savetimings == "Y")
{
$timingsfieldmap = createFieldMap($iSurveyID,"short",false,false,getBaseLanguageFromSurveyID($iSurveyID)); //AJS#
$timingsfieldmap = createFieldMap($iSurveyID,false,false,getBaseLanguageFromSurveyID($iSurveyID));

$column['id'] = $createsurvey['id'];
$column['interviewtime'] = 'FLOAT';
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/admin/exportresults_helper.php
Expand Up @@ -253,7 +253,7 @@ public function loadSurveyById($id)
$lang = Survey::model()->findByPk($intId)->language;
$clang = new limesurvey_lang($lang);

$survey->fieldMap = createFieldMap($intId,'full',false,false,getBaseLanguageFromSurveyID($intId)); //AJS#
$survey->fieldMap = createFieldMap($intId,false,false,getBaseLanguageFromSurveyID($intId));

if (empty($intId))
{
Expand Down
4 changes: 2 additions & 2 deletions application/helpers/admin/statistics_helper.php
Expand Up @@ -277,7 +277,7 @@ function buildSelects($allfields, $surveyid, $language) {
$selects=array();
$aQuestionMap=array();

$fieldmap=createFieldMap($surveyid, "full", false, false, $language); //AJS#
$fieldmap=createFieldMap($surveyid, false, false, $language);
foreach ($fieldmap as $q)
{
if(isset($q->id) && $q->id!='')
Expand Down Expand Up @@ -514,7 +514,7 @@ function buildOutputList($rt, $language, $surveyid, $outputType, $sql) {
$statlangcode = getBaseLanguageFromSurveyID($surveyid);
$statlang = new Limesurvey_lang($statlangcode);
$firstletter = substr($rt, 0, 1);
$fieldmap=createFieldMap($surveyid, "full", false, false, $language); //AJS#
$fieldmap=createFieldMap($surveyid, false, false, $language);
$sDatabaseType = Yii::app()->db->getDriverName();
$statisticsoutput="";

Expand Down
20 changes: 10 additions & 10 deletions application/helpers/common_helper.php
Expand Up @@ -1461,7 +1461,7 @@ function sendCacheHeaders()
function getQuestion($fieldcode)
{
list($sid, $gid, $qid) = explode('X', $fieldcode);
$fields=createFieldMap($sid,'full',false,false,getBaseLanguageFromSurveyID($sid)); //AJS#
$fields=createFieldMap($sid,false,false,getBaseLanguageFromSurveyID($sid));
foreach($fields as $q)
{
if($q->id==$qid && $q->surveyid==$sid && $q->gid==$gid) return $q;
Expand Down Expand Up @@ -1491,7 +1491,7 @@ function getExtendedAnswer($iSurveyID, $sFieldCode, $sValue, $oLanguage)
}
return $sValue;
}
$fieldmap = createFieldMap($iSurveyID,'short',false,false,$sLanguage); //AJS#
$fieldmap = createFieldMap($iSurveyID,false,false,$sLanguage);
if (isset($fieldmap[$sFieldCode]))
$q = $fieldmap[$sFieldCode];
else
Expand Down Expand Up @@ -1887,7 +1887,7 @@ function createCompleteSGQA($iSurveyID,$aFilters,$sLanguage) {
* @return array
*/

function createFieldMap($surveyid, $style='short', $force_refresh=false, $questionid=false, $sLanguage) {
function createFieldMap($surveyid, $force_refresh=false, $questionid=false, $sLanguage) {
$sLanguage = sanitize_languagecode($sLanguage);
$surveyid = sanitize_int($surveyid);
$clang = new Limesurvey_lang($sLanguage); ;
Expand Down Expand Up @@ -2152,7 +2152,7 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi
* @return bool
*/
function hasFileUploadQuestion($surveyid) {
$fieldmap = createFieldMap($surveyid,'short',false,false,getBaseLanguageFromSurveyID($surveyid)); //AJS#
$fieldmap = createFieldMap($surveyid,false,false,getBaseLanguageFromSurveyID($surveyid));

foreach ($fieldmap as $q) {
if (substr(get_class($q),-8)=="Question" && $q->fileUpload()) return true;
Expand Down Expand Up @@ -3580,7 +3580,7 @@ function getArrayFilterExcludesCascadesForGroup($surveyid, $gid="", $output="qid
$cascaded=array();
$sources=array();
$qidtotitle=array();
$fieldmap = createFieldMap($surveyid,'full',false,false,getBaseLanguageFromSurveyID($surveyid)); //AJS#
$fieldmap = createFieldMap($surveyid,false,false,getBaseLanguageFromSurveyID($surveyid));

$attrmach = array(); // Stores Matches of filters that have their values as questions within current group
foreach ($fieldmap as $q) // Cycle through questions to see if any have list_filter attributes
Expand Down Expand Up @@ -4182,7 +4182,7 @@ function reverseTranslateFieldNames($iOldSID,$iNewSID,$aGIDReplacements,$aQIDRep
else {
$forceRefresh=false;
}
$aFieldMap = createFieldMap($iNewSID,'short',$forceRefresh,false,getBaseLanguageFromSurveyID($iNewSID)); //AJS#
$aFieldMap = createFieldMap($iNewSID,$forceRefresh,false,getBaseLanguageFromSurveyID($iNewSID));

$aFieldMappings=array();
foreach ($aFieldMap as $q)
Expand Down Expand Up @@ -4868,7 +4868,7 @@ function getQuotaCompletedCount($iSurveyId, $quotaid)
*/
function getFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonorConditions=false)
{
$aFieldMap = createFieldMap($iSurveyID,'full',false,false,$sLanguageCode); //AJS#
$aFieldMap = createFieldMap($iSurveyID,false,false,$sLanguageCode);
$oLanguage = new Limesurvey_lang($sLanguageCode);

//Get response data
Expand Down Expand Up @@ -6505,12 +6505,12 @@ function sDefaultSubmitHandler()
*/
function fixSubquestions()
{
$surveyidresult=Yii::app()->db->createCommand("select sq.qid, sq.parent_qid, sq.gid as sqgid, q.gid, sq.type as sqtype, sq.tid as sqtid,q.type,q.tid
$surveyidresult=Yii::app()->db->createCommand("select sq.qid, sq.parent_qid, sq.gid as sqgid, q.gid, sq.tid as sqtid,q.tid
from {{questions}} sq JOIN {{questions}} q on sq.parent_qid=q.qid
where sq.parent_qid>0 and (sq.gid!=q.gid or sq.type!=q.type or sq.tid!=q.tid)")->query(); //AJS
where sq.parent_qid>0 and (sq.gid!=q.gid or sq.tid!=q.tid)")->query();
foreach($surveyidresult->readAll() as $sv)
{
Yii::app()->db->createCommand("update {{questions}} set type='{$sv['type']}', gid={$sv['gid']}, tid={$sv['tid']} where qid={$sv['qid']}")->query(); //AJS
Yii::app()->db->createCommand("update {{questions}} set gid={$sv['gid']}, tid={$sv['tid']} where qid={$sv['qid']}")->query();
}

}
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/export_helper.php
Expand Up @@ -151,7 +151,7 @@ function SPSSGetValues ($field = array()) {
function SPSSFieldMap($iSurveyID, $prefix = 'V') {
global $clang, $surveyprivate, $tokensexist, $language;

$fieldmap = createFieldMap($iSurveyID,'full',false,false,getBaseLanguageFromSurveyID($iSurveyID)); //AJS#
$fieldmap = createFieldMap($iSurveyID,false,false,getBaseLanguageFromSurveyID($iSurveyID));

#See if tokens are being used
$tokensexist = Yii::app()->db->schema->getTable('{{tokens_'.$iSurveyID . '}}');
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/expressions/em_manager_helper.php
Expand Up @@ -2372,7 +2372,7 @@ private function setVariableAndTokenMappingsForExpressionManager($surveyid,$forc
$this->em->SetSurveyMode($this->surveyMode);

// TODO - do I need to force refresh, or trust that createFieldMap will cache langauges properly?
$fieldmap=createFieldMap($surveyid,$style='full',$forceRefresh,false,$_SESSION['LEMlang']); //AJS#
$fieldmap=createFieldMap($surveyid,$forceRefresh,false,$_SESSION['LEMlang']);
$this->sid= $surveyid;

$this->runtimeTimings[] = array(__METHOD__ . '.createFieldMap',(microtime(true) - $now));
Expand Down
8 changes: 4 additions & 4 deletions application/helpers/frontend_helper.php
Expand Up @@ -734,7 +734,7 @@ function checkUploadedFileValidity($surveyid, $move, $backok=null)

if (!isset($backok) || $backok != "Y")
{
$fieldmap = createFieldMap($surveyid,'full',false,false,$_SESSION['survey_'.$surveyid]['s_lang']); //AJS#
$fieldmap = createFieldMap($surveyid,false,false,$_SESSION['survey_'.$surveyid]['s_lang']);

if (isset($_POST['fieldnames']) && $_POST['fieldnames']!="")
{
Expand Down Expand Up @@ -1680,7 +1680,7 @@ function buildsurveysession($surveyid,$previewGroup=false)
//Gather survey data for "non anonymous" surveys, for use in presenting questions
$_SESSION['survey_'.$surveyid]['thistoken']=getTokenData($surveyid, $clienttoken);
}
$fieldmap=createFieldMap($surveyid,'full',false,false,$_SESSION['survey_'.$surveyid]['s_lang']); //AJS#
$fieldmap=createFieldMap($surveyid,false,false,$_SESSION['survey_'.$surveyid]['s_lang']);


// Randomization groups for groups
Expand Down Expand Up @@ -1797,7 +1797,7 @@ function buildsurveysession($surveyid,$previewGroup=false)
{
// Get the swapped question
$oldQuestFlip = array_flip($oldQuestOrder[$gkey]);
$qfieldmap = createFieldMap($surveyid,'full',true,$newQuestOrder[$gkey][$oldQuestFlip[$q->id]],$_SESSION['survey_'.$surveyid]['s_lang']); //AJS#
$qfieldmap = createFieldMap($surveyid,true,$newQuestOrder[$gkey][$oldQuestFlip[$q->id]],$_SESSION['survey_'.$surveyid]['s_lang']);
unset($qfieldmap['id']);
unset($qfieldmap['submitdate']);
unset($qfieldmap['lastpage']);
Expand Down Expand Up @@ -2094,7 +2094,7 @@ function doAssessment($surveyid, $returndataonly=false)
"message"=>$row['message']);
}
}
$fieldmap=createFieldMap($surveyid, "full",false,false,$_SESSION['survey_'.$surveyid]['s_lang']); //AJS#
$fieldmap=createFieldMap($surveyid,false,false,$_SESSION['survey_'.$surveyid]['s_lang']);
$total=0;
$groups=array();
foreach($fieldmap as $q)
Expand Down

0 comments on commit db5f6f1

Please sign in to comment.