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); }
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); }