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