Nenhuma correspondência encontrada.
+ Nenhuma correspondência encontrada.
diff --git a/app/components/campo_representantes_digitais.php b/app/components/campo_representantes_digitais.php
index 379871b..3e55ad3 100755
--- a/app/components/campo_representantes_digitais.php
+++ b/app/components/campo_representantes_digitais.php
@@ -75,7 +75,7 @@
-
+
@@ -92,7 +92,7 @@
0) && $vb_pode_editar) : ?>
-
+
> Publicar todos online
+
@@ -390,10 +391,23 @@ class="filepond"
$.get(vs_url_campo_atualizado, function (data, status) {
$("#div_").hide();
- $("#div-image-container").html(data);
+
+ let div = document.createElement('div');
+ let close_btn = document.createElement('button');
+ close_btn.type = 'button';
+ close_btn.classList.add('btn_fechar_imagem');
+ close_btn.classList.add('btn');
+ close_btn.classList.add('btn-outline-primary');
+ close_btn.classList.add('close-media-viewer');
+ close_btn.textContent = "X";
+
+ div.appendChild(close_btn);
+
+ $("#div-image-container").html(div);
+ $("#div-image-container").append(data);
$("#div-image-container").show();
- $("#btn_fechar_imagem").show();
+ $(".btn_fechar_imagem").show();
});
} else if ($(this).hasClass('iframe-viewer')) {
let path = $(this).parent().attr('href');
@@ -404,6 +418,15 @@ class="filepond"
iframe.height = $(window).height() * 0.75;
let div = document.createElement('div');
+ let close_btn = document.createElement('button');
+ close_btn.type = 'button';
+ close_btn.classList.add('btn_fechar_imagem');
+ close_btn.classList.add('btn');
+ close_btn.classList.add('btn-outline-primary');
+ close_btn.classList.add('close-media-viewer');
+ close_btn.textContent = "X";
+
+ div.appendChild(close_btn);
div.appendChild(iframe);
$("#div_").hide();
@@ -414,15 +437,15 @@ class="filepond"
});
$("#div-image-container").show();
- $("#btn_fechar_imagem").show();
+ $(".btn_fechar_imagem").show();
}
});
-$(document).on('click', "#btn_fechar_imagem", function () {
+$(document).on('click', ".btn_fechar_imagem", function () {
$(".container-lg-com-imagem").addClass("container-lg");
$(".container-lg-com-imagem").removeClass("container-lg-com-imagem");
- $(this).hide();
+ $('.btn_fechar_imagem').hide();
$("#div-image-container").hide();
$("#div_").show();
@@ -621,6 +644,12 @@ function atualizar_campo_() {
?>
3 ? "LIKE" : "LIKERIGHT"];
+ $va_termo_busca[$vs_procurar_por] = [$vs_termo, strlen($vs_termo) > 3 ? $vs_operador : "LIKERIGHT"];
$va_termo_busca = array_merge($va_termo_busca, $_GET);
$vo_objeto_tela = new $vs_id_objeto_tela;
diff --git a/app/functions/download.php b/app/functions/download.php
new file mode 100644
index 0000000..7650a90
--- /dev/null
+++ b/app/functions/download.php
@@ -0,0 +1,77 @@
+ler($pn_objeto_codigo, "ficha");
+
+
+if ($vs_tipo_rd == "representante_digital_codigo" || $vs_tipo_rd == "arquivo_download_codigo")
+{
+ $va_files = $va_objeto[$vs_tipo_rd];
+}
+else
+{
+ send_not_found_response();
+}
+
+$vs_identificador = $va_objeto['item_acervo_identificador'];
+$vs_temp_dir = config::get(["pasta_media", "temp"]);
+$vs_zip_path = $vs_temp_dir . $vs_identificador . "_" . str_replace("_codigo", "", $vs_tipo_rd) . ".zip";
+
+$zip = new ZipArchive();
+if (!is_writable($vs_temp_dir) || $zip->open($vs_zip_path, ZipArchive::CREATE) !== true)
+{
+ send_not_found_response();
+}
+
+$counter = 1;
+foreach ($va_files as $va_rd)
+{
+ $ps_size = 'original';
+ if ($va_rd['representante_digital_formato'] != "pdf")
+ {
+ $ps_size = 'large';
+ }
+ $vs_file_path = get_file_path($va_rd['representante_digital_path'], $ps_size);
+ if (file_exists($vs_file_path))
+ {
+ $zip->addFile($vs_file_path, $vs_identificador . "-$counter." . pathinfo($vs_file_path, PATHINFO_EXTENSION));
+ $counter++;
+ }
+}
+
+if ($zip->numFiles > 0 && $zip->close())
+{
+ send_file_response($vs_zip_path, pb_force_download: true, pb_unlink_afterwards: true);
+}
+else
+{
+ send_not_found_response();
+}
diff --git a/app/functions/file_handler.php b/app/functions/file_handler.php
new file mode 100644
index 0000000..cd77dab
--- /dev/null
+++ b/app/functions/file_handler.php
@@ -0,0 +1,98 @@
+ 100000000))
+ {
+ if (trim($ps_download_file_name) != "")
+ $vs_ext = strtolower(pathinfo($ps_file_path, PATHINFO_EXTENSION));
+
+ header("Content-Disposition: attachment; filename=" . ((trim($ps_download_file_name) != "") ? trim($ps_download_file_name) . "." . $vs_ext : basename($ps_file_path)));
+ header('Content-Description: File Transfer');
+ header('Expires: 0');
+ header('Cache-Control: must-revalidate');
+ }
+
+ if (ob_get_level())
+ {
+ ob_end_clean();
+ }
+
+ readfile($ps_file_path);
+
+ if($pb_unlink_afterwards)
+ {
+ unlink($ps_file_path);
+ }
+
+ exit;
+}
\ No newline at end of file
diff --git a/app/functions/montar_listagem.php b/app/functions/montar_listagem.php
index bbf1e71..922503f 100644
--- a/app/functions/montar_listagem.php
+++ b/app/functions/montar_listagem.php
@@ -206,6 +206,9 @@
else
$vn_numero_registros_lista = $vn_numero_registros;
+ $va_objetos_primeiro_lista = $vo_objeto->ler_lista($va_parametros_filtros_consulta, $vs_visualizacao, 1, 1, $vn_ordenacao, $vs_ordem, $va_log_info, 1, $vb_retornar_ramos_inferiores ?? true);
+ $va_objetos_ultimo_lista = $vo_objeto->ler_lista($va_parametros_filtros_consulta, $vs_visualizacao, $vn_numero_registros, 1, $vn_ordenacao, $vs_ordem, $va_log_info, 1, $vb_retornar_ramos_inferiores ?? true);
+
$va_objetos_lista = $vo_objeto->ler_lista($va_parametros_filtros_consulta, $vs_visualizacao, $vn_primeiro_registro, $vn_numero_registros_lista, $vn_ordenacao, $vs_ordem, $va_log_info, 1, $vb_retornar_ramos_inferiores ?? true);
if ($vs_formato_listagem == "default")
@@ -402,6 +405,8 @@
}
}
+ $_SESSION[$vs_id_objeto_tela]["codigo_primeiro_lista"] = $va_objetos_primeiro_lista[0][$vo_objeto->get_chave_primaria()[0]];
+ $_SESSION[$vs_id_objeto_tela]["codigo_ultimo_lista"] = $va_objetos_ultimo_lista[0][$vo_objeto->get_chave_primaria()[0]];
$_SESSION[$vs_id_objeto_tela]["listagem_codigos"] = $va_itens_listagem_codigos;
}
}
diff --git a/app/functions/serve_file.php b/app/functions/serve_file.php
index 747512b..c9c8def 100644
--- a/app/functions/serve_file.php
+++ b/app/functions/serve_file.php
@@ -5,6 +5,8 @@
require_once dirname(__FILE__) . "/../../autoload.php";
}
+require_once dirname(__FILE__) . "/file_handler.php";
+
if (!isset($vb_ignorar_autenticacao))
{
session::start_session();
@@ -30,106 +32,4 @@
send_not_found_response();
}
-send_file_response($vs_file_path, $vb_force_download, $vs_download_file_name);
-
-function get_file_path($ps_file, $ps_size = null, $ps_folder = null): string
-{
- $vs_ext = strtolower(pathinfo($ps_file, PATHINFO_EXTENSION));
- $vs_folder = $ps_folder ?? utils::get_media_folder($vs_ext);
-
- if ($vs_folder == "")
- {
- return "";
- }
-
- if ($vs_folder != "images")
- {
- $vs_file_path = config::get(["pasta_media", $vs_folder]) . $ps_file;
- if (file_exists($vs_file_path))
- {
- return $vs_file_path;
- }
- }
-
- return get_image_path($ps_file, $ps_size);
-}
-
-function get_image_path($ps_file, $ps_size = null): string
-{
-
- $va_pasta_images = config::get(["pasta_media", "images"]);
- krsort($va_pasta_images);
- $vs_file_path = "";
-
- if (strpos($ps_file, ".pdf") !== false && $ps_size != "original")
- {
- $ps_file = str_replace(".pdf", ".jpg", $ps_file);
- }
-
- if ($ps_size)
- {
- $vs_file_path = $va_pasta_images[$ps_size] . $ps_file;
- if (file_exists($vs_file_path))
- {
- return $vs_file_path;
- }
- }
-
- foreach ($va_pasta_images as $vs_pasta)
- {
- $vs_file_path = $vs_pasta . $ps_file;
-
- if (file_exists($vs_file_path))
- {
- return $vs_file_path;
- }
- }
-
- return $vs_file_path;
-}
-
-function send_not_found_response() : void
-{
- header("HTTP/1.0 404 Not Found");
- exit;
-}
-
-function send_file_response($ps_file_path, $pb_force_download = false, $ps_download_file_name = "") : void
-{
- set_time_limit(0);
- ob_implicit_flush(1);
-
- $vs_content_type = mime_content_type($ps_file_path);
- header("Content-Type: " . $vs_content_type);
- header("Content-Length: " . filesize($ps_file_path));
-
- if ($pb_force_download || (strpos($ps_file_path, "/temp/") !== false && filesize($ps_file_path) > 100000000))
- {
- if (trim($ps_download_file_name) != "")
- $vs_ext = strtolower(pathinfo($ps_file_path, PATHINFO_EXTENSION));
-
- header("Content-Disposition: attachment; filename=" . ((trim($ps_download_file_name) != "") ? trim($ps_download_file_name) . "." . $vs_ext : basename($ps_file_path)));
- header('Content-Description: File Transfer');
- header('Expires: 0');
- header('Cache-Control: must-revalidate');
- }
-
- if (ob_get_level())
- {
- ob_end_clean();
- }
-
- readfile($ps_file_path);
-
- exit;
-}
-
-
-
-
-
-
-
-
-
-
+send_file_response($vs_file_path, $vb_force_download, $vs_download_file_name);
\ No newline at end of file
diff --git a/config/settings.php b/config/settings.php
index 86c3b88..f0cf23f 100644
--- a/config/settings.php
+++ b/config/settings.php
@@ -32,6 +32,9 @@
# Tamanho do logo na página de login
"logo_class" => "w-75",
+ # Mensagem que aparece para datas marcadas como "sem data"
+ "data_indisponivel" => "[s.d.]",
+
# ================================================ MENU LATERAL ================================================ #
# O menu lateral é composto por 3 seções padrões: institucional, permissões e configurações.
diff --git a/src/lib/system/objeto_base.php b/src/lib/system/objeto_base.php
index 60f9476..b75294f 100755
--- a/src/lib/system/objeto_base.php
+++ b/src/lib/system/objeto_base.php
@@ -983,10 +983,10 @@ private function montar_filtros_busca($pa_filtros_busca, $po_objeto, &$pa_joins_
$vo_data->set_ano_inicial($pa_filtros_busca[$vs_parametro_nome . "_ano_inicial"]);
if (isset($pa_filtros_busca[$vs_parametro_nome . "_dia_final"]))
- $vo_data->set_dia_final($pa_filtros_busca[$vs_parametro_nome . "_dia_final"][0]);
+ $vo_data->set_dia_final($pa_filtros_busca[$vs_parametro_nome . "_dia_final"]);
if (isset($pa_filtros_busca[$vs_parametro_nome . "_mes_final"]))
- $vo_data->set_mes_final($pa_filtros_busca[$vs_parametro_nome . "_mes_final"][0]);
+ $vo_data->set_mes_final($pa_filtros_busca[$vs_parametro_nome . "_mes_final"]);
if (isset($pa_filtros_busca[$vs_parametro_nome . "_ano_final"]))
$vo_data->set_ano_final($pa_filtros_busca[$vs_parametro_nome . "_ano_final"]);
diff --git a/src/lib/system/periodo.php b/src/lib/system/periodo.php
index 69fba6a..f9bab95 100755
--- a/src/lib/system/periodo.php
+++ b/src/lib/system/periodo.php
@@ -595,7 +595,7 @@ public function get_data_exibicao($ps_separador='')
{
$vs_data_exibicao = "";
if ($this->get_sem_data())
- return "[s.d.]";
+ return !empty(config::get(["data_indisponivel"])) ? config::get(["data_indisponivel"]) : "[s.d.]";
if ($this->get_data_inicial() == $this->get_data_final())
$vs_data_exibicao = $this->get_data_inicial_barra($ps_separador);
@@ -748,7 +748,7 @@ public function tratar_string($ps_data)
$this->set_presumido(1);
}
- if (in_array($vs_data, ["s.d.", "s.d", "sd", "s/d"]))
+ if (!empty(config::get(["data_indisponivel"])) && config::get(["data_indisponivel"]) == $vs_data || in_array($vs_data, ["s.d.", "s.d", "sd", "s/d"]))
{
$this->set_sem_data(1);
}