コード例 #1
0
ファイル: PhoneNumber.php プロジェクト: elminero/contact_v1.1
 public function setPhoneParam(PhoneNumberController $phone)
 {
     $this->_id = $phone->getId();
     $this->_personId = $phone->getPersonId();
     $this->_phoneNumber = $phone->getNumber();
     $this->_phoneType = $phone->getType();
     $this->_note = $phone->getNote();
 }
コード例 #2
0
    public function getNote()
    {
        return $this->_note;
    }
    public function phoneFieldValidate()
    {
        $phoneFieldValidate = 0;
        if ($this->_phoneNumber) {
            $phoneFieldValidate = 1;
        }
        return $phoneFieldValidate;
    }
}
// End PhoneNumberController
if (array_key_exists('addPhone', $_POST)) {
    $cPhone = new PhoneNumberController((int) $_POST['phoneId'], trim($_POST['personId']), (int) $_POST['type'], trim($_POST['phone']), trim($_POST['note']));
    if ($cPhone->phoneFieldValidate()) {
        $model = new PhoneNumberPDO();
        if (isset($_GET['action']) && $_GET['action'] === 'create') {
            $model->create($cPhone);
            header("Location: ../profile.php?id=" . $_POST['personId']);
        }
        if (isset($_GET['action']) && $_GET['action'] === 'update') {
            $model->updateById($cPhone);
            header("Location: ../profile.php?id=" . $_POST['personId']);
        }
    } elseif ($_GET['action'] === 'update') {
        header("Location: ../phonenumber.php?id={$_POST['personId']}&action=update&validate=error&update={$_POST['phoneId']}");
    } else {
        header("Location: ../phonenumber.php?id={$_POST['personId']}&validate=error");
    }