-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTaskContentHelper.php
More file actions
58 lines (53 loc) · 1.42 KB
/
TaskContentHelper.php
File metadata and controls
58 lines (53 loc) · 1.42 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* Task Content Helper
*
* @author Noriko Arai <arai@nii.ac.jp>
* @author Yuto Kitatsuji <kitatsuji.yuto@withone.co.jp>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
App::uses('AppHelper', 'View/Helper');
/**
* Task Content Helper
*
* @author Yuto Kitatsuji <kitatsuji.yuto@withone.co.jp>
* @package NetCommons\Tasks\View\Helper
*/
class TaskContentHelper extends AppHelper {
/**
* Other helpers used by FormHelper
*
* @var array
*/
public $helpers = array(
'NetCommons.Date',
'NetCommons.NetCommonsTime',
);
/**
* 表示するTODO実施期間作成
*
* @param string $date 実施期間
* @param bool $isDateSet 実施期間使用フラグ
* @param bool $isView 詳細画面フラグ
* @return string HTML
*/
public function displayDate($date, $isDateSet, $isView) {
$displayDate = '';
if ($isDateSet && $date !== null) {
$format = '';
$now = $this->NetCommonsTime->getNowDatetime();
$nowUserDatetime = $this->NetCommonsTime->toUserDatetime($now);
$dateYear = date('Y', strtotime($date));
$nowYear = date('Y', strtotime($nowUserDatetime));
if ($dateYear === $nowYear) {
$format = 'm/d';
}
$displayDate = $this->Date->dateFormat($date, $format);
} elseif (! $isView) {
$displayDate = __d('tasks', 'Not Date Set');
}
return $displayDate;
}
}