Replace all date fields by helper

This commit is contained in:
Frederic Guillot 2016-08-31 21:21:09 -04:00
parent 3861e90336
commit 0cb717f440
No known key found for this signature in database
GPG Key ID: 92D77191BA7FBC99
9 changed files with 17 additions and 44 deletions

View File

@ -31,8 +31,6 @@ class AnalyticController extends BaseController
'project' => $project,
'average' => $this->averageLeadCycleTimeAnalytic->build($project['id']),
'metrics' => $this->projectDailyStatsModel->getRawMetrics($project['id'], $from, $to),
'date_format' => $this->configModel->get('application_date_format'),
'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
'title' => t('Lead and cycle time'),
)));
}
@ -155,8 +153,6 @@ class AnalyticController extends BaseController
'display_graph' => $display_graph,
'metrics' => $display_graph ? $this->projectDailyColumnStatsModel->getAggregatedMetrics($project['id'], $from, $to, $column) : array(),
'project' => $project,
'date_format' => $this->configModel->get('application_date_format'),
'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
'title' => $title,
)));
}
@ -169,8 +165,8 @@ class AnalyticController extends BaseController
$to = $this->request->getStringParam('to', date('Y-m-d'));
if (! empty($values)) {
$from = $values['from'];
$to = $values['to'];
$from = $this->dateParser->getIsoDate($values['from']);
$to = $this->dateParser->getIsoDate($values['to']);
}
return array($from, $to);

View File

@ -42,8 +42,6 @@ class ExportController extends BaseController
'to' => $to,
),
'errors' => array(),
'date_format' => $this->configModel->get('application_date_format'),
'date_formats' => $this->dateParser->getAvailableFormats($this->dateParser->getDateFormats()),
'project' => $project,
'title' => $page_title,
), 'export/sidebar'));

View File

@ -17,13 +17,11 @@
<?= $this->form->csrf() ?>
<div class="form-inline-group">
<?= $this->form->label(t('Start Date'), 'from') ?>
<?= $this->form->text('from', $values, array(), array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->date(t('Start date'), 'from', $values) ?>
</div>
<div class="form-inline-group">
<?= $this->form->label(t('End Date'), 'to') ?>
<?= $this->form->text('to', $values, array(), array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->date(t('End date'), 'to', $values) ?>
</div>
<div class="form-inline-group">

View File

@ -17,13 +17,11 @@
<?= $this->form->csrf() ?>
<div class="form-inline-group">
<?= $this->form->label(t('Start Date'), 'from') ?>
<?= $this->form->text('from', $values, array(), array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->date(t('Start date'), 'from', $values) ?>
</div>
<div class="form-inline-group">
<?= $this->form->label(t('End Date'), 'to') ?>
<?= $this->form->text('to', $values, array(), array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->date(t('End date'), 'to', $values) ?>
</div>
<div class="form-inline-group">

View File

@ -21,13 +21,11 @@
<?= $this->form->csrf() ?>
<div class="form-inline-group">
<?= $this->form->label(t('Start Date'), 'from') ?>
<?= $this->form->text('from', $values, array(), array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->date(t('Start date'), 'from', $values) ?>
</div>
<div class="form-inline-group">
<?= $this->form->label(t('End Date'), 'to') ?>
<?= $this->form->text('to', $values, array(), array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->date(t('End date'), 'to', $values) ?>
</div>
<div class="form-inline-group">

View File

@ -9,12 +9,8 @@
<?= $this->form->hidden('controller', $values) ?>
<?= $this->form->hidden('action', $values) ?>
<?= $this->form->hidden('project_id', $values) ?>
<?= $this->form->label(t('Start Date'), 'from') ?>
<?= $this->form->text('from', $values, $errors, array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->label(t('End Date'), 'to') ?>
<?= $this->form->text('to', $values, $errors, array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->date(t('Start date'), 'from', $values) ?>
<?= $this->form->date(t('End date'), 'to', $values) ?>
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>

View File

@ -5,16 +5,12 @@
<p class="alert alert-info"><?= t('This export contains the number of tasks per column grouped per day.') ?></p>
<form method="get" action="?" autocomplete="off">
<?= $this->form->hidden('controller', $values) ?>
<?= $this->form->hidden('action', $values) ?>
<?= $this->form->hidden('project_id', $values) ?>
<?= $this->form->label(t('Start Date'), 'from') ?>
<?= $this->form->text('from', $values, $errors, array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->label(t('End Date'), 'to') ?>
<?= $this->form->text('to', $values, $errors, array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->date(t('Start date'), 'from', $values) ?>
<?= $this->form->date(t('End date'), 'to', $values) ?>
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>

View File

@ -5,16 +5,12 @@
<p class="alert alert-info"><?= t('This report contains all tasks information for the given date range.') ?></p>
<form method="get" action="?" autocomplete="off">
<?= $this->form->hidden('controller', $values) ?>
<?= $this->form->hidden('action', $values) ?>
<?= $this->form->hidden('project_id', $values) ?>
<?= $this->form->label(t('Start Date'), 'from') ?>
<?= $this->form->text('from', $values, $errors, array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->label(t('End Date'), 'to') ?>
<?= $this->form->text('to', $values, $errors, array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->date(t('Start date'), 'from', $values) ?>
<?= $this->form->date(t('End date'), 'to', $values) ?>
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>

View File

@ -10,15 +10,12 @@
<?= $this->form->hidden('action', $values) ?>
<?= $this->form->hidden('project_id', $values) ?>
<?= $this->form->label(t('Start Date'), 'from') ?>
<?= $this->form->text('from', $values, $errors, array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->label(t('End Date'), 'to') ?>
<?= $this->form->text('to', $values, $errors, array('required', 'placeholder="'.$this->text->in($date_format, $date_formats).'"'), 'form-date') ?>
<?= $this->form->date(t('Start date'), 'from', $values) ?>
<?= $this->form->date(t('End date'), 'to', $values) ?>
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>
<div class="form-actions">
<button type="submit" class="btn btn-blue"><?= t('Execute') ?></button>
</div>
</form>
</form>