summaryrefslogtreecommitdiff
path: root/plugins/TimeMachine/Helper/SubTaskTimeTracking.php
blob: 7197672a364c1b93b1ba8745679c31ae6dd69753 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php


namespace Kanboard\Plugin\TimeMachine\Helper;

use Kanboard\Core\Base;

/**
 * Class SubTaskTimeTracking
 *
 * @package Kanboard\Plugin\TimeMachine\Helper
 * @author yvalentin
 */
class SubTaskTimeTracking extends Base
{

    /**
     * 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');
    }

}