50 lines
1.0 KiB
PHP
50 lines
1.0 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
require_once($_SERVER['DOCUMENT_ROOT']."/ajax/vue_php_function.php");
|
||
|
|
|
||
|
|
error_reporting(E_ALL | E_STRICT);
|
||
|
|
ini_set('display_errors', 1);
|
||
|
|
|
||
|
|
$data = json_decode(file_get_contents("php://input"));
|
||
|
|
|
||
|
|
$pdo = new MysqlPdo(hst, ndb, user, pass);
|
||
|
|
|
||
|
|
$sql = "SET NAMES 'utf8'";
|
||
|
|
|
||
|
|
$pdo->query($sql);
|
||
|
|
|
||
|
|
$log = "";
|
||
|
|
$request = $data->request;
|
||
|
|
|
||
|
|
//Дополнительные поля
|
||
|
|
if($request == 'get_client_fields'){
|
||
|
|
$agency_id = (int)$data->agency_id;
|
||
|
|
$client_id = (int)$data->client_id;
|
||
|
|
$user_id = 0;
|
||
|
|
if(isset($data->user_id)){
|
||
|
|
$user_id = (int)$data->user_id;
|
||
|
|
}
|
||
|
|
|
||
|
|
if($user_id == 0){
|
||
|
|
$user_id = (int)$_SESSION['id'];
|
||
|
|
}
|
||
|
|
|
||
|
|
$fields = new Fields($pdo);
|
||
|
|
$res = $fields->get_client_fields($agency_id, $client_id, $user_id);
|
||
|
|
echo json_encode($res);
|
||
|
|
exit();
|
||
|
|
}
|
||
|
|
|
||
|
|
if($request == 'add_edit') {
|
||
|
|
|
||
|
|
$client_id = (int)$data->client_id;
|
||
|
|
$field_models = $data->field_models;
|
||
|
|
|
||
|
|
$fields = new Fields($pdo);
|
||
|
|
$result = $fields->add_edit($field_models, $client_id);
|
||
|
|
|
||
|
|
//echo json_encode($result);
|
||
|
|
exit();
|
||
|
|
}
|
||
|
|
|
||
|
|
?>
|