FormClasses/search.php
2024-06-14 15:55:36 +03:00

41 lines
952 B
PHP

<?php
use src\debug\Debug;
use src\Information;
use src\Processing;
require_once "vendor/autoload.php";
$rep = new \src\file_db_driver\FileDatabaseDriver();
$rep->connect(__DIR__ . "/Information.txt");
$columnKeys = $rep->getHeadKeys();
$columnValues = $rep->getHeadValues();
$columns = array_combine($columnKeys, $columnValues);
//$res = $rep->find([$_REQUEST['key'] => $_REQUEST['result_search']])->limit(7)->all();
//$fooArr = [
// 'surname' => 'Билай',
// 'dateOfBirth' => '4444-04-04',
// 'status' => '1',
// 'gender' => 'Мужчина'
//];
//Debug::dd($_REQUEST);
$res = $rep->find($_REQUEST)->limit(10)->all();
$rep->close();
$infArr = [];
foreach ($res as $key){
$inf = new Information();
$inf->load($key);
$infArr[] = $inf;
}
$json = new Processing();
$infArr = $json->createJsonArray($columns, $infArr, "form1");
$table = new \Itguild\Tables\ListJsonTable($infArr);
$table->create();
$table->render();