function watch() { $returnStr = $this->showHeader(Language::messageSMSTitle()); $returnStr .= $this->displayComboBox(); $returnStr .= "<form method='post'>"; $params = getSessionParams(); //$params['reportpage'] = 'reportRes'; $returnStr .= setSessionParamsPost($params); $returnStr .= '<div id="wrap">'; $returnStr .= '<div class="container"><p>'; $returnStr .= '<div class="panel panel-default"> <div class="panel-heading">'; $returnStr .= '<h4>' . Language::linkWatch() . '</h4>'; $returnStr .= ' </div> <div class="panel-body">'; require_once 'data.php'; require_once 'display.php'; $data = new Data(); $values = $data->getRespondentData(getFromSessionParams('watchsuid'), getFromSessionParams('watchprimkey')); $returnStr .= '</div> <div role="panel" class="panel">'; if (sizeof($values) == 0) { $returnStr .= "<br/>" . '<div class="alert alert-warning">' . Language::labelWatchNoData() . '</div>'; } else { $returnStr .= $this->displayDataTablesScripts(array("colvis", "rowreorder")); $returnStr .= "<script type='text/javascript'>\n \$(document).ready(function(){\n \$('#issuetable').dataTable(\n {\n \"iDisplayLength\": 5,\n dom: 'C<\"clear\">lfrtip',\n searching: false,\n paging: true\n } \n );\n \n });</script>\n\n "; // $returnStr .= "<br/><table id='issuetable' class='table table-bordered table-striped'><thead>"; $returnStr .= "<th>" . Language::labelWatchVariable() . "</th><th>" . Language::labelWatchValue() . "</th><th>" . Language::labelWatchClean() . "</th><th>" . Language::labelWatchMode() . "</th><th>" . Language::labelWatchLanguage() . "</th><th>" . Language::labelWatchTime() . "</th></tr>"; $returnStr .= "</thead><tbody>"; $modes = Common::surveyModes(); $languages = Language::getLanguagesArray(); $sesid = session_id(); require_once 'object.php'; require_once 'component.php'; require_once 'setting.php'; require_once 'type.php'; require_once 'variabledescriptive.php'; $survey = new Survey(getFromSessionParams('watchsuid')); foreach ($values as $is) { $returnStr .= "<tr>"; $returnStr .= "<td>" . $is["variablename"] . "</td>"; $returnStr .= "<td>" . $this->getDisplayValue($survey->getVariableDescriptiveByName($is["variablename"]), $is["answer_dec"]) . "</td>"; $returnStr .= "<td>" . $this->displayDirty([$is["dirty"]]) . "</td>"; $returnStr .= "<td>" . $modes[$is["mode"]] . "</td>"; $returnStr .= "<td>" . $languages[str_replace("_", "", getSurveyLanguagePostFix($is["language"]))]['name'] . "</td>"; $returnStr .= "<td>" . $is["ts"] . "</td>"; $returnStr .= "</tr>"; } $returnStr .= "</tbody></table>"; } $returnStr .= '</div> </div> </div>'; $returnStr .= ' </div></div>'; $returnStr .= '</p></div> </div>'; //container and wrap $returnStr .= $this->showFooter(false); echo $returnStr; }
function getPage() { global $logActions; if (getFromSessionParams('page') != null) { $_SESSION['LASTPAGE'] = getFromSessionParams('page'); $logActions->addAction(getFromSessionParams('primkey'), $this->user->getUrid(), getFromSessionParams('page')); } if (isset($_SESSION['LASTPAGE'])) { switch ($_SESSION['LASTPAGE']) { case 'tester.tools.test': return $this->showTest(); break; case 'tester.tools.reported': return $this->showReported(); break; default: return $this->mainPage(); } } else { $logActions->addAction(getFromSessionParams('primkey'), $this->user->getUrid(), getFromSessionParams('tester.home')); return $this->mainPage(); } }
function getSurveyMainSection($suid, $primkey) { /* declare */ $seid = ""; global $currentmainseid; /* returning to survey or starting */ if (getFromSessionParams(SESSION_PARAM_RGID) == '') { /* check in session first (overrides last state) */ $seid = getFromSessionParams(SESSION_PARAM_MAINSEID); if (isSurveySection($seid)) { $currentmainseid = $seid; return $seid; } /* check for last state */ global $db; $result = $db->selectQuery('select mainseid from ' . Config::dbSurveyData() . '_states where suid=' . prepareDatabaseString($suid) . ' and primkey = "' . prepareDatabaseString($primkey) . '" order by stateid desc limit 0,1'); /* we are re-entering */ if ($db->getNumberOfRows($result) > 0) { $row = $db->getRow($result); $seid = $row["mainseid"]; if (isSurveySection($seid)) { $currentmainseid = $seid; return $seid; } } /* we are starting the survey and no session parameter, then assume root section */ $currentmainseid = getBaseSectionSeid($suid); return $currentmainseid; } else { /* button action */ if (isset($_POST['navigation'])) { /* back button */ if ($_POST['navigation'] == Language::buttonBack()) { /* check for last state to determine which section we are going to */ global $db; $result = $db->selectQuery('select mainseid from ' . Config::dbSurveyData() . '_states where suid=' . prepareDatabaseString($suid) . ' and primkey = "' . prepareDatabaseString($primkey) . '" order by stateid desc limit 0,1'); //echo 'select * from ' . Config::dbSurveyData() . '_states where suid=' . prepareDatabaseString($suid) . ' and primkey = "' . prepareDatabaseString($primkey) . '" order by stateid desc limit 0,1'; if ($db->getNumberOfRows($result) > 0) { $row = $db->getRow($result); $seid = $row["mainseid"]; if (isSurveySection($seid)) { $currentmainseid = $seid; return $seid; } } } else { if ($_POST['navigation'] == Language::buttonUpdate()) { /* section does not change, so return from session */ $seid = getFromSessionParams(SESSION_PARAM_MAINSEID); if (isSurveySection($seid)) { $currentmainseid = $seid; return $seid; } } else { /* section may change, but this is handled by the current section engine * calling the nex section engine, so we keep the same section */ $seid = getFromSessionParams(SESSION_PARAM_MAINSEID); if (isSurveySection($seid)) { $currentmainseid = $seid; return $seid; } } } } /* everything failed, then assume root section */ $currentmainseid = getBaseSectionSeid($suid); return $currentmainseid; } /* check last state */ $currentmainseid = getBaseSectionSeid($suid); return $currentmainseid; }
function showEditInlineRes() { $_SESSION['PARAMETER_RETRIEVAL'] = PARAMETER_ADMIN_RETRIEVAL; require_once 'compiler.php'; require_once 'track.php'; $target = loadvar("target"); if (startsWith($target, "vsid_")) { $this->showEditVariableRes(getFromSessionParams(SESSION_PARAM_SURVEY), str_ireplace("vsid_", "", $target)); } else { if (startsWith($target, "seid_")) { $this->showEditSectionRes(getFromSessionParams(SESSION_PARAM_SURVEY), str_ireplace("seid_", "", $target)); } } $_SESSION['PARAMETER_RETRIEVAL'] = PARAMETER_SURVEY_RETRIEVAL; }
function showOutputScreenDumpsRes() { $suid = loadvar("sv"); if ($suid == "") { $suid = getFromSessionParams("sv"); } $primkey = loadvar("respondent"); if ($primkey == "") { $primkey = getFromSessionParams("respondent"); } $type = loadvar("type"); // download $data = new Data(); if ($type == 2) { $dumps = $data->getScreendumps($suid, $primkey); header('Content-Type: application/html'); header("Content-Disposition: attachment; filename=\"screenshots_" . $primkey . ".html\""); foreach ($dumps as $d) { echo $d; } exit; } // fix looping through screenshots! $cnt = getFromSessionParams("cnt"); $headers[] = array('link' => setSessionParamsHref(array('page' => 'sysadmin.output'), Language::headerOutput()), 'label' => Language::headerOutputData()); $headers[] = array('link' => setSessionParamsHref(array('page' => 'sysadmin.output.data'), Language::headerOutputData()), 'label' => Language::headerOutputData()); $headers[] = array('link' => setSessionParamsHref(array('page' => 'sysadmin.output.screendumps'), Language::headerOutputScreenDumps()), 'label' => Language::headerOutputScreenDumps()); $headers[] = array('link' => '', 'label' => Language::headerOutputScreenDumpsFor($primkey)); $returnStr = $this->showOutputHeader($headers); $no = $data->getNumberOfScreenDumps($suid, $primkey); $screenshot = $data->getScreendump($suid, $primkey, $cnt); $strpos = strpos($screenshot, "<body>"); $screenshot = substr($screenshot, $strpos + strlen("<body>")); $strpos = strpos($screenshot, "</body>"); $screenshot = substr($screenshot, 0, $strpos); $returnStr .= '<span class="label label-default">' . Language::labelOutputScreenDumpsRespondentFor() . $primkey . '</span>'; $returnStr .= '<div class="well well-sm">'; $returnStr .= '<br/><br/><div id="carousel" class="carousel slide" data-interval="false" data-ride="carousel">'; $shield = '<div class="rightshield"></div>'; if ($cnt > 1) { $leftmargin = " margin-left: 140px; "; $shield = '<div class="leftshield"></div>'; } $returnStr .= '<!-- Wrapper for slides --> <div class="carousel-inner">'; $returnStr .= '<div class="item active">'; $returnStr .= '<div class="with-shield">' . $shield . '<div style="' . $leftmargin . ' max-width: 80%;">' . $screenshot . '</div></div> </div>'; $returnStr .= ' </div> <!-- Controls -->'; if ($cnt > 1) { $returnStr .= '<a class="left carousel-control" href="' . setSessionParams(array('page' => 'sysadmin.output.screendumpsres', 'sv' => $suid, "cnt" => $cnt - 1, "respondent" => $primkey)) . '" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> </a>'; } if ($cnt < $no) { $returnStr .= '<a class="right carousel-control" href="' . setSessionParams(array('page' => 'sysadmin.output.screendumpsres', 'sv' => $suid, "cnt" => $cnt + 1, "respondent" => $primkey)) . '" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> </a>'; } $returnStr .= '</div></div>'; $returnStr .= $this->showFooter(false); return $returnStr; }
public function showNavBar() { $search = true; $interviewersActive = ' class="active"'; $unassignedSampleActive = ''; $sampleActive = ''; $reportsActive = ''; if (getFromSessionParams('interviewer') != '') { $testUser = new User(getFromSessionParams('interviewer')); if ($testUser->getUserType() == USER_SUPERVISOR) { $interviewersActive = ''; $sampleActive = ' class="active"'; } } if (startsWith($_SESSION['LASTPAGE'], 'supervisor.sample')) { $interviewersActive = ''; $sampleActive = ' class="active"'; } if (startsWith($_SESSION['LASTPAGE'], 'supervisor.unassignedsample')) { $interviewersActive = ''; $unassignedSampleActive = ' class="active"'; } if (startsWith($_SESSION['LASTPAGE'], 'supervisor.reports')) { $interviewersActive = ''; $reportsActive = ' class="active"'; } //TODO: Get from somewhere else! $user = new User($_SESSION['URID']); $returnStr = ' <!-- Fixed navbar --> <div class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="' . setSessionParams(array('page' => 'supervisor.home')) . '">' . Language::messageSMSTitle() . '</a> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li' . $interviewersActive . '>' . setSessionParamsHref(array('page' => 'supervisor.interviewers'), Language::linkInterviewers()) . '</li> <li' . $sampleActive . '>' . setSessionParamsHref(array('page' => 'supervisor.sample'), Language::linkSample()) . '</li> <li' . $unassignedSampleActive . '>' . setSessionParamsHref(array('page' => 'supervisor.unassignedsample'), Language::linkUnassignedSample()) . '</li> <li' . $reportsActive . '>' . setSessionParamsHref(array('page' => 'supervisor.reports'), Language::linkReports()) . '</li> </ul> <ul class="nav navbar-nav navbar-right"> <li class="dropdown"> <a href="#" data-hover="dropdown" class="dropdown-toggle" data-toggle="dropdown">' . $user->getName() . ' <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="' . setSessionParams(array('page' => 'supervisor.preferences')) . '"><span class="glyphicon glyphicon-wrench"></span> ' . Language::linkPreferences() . '</a></li>'; if ($user->getCommunication() != SEND_RECEIVE_WORKONSERVER) { $returnStr .= '<li><a href="' . setSessionParams(array('page' => 'supervisor.sendreceive')) . '"><span class="glyphicon glyphicon-import"></span> ' . Language::linkSendReceive() . '</a></li>'; } $returnStr .= '<li class="divider"></li> <li><a href="index.php?rs=1&se=2"><span class="glyphicon glyphicon-log-out"></span> ' . Language::linkLogout() . '</a></li> </ul> </li> </ul> '; if ($search) { $returnStr .= ' <form class="navbar-form navbar-right" role="search"> <div class="input-group" style="width:250px;overflow:hidden;"> <input type="text" class="form-control" name="searchterm">'; $returnStr .= '<span class="input-group-btn"> <button class="btn btn-default" type="submit">Search</button> </span>'; $returnStr .= setSessionParamsPost(array('page' => 'supervisor.search')); $returnStr .= '</div>'; $returnStr .= '</form> '; } $returnStr .= ' </div><!--/.nav-collapse --> </div> </div> '; return $returnStr; }
function showRemoveUser() { $content = ''; $user = new User(getFromSessionParams('urid')); $displayUsers = new DisplayUsers(); if ($user->getUrid() != $_SESSION['URID']) { //don't delete yourself! $user->delete(); $content = $displayUsers->displaySuccess(Language::messageUserDeleted()); } else { $content = $displayUsers->displayWarning(Language::messageUserNotDeleted()); } $_SESSION['LASTPAGE'] = "sysadmin.users"; return $displayUsers->showUsers($content); }
function getPage() { global $logActions; if (getFromSessionParams('page') != null) { $_SESSION['LASTPAGE'] = getFromSessionParams('page'); $logActions->addAction(getFromSessionParams('primkey'), $this->user->getUrid(), getFromSessionParams('page')); } // echo '<br/><br/><br/>' . getFromSessionParams('page'); if (isset($_SESSION['LASTPAGE'])) { switch ($_SESSION['LASTPAGE']) { case 'interviewer.info': return $this->showIwerInfoFromCalendar(getFromSessionParams('primkey')); case 'interviewer.search': return $this->showSearchRes(); case 'interviewer.calendar': return $this->showCalendar(); case 'interviewer.othersurveys': return $this->showOtherSurveys(); case 'interviewer.respondent.history': return $this->showHistory(getFromSessionParams('primkey')); case 'interviewer.respondent.info': return $this->showInfo(getFromSessionParams('primkey')); case 'interviewer.backfromsms': return $this->showBackFromSMS(getFromSessionParams('primkey'), getFromSessionParams('suid')); case 'interviewer.surveycompleted': return $this->showSurveyCompleted(getFromSessionParams('primkey'), getFromSessionParams('suid')); case 'interviewer.respondent.info': return $this->showInfo(getFromSessionParams('primkey')); case 'interviewer.respondent.edit': return $this->showEdit(getFromSessionParams('primkey')); case 'interviewer.respondent.editres': return $this->showEditRes(getFromSessionParams('primkey')); case 'interviewer.respondent.tracking': return $this->showTracking(getFromSessionParams('primkey')); case 'interviewer.respondent.remarks': return $this->showRemarks(getFromSessionParams('primkey')); case 'interviewer.respondent.addremark': return $this->showAddRemark(getFromSessionParams('primkey')); case 'interviewer.respondent.contacts': return $this->showContacts(getFromSessionParams('primkey')); case 'interviewer.respondent.addcontact': return $this->showAddContact(getFromSessionParams('primkey')); case 'interviewer.respondent.addcontactres': return $this->showAddContactRes(getFromSessionParams('primkey')); case 'interviewer.respondent.startsurvey': return $this->showStartSurvey(getFromSessionParams('primkey')); case 'interviewer.proxycheck': return $this->showProxyCheck(getFromSessionParams('primkey')); case 'interviewer.preferences': return $this->showPreferences(); case 'interviewer.preferencesres': return $this->showPreferencesRes(); case 'interviewer.preferences.resettest': return $this->showResetTestCases(); case 'interviewer.sendreceive': return $this->showSendReceive(); case 'interviewer.sendreceive.upload': return $this->showSendReceiveUploadData(); case 'interviewer.sendreceive.receive': return $this->showSendReceiveReceiveData(); case 'interviewer.household.info': return $this->showInfo(getFromSessionParams('primkey'), '', 2); case 'interviewer.household.startsurvey': return $this->showStartSurvey(getFromSessionParams('primkey'), 2); case 'interviewer.household.edit': return $this->showEdit(getFromSessionParams('primkey'), 2); case 'interviewer.household.editres': return $this->showEditRes(getFromSessionParams('primkey'), 2); case 'interviewer.household.remarks': return $this->showRemarks(getFromSessionParams('primkey'), 2); case 'interviewer.household.addremark': return $this->showAddRemark(getFromSessionParams('primkey'), 2); case 'interviewer.household.history': return $this->showHistory(getFromSessionParams('primkey'), 2); case 'interviewer.household.contacts': return $this->showContacts(getFromSessionParams('primkey'), 2); case 'interviewer.household.addcontact': return $this->showAddContact(getFromSessionParams('primkey'), '', 2); case 'interviewer.household.addcontactres': return $this->showAddContactRes(getFromSessionParams('primkey'), 2); case 'interviewer.supervisor.login': return $this->showSupervisorLogin(); case 'interviewer.supervisor.login.res': return $this->showSupervisorLoginRes(); case 'interviewer.supervisor.logout': return $this->showSupervisorLogout(); default: return $this->mainPage(); } } else { $logActions->addAction(getFromSessionParams('primkey'), $this->user->getUrid(), getFromSessionParams('interviewer.home')); return $this->mainPage(); } }
function showReportsContactGraphs() { $displayResearcher = new DisplayResearcher(); return $displayResearcher->showReportsContactGraphs(getFromSessionParams('seid')); }
function showRouting($seid) { $returnStr .= '<form id="hiddenform" name="hiddenform" method="post">'; $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.survey.clickrouting')); $returnStr .= "<input type=hidden name=action id=action />"; $returnStr .= '</form>'; $returnStr .= '<form id="editform" method="post">'; $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.survey.editrouting')); $survey = new Survey($_SESSION['SUID']); $_SESSION["SEID"] = $seid; $section = $survey->getSection($seid); $returnStr .= '<textarea style="width: 100%; height: 350px;" id="routing" name="routing">'; $returnStr .= $section->getRouting(); $returnStr .= '</textarea>'; $returnStr .= '<input type="submit" class="btn btn-default" value="Save"/>'; $returnStr .= '<span class="pull-right">'; $returnStr .= '<button class="btn btn-default" data-toggle="modal" data-target="#listModal">' . Language::labelVariables() . '</button>'; $track = new Track($_SESSION['SUID'], $seid, OBJECT_SECTION); $history = $track->getEntries(SETTING_ROUTING); if (sizeof($history) > 0) { $returnStr .= '<div class="btn-group"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> ' . Language::labelHistory() . ' <span class="caret"></span> </button> <ul class="dropdown-menu">'; foreach ($history as $h) { $us = new User($h["urid"]); $returnStr .= '<li><a href="#" data-toggle="modal" data-target="#historyModal" data-trackid="' . $h["trid"] . '">' . $h["ts"] . ' (' . $us->getUsername() . ')</a></li>'; } $returnStr .= '</ul> </div>'; } $returnStr .= '<button class="btn btn-default" data-toggle="modal" data-target="#compiledModal">' . Language::labelCompiledCode() . '</button>'; $returnStr .= '</span>'; $returnStr .= '</form>'; $user = new User($_SESSION['URID']); if ($user->hasRoutingAutoIndentation()) { $returnStr .= $this->getCodeMirror("height: 400px;"); $line = getFromSessionParams('routingline'); $extra = ''; if ($line > 0) { // coming in from search result $extra .= "jumpToLine(" . $line . ");"; } $returnStr .= '<link rel="stylesheet" href="js/codemirror/addon/hint/show-hint.css"/> <script src="js/codemirror/addon/hint/show-hint.js"></script> <script src="js/codemirror/addon/hint/nubis-hint.js"></script>'; $returnStr .= '<script type="text/javascript"> CodeMirror.commands.autocomplete = function(cm) { cm.showHint({hint: CodeMirror.hint.nubis}); } function jumpToLine(i) { var editor = $("#routing").data("CodeMirrorInstance"); // editor.getLineHandle does not help as it does not return the reference of line. editor.setCursor(i); window.setTimeout(function() { editor.setLineClass(i, null, "center-me"); var line = $(".CodeMirror-lines .center-me"); var h = line.parent(); $(".CodeMirror-scroll").scrollTop(0).scrollTop(line.offset().top - $(".CodeMirror-scroll").offset().top - Math.round($(".CodeMirror-scroll").height()/2)); }, 200); } $(document).ready(function() { function words(str) { var obj = [], words = str.split(" "); for (var i = 0; i < words.length; ++i) { obj[i] = words[i]; } return obj; } var keywords = words("cardinal card group subgroup endgroup endsubgroup empty nonresponse dk rf do enddo endif for and array if then elseif else in mod not or to inline inspect fill"); var mirrorchanged = false; var editor = CodeMirror.fromTextArea(document.getElementById("routing"), {mode: "text/x-nubis", lineNumbers: true, extraKeys: {"Ctrl-Space": "autocomplete"}}); $("#routing").data("CodeMirrorInstance", editor); editor.on("dblclick", function(cm, event) { if (event.ctrlKey) { if (mirrorchanged == false) { $("#editform").dirtyForms("setClean"); } var sel = cm.getSelection().toLowerCase(); if ($.inArray(sel, keywords) == -1) { $("#action").val(sel); $("#hiddenform").submit(); } } }); editor.on("change", function(from, to, text, removed, origin) { $("#routing").dirtyForms("setDirty"); mirrorchanged = true; }); function format() { var totalLines = editor.lineCount(); editor.autoFormatRange({line:0, ch:0}, {line:totalLines}); } var historyeditor = CodeMirror.fromTextArea(document.getElementById("historycontent"), {mode: "text/x-nubis", lineNumbers: true}); $("#historyModal").on("show.bs.modal", function (event) { event.stopImmediatePropagation(); var element = $(event.relatedTarget); // element that triggered the modal var recipient = element.data("trackid"); // Extract info from data-* attributes $.get("index.php?' . POST_PARAM_SMS_AJAX . '=' . SMS_AJAX_CALL . '&p=sysadmin.history.getentry&trid=" + recipient, null, function (data) { historyeditor.setValue(data.trim()); }, "text"); }); // jump to line ' . $extra . ' }); </script>'; } $returnStr .= '<div class="modal fade" id="compiledModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">' . Language::labelRoutingCompiledCode() . '\'' . $section->getName() . '\'</h4> </div> <div class="modal-body"> <div class="form-group"> <textarea style="width: 100%; height: 100%;" rows=30 class="form-control">' . $section->getCompiledCode() . '</textarea> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> '; // history modal if (sizeof($history) > 0) { $returnStr .= '<div class="modal fade" id="historyModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">' . Language::labelRoutingHistory() . $section->getName() . '</h4> </div> <div class="modal-body"> <div class="form-group"> <textarea id=historycontent style="width: 100%; height: 100%;"></textarea> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->'; } $returnStr .= '<div class="modal fade" id="listModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">Variables in \'' . $section->getName() . '\'</h4> </div> <div class="modal-body"> <div class="form-group"> <textarea style="width: 100%; height: 400px;" rows=30 class="form-control">'; $vars = $survey->getVariableDescriptives($section->getSeid()); foreach ($vars as $v) { $returnStr .= $v->getName() . "\r\n"; } $returnStr .= '</textarea> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> '; return $returnStr; }
function getPage() { global $logActions; if (getFromSessionParams('page') != null) { $_SESSION['LASTPAGE'] = getFromSessionParams('page'); } //echo '<br/><br/><br/>' . getFromSessionParams('page'); if (isVisionTestNurse(new User($_SESSION['URID']))) { return $this->mainPage(); //vision test: only return main page } $logActions->addAction(getFromSessionParams('primkey'), $this->user->getUrid(), getFromSessionParams('page')); if (startsWith(getFromSessionParams('page'), 'interviewer.sendreceive')) { $interviewer = new Interviewer($this->user); return $interviewer->getPage(); } else { if (isset($_SESSION['LASTPAGE'])) { switch ($_SESSION['LASTPAGE']) { case 'nurse.respondents.search': return $this->showSearchRes(); break; case 'nurse.interviewer.respondent.info': return $this->showRespondentInfo(getFromSessionParams('primkey')); break; case 'nurse.respondent.info': return $this->showRespondentInfo(getFromSessionParams('primkey')); break; case 'nurse.respondent.consent': return $this->showRespondentConsent(getFromSessionParams('primkey')); break; case 'nurse.respondent.consent.res': return $this->showRespondentConsentRes(getFromSessionParams('primkey')); break; case 'nurse.respondent.labbarcode': return $this->showRespondentLabBarcode(getFromSessionParams('primkey')); break; case 'nurse.respondent.labbarcode.res': return $this->showRespondentLabBarcodeRes(getFromSessionParams('primkey')); break; case 'nurse.respondent.barcode': return $this->showRespondentBarcode(getFromSessionParams('primkey')); break; case 'nurse.respondent.barcode.res': return $this->showRespondentBarcodeRes(getFromSessionParams('primkey')); break; case 'nurse.respondent.picture': return $this->showRespondentTakePicture(getFromSessionParams('primkey')); break; case 'nurse.respondent.smallbarcodes.print': return $this->showRespondentLabSmallBarcodes(getFromSessionParams('primkey')); break; case 'nurse.respondent.trackingsheet.print': return $this->showRespondentPrintTrackingSheet(getFromSessionParams('primkey')); break; case 'nurse.respondent.labbarcode.print': return $this->showRespondentReprintLabBarcode(getFromSessionParams('primkey')); break; case 'nurse.respondent.uploadfiles': return $this->showRespondentUploadFiles(getFromSessionParams('primkey')); break; case 'nurse.respondent.download': return $this->showRespondentDownloadFile(getFromSessionParams('id')); break; case 'nurse.respondent.fielddbs.received': return $this->showRespondentFieldDBSReceived(getFromSessionParams('primkey')); break; case 'nurse.respondent.fielddbs.received.fromlab': return $this->showRespondentFieldDBSReceivedFromLab(getFromSessionParams('primkey')); break; case 'nurse.respondent.blood.received.fromlab': return $this->showRespondentBloodReceivedFromLab(getFromSessionParams('primkey')); break; case 'nurse.fielddbs.shiptolab': return $this->showRespondentFieldDBSShipToLab(); break; case 'nurse.fielddbs.shiptolab.marked': return $this->showRespondentFieldDBSShipToLabMark(); break; case 'nurse.backfromsms': return $this->showRespondentBackFromSms(getFromSessionParams('primkey'), getFromSessionParams('suid')); break; case 'nurse.surveycompleted': return $this->showSurveyCompleted(getFromSessionParams('primkey'), getFromSessionParams('suid')); break; case 'nurse.respondent.blood.storage': return $this->showRespondentBloodStorage(getFromSessionParams('primkey')); break; case 'nurse.respondent.blood.storage.res': return $this->showRespondentBloodStorageRes(getFromSessionParams('primkey')); break; case 'nurse.respondent.dbs.storage': return $this->showRespondentDBSStorage(getFromSessionParams('primkey')); break; case 'nurse.respondent.dbs.storage.res': return $this->showRespondentDBSStorageRes(getFromSessionParams('primkey')); break; case 'nurse.respondent.requestform': return $this->showRespondentLabRequest(getFromSessionParams('primkey')); break; case 'nurse.respondent.requestform.res': return $this->showRespondentLabRequestRes(getFromSessionParams('primkey')); break; case 'nurse.labblood.overview': return $this->showLabBloodOverview(); break; case 'nurse.labblood.overview.res': return $this->showLabBloodOverviewRes(); break; case 'nurse.labdbs.overview': return $this->showLabDbsOverview(); break; case 'nurse.labdbs.overview.res': return $this->showLabDbsOverviewRes(); break; case 'nurse.respondent.fielddbsoverview.edit': return $this->ShowFieldDBSChangeDates(getFromSessionParams('primkey')); break; case 'nurse.respondent.labblood.tolab': return $this->ShowRespondentBloodSendToLab(getFromSessionParams('primkey')); break; case 'nurse.respondent.cd4results': return $this->ShowRespondentCD4(getFromSessionParams('primkey')); break; case 'nurse.respondent.cd4results.res': return $this->ShowRespondentCD4Res(getFromSessionParams('primkey')); break; case 'nurse.respondent.assigntofieldnurse': return $this->ShowRespondentFieldNurseAssign(getFromSessionParams('primkey')); break; case 'nurse.respondent.assigntofieldnurse.res': return $this->ShowRespondentFieldNurseAssignRes(getFromSessionParams('primkey')); break; case 'nurse.respondent.fieldnurse.info': return $this->ShowRespondentFieldNurseInfo(getFromSessionParams('primkey')); break; case 'nurse.sendreceive.upload': return $this->showSendReceiveUploadData(); break; case 'nurse.followup': return $this->showFollowup(); break; case 'nurse.followup.info': return $this->ShowFollowupInfo(getFromSessionParams('primkey')); break; default: return $this->mainPage(); } } else { $logActions->addAction(getFromSessionParams('primkey'), $this->user->getUrid(), getFromSessionParams('nurse.home')); return $this->mainPage(); } } }
public function showNavBar() { if (loadvar(POST_PARAM_AJAX_LOAD) == AJAX_LOAD) { return; } $householdsActive = ''; $reportsActive = ''; $dataActive = ''; $documentationActive = ''; $sampleActive = ''; if (startsWith(getFromSessionParams('page'), 'researcher.reports')) { $reportsActive = ' class="active"'; } if (startsWith(getFromSessionParams('page'), 'researcher.documentation')) { $documentationActive = ' class="active"'; } if (startsWith(getFromSessionParams('page'), 'researcher.data')) { $dataActive = ' class="active"'; } if (startsWith(getFromSessionParams('page'), 'researcher.sample')) { $sampleActive = ' class="active"'; } if (startsWith(getFromSessionParams('page'), 'researcher.households')) { $householdsActive = ' class="active"'; } $returnStr = ' <!-- Fixed navbar --> <div id="mainnavbar" class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="' . setSessionParams(array('page' => 'researcher.home')) . '">' . Language::messageSMSTitle() . '</a> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav">'; $returnStr .= '<li' . $reportsActive . '>' . setSessionParamsHref(array('page' => 'researcher.reports'), Language::linkReports()) . '</li>'; $returnStr .= '<li' . $dataActive . '>' . setSessionParamsHref(array('page' => 'researcher.data'), Language::linkData()) . '</li>'; $returnStr .= '<li' . $documentationActive . '>' . setSessionParamsHref(array('page' => 'researcher.output.documentation'), Language::linkDocumentation()) . '</li>'; // $returnStr .= '<li' . $sampleActive . '>' . setSessionParamsHref(array('page' => 'researcher.sample'), Language::linkUnassigned()) . '</li>'; $returnStr .= '</ul>'; $user = new User($_SESSION['URID']); $returnStr .= '<ul class="nav navbar-nav navbar-right"> <li class="dropdown"> <a data-hover="dropdown" class="dropdown-toggle" data-toggle="dropdown">' . $user->getUsername() . ' <b class="caret"></b></a> <ul class="dropdown-menu">'; // commenting out preferences option <li><a href="' . setSessionParams(array('page' => 'sysadmin.preferences')) . '"><span class="glyphicon glyphicon-wrench"></span> ' . Language::linkPreferences() . '</a></li>'; //$returnStr .= '<li class="divider"></li>'; $returnStr .= '<li><a ' . POST_PARAM_NOAJAX . '=' . NOAJAX . ' href="index.php?rs=1&se=2"><span class="glyphicon glyphicon-log-out"></span> ' . Language::linkLogout() . '</a></li> </ul> </li> </ul> '; // $returnStr .= $this->showSearch(); $returnStr .= ' </div><!--/.nav-collapse --> </div> </div> '; $returnStr .= "<div id='content'>"; return $returnStr; }
function getPage() { global $logActions; // echo '<br/><br/><br/>-----' . getFromSessionParams('page') . ";;" . getFromSessionParams('primkey'); if (getFromSessionParams('page') != null) { $logActions->addAction(getFromSessionParams('primkey'), $this->user->getUrid(), getFromSessionParams('page')); switch (getFromSessionParams('page')) { case 'catiinterviewer.answer': return $this->showPhoneAnswer(getFromSessionParams('primkey')); break; case 'catiinterviewer.startsurvey': return $this->showCatiStartSurvey(getFromSessionParams('primkey')); break; case 'catiinterviewer.noanswer.answeringmachine': return $this->showAnsweringMachine(getFromSessionParams('primkey')); break; case 'catiinterviewer.noanswer.answeringmachine.res': return $this->showAnsweringMachineRes(getFromSessionParams('primkey')); break; case 'catiinterviewer.noanswer.maxnumberrings': return $this->showMaxRings(getFromSessionParams('primkey')); break; case 'catiinterviewer.noanswer.disconnected': return $this->showDisconnected(getFromSessionParams('primkey')); break; case 'catiinterviewer.refusal': return $this->showRefusal(getFromSessionParams('primkey')); break; case 'catiinterviewer.barriers': return $this->showBarriers(getFromSessionParams('primkey')); break; case 'catiinterviewer.schedule': return $this->showSchedule(getFromSessionParams('primkey')); break; case 'catiinterviewer.schedule.res': return $this->showScheduleRes(getFromSessionParams('primkey')); break; case 'catiinterviewer.disconnect': return $this->showDisconnectDuringSurvey(getFromSessionParams('primkey')); break; case 'interviewer.calendar': return $this->showCalendar(); break; case 'interviewer.othersurveys': return $this->showOtherSurveys(); break; case 'interviewer.history': return $this->showHistory(getFromSessionParams('primkey')); break; case 'interviewer.contacts': return $this->showContacts(getFromSessionParams('primkey')); break; case 'interviewer.info': return $this->showInfo(getFromSessionParams('primkey')); break; case 'catiinterviewer.backfromsms': return $this->showBackFromSMS(getFromSessionParams('primkey')); break; case 'interviewer.backfromsms': return $this->showBackFromSMS(getFromSessionParams('primkey')); break; case 'interviewer.surveycompleted': return $this->showSurveyCompleted(getFromSessionParams('primkey')); break; case 'interviewer.info': return $this->showInfo(getFromSessionParams('primkey')); break; case 'interviewer.edit': return $this->showEdit(getFromSessionParams('primkey')); break; case 'interviewer.editres': return $this->showEditRes(getFromSessionParams('primkey')); break; case 'interviewer.tracking': return $this->showTracking(getFromSessionParams('primkey')); break; case 'interviewer.remarks': return $this->showRemarks(getFromSessionParams('primkey')); break; case 'interviewer.addremark': return $this->showAddRemark(getFromSessionParams('primkey')); break; case 'interviewer.addcontact': return $this->showAddContact(getFromSessionParams('primkey')); break; case 'interviewer.addcontactres': return $this->showAddContactRes(getFromSessionParams('primkey')); break; case 'interviewer.startsurvey': return $this->showStartSurvey(getFromSessionParams('primkey')); break; case 'interviewer.preferences': return $this->showPreferences(); break; case 'interviewer.preferencesres': return $this->showPreferencesRes(); break; case 'interviewer.preferences.resettest': return $this->showResetTestCases(); break; case 'interviewer.sendreceive': return $this->showSendReceive(); break; default: return $this->mainPage(); } } else { $logActions->addAction(getFromSessionParams('primkey'), $this->user->getUrid(), getFromSessionParams('interviewer.home')); return $this->mainPage(); } }
function updateRes() { global $survey, $engine; $engine = $this->engine; $survey = new Survey(getFromSessionParams('watchsuid')); $var = $survey->getVariableDescriptiveByName($is["variablename"]); $cnt = loadvar("cnt"); //echo $cnt; //echo '----' . loadvar("updatevariable" . $cnt) . '----' . loadvar("answer" . $cnt); //echo $this->engine->getDirty(loadvar("updatevariable" . $cnt)); $r = $this->engine->getAnswer(loadvar("updatevariable" . $cnt)); //echo '-----' . $r; //echo loadvar("answer" . $cnt) . '-----'; $this->engine->setAnswer(loadvar("updatevariable" . $cnt), loadvar("answer" . $cnt), $this->engine->getDirty(loadvar("updatevariable" . $cnt))); $this->update(); }
function jumpRes() { global $db; $suid = getFromSessionParams('jumpsuid'); $prim = getFromSessionParams('jumpprimkey'); $jumpto = loadvar("jumpto"); //echo $suid . '----' . $prim . '----' . $jumpto; $query = "delete from " . Config::dbSurveyData() . "_states where suid=" . $suid . " and primkey='" . $prim . "' and stateid > " . $jumpto; $db->executeQuery($query); $returnStr = "<html><head></head><body>"; $returnStr .= "<script type='text/javascript'>\n window.opener.location.reload();\n window.close();\n</script>"; $returnStr .= '</body></html'; //container and wrap echo $returnStr; }
function reportRes() { global $db; $query = "insert into " . Config::dbSurvey() . "_issues (urid,suid,primkey,mainseid,seid,rgid,displayed,category,comment,status,language,mode,version) values ("; $query .= getFromSessionParams('reporturid') . ","; $query .= getFromSessionParams('reportsuid') . ","; $query .= "'" . getFromSessionParams('reportprimkey') . "',"; $query .= "'" . getFromSessionParams('reportmainseid') . "',"; $query .= "'" . getFromSessionParams('reportseid') . "',"; $query .= "'" . getFromSessionParams('reportrgid') . "',"; $query .= "'" . getFromSessionParams('reportdisplayed') . "',"; $query .= "'" . loadvar('reportcategory') . "',"; $query .= "'" . loadvar('reportcomment') . "',"; $query .= ISSUE_REPORTED . ", "; $query .= "'" . getFromSessionParams('reportlanguage') . "',"; $query .= "'" . getFromSessionParams('reportmode') . "',"; $query .= "'" . getFromSessionParams('reportversion') . "'"; $query .= ")"; //echo $query; $db->executeQuery($query); $returnStr = $this->showHeader(Language::messageSMSTitle()); $returnStr .= '<div id="wrap">'; $returnStr .= '<div class="container"><p>'; $returnStr .= $this->reportSub('<div class="alert alert-success">' . Language::reportProblemConfirmation() . '</div>'); //'<button onclick="window.close();" type="cancel" class="btn btn-default" style="min-width:100px">' . Language::buttonClose() . '</button>'; $returnStr .= ' </div></div>'; $returnStr .= '</p></div> </div>'; //container and wrap $returnStr .= $this->showFooter(); echo $returnStr; }
function showInterviewerAssignedSample() { $displaySupervisor = new DisplaySupervisor(); return $displaySupervisor->displayInterviewerAssignedSample(new User(getFromSessionParams('interviewer'))); }
case "report": $reportissue = new ReportIssue(); $reportissue->report(); break; case "reportRes": $reportissue = new ReportIssue(); $reportissue->reportRes(); break; case "jumpback": $jumper = new JumpBack(); $jumper->jump(); break; case "jumpbackRes": $jumper = new JumpBack(); $jumper->jumpRes(); break; case "update": $update = new Updater(); $update->update(); break; case "updateRes": $update = new Updater(); $update->updateRes(); break; default: //$reportissue->report(); break; } if (getFromSessionParams('type') != "2") { $_SESSION[SURVEY_EXECUTION_MODE] = SURVEY_EXECUTION_MODE_NORMAL; }
function addTimings($lastrgid, $laststateid) { if (Config::logSurveyTimings() == false) { return; } $localdb = null; if (Config::useTransactions() == true) { global $transdb; $localdb = $transdb; } else { global $db; $localdb = $db; } $vars = splitString("/~/", getFromSessionParams(SESSION_PARAM_VARIABLES)); $begin = date("Y-m-d H:i:s", getFromSessionParams(SESSION_PARAM_TIMESTAMP)); $end = time(); $lang = getSurveyLanguage(); $mode = getSurveyMode(); $version = getSurveyVersion(); $time = time(); foreach ($vars as $var) { $var = $this->prefixVariableName($var); $query = "insert into " . Config::dbSurveyData() . '_times (suid, primkey, stateid, rgid, variable, begintime, endtime, timespent, language, mode, version) values ('; $query .= prepareDatabaseString($this->getSuid()) . ","; $query .= "'" . prepareDatabaseString($this->primkey) . "',"; $query .= "'" . prepareDatabaseString($laststateid) . "',"; $query .= "'" . prepareDatabaseString($lastrgid) . "',"; $query .= "'" . prepareDatabaseString($var) . "',"; $query .= "'" . prepareDatabaseString($begin) . "',"; $query .= "'" . date("Y-m-d H:i:s", $end) . "',"; $query .= $time - getFromSessionParams(SESSION_PARAM_TIMESTAMP) . ","; $query .= prepareDatabaseString($lang) . ","; $query .= prepareDatabaseString($mode) . ","; $query .= prepareDatabaseString($version) . ")"; //echo$query . "<br/>"; $localdb->executeQuery($query); } }
function showTranslateGroupAssistanceRes() { $displayTranslator = new DisplayTranslator(); $survey = new Survey($_SESSION['SUID']); $gid = getFromSessionParams('gid'); $group = $survey->getGroup($gid); $_SESSION['GID'] = $gid; $group->setEmptyMessage(loadvarAllowHTML(SETTING_EMPTY_MESSAGE)); $group->setErrorMessageExactRequired(loadvarAllowHTML(SETTING_ERROR_MESSAGE_EXACT_REQUIRED)); $group->setErrorMessageMinimumRequired(loadvarAllowHTML(SETTING_ERROR_MESSAGE_MINIMUM_REQUIRED)); $group->setErrorMessageMaximumRequired(loadvarAllowHTML(SETTING_ERROR_MESSAGE_MAXIMUM_REQUIRED)); $group->setErrorMessageExclusive(loadvarAllowHTML(SETTING_ERROR_MESSAGE_EXCLUSIVE)); $group->setErrorMessageInclusive(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INCLUSIVE)); $group->SetErrorMessageUniqueRequired(loadvarAllowHTML(SETTING_ERROR_MESSAGE_UNIQUE_REQUIRED)); $content = $displayTranslator->displaySuccess(Language::messageGroupChanged($group->getName())); $group->save(); /* compile */ $compiler = new Compiler($_SESSION['SUID'], getSurveyVersion($survey)); $mess = $compiler->generateGroups(array($group)); $mess = $compiler->generateGetFillsGroups(array($group)); /* update last page */ $_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res")); /* return result */ return $displayTranslator->showTranslateGroup($_SESSION['GID'], $content); }