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 isSurveyMode($l) { if (trim($l) == "" || !is_numeric($l)) { return false; } /* forego checks below */ if (Config::checkComponents() == false) { return true; } global $mode; if ($l == $mode) { return true; } // check in modes return inArray($l, array_keys(Common::surveyModes())); }
public function showNavBar() { $returnStr = $this->getHeader(); //language $rgid = $this->engine->getRgid(); $variablenames = $this->getRealVariables(explode("~", $this->engine->getDisplayed())); $variablenamesfull = $this->engine->getDisplayed(); $template = $this->engine->getTemplate(); $click = ""; if ($template != "") { $group = $this->engine->getGroup($template); $click = $this->engine->replaceFills($group->getClickLanguageChange()); } else { $vars = explode("~", $variablenames); $var = $this->engine->getVariableDescriptive($vars[0]); $click = $this->engine->replaceFills($var->getClickLanguageChange()); } $click = str_replace("'", "", $click); $clickmode = ""; if ($template != "") { $group = $this->engine->getGroup($template); $clickmode = $this->engine->replaceFills($group->getClickModeChange()); } else { $vars = explode("~", $variablenames); $var = $this->engine->getVariableDescriptive($vars[0]); $clickmode = $this->engine->replaceFills($var->getClickModeChange()); } $clickmode = str_replace("'", "", $clickmode); // begin language global $survey; $user = new User($_SESSION['URID']); $allowedmodes = $user->getModes(); $allowedlanguages = explode("~", $user->getLanguages(getSurvey(), getSurveyMode())); $default = $survey->getDefaultLanguage(); $ut = "sysadmin"; if ($user->getUserType() == USER_TRANSLATOR) { $ut = "translator"; if (!inArray($default, $allowedlanguages)) { $allowedlanguages[] = $default; } } else { if ($user->GetUserType() == USER_TESTER) { $ut = "tester"; } } if (getSurveyModeAllowChange() == MODE_CHANGE_RESPONDENT_ALLOWED) { //$allowed = explode("~", $survey->getAllowedModes()); if (sizeof($allowedmodes) > 1) { $template = $this->engine->getTemplate(); $returnStr .= '<li class="dropdown">'; $returnStr .= ' <a href="#" class="dropdown-toggle" data-toggle="dropdown">Mode <b class="caret"></b></a>'; $returnStr .= '<ul class="dropdown-menu" role="menu">'; $current = getSurveyMode(); $modes = Common::surveyModes(); foreach ($modes as $key => $mode) { if (inArray($key, $allowedmodes)) { $check = ''; if ($key == $current) { $check = ' <span class="glyphicon glyphicon-ok"></span>'; } //$returnStr .= '<li><a href=# onclick=\'document.getElementById("r").value="' . setSessionsParamString(array_merge(array(SESSION_PARAM_LASTACTION => $this->engine->getLastSurveyAction(), SESSION_PARAM_SURVEY => $survey->getSuid(), SESSION_PARAM_PRIMKEY => $this->primkey, SESSION_PARAM_RGID => $rgid, SESSION_PARAM_VARIABLES => $variablenames, SESSION_PARAM_GROUP => $template, SESSION_PARAM_MODE => $current, SESSION_PARAM_VERSION => getSurveyVersion(), SESSION_PARAM_LANGUAGE => getSurveyLanguage(), SESSION_PARAM_TIMESTAMP => time(), SESSION_PARAM_SEID => $this->engine->getSeid(), SESSION_PARAM_MAINSEID => $this->engine->getMainSeid()), array(SESSION_PARAM_NEWMODE => $key))) . '"; document.getElementById("navigation").value="' . NAVIGATION_MODE_CHANGE . '"; $("#form").submit(); \'>' . $mode . $check . '</a></li>'; $returnStr .= '<li><a href=# onclick=\'document.getElementById("r").value="' . setSessionsParamString(array_merge(array(SESSION_PARAM_SURVEY => $survey->getSuid(), SESSION_PARAM_PRIMKEY => $this->engine->getPrimaryKey(), SESSION_PARAM_RGID => $rgid, SESSION_PARAM_VARIABLES => $variablenames, SESSION_PARAM_GROUP => $template, SESSION_PARAM_MODE => getSurveyMode(), SESSION_PARAM_LANGUAGE => getSurveyLanguage(), SESSION_PARAM_TEMPLATE => getSurveyTemplate(), SESSION_PARAM_TIMESTAMP => time(), SESSION_PARAM_SEID => $this->engine->getSeid(), SESSION_PARAM_MAINSEID => $this->engine->getMainSeid()), array(SESSION_PARAM_NEWMODE => $key))) . '"; document.getElementById("navigation").value="' . addslashes(Language::buttonUpdate()) . '"; ' . $clickmode . ' document.getElementById("form").submit(); \'>' . $mode . $check . '</a></li>'; } } $returnStr .= '</ul></li>'; } } if (getSurveyLanguageAllowChange() == LANGUAGE_CHANGE_RESPONDENT_ALLOWED) { //$allowed = explode("~", $survey->getAllowedLanguages(getSurveyMode())); if (sizeof($allowedlanguages) > 1) { $returnStr .= '<li class="dropdown">'; $returnStr .= ' <a href="#" class="dropdown-toggle" data-toggle="dropdown">Language <b class="caret"></b></a><ul class="dropdown-menu">'; $langs = Language::getLanguagesArray(); //getSurveyLanguages($this->engine->survey); foreach ($langs as $lang) { if (inArray($lang["value"], $allowedlanguages)) { $check = ''; if ($lang["value"] == getSurveyLanguage()) { $check = ' <span class="glyphicon glyphicon-ok"></span>'; } $returnStr .= '<li><a href=# onclick=\'document.getElementById("r").value="' . setSessionsParamString(array_merge(array(SESSION_PARAM_SURVEY => $survey->getSuid(), SESSION_PARAM_PRIMKEY => $this->engine->getPrimaryKey(), SESSION_PARAM_RGID => $rgid, SESSION_PARAM_VARIABLES => $variablenames, SESSION_PARAM_GROUP => $template, SESSION_PARAM_MODE => getSurveyMode(), SESSION_PARAM_LANGUAGE => getSurveyLanguage(), SESSION_PARAM_TEMPLATE => getSurveyTemplate(), SESSION_PARAM_TIMESTAMP => time(), SESSION_PARAM_SEID => $this->engine->getSeid(), SESSION_PARAM_MAINSEID => $this->engine->getMainSeid()), array(SESSION_PARAM_NEWLANGUAGE => $lang["value"]))) . '"; document.getElementById("navigation").value="' . addslashes(Language::buttonUpdate()) . '"; ' . $click . ' document.getElementById("form").submit(); \'>' . $lang["name"] . $check . '</a></li>'; } } $returnStr .= '</ul></li>'; } //end language } $user = new User($_SESSION['URID']); $returnStr .= '<li class="dropdown"> <a href="#" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown">' . $user->getName() . ' <b class="caret"></b></a> <ul class="dropdown-menu"> <li class="dropdown-header">' . $this->engine->getPrimaryKey() . '</li> <li class="dropdown-header">' . $variablenamesfull . '</li>'; $windowopen = 'window.open(\'tester/' . setSessionParams(array('reporturid' => $_SESSION['URID'], 'testpage' => 'report', 'reportsuid' => $this->engine->getSuid(), 'reportseid' => $this->engine->getSeid(), 'reportmainseid' => $this->engine->getMainSeid(), 'reportrgid' => $rgid, 'reportdisplayed' => $variablenames, 'reportlanguage' => getSurveyLanguage(), 'reportmode' => getSurveyMode(), 'reportversion' => getSurveyVersion(), 'reportprimkey' => $this->engine->getPrimarykey())) . '\', \'popupWindow\', \'width=770,height=500,scrollbars=yes,top=100,left=100\'); return false;'; $javascript = ' onclick="' . $windowopen . '"'; $returnStr .= '<li><a style="cursor: pointer;" ' . $javascript . '><span class="glyphicon glyphicon-remove-sign"></span> ' . Language::linkReportProblem() . '</a></li>'; $windowopen = 'window.open(\'tester/' . setSessionParams(array('testpage' => 'watch', 'watchurid' => $_SESSION['URID'], 'watchsuid' => $this->engine->getSuid(), 'watchseid' => $this->engine->getSeid(), 'watchmainseid' => $this->engine->getMainSeid(), 'watchrgid' => $rgid, 'watchdisplayed' => $variablenames, 'watchlanguage' => getSurveyLanguage(), 'watchmode' => getSurveyMode(), 'watchversion' => getSurveyVersion(), 'watchprimkey' => $this->engine->getPrimarykey())) . '\', \'popupWindow\', \'width=770,height=650,scrollbars=yes,top=100,left=100\'); return false;'; $javascript = ' onclick="' . $windowopen . '"'; $returnStr .= '<li><a style="cursor: pointer;" ' . $javascript . '><span class="glyphicon glyphicon-zoom-in"></span> ' . Language::linkWatch() . '</a></li>'; $first = $this->engine->isFirstState(); if ($first == false || $first == true && $this->engine->getForward() == true) { if ($this->engine->getForward() == true) { $stateid = $this->engine->getStateId() + 1; } else { $stateid = $this->engine->getStateId(); } $windowopen = 'window.open(\'tester/' . setSessionParams(array('testpage' => 'jumpback', 'jumpurid' => $_SESSION['URID'], 'jumpsuid' => $this->engine->getSuid(), 'jumpstateid' => $stateid, 'jumpprimkey' => $this->engine->getPrimaryKey())) . '\', \'popupWindow\', \'width=770,height=300,scrollbars=yes,top=100,left=100\'); return false;'; $javascript = ' onclick="' . $windowopen . '"'; $returnStr .= '<li><a style="cursor: pointer;" ' . $javascript . '><span class="glyphicon glyphicon-arrow-left"></span> ' . Language::linkJumpBack() . '</a></li>'; } $returnStr .= '<li><a href="' . setSessionParams(array('page' => $ut . '.tools.test', 'suid' => $this->engine->getSuid())) . '&se=' . addslashes(USCIC_SMS) . '"><span class="glyphicon glyphicon-home"></span> ' . Language::linkBackToNubis() . '</a></li> <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> '; $returnStr .= '</div><!--/.nav-collapse --> </div> </div>'; return $returnStr; }
function showEditUserAccessRes() { /* update last page */ $_SESSION['LASTPAGE'] = 'sysadmin.users.edituser'; $displayUsers = new DisplayUsers(); $urid = getFromSessionParams('urid'); $_SESSION['LASTURID'] = $urid; // store access $user = new User($urid); $content = $displayUsers->displaySuccess(Language::messageUserChanged($user->getName())); $surv = loadvar(SMS_POST_SURVEY); $allmodes = Common::surveyModes(); foreach ($allmodes as $k => $all) { if (loadvar(SETTING_USER_MODE . $k) == USER_MODE_YES) { $ans = loadvar(SETTING_USER_LANGUAGES . $k); if (!is_array($ans)) { $ans = array($ans); } if (sizeof($ans) > 0) { //echo implode("~", $ans); $user->setLanguages($surv, $k, implode("~", $ans)); } } else { $user->removeMode($surv, $k); } } $user->saveChanges(); return $displayUsers->showEditUser($_SESSION['LASTURID'], $content); }
function getAllowedModes() { $allowed = $this->getSettingDirectly(USCIC_SURVEY, OBJECT_SURVEY, SETTING_ALLOWED_MODES)->getValue(); if ($allowed == "") { $allowed = implode("~", array_keys(Common::surveyModes())); } return $allowed; }
function showMode() { global $survey; $allowed = explode("~", $survey->getAllowedModes()); if (sizeof($allowed) == 1) { return ""; } $rgid = $this->engine->getRgid(); $variablenames = $this->getRealVariables(explode("~", $this->engine->getDisplayed())); $template = $this->engine->getTemplate(); $click = ""; if ($template != "") { $group = $this->engine->getGroup($template); $click = $this->engine->replaceFills($group->getClickModeChange()); } else { $vars = explode("~", $variablenames); $var = $this->engine->getVariableDescriptive($vars[0]); $click = $this->engine->replaceFills($var->getClickModeChange()); } $click = str_replace("'", "", $click); $returnStr = '<div class="btn-group"> <button type="button" class="btn btn-default dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"> ' . Language::surveyChangeMode() . ' <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu">'; $current = getSurveyMode(); $modes = Common::surveyModes(); foreach ($modes as $key => $mode) { if (inArray($key, $allowed)) { $check = ''; if ($key == $current) { $check = ' <span class="glyphicon glyphicon-ok"></span>'; } $returnStr .= '<li><a href=# onclick=\'document.getElementById("r").value="' . setSessionsParamString(array_merge(array(SESSION_PARAM_LASTACTION => $this->engine->getLastSurveyAction(), SESSION_PARAM_SURVEY => $survey->getSuid(), SESSION_PARAM_PRIMKEY => $this->primkey, SESSION_PARAM_RGID => $rgid, SESSION_PARAM_VARIABLES => $variablenames, SESSION_PARAM_GROUP => $template, SESSION_PARAM_MODE => $current, SESSION_PARAM_VERSION => getSurveyVersion(), SESSION_PARAM_LANGUAGE => getSurveyLanguage(), SESSION_PARAM_TIMESTAMP => time(), SESSION_PARAM_SEID => $this->engine->getSeid(), SESSION_PARAM_MAINSEID => $this->engine->getMainSeid()), array(SESSION_PARAM_NEWMODE => $key))) . '"; document.getElementById("navigation").value="' . NAVIGATION_MODE_CHANGE . '"; ' . $click . ' document.getElementById("form").submit(); \'>' . $mode . $check . '</a></li>'; } } $returnStr .= ' </ul> </div>'; return $returnStr; }
function reportSub($message = '') { $returnStr = $this->displayComboBox(); $returnStr .= '<div class="panel panel-default"> <div class="panel-heading">'; $returnStr .= '<h4>' . Language::reportProblem() . '</h4>'; $returnStr .= ' </div> <div class="panel-body">'; $returnStr .= $message; global $survey; $issues = $survey->getReportedIssues(); $returnStr .= '<div> <!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#newissue" aria-controls="home" role="tab" data-toggle="tab">New problem</a></li> <li role="presentation"><a href="#reportedissues" aria-controls="home" role="tab" data-toggle="tab">Reported problems (' . sizeof($issues) . ')</a></li> </ul> <div class="tab-content"> <div role="tabpanel" class="tab-pane active" id="newissue">'; $returnStr .= "<br/><table>"; $returnStr .= "<tr><td>" . Language::reportProblemCategory() . "</td><td>"; $returnStr .= "<select class='selectpicker show-tick' name='reportcategory'>"; $options = Language::reportProblemCategories(); foreach ($options as $k => $option) { $returnStr .= "<option value=" . $k . ">" . $option . "</option>"; } $returnStr .= "</select></td></tr>"; $returnStr .= "<tr><td valign=top>" . Language::reportProblemDescription() . "</td><td>"; $returnStr .= "<textarea name='reportcomment' class='form-control' style='min-width: 400px;' rows=6></textarea>"; $returnStr .= "</td></tr>"; $returnStr .= '</table><br/>'; $returnStr .= '<button type="submit" class="btn btn-success" style="min-width:100px">' . Language::buttonReport() . '</button>'; $returnStr .= '<button onclick="window.close();" type="cancel" class="btn btn-default" style="min-width:100px">' . Language::buttonClose() . '</button>'; $returnStr .= "</form>"; $returnStr .= '</div> <div role="tabpanel" class="tab-pane" id="reportedissues">'; if (sizeof($issues) == 0) { $returnStr .= "<br/>" . '<div class="alert alert-warning">' . Language::labelNoProblemsReported() . '</div>'; } else { $returnStr .= $this->displayDataTablesScripts(array("colvis", "rowreorder")); $returnStr .= "<script type='text/javascript'>\n \$(document).ready(function(){\n \$('#issuetable').dataTable(\n {\n \"iDisplayLength\": " . sizeof($issues) . ",\n dom: 'C<\"clear\">lfrtip',\n searching: false,\n paging: false\n } \n );\n \n });</script>\n\n "; // $returnStr .= "<br/><table id='issuetable' class='table table-bordered table-striped'><thead>"; $returnStr .= "<th>Reported by</th><th>" . Language::labelReportedOn() . "</th><th>" . Language::labelReportedCategory() . "</th><th>" . Language::labelReportedDescription() . "</th><th>" . Language::labelReportedMode() . "</th><th>" . Language::labelReportedLanguage() . "</th>"; $returnStr .= "</thead><tbody>"; $modes = Common::surveyModes(); $languages = Language::getLanguagesArray(); $cats = Language::reportProblemCategories(); foreach ($issues as $is) { $us = new User($is['urid']); $returnStr .= "<tr>"; $returnStr .= "<td>" . $us->getUsername() . "</td>"; $returnStr .= "<td>" . $is["ts"] . "</td>"; $returnStr .= "<td>" . $cats[$is["category"]] . "</td>"; $returnStr .= "<td>" . $is["comment"] . "</td>"; $returnStr .= "<td>" . $modes[$is["mode"]] . "</td>"; $returnStr .= "<td>" . $languages[str_replace("_", "", getSurveyLanguagePostFix($is["language"]))]['name'] . "</td>"; $returnStr .= "</tr>"; } $returnStr .= "</tbody></table>"; } $returnStr .= '</div> </div> </div>'; return $returnStr; }
function showIssues($content = "") { $returnStr = $this->showToolsHeader(Language::linkReported()); $returnStr .= $content; $surveys = new Surveys(); $surveys = $surveys->getSurveys(); if (sizeof($surveys) > 0) { $returnStr .= "<form id=refreshform method=post>"; $returnStr .= '<input type=hidden name=page value="sysadmin.tools.issues">'; $returnStr .= '<input type=hidden name="' . SMS_POST_SURVEY . '" id="' . SMS_POST_SURVEY . '_hidden" value="' . getSurvey() . '">'; $returnStr .= '<input type=hidden name="' . SMS_POST_MODE . '" id="' . SMS_POST_MODE . '_hidden" value="' . getSurveyMode() . '">'; $returnStr .= '<input type=hidden name="' . SMS_POST_LANGUAGE . '" id="' . SMS_POST_LANGUAGE . '_hidden" value="' . getSurveyLanguage() . '">'; $returnStr .= "</form>"; // get reported issues for survey global $survey; $issues = $survey->getReportedIssues(); // no problems reported if (sizeof($issues) == 0) { $returnStr .= "<br/>" . '<div class="alert alert-warning">' . 'No reported problems found' . '</div>'; } else { $returnStr .= $this->displayComboBox(); $returnStr .= '<span class="label label-default">Filter by</span>'; $returnStr .= '<div class="well well-sm">'; $returnStr .= '<table>'; $returnStr .= '<tr><td>' . Language::labelTestSurvey() . "</td><td><select onchange='document.getElementById(\"" . SMS_POST_SURVEY . "_hidden\").value=this.value; document.getElementById(\"refreshform\").submit();' name=" . POST_PARAM_SUID . " class='selectpicker show-tick'>"; $current = new Survey(getSurvey()); foreach ($surveys as $survey) { $selected = ""; if ($survey->getSuid() == $current->getSuid()) { $selected = "SELECTED"; } $returnStr .= "<option {$selected} value=" . $survey->getSuid() . '>' . $survey->getName() . '</option>'; } $returnStr .= "</select></td></tr></table></div>"; $returnStr .= $this->displayDataTablesScripts(array("colvis", "rowreorder")); $returnStr .= "<script type='text/javascript'>\n \$(document).ready(function(){\n \$('#issuetable').dataTable(\n {\n \"iDisplayLength\": " . sizeof($issues) . ",\n dom: 'C<\"clear\">lfrtip',\n searching: false,\n paging: false\n } \n );\n \n });</script>\n\n "; // $returnStr .= "<br/><table id='issuetable' class='table table-bordered table-striped'><thead>"; $returnStr .= "<th>Reported by</th><th>Reported on</th><th>Category</th><th>Description</th><th>Primary key</th><th>Interview mode</th><th>Language</th>"; $returnStr .= "</thead><tbody>"; $modes = Common::surveyModes(); $languages = Language::getLanguagesArray(); $cats = Language::reportProblemCategories(); foreach ($issues as $is) { $us = new User($is['urid']); $returnStr .= "<tr>"; $returnStr .= "<td>" . $us->getUsername() . "</td>"; $returnStr .= "<td>" . $is["ts"] . "</td>"; $returnStr .= "<td>" . $cats[$is["category"]] . "</td>"; $returnStr .= "<td>" . $is["comment"] . "</td>"; $returnStr .= "<td>" . $is["primkey"] . "</td>"; $returnStr .= "<td>" . $modes[$is["mode"]] . "</td>"; $returnStr .= "<td>" . $languages[str_replace("_", "", getSurveyLanguagePostFix($is["language"]))]['name'] . "</td>"; $returnStr .= "</tr>"; } $returnStr .= "</tbody></table>"; } } else { $returnStr .= $this->displayInfo(Language::messageNoSurveysAvailable()); } $returnStr .= '</p></div></div>'; //container and wrap $returnStr .= $this->showBottomBar(); $returnStr .= $this->showFooter(false); return $returnStr; }
function showEditUser($urid, $message = "") { $user = new User($urid); $returnStr = $this->showSysAdminHeader(Language::messageSMSTitle()); $returnStr .= '<div id="wrap">'; $returnStr .= $this->showNavBar(); $returnStr .= '<div class="container"><p>'; $returnStr .= '<ol class="breadcrumb">'; $returnStr .= '<li>' . setSessionParamsHref(array('page' => 'sysadmin.users'), Language::headerUsers()) . '</li>'; if ($user->getUsername() == '') { $returnStr .= '<li>' . Language::labelUserAddUser() . '</li>'; } else { $returnStr .= '<li>' . Language::labelEdit() . ' ' . $user->getUsername() . '</li>'; } $returnStr .= '</ol>'; $returnStr .= $message; $returnStr .= $this->displayComboBox(); $returnStr .= '<form id="editform" method="post">'; $returnStr .= '<span class="label label-default">' . Language::labelUserGeneral() . '</span>'; $returnStr .= '<div class="well">'; $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.users.edituserres', 'urid' => $urid)); $returnStr .= '<div class="row">'; $returnStr .= '<div class="col-md-6">'; $returnStr .= '<table>'; $returnStr .= '<tr><td>' . Language::labelUserUserName() . '</td><td><input type="text" class="form-control" name="username" value="' . convertHTLMEntities($user->getUsername(), ENT_QUOTES) . '"></td></tr>'; $returnStr .= '<tr><td>' . Language::labelUserUserNameName() . '</td><td><input type="text" class="form-control" name="name" value="' . convertHTLMEntities($user->getName(), ENT_QUOTES) . '"></td></tr>'; $returnStr .= '<tr><td align=top>' . Language::labelUserActive() . '</td><td>'; $returnStr .= $this->showDropDown(array(VARIABLE_ENABLED => Language::labelEnabled(), VARIABLE_DISABLED => Language::labelDisabled()), $user->getStatus(), 'status'); $returnStr .= '</td></tr>'; $returnStr .= '<tr><td align=top>' . Language::labelUserUserType() . '</td><td>'; $returnStr .= $this->showDropDown(array(USER_INTERVIEWER => Language::labelInterviewer(), USER_NURSE => Language::labelNurse(), USER_SUPERVISOR => Language::labelSupervisor(), USER_TRANSLATOR => Language::labelTranslator(), USER_RESEARCHER => Language::labelResearcher(), USER_SYSADMIN => Language::labelSysadmin(), USER_TESTER => Language::labelTester()), $user->getUserType(), 'usertype', 'usertype'); $returnStr .= '</td></tr>'; $returnStr .= "<script type='text/javascript'>"; $returnStr .= '$( document ).ready(function() { $("#usertype").change(function (e) { if (this.value == ' . USER_NURSE . ') { $("#subtype").show(); $("#subtype2").hide(); } else if (this.value == ' . USER_SYSADMIN . ') { $("#subtype2").show(); $("#subtype").hide(); } else { $("#subtype").hide(); $("#subtype2").hide(); } if (this.value == ' . USER_INTERVIEWER . ' || this.value == ' . USER_CATIINTERVIEWER . ' || this.value == ' . USER_NURSE . ' || this.value == ' . USER_SUPERVISOR . ') { $("#super").show(); $("#accessdiv").hide(); $("#surveyaccess").hide(); } else { $("#super").hide(); $("#accessdiv").show(); $("#surveyaccess").show(); } }); })'; $returnStr .= "</script>"; if (inArray($user->getUserType(), array(USER_NURSE))) { $returnStr .= '<tr id=subtype><td align=top>' . Language::labelUserUserSubType() . '</td><td>'; $returnStr .= $this->showDropDown(array(USER_NURSE_MAIN => Language::labelNurseMain(), USER_NURSE_LAB => Language::labelNurseLab(), USER_NURSE_FIELD => Language::labelNurseField(), USER_NURSE_VISION => Language::labelNurseVision()), $user->getUserSubType(), 'usersubtype'); $returnStr .= '</td></tr>'; } else { if (inArray($user->getUserType(), array(USER_SYSADMIN))) { $returnStr .= '<tr id=subtype2><td align=top>' . Language::labelUserUserSubType() . '</td><td>'; $returnStr .= $this->showDropDown(array(USER_SYSADMIN_MAIN => Language::labelSysadminMain(), USER_SYSADMIN => Language::labelSysadminAdmin()), $user->getUserSubType(), 'usersubtype'); $returnStr .= '</td></tr>'; } else { $returnStr .= '<tr id=subtype style="display: none;"><td align=top>' . Language::labelUserUserSubType() . '</td><td>'; $returnStr .= $this->showDropDown(array(USER_NURSE_MAIN => Language::labelNurseMain(), USER_NURSE_LAB => Language::labelNurseLab(), USER_NURSE_FIELD => Language::labelNurseField(), USER_NURSE_VISION => Language::labelNurseVision()), $user->getUserSubType(), 'usersubtype'); $returnStr .= '</td></tr>'; $returnStr .= '<tr id=subtype2 style="display: none;"><td align=top>' . Language::labelUserUserSubType() . '</td><td>'; $returnStr .= $this->showDropDown(array(USER_SYSADMIN_MAIN => Language::labelSysadminMain(), USER_SYSADMIN => Language::labelSysadminAdmin()), $user->getUserSubType(), 'usersubtype'); $returnStr .= '</td></tr>'; } } if (inArray($user->getUserType(), array(USER_INTERVIEWER, USER_CATIINTERVIEWER, USER_NURSE, USER_SUPERVISOR))) { $returnStr .= '<tr id=super><td>' . Language::labelUserSupervisor() . '</td><td>'; $users = new Users(); $users = $users->getUsersByType(USER_SUPERVISOR); $returnStr .= $this->displayUsers($users, $user->getSupervisor(), 'uridsel', true); $returnStr .= '</td></tr>'; } $extra = ''; if (inArray($user->getUserType(), array(USER_NURSE, USER_INTERVIEWER, USER_SUPERVISOR, USER_CATIINTERVIEWER))) { $extra = "style='display: none;'"; } $returnStr .= '<tr id="surveyaccess"' . $extra . '><td>' . Language::labelUserSurveyAllowed() . '</td><td>' . $this->displaySurveys(SETTING_USER_SURVEYS . "[]", SETTING_USER_SURVEYS, implode("~", $user->getSurveysAccess()), '', "multiple") . '</td></tr>'; $returnStr .= '</table></div>'; $returnStr .= '<div class="col-md-6">'; $returnStr .= '<table>'; $returnStr .= '<tr><td align=top>' . Language::labelUserPassword() . '</td><td><input type="text" class="form-control" name="pwd1"></td></tr>'; $returnStr .= '<tr><td align=top>' . Language::labelUserPassword2() . '</td><td><input type="text" class="form-control" name="pwd2"></td></tr>'; $returnStr .= '</table></div></div>'; if ($urid != "") { $returnStr .= '<br/><input type="submit" class="btn btn-default" value="' . Language::buttonEdit() . '"/>'; } else { $returnStr .= '<br/><input type="submit" class="btn btn-default" value="' . Language::buttonAdd() . '"/>'; } $returnStr .= '</div></form>'; $suid = $_SESSION['SUID']; /* available surveys */ if ($urid != "") { $extra = ''; if (inArray($user->getUserType(), array(USER_NURSE, USER_INTERVIEWER, USER_SUPERVISOR, USER_CATIINTERVIEWER))) { $extra = "style='display: none;'"; } $returnStr .= "<div " . $extra . " id='accessdiv'>"; $returnStr .= "<form id=refreshform method=post>"; $returnStr .= '<input type=hidden name=page value="sysadmin.users.edituser">'; $returnStr .= '<input type=hidden name="' . SMS_POST_SURVEY . '" id="' . SMS_POST_SURVEY . '_hidden" value="' . getSurvey() . '">'; $returnStr .= "</form>"; $returnStr .= '<form id="editform1" method="post">'; $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.users.edituseraccessres', 'urid' => $urid)); $returnStr .= '<span class="label label-default">' . Language::labelUserAccess() . '</span>'; $returnStr .= '<div class="well">'; $returnStr .= "<table>"; $allsurveys = $user->getSurveysAccess(); if (!inArray($suid, $allsurveys)) { $suid = $allsurveys[0]; } $survey = new Survey($suid); $u = $_SESSION['URID']; $_SESSION['URID'] = $urid; // pretend to be edited user for a moment to get surveys to display $returnStr .= '<tr><td>' . Language::labelUserSurveyAccess() . '</td><td>' . $this->displaySurveys(SMS_POST_SURVEY, SMS_POST_SURVEY, $suid, '', "") . '</td></tr>'; $_SESSION['URID'] = $u; $returnStr .= "<script type='text/javascript'>"; $returnStr .= '$( document ).ready(function() { $("#' . SMS_POST_SURVEY . '").change(function (e) { $("#' . SMS_POST_SURVEY . '_hidden").val(this.value); $("#refreshform").submit(); }); })'; $returnStr .= "</script>"; /* available modes */ $modes = Common::surveyModes(); $allowedmodes = explode("~", $survey->getAllowedModes()); $usermodes = $user->getModes($suid); foreach ($allowedmodes as $mode) { $returnStr .= "<tr class='modesrow'><td>" . $modes[$mode] . "</td><td>"; $returnStr .= $this->displayUserMode(SETTING_USER_MODE . $mode, inArray($mode, $usermodes)); $userlanguages = $user->getLanguages($suid, $mode); $returnStr .= "<td>" . Language::labelUserLanguageAllowed() . "</td>"; $returnStr .= "<td>" . $this->displayLanguagesAdmin(SETTING_USER_LANGUAGES . $mode, SETTING_USER_LANGUAGES . $mode, $userlanguages, true, false, false, "multiple", $survey->getAllowedLanguages($mode)) . "</td>"; $returnStr .= "</tr>"; } $returnStr .= '</table>'; $returnStr .= '<br/><input type="submit" class="btn btn-default" value="' . Language::buttonEdit() . '"/>'; $returnStr .= '</div></form></div>'; } $returnStr .= '</p></div> </div>'; //container and wrap $returnStr .= $this->showBottomBar(); $returnStr .= $this->showFooter(false); return $returnStr; }
function update() { $returnStr = $this->showHeader(Language::messageSMSTitle()); $returnStr .= $this->displayComboBox(); $returnStr .= '<div id="wrap">'; $returnStr .= '<div class="container"><p>'; $returnStr .= '<div class="panel panel-default"> <div class="panel-heading">'; $returnStr .= '<h4>' . Language::linkUpdate() . '</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 { $display = $this->engine->getDisplayObject(); $returnStr .= $display->displayDataTablesScripts(array("colvis", "rowreorder")); $returnStr .= "<script type='text/javascript'>\n \$(document).ready(function(){\n \$('#issuetable').dataTable(\n {\n \"iDisplayLength\": 4,\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::labelUpdateVariable() . "</th><th>" . Language::labelUpdateQuestion() . "</th><th>" . Language::labelUpdateCurrent() . "</th><th>" . Language::labelUpdateChangeTo() . "</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'; global $survey; $survey = new Survey(getFromSessionParams('watchsuid')); $cnt = 1; $params = getSessionParams(); $params[SESSION_PARAM_SURVEY] = getFromSessionParams('watchsuid'); // add for getSurvey $params['testpage'] = 'updateRes'; $paramstring = setSessionParamsPost($params); foreach ($values as $is) { $var = $survey->getVariableDescriptiveByName($is["variablename"]); $returnStr .= "<tr>"; $returnStr .= "<td>" . $is["variablename"] . "</td>"; $returnStr .= "<td>" . $var->getQuestion() . "</td>"; $returnStr .= "<td>" . $this->getDisplayValue($var, $is["answer_dec"]) . "</td>"; $returnStr .= "<td>" . $this->displayInput($paramstring, $is["variablename"], $var, $is["answer_dec"], $cnt) . "</td>"; $returnStr .= "</tr>"; $cnt++; } $returnStr .= "</tbody></table>"; } $returnStr .= '</div> </div> </div>'; $returnStr .= ' </div></div>'; $returnStr .= '</p></div> </div>'; //container and wrap $returnStr .= $this->showFooter(false); echo $returnStr; }
function displayModesAdmin($name, $id, $value, $multiple = "", $list = "", $onchange = "") { $returnStr = $this->displayComboBox(); $tag = ""; if ($multiple != "") { $tag = "[]"; } $returnStr .= '<select ' . $onchange . ' ' . $multiple . ' id="' . $id . '" name="' . $name . $tag . '" class="form-control selectpicker show-tick">'; $modes = Common::surveyModes(); ksort($modes); $values = explode("~", $value); $modelist = explode("~", $list); $icons = array(MODE_CAPI => "data-icon='glyphicon glyphicon-user'", MODE_CATI => "data-icon='glyphicon glyphicon-earphone'", MODE_CASI => "data-icon='glyphicon glyphicon-globe'", MODE_CADI => "data-icon='glyphicon glyphicon-pencil'"); foreach ($modes as $k => $mode) { if (trim($list) == "" || inArray($k, $modelist)) { $selected = ""; if (inArray($k, $values)) { $selected = "SELECTED"; } $icon = $icons[$k]; $returnStr .= "<option {$icon} {$selected} value=" . $k . ">" . $mode . "</option>"; } } $returnStr .= "</select>"; return $returnStr; }