xref: /plugin/bez/tpl/task.php (revision 510f3b217af986987360986354207cda3b1fd3d2)
1<a style="display:none;" href="#" class="show_tasks_hidden"><?php echo $bezlang['show_tasks_hidden'] ?></a>
2<?php foreach ($params['tasks'] as $task): ?>
3		<a name="z<?php echo $task['id'] ?>"></a>
4		<div id="z<?php echo $task['id'] ?>" class="task
5			<?php
6				switch($task['state']) {
7					case $bezlang['task_opened']:
8						echo 'opened';
9						break;
10					case $bezlang['task_done']:
11						echo 'closed';
12						break;
13					case $bezlang['task_rejected']:
14						echo 'rejected';
15						break;
16				}
17			?>">
18
19		<div class="bez_timebox">
20			<span><strong><?php echo $bezlang['open'] ?>:</strong> <?php echo $helper->time2date($task['date']) ?></span>
21			<?php if ($task['state'] != $bezlang['task_opened']): ?>
22				<span>
23					<strong><?php echo $task['state']?>:</strong>
24					<?php echo $helper->time2date($task['close_date']) ?>
25				</span>
26			<?php endif ?>
27		</div>
28
29		<h2>
30			<a href="<?php echo $this->issue_uri($task['issue']).'#z'.$task['id'] ?>">#z<?php echo $task['id'] ?></a>
31			<?php echo lcfirst($task['action']) ?>
32			(<?php echo lcfirst($task['state']) ?>)
33		</h2>
34
35		<table>
36		<tr>
37				<th><?php echo $bezlang['reporter'] ?>:</th>
38				<td><?php echo $task['reporter'] ?></td>
39
40				<th><?php echo $bezlang['executor'] ?>:</th>
41				<td><?php echo $task['executor'] ?></td>
42
43				<?php if ($task['cost'] != 0): ?>
44					<th><?php echo $bezlang['cost'] ?>:</th>
45					<td><?php echo $task['cost'] ?></td>
46				<?php endif ?>
47		</tr>
48		</table>
49
50		<h3><?php echo $bezlang['description'] ?></h3>
51		<?php echo $task['task'] ?>
52
53		<?php if ($task['rejected']): ?>
54			<h3><?php echo $bezlang['reason'] ?></h3>
55			<?php echo $task['reason'] ?>
56		<?php endif ?>
57
58		<?php if ($template['issue_opened'] && ($template['user_is_coordinator'] || $task['executor_nick'] == $template['user'])): ?>
59			<a class="bds_inline_button bds_edit_button"
60			href="?id=<?php echo $this->id('issue_show', $template['issue']['id'], 'edit', 'task', $task['id']) ?>#z_">
61				<?php echo $bezlang['edit'] ?>
62
63		<a class="bds_inline_button bds_send_button" href="
64			<?php echo $helper->mailto($task['executor_email'],
65			$bezlang['task'].': #'.$task['issue'].' '.$template['issue']['title'].' | #z'.$task['id'].' '.$task['action'],
66			$template['uri'].'#z'.$task['id']) ?>">
67<?php echo $bezlang['send_mail'] ?>
68		</a>
69		<?php endif ?>
70		</div>
71<?php endforeach ?>
72<?php if ($template['issue_opened'] && ($template['user_is_coordinator'] || strstr($params['task_action'], 'update'))): ?>
73	<a style="display:none;" href="#z_" class="add_task"><?php echo $bezlang['add_task'] ?></a>
74	<form class="<?php $e = explode(':', $params['task_action']); echo $e[0] ?> task_form"
75			action="<?php echo $template['uri'] ?>:<?php echo $params['task_action'] ?>#z_" method="POST">
76			<?php foreach ($params['hidden'] as $name => $value): ?>
77				<input type="hidden" name="<?php echo $name ?>" value="<?php echo $value ?>" />
78			<?php endforeach ?>
79			<fieldset class="bds_form">
80			<?php if ($template['issue_opened'] && $template['user_is_coordinator']): ?>
81				<?php if (count($template['causes']) == 0) : ?>
82					<div class="row" >
83						<div style="display:table-cell"><br><br></div>
84						<label style="position: relative">
85							<div class="info" style="position: absolute; left: -7em; width:45em;"><?php echo $bezlang['info_no_causes_added'] ?></div>
86						</label>
87					</div>
88				<?php endif ?>
89				<?php if (strpos($params['task_action'], 'update') === 0): ?>
90					<div class="row">
91					<label for="id"><?php echo $bezlang['id'] ?>:</label>
92					<span><strong>#z<?php echo $template['task_id'] ?></strong></span>
93					</div>
94				<?php endif ?>
95				<div class="row">
96				<label for="executor"><?php echo $bezlang['executor'] ?>:</label>
97				<span>
98				<select name="executor" id="executor">
99				<?php foreach ($template['users'] as $nick => $name): ?>
100					<option <?php if ($value['executor'] == $nick) echo 'selected' ?>
101					 value="<?php echo $nick ?>"><?php echo $name ?></option>
102				<?php endforeach ?>
103				</select>
104				</span>
105				</div>
106				<div class="row">
107				<label for="action"><?php echo $bezlang['action'] ?>:</label>
108				<span>
109				<?php if (isset($params['hidden']['cause'])) : ?>
110					<select name="action" id="action">
111					<?php foreach ($template['taskactions'] as $key => $name): ?>
112						<option <?php if ($value['action'] == $key) echo 'selected' ?>
113						 value="<?php echo $key ?>"><?php echo $name ?></option>
114					<?php endforeach ?>
115					</select>
116				<?php else : ?>
117					<strong>
118						<?php echo $bezlang['correction'] ?>
119					</strong>
120				<?php endif ?>
121				</span>
122				</div>
123
124				<div class="row">
125					<label for="task"><?php echo $bezlang['description'] ?>:</label>
126					<span><textarea name="task" id="task"><?php echo $value['task'] ?></textarea></span>
127				</div>
128
129				<div class="row">
130					<label for="cost"><?php echo $bezlang['cost'] ?>:</label>
131					<span><input name="cost" id="cost" value="<?php echo $value['cost'] ?>"></span>
132				</div>
133				<?php endif ?>
134				<?php if (strstr($params['task_action'], 'update')): ?>
135					<div class="row">
136					<label for="task_state"><?php echo $bezlang['task_state'] ?>:</label>
137					<span>
138					<select name="state" id="task_state">
139					<?php foreach ($template['task_states'] as $code => $name): ?>
140						<option <?php if ($value['state'] == $code) echo 'selected' ?>
141						 value="<?php echo $code?>"><?php echo $name ?></option>
142					<?php endforeach ?>
143					</select>
144					</span>
145					</div>
146					<div class="row">
147						<label for="reason"><?php echo $bezlang['reason'] ?>:</label>
148						<span><textarea name="reason" id="reason"><?php echo $value['reason'] ?></textarea></span>
149					</div>
150				<?php endif ?>
151			</fieldset>
152			<input type="submit" value="<?php echo $template['task_button'] ?>">
153			<a href="?id=<?php echo $this->id('issue_show', $template['issue']['id']) ?>"
154			 class="bez_delete_button bez_link_button">
155				<?php echo $bezlang['cancel'] ?>
156			</a>
157
158		</form>
159	<?php endif ?>
160