summaryrefslogtreecommitdiff
path: root/app/Helper
diff options
context:
space:
mode:
Diffstat (limited to 'app/Helper')
-rw-r--r--app/Helper/FormHelper.php42
-rw-r--r--app/Helper/TaskHelper.php18
2 files changed, 46 insertions, 14 deletions
diff --git a/app/Helper/FormHelper.php b/app/Helper/FormHelper.php
index c2ea1d72..0bb94d39 100644
--- a/app/Helper/FormHelper.php
+++ b/app/Helper/FormHelper.php
@@ -307,6 +307,48 @@ class FormHelper extends Base
}
/**
+ * Date field
+ *
+ * @access public
+ * @param string $label
+ * @param string $name
+ * @param array $values
+ * @param array $errors
+ * @param array $attributes
+ * @return string
+ */
+ public function date($label, $name, array $values, array $errors = array(), array $attributes = array())
+ {
+ $userFormat = $this->dateParser->getUserDateFormat();
+ $values = $this->dateParser->format($values, array($name), $userFormat);
+ $attributes = array_merge(array('placeholder="'.date($userFormat).'"'), $attributes);
+
+ return $this->helper->form->label($label, $name) .
+ $this->helper->form->text($name, $values, $errors, $attributes, 'form-date');
+ }
+
+ /**
+ * Datetime field
+ *
+ * @access public
+ * @param string $label
+ * @param string $name
+ * @param array $values
+ * @param array $errors
+ * @param array $attributes
+ * @return string
+ */
+ public function datetime($label, $name, array $values, array $errors = array(), array $attributes = array())
+ {
+ $userFormat = $this->dateParser->getUserDateTimeFormat();
+ $values = $this->dateParser->format($values, array($name), $userFormat);
+ $attributes = array_merge(array('placeholder="'.date($userFormat).'"'), $attributes);
+
+ return $this->helper->form->label($label, $name) .
+ $this->helper->form->text($name, $values, $errors, $attributes, 'form-datetime');
+ }
+
+ /**
* Display the form error class
*
* @access private
diff --git a/app/Helper/TaskHelper.php b/app/Helper/TaskHelper.php
index 599146b9..32f2a9ae 100644
--- a/app/Helper/TaskHelper.php
+++ b/app/Helper/TaskHelper.php
@@ -207,24 +207,14 @@ class TaskHelper extends Base
public function selectStartDate(array $values, array $errors = array(), array $attributes = array())
{
- $placeholder = date($this->configModel->get('application_date_format', 'm/d/Y H:i'));
- $attributes = array_merge(array('tabindex="12"', 'placeholder="'.$placeholder.'"'), $attributes);
-
- $html = $this->helper->form->label(t('Start Date'), 'date_started');
- $html .= $this->helper->form->text('date_started', $values, $errors, $attributes, 'form-datetime');
-
- return $html;
+ $attributes = array_merge(array('tabindex="12"'), $attributes);
+ return $this->helper->form->datetime(t('Start Date'), 'date_started', $values, $errors, $attributes);
}
public function selectDueDate(array $values, array $errors = array(), array $attributes = array())
{
- $placeholder = date($this->configModel->get('application_date_format', 'm/d/Y'));
- $attributes = array_merge(array('tabindex="13"', 'placeholder="'.$placeholder.'"'), $attributes);
-
- $html = $this->helper->form->label(t('Due Date'), 'date_due');
- $html .= $this->helper->form->text('date_due', $values, $errors, $attributes, 'form-date');
-
- return $html;
+ $attributes = array_merge(array('tabindex="13"'), $attributes);
+ return $this->helper->form->date(t('Due Date'), 'date_due', $values, $errors, $attributes);
}
public function formatPriority(array $project, array $task)