This commit is contained in:
Билай Станислав 2024-05-21 17:06:42 +03:00
parent 8254407aae
commit 44f11cbb1d
8 changed files with 95 additions and 102 deletions

View File

@ -1,10 +1,11 @@
Билай Станислав Романович; 2002-03-11; Мужчина; +79493761924; stasbilay02@yandex.ru; Билай;Станислав;Романович;2002-03-11;Мужчина;+7;9493761924;stasbilay02@yandex.ru;
Иванов Иван Иванович; 2002-03-11; Мужчина; +71111111111; dsjgbdskgb@yandex.ru; Иванов;Иван;Иванович;2002-03-11;Мужчина;+7;1111111111;dsjgbdskgb@yandex.ru;
Иванова Мария Сергеевна; 2002-04-05; Женжина; +382222222222; sdguhnlnoih@gmail.com; Иванова;Мария;Сергеевна;2002-04-05;Женжина;+38;2222222222;sdguhnlnoih@gmail.com;
Плешкова Анастасия Денисовна; 2006-11-10; Женжина; +73333333333; ple.anastasiya@gmail.com; Плешкова;Анастасия;Денисовна;2006-11-10;Женжина;+7;3333333333;ple.anastasiya@gmail.com;
Зайцева Анжела Игоревна; 1998-12-12; Женжина; +74444444444; aksjfhfka@mail.ru; Зайцева;Анжела;Игоревна;1998-12-12;Женжина;+7;4444444444;aksjfhfka@mail.ru;
Петров Петр Петрович; 1987-03-02; Мужчина; +77777777777; jksghhsdkj@gmail.com; Петров;Петр;Петрович;1987-03-02;Мужчина;+7;7777777777;jksghhsdkj@gmail.com;
Зайцев Федор Александрович; 2014-12-22; Мужчина; +76667774441; asert@mail.ru; Зайцев;Федор;Александрович;2014-12-22;Мужчина;+7;6667774441;asert@mail.ru;
Билай Станислав Романович;1111-11-11;Мужчина;+79493761924;stasbilay02@yandex.ru; Билай;Станислав;Романович;1111-11-11;Мужчина;+7;9493761924;stasbilay02@yandex.ru;
Плешкова Анастасия Денисовна;1111-11-11;Мужчина;+73333333333;ple.anastasiya@gmail.com; Плешкова;Анастасия;Денисовна;1111-11-11;Мужчина;+7;3333333333;ple.anastasiya@gmail.com;
Зайцев Федор Александрович;1234-12-12;Мужчина;+76667774441;asert@mail.ru; Зайцев;Федор;Александрович;1234-12-12;Мужчина;+7;6667774441;asert@mail.ru;
Билай;Станислав;Романович;1111-11-11;Мужчина;+38;9493761924;stasbilay02@yandex.ru

View File

@ -1,9 +1,11 @@
<?php $form = '<form action="info.php" target="_blank" method="post"> <?php $form = '<form action="info.php" target="_blank" method="post">
Фамилия: <br> Фамилия:<br>
<input type = "text" name = "surname" required size="50" autofocus placeholder="Фамилия"> <br> <br> <input type = "text" name = "surname" required size="50" autofocus placeholder="Фамилия"> <br> <br>
Имя: <br>
Имя:<br>
<input type = "text" name = "name" required size="50" placeholder="Имя"> <br> <br> <input type = "text" name = "name" required size="50" placeholder="Имя"> <br> <br>
Отчество (если есть): <br>
Отчество (если есть):<br>
<input type = "text" name = "patronymic" size="50" placeholder="Отчество"> <br> <br> <input type = "text" name = "patronymic" size="50" placeholder="Отчество"> <br> <br>
Дата Рождения: <br> Дата Рождения: <br>

View File

@ -2,40 +2,22 @@
namespace src; namespace src;
use AdditionallyInfo;
use Contacts;
use FullName;
use Information; use Information;
require_once "src/Information.php"; require_once "src/Information.php";
require_once "src/FullName.php";
require_once "src/Contacts.php";
require_once "src/AdditionallyInfo.php";
$surname = $_REQUEST["surname"]; $fileName = "Information.txt";
$name = $_REQUEST["name"]; $fileModeOpen = "a";
$patronymic = $_REQUEST["patronymic"];
$fullName = new FullName($surname, $name, $patronymic); $fullInformation = new Information();
$fullName = $fullName->getFoolName(); $fullInformation->load($_REQUEST);
$gender = $_REQUEST["gender"]; echo "<pre>";
$dateOfBirth = $_REQUEST["dateOfBirth"]; print_r($fullInformation);
$string = $fullInformation->toString();
$additionallyInfo = new AdditionallyInfo($dateOfBirth, $gender); $file = fopen($fileName, $fileModeOpen);
$additionallyInfo = $additionallyInfo->getAdditionallyInfo(); fwrite($file, $string);
$countryCode = $_REQUEST["countryCode"];
$phoneNumber = $_REQUEST["phoneNumber"];
$email = $_REQUEST["email"];
$contacts = new Contacts($countryCode, $phoneNumber, $email);
$contacts = $contacts->getContacts();
$fullInformation = new Information($fullName, $additionallyInfo, $contacts);
$fullInformation = $fullInformation->getFullInformation();
$file = fopen("Information.txt", "a");
fwrite($file, $fullInformation);
fclose($file); fclose($file);
require "table.php"; require "table.php";

View File

@ -1,14 +0,0 @@
<?php
class AdditionallyInfo
{
public $bDay;
public $gender;
public function __construct($bDay, $gender) {
$this->bDay = $bDay;
$this->gender = $gender;
}
public function getAdditionallyInfo() {
return $this->bDay . ";" . $this->gender;
}
}

View File

@ -1,17 +0,0 @@
<?php
class Contacts
{
public $countryCode;
public $phoneNumber;
public $email;
public function __construct($countryCode, $phoneNumber, $email){
$this->countryCode = $countryCode;
$this->phoneNumber = $phoneNumber;
$this->email = $email;
}
public function getContacts(){
return $this->countryCode . $this->phoneNumber . ";" . $this->email;
}
}

View File

@ -1,19 +0,0 @@
<?php
class FullName
{
public $surname;
public $name;
public $patronymic;
public function __construct($surname, $name, $patronymic)
{
$this->surname = $surname;
$this->name = $name;
$this->patronymic = $patronymic;
}
public function getFoolName()
{
return $this->surname . ' ' . $this->name . ' ' . $this->patronymic;
}
}

View File

@ -1,22 +1,77 @@
<?php <?php
/**
* @property string $surname
* @property string $name
* @property string $patronymic
* @property string $dateOfBirth
* @property string $gender
* @property string $countryCode
* @property string $phoneNumber
* @property string $email
*/
class Information class Information
{ {
public $foolName; public string $surname;
public $additionallyInfo; public string $name;
public $contacts; public string $patronymic;
public string $dateOfBirth;
public string $gender;
public string $countryCode;
public string $phoneNumber;
public string $email;
public function __construct($foolName, $additionallyInfo, $contacts) //public $gender;
public function __construct()
{ {
$this->foolName = $foolName;
$this->additionallyInfo = $additionallyInfo;
$this->contacts = $contacts;
} }
public function getFullInformation() /**
* @param array $dataArray
* @return void
*/
public function load(array $dataArray): void
{ {
return $this->foolName . ";" . $this->additionallyInfo . ";" . $this->contacts . ";\n"; if ($dataArray) {
$this->surname = $dataArray['surname'] ?? '';
$this->name = $dataArray['name'] ?? '';
$this->patronymic = $dataArray['patronymic'] ?? '';
$this->dateOfBirth = $dataArray['dateOfBirth'] ?? '';
$this->gender = $dataArray['gender'] ?? '';
$this->countryCode = $dataArray['countryCode'] ?? '';
$this->phoneNumber = $dataArray['phoneNumber'] ?? '';
$this->email = $dataArray['email'] ?? '';
}
}
/**
* @param string $key
* @return string|null
*/
public function getByKey(string $key): ?string
{
if (isset($this->{$key})) {
return $this->{$key};
}
return null;
}
/**
* @return string
*/
public function toString(): string
{
return $this->surname . ';' . $this->name . ';' . $this->patronymic . ';' . $this->dateOfBirth . ';' .
$this->gender . ';' . $this->countryCode . ';' . $this->phoneNumber . ';' . $this->email . "\n";
}
public function search()
{
} }
} }

View File

@ -38,9 +38,12 @@
<caption>Инфрмацмонная таблица </caption> <caption>Инфрмацмонная таблица </caption>
<table style="width: 100%"> <table style="width: 100%">
<tr> <tr>
<th>ФИО</th> <th>Фамилия</th>
<th>Имя</th>
<th>Отчество</th>
<th>Дата рождения</th> <th>Дата рождения</th>
<th>Пол</th> <th>Пол</th>
<th>Код страны</th>
<th>Номер Телефона</th> <th>Номер Телефона</th>
<th>Email</th> <th>Email</th>
</tr> </tr>