xref: /plugin/bez/tpl/task_form.php (revision 9b27512b609c5705b93ebef2c087bb1aa02d77f4)
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 (isset($template['issue']) && $helper->user_coordinator($template['issue']['id'])): ?>
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 (!$helper->user_coordinator($template['issue']['id'])) $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				<select name="tasktype">
57					<option <?php if ($value['tasktype'] == '') echo 'selected' ?> value="">-- <?php echo $bezlang['none'] ?> --</option>
58					<?php foreach ($template['tasktypes'] as $id => $type): ?>
59						<option <?php if ($value['tasktype'] == $id) echo 'selected' ?> value="<?php echo $id ?>"><?php echo $type ?></option>
60					<?php endforeach ?>
61				</select>
62			</span>
63			</div>
64
65			<div class="row">
66			<label for="action"><?php echo $bezlang['class'] ?>:</label>
67			<span>
68				<strong>
69					<?php if (!isset($template['issue'])): ?>
70						<?php echo $bezlang['programme'] ?>
71					<?php elseif (!isset($template['cause'])): ?>
72						<?php echo $bezlang['correction'] ?>
73						<input type="hidden" name="action" value="0" />
74					<?php elseif ($template['cause']['potential'] == 0): ?>
75						<?php echo $bezlang['corrective_action'] ?>
76						<input type="hidden" name="action" value="1" />
77					<?php else: ?>
78						<?php echo $bezlang['preventive_action'] ?>
79						<input type="hidden" name="action" value="2" />
80					<?php endif ?>
81				</strong>
82			</span>
83			</div>
84
85			<div class="row">
86				<label for="task"><?php echo $bezlang['description'] ?>:</label>
87				<span><textarea name="task" id="task" <?php echo $disabled ?>><?php echo $value['task'] ?></textarea></span>
88			</div>
89
90
91			<div class="row task_plan_field">
92				<label for="plan_date"><?php echo $bezlang['plan_date'] ?>:</label>
93				<span>
94					<input name="plan_date" style="width:90px;" value="<?php echo $value['plan_date'] ?>"/> <label><input type="checkbox" name="all_day_event" value="1"
95				<?php if (isset($value['all_day_event']) && $value['all_day_event'] != '0'): ?>
96					checked
97				<?php endif ?> /> <?php echo $bezlang['all_day_event'] ?></label>
98				</span>
99			</div>
100
101			<div class="row task_plan_field">
102				<label for="start_time"><?php echo $bezlang['start_time'] ?>:</label>
103				<span>
104					<input name="start_time" style="width:60px;" class="bez_timepicker" value="<?php echo $value['start_time'] ?>"/>
105				</span>
106			</div>
107
108			<div class="row task_plan_field">
109				<label for="finish_time"><?php echo $bezlang['finish_time'] ?>:</label>
110				<span>
111					<input name="finish_time" style="width:60px;" class="bez_timepicker" value="<?php echo $value['finish_time'] ?>"/>
112				</span>
113			</div>
114
115			<div class="row">
116				<label for="cost"><?php echo $bezlang['cost'] ?>:</label>
117				<span><input name="cost" id="cost" value="<?php echo $value['cost'] ?>" <?php echo $disabled ?>></span>
118			</div>
119			<?php if (isset($nparams['tid'])): ?>
120				<div class="row">
121				<label for="task_state"><?php echo $bezlang['task_state'] ?>:</label>
122				<span>
123					<strong><?php echo $template['state'] ?></strong>
124				</span>
125				</div>
126				<?php if ($template['raw_state'] != 0): ?>
127				<div class="row">
128					<label for="reason">
129						<?php if ($template['raw_state'] == 1): ?>
130							<?php echo $bezlang['evaluation'] ?>
131						<?php else: ?>
132							<?php echo $bezlang['reason'] ?>
133						<?php endif ?>
134					</label>
135					<span><textarea name="reason" id="reason"><?php echo $value['reason'] ?></textarea></span>
136				</div>
137				<?php endif ?>
138			<?php endif ?>
139		</fieldset>
140		<input type="submit" value="<?php echo $template['task_button'] ?>">
141		<a href="?id=<?php
142			if (!isset($template['issue']))
143				echo $this->id('show_task', 'tid', $nparams['tid']);
144			elseif (isset($nparams[tid]))
145				echo $this->id('issue_task', 'id', $template['issue']['id'], 'tid', $nparams[tid]);
146			else
147				echo $this->id('issue_tasks', 'id', $template['issue']['id']);
148			?>"
149		 class="bez_delete_button bez_link_button">
150			<?php echo $bezlang['cancel'] ?>
151		</a>
152
153	</form>
154
155<a name="z_"></a>
156