Skip to content

Commit

Permalink
Fixed bug #763: It was possible to choose label set from another lang…
Browse files Browse the repository at this point in the history
…uage - now only label sets containing at least the base language are only choosable

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@2655 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Mar 31, 2007
1 parent bfc41dc commit 346f929
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion admin/questionhandling.php
Expand Up @@ -404,7 +404,7 @@
if ($activated != "Y")
{
$editquestion .= "\t\t<select name='lid' >\n";
$labelsets=getlabelsets();
$labelsets=getlabelsets(GetBaseLanguageFromSurveyID($surveyid));
if (count($labelsets)>0)
{
if (!$eqrow['lid'])
Expand Down
18 changes: 16 additions & 2 deletions common.php
Expand Up @@ -878,10 +878,24 @@ function getSurveyInfo($surveyid, $languagecode='')
}


function getlabelsets()
function getlabelsets($languages=null)
// Returns a list with label sets
// if the $languages paramter is provided then only labelset containing all of the languages in the paramter are provided
{
global $dbprefix, $connect, $surveyid;
$query = "SELECT ".db_table_name('labelsets').".lid as lid, label_name FROM ".db_table_name('labelsets')." order by label_name";
if ($languages){
$languagesarray=explode(' ',trim($languages));
}
$query = "SELECT ".db_table_name('labelsets').".lid as lid, label_name FROM ".db_table_name('labelsets');
if ($languages){
$query .=" where ";
foreach ($languagesarray as $item)
{
$query .=" languages like '%$item %' and ";
}
$query .=" 1=1 ";
}
$query .=" order by label_name";
$result = db_execute_assoc($query) or die ("Couldn't get list of label sets<br />$query<br />".htmlspecialchars($connect->ErrorMsg()));
$labelsets=array();
while ($row=$result->FetchRow())
Expand Down

0 comments on commit 346f929

Please sign in to comment.