function showSurvey($message = "") { $survey = new Survey($_SESSION['SUID']); $returnStr = $this->showTranslatorHeader(Language::messageSMSTitle()); $returnStr .= '<div id="wrap">'; $returnStr .= $this->showNavBar(); $returnStr .= '<div class="container">'; $returnStr .= '<ol class="breadcrumb">'; $returnStr .= '<li>' . setSessionParamsHref(array('page' => 'translator.surveys'), Language::headerSurveys()) . '</li>'; $returnStr .= '<li>' . $survey->getName() . '</li>'; if ($_SESSION['VRFILTERMODE_SURVEY'] == 0) { $returnStr .= '<li class="active">' . Language::headerSections() . '</li>'; } else { if ($_SESSION['VRFILTERMODE_SURVEY'] == 1) { $returnStr .= '<li class="active">' . Language::headerSettings() . '</li>'; } else { if ($_SESSION['VRFILTERMODE_SURVEY'] == 2) { $returnStr .= '<li class="active">' . Language::headerTypes() . '</li>'; } else { if ($_SESSION['VRFILTERMODE_SURVEY'] == 3) { $returnStr .= '<li class="active">' . Language::headerGroups() . '</li>'; } else { $returnStr .= '<li class="active">' . Language::headerSections() . '</li>'; } } } } $returnStr .= '</ol>'; $returnStr .= $this->getSurveyTopTab($_SESSION['VRFILTERMODE_SURVEY']); $returnStr .= '<div class="well" style="background-color:white;">'; $returnStr .= $message; $returnStr .= '<div class="row row-offcanvas row-offcanvas-right">'; $returnStr .= '<div id=sectiondiv class="col-xs-12 col-sm-9">'; if ($_SESSION['VRFILTERMODE_SURVEY'] == 0) { $survey = new Survey($_SESSION['SUID']); $sections = $survey->getSections(); $returnStr .= $this->showSections($sections); } else { if ($_SESSION['VRFILTERMODE_SURVEY'] == 1) { $returnStr .= $this->showSettingsList(); } else { if ($_SESSION['VRFILTERMODE_SURVEY'] == 2) { $survey = new Survey($_SESSION['SUID']); $types = $survey->getTypes(); $returnStr .= $this->showTypes($types); } else { if ($_SESSION['VRFILTERMODE_SURVEY'] == 3) { $survey = new Survey($_SESSION['SUID']); $groups = $survey->getGroups(); $returnStr .= $this->showGroups($groups); } else { $survey = new Survey($_SESSION['SUID']); $sections = $survey->getSections(); $returnStr .= $this->showSections($sections); } } } } $returnStr .= '</div>'; $returnStr .= $this->showSurveySideBar($survey, $_SESSION['VRFILTERMODE_SURVEY']); $returnStr .= '</div>'; $returnStr .= '</div></div></div>'; //container and wrap $returnStr .= $this->showBottomBar(); $returnStr .= $this->showFooter(false); return $returnStr; }
function show_form($page, $action, $qid, $type = 'new', $current = null) { $page->changeTpl('survey/edit_survey.tpl'); $page->assign('survey_action', $action); $page->assign('survey_qid', $qid); $page->assign('survey_formaction', './survey/edit'); $page->assign('survey_type', $type); if (!is_null($current) && is_array($current)) { $page->assign('survey_current', $current); } elseif ($type == 'new') { $page->addJsLink('ajax.js'); $page->assign('survey_types', Survey::getTypes()); } if ($type == 'root' || $type == 'newsurvey') { $page->assign('survey_modes', Survey::getModes()); } }
function showRemoveSurveyRes() { /* update last page */ $_SESSION['LASTPAGE'] = 'sysadmin.surveys'; $displaySysAdmin = new DisplaySysAdmin(); $suid = getFromSessionParams('suid'); if ($suid != '') { //remove $survey = new Survey($suid); /* remove sections */ $sections = $survey->getSections(); foreach ($sections as $section) { $section->remove(); /* remove variables */ $variables = $survey->getVariableDescriptives($section->getSeid()); foreach ($variables as $variable) { $variable->remove(); } } /* remove types */ $types = $survey->getTypes(); foreach ($types as $type) { $type->remove(); } /* remove types */ $groups = $survey->getGroups(); foreach ($groups as $group) { $group->remove(); } /* remove versions */ $versions = $survey->getVersions(); foreach ($versions as $version) { $version->remove(); } /* remove survey */ $survey->remove(); /* update users */ $users = new Users(); $users = $users->getUsers(); foreach ($users as $u) { $u->removeSurvey($suid); $u->saveChanges(); } /* return result */ return $displaySysAdmin->showSurveys($displaySysAdmin->displaySuccess(Language::messageSurveyRemoved($survey->getName()))); } else { return $displaySysAdmin->showSurveys(); } }
function showTypes() { $returnStr = ''; $survey = new Survey($_SESSION['SUID']); $types = $survey->getTypes(); $displaySysAdmin = new DisplaySysAdmin(); $returnStr .= $displaySysAdmin->showTypes($types); return $returnStr; }
function showAvailableTypes($current) { $survey = new Survey($_SESSION['SUID']); $types = $survey->getTypes(); if (sizeof($types) == 0) { return ""; } $returnStr = '<tr><td>' . Language::labelTypeEditGeneralVariableType() . '</td><td>'; $returnStr .= "<select id='typeselect' class='selectpicker show-tick' name=" . SETTING_TYPE . ">"; $selected = ""; if ($current == "" || $current == -1) { $selected = " SELECTED"; } $returnStr .= "<option {$selected} value=-1>" . Language::optionTypeNone() . "</option>"; foreach ($types as $type) { $selected = ""; if ($type->getTyd() == $current) { $selected = " SELECTED"; } $returnStr .= "<option {$selected} value=" . $type->getTyd() . ">" . $type->getName() . "</option>"; } $returnStr .= "</select>"; $returnStr .= '</td></tr>'; $returnStr .= '<script type="text/javascript"> $( document ).ready(function() { $("#typeselect").change(function() { if (this.value == -1) { $("#arraytypeoption").remove(); $("#keeptypeoption").remove(); $("#answertypeoption").remove(); } else { $("#arraydrop option:first").after($("<option />", { "value": "' . SETTING_FOLLOW_TYPE . '", text: "' . Language::optionsFollowType() . '", id: "arraytypeoption" })); $("#keepdrop option:first").after($("<option />", { "value": "' . SETTING_FOLLOW_TYPE . '", text: "' . Language::optionsFollowType() . '", id: "keeptypeoption" })); $("#answertype").prepend("<option value=\'' . SETTING_FOLLOW_TYPE . '\' id=\'answertypeoption\'>' . Language::optionsFollowType() . '</option>"); } $("#arraydrop").selectpicker("refresh"); $("#keepdrop").selectpicker("refresh"); $("#answertype").selectpicker("refresh"); }); }); </script>'; return $returnStr; }