-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathReservationDailyHelper.php
More file actions
165 lines (150 loc) · 5.03 KB
/
ReservationDailyHelper.php
File metadata and controls
165 lines (150 loc) · 5.03 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<?php
/**
* Reservation Daily Helper
*
* @author Allcreator Co., Ltd. <info@allcreator.net>
* @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');
/**
* Reservation daily Helper
*
* @author Allcreator Co., Ltd. <info@allcreator.net>
* @package NetCommons\Reservations\View\Helper
*/
class ReservationDailyHelper extends ReservationMonthlyHelper {
/**
* Other helpers used by FormHelper
*
* @var array
*/
public $helpers = array(
'NetCommons.NetCommonsForm',
'NetCommons.NetCommonsHtml',
'NetCommons.TitleIcon',
'Form',
'Reservations.ReservationCommon',
'Reservations.ReservationUrl',
'Reservations.ReservationWorkflow',
);
/**
* getSpaceName
*
* スペース名取得
*
* @param array &$vars 施設予約情報
* @param int $roomId ルームID
* @param int $languageId language_id
* @return string
*/
public function getSpaceName(&$vars, $roomId, $languageId) {
if ($roomId == Space::getRoomIdRoot(Space::COMMUNITY_SPACE_ID)) {
return __d('reservations', 'All the members');
}
$roomsLanguages = $vars['roomsLanguages'];
$roomName = '';
foreach ($roomsLanguages as $room) {
//print_r($room);
if ($room['RoomsLanguages']['room_id'] == $roomId &&
$room['RoomsLanguages']['language_id'] == $languageId) {
$roomName = $room['RoomsLanguages']['name'];
}
}
return $roomName;
}
/**
* getPlanSummariesHtml
*
* 予定概要群html取得
*
* @param array &$vars 施設予約情報
* @param int $year 年
* @param int $month 月
* @param int $day 日
* @param string $fromTime この日の1日のスタート時刻
* @param string $toTime この日の1日のエンド時刻
* @param array $plans この日の予定群
* @return string HTML
*/
public function getPlanSummariesHtml(&$vars, $year, $month, $day, $fromTime, $toTime, $plans) {
$html = '';
foreach ($plans as $plan) {
//仕様
//予定が1件以上あるとき)
$html .= "<tr><td><div class='row'><div class='col-xs-12'>"; //1プランの開始
//$html .= "<p class='reservation-plan-clickable text-left reservation-daily-nontimeline-plan'>";
$html .= $this->getPlanTitleDailyListHtml($vars, $year, $month, $day, $fromTime, $toTime, $plan);
// 1プランの終了
$html .= "</p>";
$html .= "</div></div></div></td></tr>";
}
return $html;
}
/**
* getPlanTitleDailyListHtml
*
* 予定(タイトル)html取得
*
* @param array &$vars 施設予約情報
* @param int $year 年
* @param int $month 月
* @param int $day 日
* @param string $fromTime この日の1日のスタート時刻
* @param string $toTime この日の1日のエンド時刻
* @param array $plan 予定
* @return string HTML
*/
public function getPlanTitleDailyListHtml(&$vars, $year, $month, $day, $fromTime, $toTime, $plan) {
$reservationPlanMark = $this->ReservationCommon->getPlanMarkClassName($vars, $plan);
$html = "<div class='reservation-plan-mark {$reservationPlanMark}'>";
// ワークフロー(一時保存/承認待ち、など)のマーク
$html .= '<div>';
$html .= $this->ReservationCommon->makeWorkFlowLabel($plan['ReservationEvent']['status']);
$html .= '</div>';
$url = $this->ReservationUrl->makePlanShowUrl($year, $month, $day, $plan, true);
if ($fromTime !== $plan['ReservationEvent']['fromTime'] ||
$toTime !== $plan['ReservationEvent']['toTime']) {
$html .= '<p class="reservation-daily-nontimeline-plan reservation-plan-time small">';
$html .= h($plan['ReservationEvent']['fromTime']) . ' - ' .
h($plan['ReservationEvent']['toTime']) . '</p>';
}
$spaceName = $this->getSpaceName(
$vars, $plan['ReservationEvent']['room_id'], $plan['ReservationEvent']['language_id']);
$spaceName = $this->ReservationCommon->decideRoomName($spaceName, $reservationPlanMark);
$html .= '<p class="reservation-plan-spacename small">' . h($spaceName) . '</p>';
$html .= '<h3 class="reservation-plan-title">';
$html .= $this->NetCommonsHtml->link(
$this->TitleIcon->titleIcon($plan['ReservationEvent']['title_icon']) .
h($plan['ReservationEvent']['title']),
$url,
array('escape' => false)
);
$html .= '</h3>';
$html .= '</p>';
if ($plan['ReservationEvent']['location'] != '') {
$html .= '<p class="reservation-plan-place small">' . __d('reservations', 'Location details:');
$html .= h($plan['ReservationEvent']['location']) . '</p>';
}
if ($plan['ReservationEvent']['contact']) {
$html .= '<p class="reservation-plan-address small">' . __d('reservations', 'Contact');
$html .= h($plan['ReservationEvent']['contact']) . '</p>';
}
return $html;
}
/**
* makeDailyListBodyHtml
*
* (日表示)本体html生成
*
* @param array $vars コントローラーからの情報
* @return string HTML
*/
public function makeDailyListBodyHtml($vars) {
$html = '';
$nctm = new NetCommonsTime();
$html .= $this->_makePlanSummariesHtml($vars, $nctm, $vars['year'], $vars['month'], $vars['day']);
return $html;
}
}