Skip to content

Commit

Permalink
DateTime: Remove global and user formattings
Browse files Browse the repository at this point in the history
refs #6077
  • Loading branch information
mxhash committed Sep 4, 2014
1 parent 6739034 commit 6fcf5ec
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 32 deletions.
13 changes: 4 additions & 9 deletions application/views/helpers/DateFormat.php
Expand Up @@ -3,7 +3,6 @@
// {{{ICINGA_LICENSE_HEADER}}}

use Icinga\Application\Icinga;
use Icinga\Application\Config;
use Icinga\Util\DateTimeFactory;
use Icinga\Web\Form\Validator\DateTimeValidator;

Expand Down Expand Up @@ -109,10 +108,8 @@ public function formatDateTime($timestamp)
*/
public function getDateFormat()
{
return $this->request->getUser()->getPreferences()->get(
'app.dateFormat',
Config::app()->global !== null ? Config::app()->global->get('dateFormat', 'd/m/Y') : 'd/m/Y'
);
// TODO(mh): Missing localized format (#6077)
return 'd/m/Y';
}

/**
Expand All @@ -122,10 +119,8 @@ public function getDateFormat()
*/
public function getTimeFormat()
{
return $this->request->getUser()->getPreferences()->get(
'app.timeFormat',
Config::app()->global !== null ? Config::app()->global->get('timeFormat', 'g:i A') : 'g:i A'
);
// TODO(mh): Missing localized format (#6077)
return 'g:i A';
}

/**
Expand Down
2 changes: 0 additions & 2 deletions config/config.ini.in
@@ -1,7 +1,5 @@
[global]
timezone = "Europe/Berlin"
dateFormat = "d/m/Y"
timeFormat = "g:i A"

; Contains the directories that will be searched for available modules. Modules that
; don't exist in these directories can still be symlinked in the module folder, but
Expand Down
Expand Up @@ -278,9 +278,8 @@ private function getGlobalConfiguration()
*/
private function getTimeFormat()
{
$globalConfig = $this->getGlobalConfiguration();
$preferences = $this->getRequest()->getUser()->getPreferences();
return $preferences->get('app.timeFormat', $globalConfig->get('timeFormat', 'g:i A'));
// TODO(mh): Missing localized format (#6077)
return 'g:i A';
}

/**
Expand All @@ -290,8 +289,7 @@ private function getTimeFormat()
*/
private function getDateFormat()
{
$globalConfig = $this->getGlobalConfiguration();
$preferences = $this->getRequest()->getUser()->getPreferences();
return $preferences->get('app.dateFormat', $globalConfig->get('dateFormat', 'd/m/Y'));
// TODO(mh): Missing localized format (#6077)
return 'd/m/Y';
}
}
17 changes: 2 additions & 15 deletions modules/monitoring/application/forms/Command/CommandForm.php
Expand Up @@ -115,21 +115,8 @@ protected function createAuthorField()
*/
public function getValidDateTimeFormats()
{
$config = $this->getConfiguration();
$global = $config->global;
if ($global === null) {
$global = new Zend_Config(array());
}
$preferences = $this->getUserPreferences();
return array(
implode(
' ',
array(
$preferences->get('app.dateFormat', $global->get('dateFormat', 'd/m/Y')),
$preferences->get('app.timeFormat', $global->get('timeFormat', 'g:i A'))
)
)
);
// TODO(mh): Missing localized format (#6077)
return 'd/m/Y g:i A';
}

/**
Expand Down

0 comments on commit 6fcf5ec

Please sign in to comment.