nativegallery/app/Controllers/Api/Admin/GetVehicleInputs.php

30 lines
861 B
PHP
Raw Normal View History

2024-10-06 23:03:55 +03:00
<?php
namespace App\Controllers\Api\Admin;
use App\Services\{Auth, Router, GenerateRandomStr, DB, Json, EXIF};
use App\Models\{User, Vote, Photo};
class GetVehicleInputs
{
public function __construct()
{
$id = explode('/', $_SERVER['REQUEST_URI'])[4];
2024-10-08 21:42:55 +03:00
$vehicle = DB::query('SELECT * FROM entities WHERE id=:id', array(':id' => $id))[0];
2024-10-06 23:03:55 +03:00
$data = json_decode($vehicle['sampledata'], true);
foreach ($data as $d) {
2024-10-08 21:42:55 +03:00
if ($d['important'] === "1") {
$imp = 'required';
}
2024-10-06 23:03:55 +03:00
echo '
<div class="mb-3">
2024-10-08 21:42:55 +03:00
<label for="exampleFormControlInput1" class="form-label">' . $d['name'] . '</label>
<input type="text" name="title" class="form-control" id="exampleFormControlInput1" placeholder="'.$d['name'].'" '.$imp.'>
2024-10-06 23:03:55 +03:00
</div>';
}
}
}