-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCircularNoticeHelper.php
More file actions
51 lines (46 loc) · 1.22 KB
/
CircularNoticeHelper.php
File metadata and controls
51 lines (46 loc) · 1.22 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
<?php
/**
* CircularNotice 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');
/**
* CircularNotice Helper
*
* @author Yuto Kitatsuji <kitatsuji.yuto@withone.co.jp>
* @package NetCommons\CircularNotices\View\Helper
*/
class CircularNoticeHelper extends AppHelper {
/**
* Other helpers used by FormHelper
*
* @var array
*/
public $helpers = array(
'NetCommons.Date',
'NetCommons.NetCommonsTime',
);
/**
* 表示する回覧期間及び回覧期限作成
*
* @param string $date 回覧期間又は回覧期限
* @return string HTML
*/
public function displayDate($date) {
$format = '';
$now = $this->NetCommonsTime->getNowDatetime();
$nowUserDatetime = $this->NetCommonsTime->toUserDatetime($now);
$dateYear = date('Y', strtotime($date));
$nowYear = date('Y', strtotime($nowUserDatetime));
if ($dateYear === $nowYear) {
$format = 'Y/m/d H:i';
}
$displayDate = $this->Date->dateFormat($date, $format);
return $displayDate;
}
}