xref: /plugin/bez/tpl/start.php (revision 3b22163a4261301fbcc0deb71ff03fb3a1a35e1e)
1<h1><?php echo $bezlang['bds_timeline'] ?></h1>
2
3<dl id="bds_timeline">
4<?php foreach ($template['timeline'] as $day => $elms): ?>
5	<h2>
6		<?php echo $helper->time2date(strtotime("-$day days")) ?><?php if ($day < 2) echo ':' ?>
7		<?php if ($day == 0): ?>
8			<?php echo $bezlang['today'] ?>
9		<?php elseif ($day == 1): ?>
10			<?php echo $bezlang['yesterday'] ?>
11		<?php endif ?>
12	</h2>
13	<?php foreach ($elms as $elm): ?>
14		<dt class="<?php echo $elm['class'] ?>">
15			<?php if (strstr($elm['class'], 'issue')): ?>
16				<a href="<?php echo $helper->issue_uri($elm['id']) ?>">
17					<span class="time"><?php echo date('H:i', $elm['date']) ?></span>
18						<?php if ($elm['class'] == 'issue_created'): ?>
19							<?php echo $bezlang['issue_created'] ?>
20						<?php elseif ($elm['class'] == 'issue_closed'): ?>
21							<?php echo $bezlang['issue_closed'] ?>
22						<?php elseif ($elm['class'] == 'issue_rejected'): ?>
23							<?php echo $bezlang['issue_rejected'] ?>
24						<?php endif ?>
25						<?php echo $elm['type'] ?>
26						<span class="id">#<?php echo $elm['id'] ?></span>
27						[<?php echo $elm['entity'] ?>] <?php echo $elm['title'] ?>
28						<?php echo $bezlang['by'] ?>
29						<span class="author"><?php echo $elm['reporter'] ?></span>
30				</a>
31			<?php elseif (strstr($elm['class'], 'task')): ?>
32				<a href="<?php echo $helper->issue_uri($elm['id']) ?>#z<?php echo $elm['id'] ?>">
33					<span class="time"><?php echo date('H:i', $elm['date']) ?></span>
34						<?php if ($elm['class'] == 'task_added'): ?>
35							<?php echo $bezlang['task_created'] ?>
36						<?php elseif ($elm['class'] == 'issue_closed'): ?>
37							<?php echo $bezlang['issue_closed'] ?>
38						<?php elseif ($elm['class'] == 'issue_rejected'): ?>
39							<?php echo $bezlang['issue_rejected'] ?>
40						<?php endif ?>
41						<?php echo $elm['type'] ?>
42						<span class="id">z<?php echo $elm['id'] ?></span>
43						<?php echo $elm['title'] ?> <?php echo $bezlang['by'] ?>
44						<span class="author"><?php echo $elm['reporter'] ?></span>
45				</a>
46			<?php endif ?>
47		</dt>
48		<dd>
49			<?php if (strstr($elm['class'], 'issue')): ?>
50				<?php echo $helper->wiki_parse($elm['description']) ?>
51				<?php if ($elm['class'] == 'issue_closed'): ?>
52					<h3><?php echo $bezlang['opinion'] ?></h3>
53					<?php echo $helper->wiki_parse($elm['opinion']) ?>
54				<?php endif ?>
55			<?php elseif (strstr($elm['class'], 'task')): ?>
56				<?php echo $helper->wiki_parse($elm['task']) ?>
57			<?php endif ?>
58		</dd>
59	<?php endforeach ?>
60<?php endforeach ?>
61
62			$aid = explode(':', $id);
63			switch($cursor['type']) {
64				case 'comment':
65				case 'change':
66				case 'task':
67					<a href="'.$this->string_issue_href($aid[0], $aid[1]).'">
68				break;
69				case 'comment_rev':
70				case 'task_rev':
71					if ($aid[2] == -1) {
72						<a href="'.$this->string_issue_href($aid[0], $aid[1]).'">
73					} else {
74						<a href="'.$this->string_issue_href($aid[0], $aid[1], $aid[2]).'">
75					}
76				break;
77				case 'issue_created':
78					<a href="'.$this->string_issue_href($aid[0]).'">
79				break;
80				case 'change':
81					<a href="'.$this->string_issue_href($aid[0]).'">
82				break;
83				default:
84					<a href="#">
85				break;
86			}
87			<span class="time">
88			echo date('H:i', $cursor['date']);
89			</span>
90
91			switch($cursor['type']) {
92				case 'comment':
93				case 'task':
94					if ($cursor['type'] == 'task') {
95						echo $this->getLang('task_added');
96					} else {
97						echo $this->getLang('comment_added');
98					}
99
100					<span class="id">
101					#'.$aid[0].':'.$aid[1];
102					</span>
103
104					(
105					echo $cursor['title'];
106					)
107					if ($cursor['type'] == 'task') {
108
109						echo $this->getLang('task_for');
110
111						<span class="author">
112						echo $this->string_format_field('name', $cursor['info']['executor']);
113						</span>
114					}
115
116					echo $this->getLang('by');
117
118					<span class="author">
119					echo $this->string_format_field('name', $cursor['author']);
120					</span>
121					</a>
122					</dt>
123					<dd>
124					echo $this->wiki_parse($cursor['info']['content']);
125					</dd>
126
127				break;
128				case 'change':
129				case 'change_state':
130					$state = $cursor['info']['new']['state'];
131					if (isset($state)) {
132						$diff = array('opinion');
133						if (in_array($state, $this->blocking_states)) {
134							echo $this->getLang('issue_closed');
135						} else {
136							echo $this->getLang('issue_reopened');
137						}
138					} else {
139						$diff = array();
140						echo $this->getLang('change_made');
141					}
142
143					<span class="id">
144					#'.$aid[0].':'.$aid[1];
145					</span>
146
147					(
148					echo $cursor['title'];
149					)
150
151					echo $this->getLang('by');
152
153					<span class="author">
154					echo $this->string_format_field('name', $cursor['author']);
155					</span>
156					</a>
157					</dt>
158					<dd>
159					echo $this->html_format_change($cursor['info']['new'], $cursor['info']['prev'], $diff);
160					if (isset($cursor['info']['new']['state'])) {
161						echo $this->wiki_parse($cursor['info']['new']['opinion']);
162					}
163					</dd>
164				break;
165				case 'comment_rev':
166				case 'task_rev':
167					if ($cursor['type'] == 'task_rev') {
168						if ($cursor['info']['state'] != $cursor['info']['old']['state']) {
169							if ($cursor['info']['state'] == 0) {
170								echo $this->getLang('task_reopened');
171							} else if ($cursor['info']['state'] == 1) {
172								echo $this->getLang('task_closed');
173							} else if ($cursor['info']['state'] == 2) {
174								echo $this->getLang('task_rejected');
175							}
176						} else {
177							echo $this->getLang('task_changed');
178						}
179					} else {
180						echo $this->getLang('comment_changed');
181					}
182
183					<span class="id">
184					#'.$aid[0].':'.$aid[1];
185					</span>
186
187					(
188					echo $cursor['title'];
189					)
190
191					echo lcfirst($this->getLang('version'));
192
193					<span class="id">
194					echo $cursor['info']['rev_len'] - $aid[2];
195					</span>
196
197					echo $this->getLang('by');
198
199					<span class="author">
200					echo $this->string_format_field('name', $cursor['author']);
201					</span>
202					</a>
203					</dt>
204					<dd>
205					if ($cursor['type'] == 'task_rev' && isset($cursor['info']['old'])) {
206						//remoev unchanged field
207						$new = array();
208						foreach ($cursor['info']['old'] as $k => $v) {
209							if (isset($cursor['info'][$k])) {
210								$new[$k] = $cursor['info'][$k];
211							}
212						}
213
214						echo $this->html_format_change($new, $cursor['info']['old'], array('reason'), 'task');
215						echo $this->wiki_parse($cursor['info']['reason']);
216					} else {
217						echo $this->wiki_parse($cursor['info']['content']);
218					}
219					</dd>
220				break;
221				case 'issue_created':
222					echo $this->getLang('issue_created');
223
224					<span class="id">
225					#'.$aid[0];
226					</span>
227
228					(
229					echo $cursor['title'];
230					)
231
232					echo $this->getLang('by');
233
234					<span class="author">
235					echo $this->string_format_field('name', $cursor['author']);
236					</span>
237
238					</a>
239					</dt>
240					<dd>
241					echo $this->wiki_parse($cursor['info']['description']);
242					</dd>
243				break;
244				case 'change':
245				break;
246				default:
247					</a>
248					</dt>
249				break;
250			}
251		}
252		</dl>
253