Example #1
0
    } else {
        include "access_denied.php";
    }
}
if (isset($surveyid) && $surveyid && $gid) {
    // TODO: check that surveyid and thus baselang are always set here
    $sumquery4 = "SELECT * FROM " . db_table_name('questions') . " WHERE sid={$surveyid} AND\n\tgid={$gid} AND language='" . $baselang . "'";
    //Getting a count of questions for this survey
    $sumresult4 = $connect->Execute($sumquery4);
    //Checked
    $sumcount4 = $sumresult4->RecordCount();
    $grpquery = "SELECT * FROM " . db_table_name('groups') . " WHERE gid={$gid} AND\n\tlanguage='" . $baselang . "' ORDER BY " . db_table_name('groups') . ".group_order";
    $grpresult = db_execute_assoc($grpquery);
    //Checked
    // Check if other questions/groups are dependent upon this group
    $condarray = GetGroupDepsForConditions($surveyid, "all", $gid, "by-targgid");
    $groupsummary = "<div class='menubar'>\n" . "<div class='menubar-title ui-widget-header'>\n";
    while ($grow = $grpresult->FetchRow()) {
        $grow = array_map('FlattenText', $grow);
        $groupsummary .= '<strong>' . $clang->gT("Question group") . '</strong>&nbsp;' . "<span class='basic'>{$grow['group_name']} (" . $clang->gT("ID") . ":{$gid})</span>\n" . "</div>\n" . "<div class='menubar-main'>\n" . "<div class='menubar-left'>\n";
        //        // CREATE BLANK SPACE FOR IMAGINARY BUTTONS
        //
        //
        $groupsummary .= "" . "<img src='{$imageurl}/blank.gif' alt='' width='54' height='20'  />\n";
        if (bHasSurveyPermission($surveyid, 'surveycontent', 'update')) {
            $groupsummary .= "<img src='{$imageurl}/seperator.gif' alt=''  />\n" . "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=previewgroup&amp;sid={$surveyid}&amp;gid={$gid}','_blank')\"" . " title=\"" . $clang->gTview("Preview current question group") . "\">" . "<img src='{$imageurl}/preview.png' alt='" . $clang->gT("Preview current question group") . "' name='PreviewGroup' /></a>\n";
        } else {
            $groupsummary .= "<img src='{$imageurl}/seperator.gif' alt=''  />\n";
        }
        // EDIT CURRENT QUESTION GROUP BUTTON
        if (bHasSurveyPermission($surveyid, 'surveycontent', 'update')) {
Example #2
0
         //Move the question we're changing out of the way
         $cdquery = "UPDATE " . db_table_name('groups') . " SET group_order=-1 WHERE sid={$surveyid} AND group_order={$oldpos}";
         $cdresult = $connect->Execute($cdquery) or safe_die($connect->ErrorMsg());
         //Move all question_orders that are later than the newpos up one
         $cdquery = "UPDATE " . db_table_name('groups') . " SET group_order=group_order+1 WHERE sid={$surveyid} AND group_order > {$newpos} AND group_order <= {$oldpos}";
         $cdresult = $connect->Execute($cdquery) or safe_die($connect->ErrorMsg());
         //Renumber the question we're changing
         $cdquery = "UPDATE " . db_table_name('groups') . " SET group_order=" . ($newpos + 1) . " WHERE sid={$surveyid} AND group_order=-1";
         $cdresult = $connect->Execute($cdquery) or safe_die($connect->ErrorMsg());
     }
 }
 $ordergroups = "<div class='header'>" . $clang->gT("Change Group Order") . "</div><br />\n";
 // Get groups dependencies regarding conditions
 // => Get an array of groups containing questions with conditions outside the group
 // $groupdepsarray[dependent-gid][target-gid]['conditions'][qid-having-conditions]=Array(cids...)
 $groupdepsarray = GetGroupDepsForConditions($surveyid);
 $nicegroupdeps = array();
 if (!is_null($groupdepsarray)) {
     $ordergroups .= "<ul class='movableList'><li class='movableNode'><strong><font color='orange'>" . $clang->gT("Warning") . ":</font> " . $clang->gT("Current survey has questions with conditions outside their own group") . "</strong><br /><br /><i>" . $clang->gT("Re-ordering groups is restricted to ensure that questions on which conditions are based aren't reordered after questions having the conditions set") . "</i></strong><br /><br/>" . $clang->gT("The following groups are concerned") . ":<ul>\n";
     foreach ($groupdepsarray as $depgid => $depgrouprow) {
         foreach ($depgrouprow as $targgid => $targrow) {
             $ordergroups .= "<li>" . sprintf($clang->gT("Group %s depends on group %s, see the marked conditions on:"), "<a href='#' onclick=\"window.open('admin.php?sid=" . $surveyid . "&amp;gid=" . $depgid . "')\">" . $targrow['depgpname'] . "</a>", "<a href='#' onclick=\"window.open('admin.php?sid=" . $surveyid . "&amp;gid=" . $targgid . "')\">" . $targrow['targetgpname'] . "</a> ");
             $nicegroupdeps[$depgid] = $targgid;
             foreach ($targrow['conditions'] as $depqid => $depqrow) {
                 $listcid = implode("-", $depqrow);
                 $ordergroups .= " <a href='#' onclick=\"window.open('admin.php?sid=" . $surveyid . "&amp;gid=" . $depgid . "&amp;qid=" . $depqid . "&amp;action=conditions&amp;markcid=" . $listcid . "','_top')\"> [" . $clang->gT("QID") . ": " . $depqid . "]</a>";
             }
             $ordergroups .= "</li>\n";
         }
     }
     $ordergroups .= "</ul></li></ul>";