Skip to content
Snippets Groups Projects
Verified Commit 7b503a05 authored by Damien's avatar Damien
Browse files

FEAT #9284 Export Date type

parent 54b36f0a
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,7 @@ use Resource\models\ResourceListModel; ...@@ -24,6 +24,7 @@ use Resource\models\ResourceListModel;
use Respect\Validation\Validator; use Respect\Validation\Validator;
use Slim\Http\Request; use Slim\Http\Request;
use Slim\Http\Response; use Slim\Http\Response;
use SrcCore\models\TextFormatModel;
use SrcCore\models\ValidatorModel; use SrcCore\models\ValidatorModel;
use Tag\models\TagModel; use Tag\models\TagModel;
use User\models\UserModel; use User\models\UserModel;
...@@ -222,9 +223,8 @@ class ExportController ...@@ -222,9 +223,8 @@ class ExportController
$csvContent[] = ExportController::getSignatureDates(['resId' => $resource['res_id']]); $csvContent[] = ExportController::getSignatureDates(['resId' => $resource['res_id']]);
} }
} else { } else {
if (strpos($value['value'], 'date') !== false && !empty($resource[$value['value']])) { if (strpos($value['value'], 'date') !== false) {
$date = new \DateTime($resource[$value['value']]); $csvContent[] = TextFormatModel::formatDate($resource[$value['value']]);
$csvContent[] = $date->format('d-m-Y H:i');
} else { } else {
$csvContent[] = $resource[$value['value']]; $csvContent[] = $resource[$value['value']];
} }
......
...@@ -15,13 +15,19 @@ ...@@ -15,13 +15,19 @@
namespace SrcCore\models; namespace SrcCore\models;
//This model is not customizable
class CoreConfigModel class CoreConfigModel
{ {
public static function getCustomId() public static function getCustomId()
{ {
static $customId = null;
if ($customId !== null) {
return $customId;
}
if (!file_exists('custom/custom.xml') || empty($_SERVER['SCRIPT_NAME']) || empty($_SERVER['SERVER_ADDR'])) { if (!file_exists('custom/custom.xml') || empty($_SERVER['SCRIPT_NAME']) || empty($_SERVER['SERVER_ADDR'])) {
return ''; $customId = '';
return $customId;
} }
$explodeUrl = explode('/', $_SERVER['SCRIPT_NAME']); $explodeUrl = explode('/', $_SERVER['SCRIPT_NAME']);
...@@ -39,15 +45,19 @@ class CoreConfigModel ...@@ -39,15 +45,19 @@ class CoreConfigModel
$xmlfile = simplexml_load_file('custom/custom.xml'); $xmlfile = simplexml_load_file('custom/custom.xml');
foreach ($xmlfile->custom as $value) { foreach ($xmlfile->custom as $value) {
if (!empty($value->path) && $value->path == $path) { if (!empty($value->path) && $value->path == $path) {
return (string)$value->custom_id; $customId = (string)$value->custom_id;
return $customId;
} elseif ($value->ip == $_SERVER['SERVER_ADDR']) { } elseif ($value->ip == $_SERVER['SERVER_ADDR']) {
return (string)$value->custom_id; $customId = (string)$value->custom_id;
return $customId;
} elseif ($value->external_domain == $_SERVER['HTTP_HOST'] || $value->domain == $_SERVER['HTTP_HOST']) { } elseif ($value->external_domain == $_SERVER['HTTP_HOST'] || $value->domain == $_SERVER['HTTP_HOST']) {
return (string)$value->custom_id; $customId = (string)$value->custom_id;
return $customId;
} }
} }
return ''; $customId = '';
return $customId;
} }
public static function getApplicationName() public static function getApplicationName()
......
...@@ -33,20 +33,13 @@ class TextFormatModel ...@@ -33,20 +33,13 @@ class TextFormatModel
public static function formatDate($date) public static function formatDate($date)
{ {
$last_date = ''; if (empty($date)) {
return '';
if (!empty($date)) {
if (strpos($date, " ")) {
$date_ex = explode(" ", $date);
$the_date = explode("-", $date_ex[0]);
$last_date = $the_date[2]."-".$the_date[1]."-".$the_date[0];
} else {
$the_date = explode("-", $date);
$last_date = $the_date[2]."-".$the_date[1]."-".$the_date[0];
}
} }
return $last_date; $date = new \DateTime($date);
return $date->format('d-m-Y H:i');
} }
public static function removeAccent(array $aArgs) public static function removeAccent(array $aArgs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment