Beispiel #1
0
 function showEditRes($primkey, $type = 1)
 {
     $communication = new Communication();
     if ($type == 1) {
         $respondent = new Respondent($primkey);
         $respondent->setFirstName(loadvar('firstname'), true);
         $communication->addSQLToUser($respondent->getLastQuery(), $respondent->getUrid());
         $respondent->setLastName(loadvar('lastname'), true);
         $communication->addSQLToUser($respondent->getLastQuery(), $respondent->getUrid());
     } else {
         $respondent = new Household($primkey);
         $respondent->setName(loadvar('name'), true);
     }
     $respondent->setAddress1(loadvar('address1'), true);
     $communication->addSQLToUser($respondent->getLastQuery(), $respondent->getUrid());
     $respondent->setAddress2(loadvar('address2'), true);
     $communication->addSQLToUser($respondent->getLastQuery(), $respondent->getUrid());
     $respondent->setZip(loadvar('zip'), true);
     $communication->addSQLToUser($respondent->getLastQuery(), $respondent->getUrid());
     $respondent->setCity(loadvar('city'), true);
     $communication->addSQLToUser($respondent->getLastQuery(), $respondent->getUrid());
     $respondent->setTelephone1(loadvar('telephone1'), true);
     $communication->addSQLToUser($respondent->getLastQuery(), $respondent->getUrid());
     //$respondent->setTelephone2(loadvar('telephone2'));
     //$communication->addSQLToUser($respondent->getLastQuery(), $respondent->getUrid());
     $respondent->setEmail(loadvar('email'), true);
     $communication->addSQLToUser($respondent->getLastQuery(), $respondent->getUrid());
     //log???
     $errorMessage = $respondent->saveChanges();
     $display = new Display();
     $messageEditError = $display->displaySuccess(Language::messageRespondentChanged($respondent));
     //'<div class="alert alert-info">Changes saved.</div>';
     if (sizeof($errorMessage) > 0) {
         $messageEditError = $display->displayError(implode('<br/>', $errorMessage));
     }
     $displaySupervisor = new DisplaySupervisor();
     return $displaySupervisor->showInfo($respondent, $messageEditError);
 }
Beispiel #2
0
function getSurvey()
{
    /* SMS */
    if ($_SESSION['SYSTEM_ENTRY'] == USCIC_SMS) {
        if (loadvar(SMS_POST_SURVEY) != "") {
            $_SESSION['SUID'] = loadvar(SMS_POST_SURVEY);
        }
        if (isset($_SESSION['SUID'])) {
            return $_SESSION['SUID'];
        }
        $surveys = new Surveys();
        $suid = $surveys->getFirstSurvey(true);
        if (isSurvey($l)) {
            $_SESSION['SUID'] = $suid;
            return $suid;
        }
        $_SESSION['SUID'] = 1;
        return 1;
    }
    /* SURVEY */
    // check for new survey
    global $engine, $suid;
    /* get from loadvar */
    $l = loadvarSurvey(POST_PARAM_SUID);
    if (isSurvey($l)) {
        $suid = $l;
        $_SESSION["PARAMS"][SESSION_PARAM_SURVEY] = $l;
        return $suid;
    }
    $l = getFromSessionParams(SESSION_PARAM_NEWSURVEY);
    if (isSurvey($l)) {
        $_SESSION["PARAMS"][SESSION_PARAM_SURVEY] = $l;
        unset($_SESSION["PARAMS"][SESSION_PARAM_NEWSURVEY]);
        $suid = $l;
        return $suid;
    }
    // check for old survey
    $l = getFromSessionParams(SESSION_PARAM_SURVEY);
    if (isSurvey($l)) {
        $suid = $l;
        $_SESSION["PARAMS"][SESSION_PARAM_SURVEY] = $l;
        return $suid;
    }
    /* global suid has been set (via setting below, so no need to repeat) */
    if (isSurvey($suid)) {
        return $suid;
    }
    /* check for default survey */
    $l = getDefaultSurvey();
    if (isSurvey($l)) {
        $suid = $l;
        $_SESSION["PARAMS"][SESSION_PARAM_SURVEY] = $l;
        return $suid;
    }
    /* everything else failed */
    $surveys = new Surveys();
    $suid = $surveys->getFirstSurvey(true);
    if ($suid == "") {
        $display = new Display();
        echo $display->displayError(Language::messageSurveyUnavailable());
        doExit();
    }
    $_SESSION["PARAMS"][SESSION_PARAM_SURVEY] = $suid;
    return $suid;
}
 function showEditRes($primkey)
 {
     $respondent = new Respondent($primkey);
     $respondent->setFirstName(loadvar('firstname'));
     $respondent->setLastName(loadvar('lastname'));
     $respondent->setAddress1(loadvar('address1'));
     $respondent->setAddress2(loadvar('address2'));
     $respondent->setZip(loadvar('zip'));
     $respondent->setCity(loadvar('city'));
     $respondent->setTelephone1(loadvar('telephone1'));
     $respondent->setTelephone2(loadvar('telephone2'));
     $respondent->setEmail(loadvar('email'));
     //log???
     $errorMessage = $respondent->saveChanges();
     $display = new Display();
     $messageEditError = $display->displaySuccess(Language::messageRespondentChanged($primkey));
     //'<div class="alert alert-info">Changes saved.</div>';
     if (sizeof($errorMessage) > 0) {
         $messageEditError = $display->displayError(implode('<br/>', $errorMessage));
     }
     $displayCatiInterviewer = new DisplayCatiInterviewer();
     return $displayCatiInterviewer->showInfo($respondent, $messageEditError);
 }
Beispiel #4
0
     foreach ($mods as $m) {
         $user->setLanguages($this->addtosuid, $m, $survey->getAllowedLanguages($m));
     }
     $user->saveChanges();
     // return result
     return "";
 }
 function importMMIC()
 {
     set_time_limit(0);
     $this->importdb = new Database();
     $server = loadvar(SETTING_IMPORT_SERVER);
     if ($server == "") {
         $server = "localhost";
     }
     if ($this->importdb->connect($server, loadvar(SETTING_IMPORT_DATABASE), loadvar(SETTING_IMPORT_USER), loadvar(SETTING_IMPORT_PASSWORD)) == false) {
         $display = new Display();
         return $display->displayError(Language::messageToolsImportDbFailure());
     }
     $this->sourcetable = loadvar(SETTING_IMPORT_TABLE);
     // add
     if (loadvar(SETTING_IMPORT_AS) == IMPORT_TARGET_ADD) {
         $surveys = new Surveys();
         $this->addtosuid = $surveys->getMaximumSuid();
     } else {
         if (loadvar(SETTING_IMPORT_AS) == IMPORT_TARGET_REPLACE) {
             $this->addtosuid = 0;
             /* delete existing content */
             $tables = Common::surveyTables();
             foreach ($tables as $table) {
                 $query = "delete from " . Config::dbSurvey() . $table;
                 $this->db->executeQuery($query);
             }
             /* delete existing data */
             $tables = Common::surveyDataTables();
             foreach ($tables as $table) {
                 if ($table == "_actions") {
                     $query = "delete from " . Config::dbSurvey() . $table . " where suid != ''";
                 } else {
                     $query = "delete from " . Config::dbSurvey() . $table;
                 }
                 $this->db->executeQuery($query);
             }
             /* delete test data */
             $tables = Common::surveyTestDataTables();
             foreach ($tables as $table) {
                 if ($table == "_actions") {
                     $query = "delete from " . Config::dbSurvey() . $table . " where suid != ''";
                 } else {
                     $query = "delete from " . Config::dbSurvey() . $table;
                 }
                 $this->db->executeQuery($query);
             }
Beispiel #5
0
 function showEditRes($primkey, $type = 1)
 {
     if ($type == 1) {
         $respondent = new Respondent($primkey);
         $respondent->setFirstName(loadvar('firstname'));
         $respondent->setLastName(loadvar('lastname'));
     } else {
         $respondent = new Household($primkey);
         $respondent->setName(loadvar('name'));
         $respondent->setAddress1(loadvar('address1'));
         $respondent->setAddress2(loadvar('address2'));
         $respondent->setZip(loadvar('zip'));
         $respondent->setCity(loadvar('city'));
     }
     if (dbConfig::defaultPanel() == PANEL_RESPONDENT) {
         //only save for respondent panels
         $respondent->setAddress1(loadvar('address1'));
         $respondent->setAddress2(loadvar('address2'));
         $respondent->setZip(loadvar('zip'));
         $respondent->setCity(loadvar('city'));
     }
     $respondent->setTelephone1(loadvar('telephone1'));
     //$respondent->setTelephone2(loadvar('telephone2'));
     $respondent->setEmail(loadvar('email'));
     //log???
     $errorMessage = $respondent->saveChanges();
     $display = new Display();
     $messageEditError = $display->displaySuccess(Language::messageRespondentChanged($respondent));
     //'<div class="alert alert-info">Changes saved.</div>';
     if (sizeof($errorMessage) > 0) {
         $messageEditError = $display->displayError(implode('<br/>', $errorMessage));
     }
     $displayInterviewer = new DisplayInterviewer();
     return $displayInterviewer->showInfo($respondent, $messageEditError);
 }