/** * Shows admin menu for question groups * @param int Survey id * @param int Group id */ function _questiongroupbar($iSurveyID, $gid, $qid = null, $action = null) { $clang = $this->getController()->lang; $baselang = Survey::model()->findByPk($iSurveyID)->language; Yii::app()->loadHelper('replacements'); // TODO: check that surveyid and thus baselang are always set here $sumresult4 = Questions::model()->findAllByAttributes(array('sid' => $iSurveyID, 'gid' => $gid, 'language' => $baselang)); $sumcount4 = count($sumresult4); $grpresult = Groups::model()->findAllByAttributes(array('gid' => $gid, 'language' => $baselang)); // Check if other questions/groups are dependent upon this group $condarray = getGroupDepsForConditions($iSurveyID, "all", $gid, "by-targgid"); $groupsummary = "<div class='menubar'>\n" . "<div class='menubar-title ui-widget-header'>\n"; //$sumquery1 = "SELECT * FROM ".db_table_name('surveys')." inner join ".db_table_name('surveys_languagesettings')." on (surveyls_survey_id=sid and surveyls_language=language) WHERE sid=$iSurveyID"; //Getting data for this survey $sumresult1 = Survey::model()->with(array('languagesettings' => array('condition' => 'surveyls_language=language')))->findByPk($iSurveyID); //$sumquery1, 1) ; //Checked // if surveyid is invalid then die to prevent errors at a later time $surveyinfo = $sumresult1->attributes; $surveyinfo = array_merge($surveyinfo, $sumresult1->languagesettings[0]->attributes); $surveyinfo = array_map('flattenText', $surveyinfo); //$surveyinfo = array_map('htmlspecialchars', $surveyinfo); $aData['activated'] = $activated = $surveyinfo['active']; foreach ($grpresult as $grow) { $grow = $grow->attributes; $grow = array_map('flattenText', $grow); $aData = array(); $aData['activated'] = $activated; $aData['qid'] = $qid; $aData['QidPrev'] = $QidPrev = getQidPrevious($iSurveyID, $gid, $qid); $aData['QidNext'] = $QidNext = getQidNext($iSurveyID, $gid, $qid); if ($action == 'editgroup' || $action == 'addquestion' || $action == 'viewquestion' || $action == "editdefaultvalues") { $gshowstyle = "style='display: none'"; } else { $gshowstyle = ""; } $aData['gshowstyle'] = $gshowstyle; $aData['surveyid'] = $iSurveyID; $aData['gid'] = $gid; $aData['grow'] = $grow; $aData['clang'] = $clang; $aData['condarray'] = $condarray; $aData['sumcount4'] = $sumcount4; $aData['iIconSize'] = Yii::app()->getConfig('adminthemeiconsize'); $aData['imageurl'] = Yii::app()->getConfig('adminimageurl'); $groupsummary .= $this->getController()->render('/admin/survey/QuestionGroups/questiongroupbar_view', $aData, true); } $groupsummary .= "\n</table>\n"; $finaldata['display'] = $groupsummary; $this->getController()->render('/survey_view', $finaldata); }
} // CHANGE QUESTION ORDER BUTTON if (bHasSurveyPermission($surveyid, 'surveycontent', 'update')) { $groupsummary .= "<img src='{$imageurl}/seperator.gif' alt='' />\n"; if ($activated != "Y" && getQuestionSum($surveyid, $gid) > 1) { // $groupsummary .= "<img src='$imageurl/blank.gif' alt='' width='40' />\n"; // $groupsummary .= "<img src='$imageurl/seperator.gif' alt='' />\n"; $groupsummary .= "<a href='{$scriptname}?action=orderquestions&sid={$surveyid}&gid={$gid}' title=\"" . $clang->gTview("Change Question Order") . "\" >" . "<img src='{$imageurl}/reorder.png' alt='" . $clang->gT("Change Question Order") . "' name='updatequestionorder' /></a>\n"; } else { $groupsummary .= "<img src='{$imageurl}/blank.gif' alt='' width='40' />\n"; } } $groupsummary .= "</div>\n" . "<div class='menubar-right'>\n" . "<span class=\"boxcaption\">" . $clang->gT("Questions") . ":</span><select class=\"listboxquestions\" name='qid' " . "onchange=\"window.open(this.options[this.selectedIndex].value, '_top')\">" . getQuestions($surveyid, $gid, $qid) . "</select>\n"; // QUICK NAVIGATION TO PREVIOUS AND NEXT QUESTION // TODO: Fix functionality to previos and next question buttons (Andrie) $QidPrev = getQidPrevious($surveyid, $gid, $qid); $groupsummary .= "<span class='arrow-wrapper'>"; if ($QidPrev != "") { $groupsummary .= "" . "<a href='{$scriptname}?sid={$surveyid}&gid={$gid}&qid={$QidPrev}'>" . "<img src='{$imageurl}/previous_20.png' title='' alt='" . $clang->gT("Previous question") . "' " . "name='questiongroupprevious'/></a>"; } else { $groupsummary .= "" . "<img src='{$imageurl}/previous_disabled_20.png' title='' alt='" . $clang->gT("No previous question") . "' " . "name='noquestionprevious' />"; } $QidNext = getQidNext($surveyid, $gid, $qid); if ($QidNext != "") { $groupsummary .= "" . "<a href='{$scriptname}?sid={$surveyid}&gid={$gid}&qid={$QidNext}'>" . "<img src='{$imageurl}/next_20.png' title='' alt='" . $clang->gT("Next question") . "' " . "name='questionnext' /> </a>"; } else { $groupsummary .= "" . "<img src='{$imageurl}/next_disabled_20.png' title='' alt='" . $clang->gT("No next question") . "' " . "name='noquestionnext' />"; } $groupsummary .= "</span>"; // ADD NEW QUESTION TO GROUP BUTTON if ($activated == "Y") {