Merge branch 'master' of https://github.com/thelia/thelia into coupon
# By Manuel Raynaud (19) and others # Via Manuel Raynaud (5) and others * 'master' of https://github.com/thelia/thelia: (37 commits) add PropelDataCollector to debugbar, still missing some informations remove unused class integrate debugbar module remove htmlpurifier modify insert.sql including debugBar module add new event and new tag Started category modification Factorized modal dialogs javascript Factorized creation and confirmation modal dialogs create controller adding delivery module in session create Delivery loop Working : Continuing categories administration... Working : create base loop for delivery and payment entities remove htmlpurifier dependency country id can be an argument for calculate method Working : Working : fix typo ... Conflicts: composer.lock core/lib/Thelia/Controller/Admin/CategoryController.php templates/admin/default/assets/less/thelia/variables.less
This commit is contained in:
66
core/lib/Thelia/Tools/DateTimeFormat.php
Executable file
66
core/lib/Thelia/Tools/DateTimeFormat.php
Executable file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program is free software; you can redistribute it and/or modify */
|
||||
/* it under the terms of the GNU General Public License as published by */
|
||||
/* the Free Software Foundation; either version 3 of the License */
|
||||
/* */
|
||||
/* This program is distributed in the hope that it will be useful, */
|
||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||
/* GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public License */
|
||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tools;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
class DateTimeFormat
|
||||
{
|
||||
protected $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public static function getInstance(Request $request)
|
||||
{
|
||||
return new DateTimeFormat($request);
|
||||
}
|
||||
|
||||
public function getFormat($output = null)
|
||||
{
|
||||
$lang = $this->request->getSession()->getLang();
|
||||
|
||||
$format = null;
|
||||
|
||||
if($lang) {
|
||||
switch ($output) {
|
||||
case "date" :
|
||||
$format = $lang->getDateFormat();
|
||||
break;
|
||||
case "time" :
|
||||
$format = $lang->getTimeFormat();
|
||||
break;
|
||||
default:
|
||||
case "datetime" :
|
||||
$format = $lang->getDateTimeFormat();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $format;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user