xref: /plugin/bez/tpl/task_form.php (revision 260e885eca7d099324ac54faba0c1e7584bdf44f)
1<?php if ($helper->user_coordinator($template['issue']['id'])): ?>
2	<?php $issue = $template['issue'] ?>
3	<?php include "issue_box.php" ?>
4	<br>
5	<?php if (isset($template['cause'])): ?>
6		<?php $cause = $template['cause'] ?>
7		<div class="bds_block" id="bez_causes">
8			<?php include "cause.php" ?>
9		</div>
10		<br>
11	<?php endif ?>
12
13	<form class="bez_form bez_task_form" action="?id=<?php echo $template['task_action'] ?>" method="POST">
14			<fieldset class="bds_form">
15				<?php if (isset($nparams['tid'])): ?>
16					<div class="row">
17					<label for="id"><?php echo $bezlang['id'] ?>:</label>
18					<span><strong>#z<?php echo $nparams['tid'] ?></strong></span>
19					</div>
20
21					<?php if ($helper->user_coordinator($template['issue']['id'])): ?>
22					<div class="row">
23						<label for="cause_id"><?php echo ucfirst($bezlang['cause']) ?>:</label>
24						<span>
25							<select name="cause_id" id="cause_id">
26								<option <?php if ($value['cause_id'] == '') echo 'selected' ?>
27									value="">--- <?php echo $bezlang['correction'] ?> ---</option>
28
29								<?php foreach ($template['causes'] as $cause): ?>
30									<option <?php if ($value['cause_id'] == $cause['id']) echo 'selected' ?>
31									 value="<?php echo $cause['id'] ?>">#p<?php echo $cause['id'] ?></option>
32								<?php endforeach ?>
33							</select>
34						</span>
35					</div>
36					<?php endif ?>
37				<?php endif ?>
38				<?php if (!$helper->user_coordinator($template['issue']['id'])) $disabled = 'disabled' ?>
39				<div class="row">
40				<label for="executor"><?php echo $bezlang['executor'] ?>:</label>
41				<span>
42				<select name="executor" id="executor" <?php echo $disabled ?>>
43				<?php foreach ($template['users'] as $nick => $name): ?>
44					<option <?php if ($value['executor'] == $nick) echo 'selected' ?>
45					 value="<?php echo $nick ?>"><?php echo $name ?></option>
46				<?php endforeach ?>
47				</select>
48				</span>
49				</div>
50				<div class="row">
51				<label for="action"><?php echo $bezlang['action'] ?>:</label>
52				<span>
53					<strong>
54						<?php if (!isset($template['cause'])): ?>
55							<?php echo $bezlang['correction'] ?>
56							<input type="hidden" name="action" value="0" />
57						<?php elseif ($template['cause']['potential'] == 0): ?>
58							<?php echo $bezlang['corrective_action'] ?>
59							<input type="hidden" name="action" value="1" />
60						<?php else: ?>
61							<?php echo $bezlang['preventive_action'] ?>
62							<input type="hidden" name="action" value="2" />
63						<?php endif ?>
64					</strong>
65				</span>
66				</div>
67
68				<div class="row">
69					<label for="task"><?php echo $bezlang['description'] ?>:</label>
70					<span><textarea name="task" id="task" <?php echo $disabled ?>><?php echo $value['task'] ?></textarea></span>
71				</div>
72
73				<div class="row">
74					<label for="cost"><?php echo $bezlang['cost'] ?>:</label>
75					<span><input name="cost" id="cost" value="<?php echo $value['cost'] ?>" <?php echo $disabled ?>></span>
76				</div>
77				<?php if (isset($nparams['tid'])): ?>
78					<div class="row">
79					<label for="task_state"><?php echo $bezlang['task_state'] ?>:</label>
80					<span>
81						<strong><?php echo $template['state'] ?></strong>
82					</span>
83					</div>
84					<?php if ($template['raw_state'] != 0): ?>
85					<div class="row">
86						<label for="reason">
87							<?php if ($template['raw_state'] == 1): ?>
88								<?php echo $bezlang['evaluation'] ?>
89							<?php else: ?>
90								<?php echo $bezlang['reason'] ?>
91							<?php endif ?>
92						</label>
93						<span><textarea name="reason" id="reason"><?php echo $value['reason'] ?></textarea></span>
94					</div>
95					<?php endif ?>
96				<?php endif ?>
97			</fieldset>
98			<input type="submit" value="<?php echo $template['task_button'] ?>">
99			<a href="?id=<?php
100				if (isset($nparams[tid]))
101					echo $this->id('issue_task', 'id', $template['issue']['id'], 'tid', $nparams[tid]);
102				else
103					echo $this->id('issue_tasks', 'id', $template['issue']['id']);
104				?>"
105			 class="bez_delete_button bez_link_button">
106				<?php echo $bezlang['cancel'] ?>
107			</a>
108
109		</form>
110	<?php endif ?>
111	<a name="z_"></a>
112	</div>
113</div>
114
115