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