mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
105 lines
2.8 KiB
PHP
105 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Sistema;
|
|
|
|
use CodeIgniter\Controller;
|
|
|
|
class Intranet extends Controller
|
|
{
|
|
|
|
function presupuestos($resource_name)
|
|
{
|
|
helper('file');
|
|
|
|
$resource_path = WRITEPATH . 'uploads/presupuestos/' . $resource_name;
|
|
|
|
if (file_exists($resource_path)) {
|
|
// Get the mime type of the file
|
|
$mime_type = mime_content_type($resource_path);
|
|
|
|
// Get an instance of the Response class
|
|
$response = service('response');
|
|
|
|
// Set the content type
|
|
$response->setContentType($mime_type);
|
|
|
|
// Set the output
|
|
$response->setBody(file_get_contents($resource_path));
|
|
|
|
// Send the response to the browser
|
|
$response->send();
|
|
}
|
|
|
|
}
|
|
|
|
function tickets($resource_name)
|
|
{
|
|
helper('file');
|
|
|
|
$resource_path = WRITEPATH . 'uploads/tickets/' . $resource_name;
|
|
|
|
if (file_exists($resource_path)) {
|
|
// Get the mime type of the file
|
|
$mime_type = mime_content_type($resource_path);
|
|
|
|
// Get an instance of the Response class
|
|
$response = service('response');
|
|
|
|
// Set the content type
|
|
$response->setContentType($mime_type);
|
|
|
|
// Set the output
|
|
$response->setBody(file_get_contents($resource_path));
|
|
|
|
// Send the response to the browser
|
|
$response->send();
|
|
}
|
|
|
|
}
|
|
function orden_trabajo($ot_id, $resource_name)
|
|
{
|
|
helper('file');
|
|
$resource_path = WRITEPATH . 'uploads/orden_trabajo/' . $ot_id . '/' . $resource_name;
|
|
if (file_exists($resource_path)) {
|
|
// Get the mime type of the file
|
|
$mime_type = mime_content_type($resource_path);
|
|
|
|
// Get an instance of the Response class
|
|
$response = service('response');
|
|
|
|
// Set the content type
|
|
$response->setContentType($mime_type);
|
|
|
|
// Set the output
|
|
$response->setBody(file_get_contents($resource_path));
|
|
|
|
// Send the response to the browser
|
|
$response->send();
|
|
}
|
|
|
|
}
|
|
|
|
function catalogo($catalogo_id, $resource_name)
|
|
{
|
|
helper('file');
|
|
$resource_path = WRITEPATH . 'uploads/catalogo/' . $catalogo_id . '/' . $resource_name;
|
|
if (file_exists($resource_path)) {
|
|
// Get the mime type of the file
|
|
$mime_type = mime_content_type($resource_path);
|
|
|
|
// Get an instance of the Response class
|
|
$response = service('response');
|
|
|
|
// Set the content type
|
|
$response->setContentType($mime_type);
|
|
|
|
// Set the output
|
|
$response->setBody(file_get_contents($resource_path));
|
|
|
|
// Send the response to the browser
|
|
$response->send();
|
|
}
|
|
|
|
}
|
|
|
|
} |