Skip to content

Commit

Permalink
Fixed issue #07086: Export results window shows SGQA-Codes instead of…
Browse files Browse the repository at this point in the history
… variable names

Dev: Fixed surveyTiming are not in export list
  • Loading branch information
Shnoulle committed Dec 21, 2012
1 parent 2cd136f commit f4b8793
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 3 deletions.
4 changes: 4 additions & 0 deletions application/controllers/admin/export.php
Expand Up @@ -157,6 +157,10 @@ public function exportresults()
{
//FIND OUT HOW MANY FIELDS WILL BE NEEDED - FOR 255 COLUMN LIMIT
$aFieldMap = createFieldMap($iSurveyID,false,false,getBaseLanguageFromSurveyID($iSurveyID));
if ($thissurvey['savetimings'] === "Y") {
//Append survey timings to the fieldmap array
$aFieldMap = $aFieldMap + createTimingsFieldMap($iSurveyID, 'full',false,false,getBaseLanguageFromSurveyID($iSurveyID));
}
$iFieldCount = count($aFieldMap);

$selecthide = "";
Expand Down
81 changes: 80 additions & 1 deletion application/helpers/viewHelper.php
Expand Up @@ -19,6 +19,7 @@
class viewHelper
{
/**
* getImageLink
* Returns HTML needed for a link that consists of only an image with alt text.
*
* Usage: getImageLink('test.png', 'controller/action/params', 'Your description', 'optionalClass', '_blank')
Expand Down Expand Up @@ -53,4 +54,82 @@ public static function getImageLink($imgName, $linkUrl, $linkTxt, $linkTarget =

return $output;
}
}

/**
* getFieldText
* Returns $string : complete field information text for surveytable.
*
* Usage: getFieldText($q, $option)
*
* @param object $q the field information from createFieldMap
* @param array $option option for filtering
*/
public static function getFieldText($q, $option=false)
{
// Maybe put flatten in option
if(isset($q->fieldname))
{
$questiontext=FlattenText($q->text,false,true);
if(isset($q->scalename) && $q->scalename)
{
$questiontext.="[".FlattenText($q->scalename,false,true)."]";
}
if(isset($q->sq) && $q->sq)
{
$questiontext.="[".FlattenText($q->sq,false,true)."]";
}
if(isset($q->sq1) && $q->sq1)
{
$questiontext.="[".FlattenText($q->sq1,false,true)."]";
}
if(isset($q->sq2) && $q->sq2)
{
$questiontext.="[".FlattenText($q->sq2,false,true)."]";
}
}
else
{
$questiontext="";
}
return $questiontext;
}

/**
* getFieldCode
* Returns $string : complete field information code for surveytable.
*
* Usage: getFieldCode($field, $option)
*
* @param object $q the field information from createFieldMap
* @param array $option option for filtering
*/
public static function getFieldCode($q, $option=false)
{
if(isset($q->fieldname))
{
if(isset($q->title) && $q->title)
{
$questioncode=$q->title;
if(isset($q->scale))
{
$scalenum=intval($q->scale)+1;
$questioncode.="[".$scalenum."]";
}
if(isset($q->aid) && $q->aid)
{
$questioncode.="[".$q->aid."]";
}
}
else
{
$questioncode=$q->fieldname;
}
}
else
{
$questioncode="";
}
return $questioncode;
}

}
6 changes: 4 additions & 2 deletions application/views/admin/export/exportresults_view.php
Expand Up @@ -101,6 +101,8 @@
<?php $i=1;
foreach($excesscols as $q)
{
$questiontext=viewHelper::getFieldText($q);
$questioncode=viewHelper::getFieldCode($q);
echo "<option value='{$q->fieldname}'";
if (isset($_POST['summary']))
{
Expand All @@ -113,7 +115,7 @@
{
echo " selected";
}
echo ">{$i}: {$q->fieldname} - ".ellipsize(FlattenText($q->text,false,true),40,0.9)."</option>\n";
echo " title='{$q->fieldname} : ".sanitize_html_string($questiontext)."'>".ellipsize("{$i} : {$questioncode} - {$questiontext}",45)."</option>\n";
$i++;
} ?>
</select>
Expand All @@ -135,4 +137,4 @@
</select></fieldset>
<?php } ?>
</div>
<div style='clear:both;'><p><input type='submit' value='<?php $clang->eT("Export data");?>' /></div></form></div>
<div style='clear:both;'><p><input type='submit' value='<?php $clang->eT("Export data");?>' /></div></form></div>

0 comments on commit f4b8793

Please sign in to comment.