예제 #1
0
    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;
    }
예제 #2
0
    function getRespondentActionButtons($respondentOrHousehold, $refpage)
    {
        $content = '';
        if ($respondentOrHousehold->hasFinalCode() && $respondentOrHousehold->isCompleted()) {
            //if not completed: can still be assigned to different iwer
            $content = $this->displayInfo(Language::labelSupervisorFinalCodeAssigned());
        } else {
            if ($respondentOrHousehold instanceof Household) {
                //          $content .= '<form method="post">';
                //            $content .= setSessionParamsPost(array('page' => 'supervisor.interviewer.respondent.reassign', 'primkey' => $respondentOrHousehold->getPrimkey()));
                $users = new Users();
                $users = $users->getUsersBySupervisor($_SESSION['URID']);
                // $content .= $this->displayUsers($users, $respondentOrHousehold->getUrid());
                // $content .= '<br/>';
                // $content .= '<input type="submit" class="btn btn-default" value="Reassign"/>';
                // $content .= '</form>';
                $content .= $this->showActionBar(Language::labelSupervisorAssignToInterviewer(), $this->displayUsers($users, $respondentOrHousehold->getUrid(), 'uridsel', false, true), 'Reassign', setSessionParamsPost(array('page' => 'supervisor.interviewer.household.reassign', 'primkey' => $respondentOrHousehold->getPrimkey())), confirmAction('Are you sure you want to reassign this household? Make sure the intervier data for this household has been uploaded, otherwise data wil be lost! Type YES to continue.', 'YES'));
                if (!$respondentOrHousehold->hasFinalCode()) {
                    $content .= $this->showActionBar(Language::labelSupervisorAssignFinalStatus(), $this->displayFinalStatusCodesSelect($respondentOrHousehold->getUrid()), 'Set status', setSessionParamsPost(array('page' => 'supervisor.interviewer.household.contact.setstatus', 'primkey' => $respondentOrHousehold->getPrimkey())), confirmAction('Are you sure you want to reassign this household? Type YES to continue.', 'YES'));
                }
            } else {
                if (!$respondentOrHousehold->hasFinalCode()) {
                    $content .= $this->showActionBar(Language::labelSupervisorAssignFinalStatus(), $this->displayFinalStatusCodesSelect($users, $respondentOrHousehold->getUrid()), 'Set status', setSessionParamsPost(array('page' => 'supervisor.interviewer.household.respondent.contact.setstatus', 'primkey' => $respondentOrHousehold->getPrimkey())), confirmAction('Are you sure you want to assign a final status code to this respondent? Type YES to continue.', 'YES'));
                } else {
                    $content = $this->displayInfo(Language::labelSupervisorFinalCodeAssigned());
                }
            }
        }
        //NEEDS VALIDATION?
        if ($respondentOrHousehold instanceof Respondent) {
            if ($respondentOrHousehold->needsValidation()) {
                $beforeText = '<button type="button" class="btn btn-warning" data-toggle="modal" data-target="#myModal">' . Language::labelSupervisorCheckAnswers() . '</button>';
                $content .= '  
<!-- Modal -->
<div class="modal fade" id="myModal" 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"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">' . Language::labelSupervisorCheckRespondentAnswers() . '</h4>
      </div>
      <div class="modal-body">
        <table>
        <thead><tr><th>' . Language::labelSupervisorCheckRespondentQuestion() . '</th><th>' . Language::labelSupervisorCheckRespondentAnswer() . '</th></tr></thead>
	<tbody>';
                $validationQuestions = Language::validationQuestions();
                $survey = new Survey(2);
                foreach ($validationQuestions as $question) {
                    $var = $survey->getVariableDescriptiveByName(getBasicName($question));
                    $content .= '<tr><td>' . $question . ': ' . $var->getDescription() . '</td><td>';
                    $content .= '</td></tr>';
                }
                $content .= '</tbody></table>';
                //         $content .= json_encode($survey);
                $content .= '
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">' . Language::buttonClose() . '</button>
      </div>
    </div>
  </div>
</div> 
';
                $content .= $this->showActionBar(Language::labelSupervisorCheckRespondentValidate(), $this->displayValidationStatus(Language::optionsSupervisorValidation(), $respondentOrHousehold->getUrid(), 'validationsel', false, $beforeText), 'Set validation status', setSessionParamsPost(array('page' => 'supervisor.interviewer.household.respondent.setvalidation', 'primkey' => $respondentOrHousehold->getPrimkey())));
            }
        }
        return $content;
    }
예제 #3
0
 function showClickRouting()
 {
     $action = loadvar("action");
     $survey = new Survey($_SESSION['SUID']);
     $var = $survey->getVariableDescriptiveByName($action);
     if ($var->getVsid() != "") {
         $_SESSION['LASTPAGE'] = 'sysadmin.survey.variable';
         return $this->showEditVariable($var->getVsid());
     }
     $section = $survey->getSectionByName($action);
     if ($section->getSeid() != "") {
         $_SESSION['LASTPAGE'] = 'sysadmin.survey.section';
         return $this->showSection("", $section->getSeid());
     }
     $group = $survey->getGroupByName($action);
     if ($group->getGid() != "") {
         $_SESSION['LASTPAGE'] = 'sysadmin.survey.group';
         return $this->showEditGroup($group->getGid());
     }
     /* nothing to click through */
     $displaySysAdmin = new DisplaySysAdmin();
     $content = $displaySysAdmin->displayWarning(Language::messageRoutingClickError($action));
     return $this->showSection($content);
 }
예제 #4
0
 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();
 }