xref: /plugin/bez/tpl/task_form.php (revision c54650bdd12774fa97026cb5281d37004de894ee)
1<?php if ($helper->user_coordinator($template['issue']['id'])): ?>
2	<?php if (isset($template['issue'])): ?>
3		<?php $issue = $template['issue'] ?>
4		<?php include "issue_box.php" ?><br>
5	<?php endif ?>
6
7	<?php if (isset($template['cause'])): ?>
8		<?php $cause = $template['cause'] ?>
9		<div class="bds_block" id="bez_causes">
10			<?php include "cause.php" ?>
11		</div>
12		<br>
13	<?php endif ?>
14
15	<form class="bez_form bez_task_form" action="?id=<?php echo $template['task_action'] ?>" method="POST">
16			<fieldset class="bds_form">
17				<?php if (isset($nparams['tid'])): ?>
18					<div class="row">
19					<label for="id"><?php echo $bezlang['id'] ?>:</label>
20					<span><strong>#z<?php echo $nparams['tid'] ?></strong></span>
21					</div>
22
23					<?php if (isset($template['issue']) && $helper->user_coordinator($template['issue']['id'])): ?>
24					<div class="row">
25						<label for="cause_id"><?php echo ucfirst($bezlang['cause']) ?>:</label>
26						<span>
27							<select name="cause_id" id="cause_id">
28								<option <?php if ($value['cause_id'] == '') echo 'selected' ?>
29									value="">--- <?php echo $bezlang['correction'] ?> ---</option>
30
31								<?php foreach ($template['causes'] as $cause): ?>
32									<option <?php if ($value['cause_id'] == $cause['id']) echo 'selected' ?>
33									 value="<?php echo $cause['id'] ?>">#p<?php echo $cause['id'] ?></option>
34								<?php endforeach ?>
35							</select>
36						</span>
37					</div>
38					<?php endif ?>
39				<?php endif ?>
40				<?php if (!$helper->user_coordinator($template['issue']['id'])) $disabled = 'disabled' ?>
41				<div class="row">
42				<label for="executor"><?php echo $bezlang['executor'] ?>:</label>
43				<span>
44				<select name="executor" id="executor" <?php echo $disabled ?>>
45					<option value="">--- <?php echo $bezlang['select'] ?>---</option>
46				<?php foreach ($template['users'] as $nick => $name): ?>
47					<option <?php if ($value['executor'] == $nick) echo 'selected' ?>
48					 value="<?php echo $nick ?>"><?php echo $name ?></option>
49				<?php endforeach ?>
50				</select>
51				</span>
52				</div>
53
54				<div class="row">
55				<label for="executor"><?php echo $bezlang['task_type'] ?>:</label>
56				<span>
57					<select name="tasktype">
58						<option <?php if ($value['tasktype'] == '') echo 'selected' ?> value="">-- <?php echo $bezlang['none'] ?> --</option>
59						<?php foreach ($template['tasktypes'] as $id => $type): ?>
60							<option <?php if ($value['tasktype'] == $id) echo 'selected' ?> value="<?php echo $id ?>"><?php echo $type ?></option>
61						<?php endforeach ?>
62					</select>
63				</span>
64				</div>
65
66				<div class="row">
67				<label for="action"><?php echo $bezlang['class'] ?>:</label>
68				<span>
69					<strong>
70						<?php if (!isset($template['issue'])): ?>
71							<?php echo $bezlang['programme'] ?>
72						<?php elseif (!isset($template['cause'])): ?>
73							<?php echo $bezlang['correction'] ?>
74							<input type="hidden" name="action" value="0" />
75						<?php elseif ($template['cause']['potential'] == 0): ?>
76							<?php echo $bezlang['corrective_action'] ?>
77							<input type="hidden" name="action" value="1" />
78						<?php else: ?>
79							<?php echo $bezlang['preventive_action'] ?>
80							<input type="hidden" name="action" value="2" />
81						<?php endif ?>
82					</strong>
83				</span>
84				</div>
85
86				<div class="row">
87					<label for="task"><?php echo $bezlang['description'] ?>:</label>
88					<span><textarea name="task" id="task" <?php echo $disabled ?>><?php echo $value['task'] ?></textarea></span>
89				</div>
90
91
92				<div class="row task_plan_field">
93					<label for="plan_date"><?php echo $bezlang['plan_date'] ?>:</label>
94					<span>
95						<input name="plan_date" style="width:90px;" value="<?php echo $value['plan_date'] ?>"/> <label><input type="checkbox" name="all_day_event" value="1"
96					<?php if (isset($value['all_day_event']) && $value['all_day_event'] != '0'): ?>
97						checked
98					<?php endif ?> /> <?php echo $bezlang['all_day_event'] ?></label>
99					</span>
100				</div>
101
102				<div class="row task_plan_field">
103					<label for="start_time"><?php echo $bezlang['start_time'] ?>:</label>
104					<span>
105						<input name="start_time" style="width:60px;" class="bez_timepicker" value="<?php echo $value['start_time'] ?>"/>
106					</span>
107				</div>
108
109				<div class="row task_plan_field">
110					<label for="finish_time"><?php echo $bezlang['finish_time'] ?>:</label>
111					<span>
112						<input name="finish_time" style="width:60px;" class="bez_timepicker" value="<?php echo $value['finish_time'] ?>"/>
113					</span>
114				</div>
115
116				<div class="row">
117					<label for="cost"><?php echo $bezlang['cost'] ?>:</label>
118					<span><input name="cost" id="cost" value="<?php echo $value['cost'] ?>" <?php echo $disabled ?>></span>
119				</div>
120				<?php if (isset($nparams['tid'])): ?>
121					<div class="row">
122					<label for="task_state"><?php echo $bezlang['task_state'] ?>:</label>
123					<span>
124						<strong><?php echo $template['state'] ?></strong>
125					</span>
126					</div>
127					<?php if ($template['raw_state'] != 0): ?>
128					<div class="row">
129						<label for="reason">
130							<?php if ($template['raw_state'] == 1): ?>
131								<?php echo $bezlang['evaluation'] ?>
132							<?php else: ?>
133								<?php echo $bezlang['reason'] ?>
134							<?php endif ?>
135						</label>
136						<span><textarea name="reason" id="reason"><?php echo $value['reason'] ?></textarea></span>
137					</div>
138					<?php endif ?>
139				<?php endif ?>
140			</fieldset>
141			<input type="submit" value="<?php echo $template['task_button'] ?>">
142			<a href="?id=<?php
143				if (!isset($template['issue']))
144					echo $this->id('show_task', 'tid', $nparams['tid']);
145				elseif (isset($nparams[tid]))
146					echo $this->id('issue_task', 'id', $template['issue']['id'], 'tid', $nparams[tid]);
147				else
148					echo $this->id('issue_tasks', 'id', $template['issue']['id']);
149				?>"
150			 class="bez_delete_button bez_link_button">
151				<?php echo $bezlang['cancel'] ?>
152			</a>
153
154		</form>
155<?php endif ?>
156<a name="z_"></a>
157