Skip to content

Commit

Permalink
added checks to group edit to:
Browse files Browse the repository at this point in the history
1. Remove a language that is not part of the survey anymore
2. Add default records for new languages ( added post group creation )

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@2095 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
David Olivier committed Oct 16, 2006
1 parent 0f95c92 commit c98dd1f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions admin/html.php
Expand Up @@ -2480,6 +2480,37 @@
{
if ($sumrows5['edit_survey_property'])
{
$grplangs = GetAdditionalLanguagesFromSurveyID($surveyid);
array_pop($grplangs);
$baselang = GetBaseLanguageFromSurveyID($surveyid);
$grplangs[] = $baselang;
$grplangs = array_flip($grplangs);

$egquery = "SELECT * FROM ".db_table_name('groups')." WHERE sid=$surveyid AND gid=$gid";
$egresult = db_execute_assoc($egquery);
while ($esrow = $egresult->FetchRow())
{
if(!array_key_exists($esrow['language'], $grplangs)) // Language Exists, BUT ITS NOT ON THE SURVEY ANYMORE.
{
$egquery = "DELETE FROM ".db_table_name('groups')." WHERE sid='{$surveyid}' AND gid='{$gid}' AND language='".$esrow['language']."'";
$egresultD = $connect->Execute($egquery);
} else {
$grplangs[$esrow['language']] = 99;
}
if ($esrow['language'] == $baselang) $basesettings = array('group_name' => $esrow['group_name'],'description' => $esrow['description'],'group_order' => $esrow['group_order']);

}

while (list($key,$value) = each($grplangs))
{
if ($value != 99)
{
//die("INSERT:".$key);
$egquery = "INSERT INTO ".db_table_name('groups')." (gid, sid, group_name, description,group_order,language) VALUES ('{$gid}', '{$surveyid}', '{$basesettings['group_name']}', '{$basesettings['description']}','{$basesettings['group_order']}', '{$key}')";
$egresult = $connect->Execute($egquery);
}
}

$egquery = "SELECT * FROM ".db_table_name('groups')." WHERE sid=$surveyid AND gid=$gid";
$egresult = db_execute_assoc($egquery);
$editgroup ="<table width='100%' border='0'>\n\t<tr><td bgcolor='black' align='center'>"
Expand Down

0 comments on commit c98dd1f

Please sign in to comment.