Example #1
0
 function showRespondentSetContactStatus($primkey, $type = 1)
 {
     if ($type == 1) {
         $respondent = new Respondent($primkey);
     } else {
         $respondent = new Household($primkey);
     }
     $contactcode = loadvar("csid");
     $contactts = date('Y-m-d H:i:s');
     $contacts = new Contacts();
     $errorMessage = $contacts->addContact($primkey, $contactcode, $contactts, '', '', '', '', $_SESSION['URID']);
     if ($respondent->getUrid() != $_SESSION['URID']) {
         //if assigned to other urid than this
         //add to communication!
         $communication = new Communication();
         $communication->addSQLToUser($contacts->getLastQuery(), $respondent->getUrid());
     }
     $display = new Display();
     if (sizeof($errorMessage) == 0) {
         return $this->showInterviewerRespondentInfo($primkey, $display->displayInfo(Language::messageContactAdded()), $type);
     } else {
         return $this->showInterviewerRespondentInfo($primkey, $display->displayError(implode('<br/>', $errorMessage)), $type);
     }
 }
Example #2
0
 function showAddContactRes($primkey)
 {
     $respondent = new Respondent($primkey);
     $contactwith = loadvar("contactwith");
     $contactperson = loadvar("contactperson");
     $contactcode = loadvar("contactcode");
     $contactts = loadvar("contactts");
     $contactappointment = loadvar("contactappointment");
     $contactremark = loadvar("contactremark");
     $contacts = new Contacts();
     $errorMessage = $contacts->addContact($primkey, $contactcode, $contactts, $contactwith, $contactperson, $contactremark, $contactappointment, $_SESSION['URID']);
     $display = new Display();
     if (sizeof($errorMessage) == 0) {
         return $this->showInfo($primkey, $display->displayInfo(Language::messageContactAdded()));
     } else {
         return $this->showAddContact($primkey, $display->displayError(implode('<br/>', $errorMessage)));
     }
 }
Example #3
0
        $phone = test_input($_POST["phone"]);
        $phoneErr = "";
    }
}
if (!preg_match("/^[a-zA-Z ]*\$/", $name)) {
    $nameErr = "Only letters and white space allowed. ";
}
if (!preg_match("/^[0-9]+\$/", $phone) && !empty($phone)) {
    $phoneErr = "Only numbers allowed. ";
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL) && !empty($email)) {
    $emailErr = "Invalid email format";
}
if ($nameErr . $emailErr . $phoneErr . $phoneErr == '') {
    $contact = new Contacts();
    if ($contact->addContact($name, $company, $address, $phone, $email, $notes)) {
        $name = $company = $address = $phone = $email = $notes = '';
        header('Location: addContact.php?action=addContactOK');
    } else {
        header('Location: addContact.php?action=addContactFail');
    }
}
require "header.php";
?>

<div class="clearfix visible-xs-block"></div>

<?php 
switch ($_GET['action']) {
    case 'addContactOK':
        echo '</p><span><font class="addContactOK">Contact added.</font></span></p>';
Example #4
0
 function showStartSurvey($primkey, $type = 1, $message = '')
 {
     if ($type == 1) {
         $respondent = new Respondent($primkey);
     } else {
         $respondent = new Household($primkey);
     }
     $_SESSION['SURVEYLOGIN'] = LOGIN_DIRECT;
     $respondent->setStatus(1);
     //set status to 1: started survey
     $respondent->saveChanges();
     //add contact 100
     $contactcode = Language::startInterviewCode();
     $contactts = date('Y-m-d H:i:s');
     $contacts = new Contacts();
     $errorMessage = $contacts->addContact($respondent->getPrimkey(), $contactcode, $contactts, '', '', '', '', $_SESSION['URID']);
     //end add contact
     $displayInterviewer = new DisplayInterviewer();
     return $displayInterviewer->showStartSurvey($respondent, $message);
 }