xref: /plugin/bez/tpl/task_form.php (revision 085d47f1c02f9378de2be93e1b51121ba5332543)
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 && isset($template['issue'])): ?>
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			<div class="row">
40			<label for="executor"><?php echo $bezlang['executor'] ?>:</label>
41			<span>
42			<?php if ($template['auth_level'] >= 15): ?>
43				<select name="executor" id="executor">
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			<?php else: ?>
51				<input type="hidden" name="executor" value="<?php echo $template['user'] ?>">
52				<strong>
53				<?php echo $template['user_name'] ?>
54				</strong>
55			<?php endif ?>
56
57
58			</span>
59			</div>
60
61			<div class="row">
62			<label for="tasktype"><?php echo $bezlang['task_type'] ?>:</label>
63			<span>
64				<?php if ($template['auth_level'] < 15): ?>
65					<input type="hidden" name="tasktype" value="<?php echo $nparams['tasktype'] ?>">
66					<strong>
67					<?php echo $template['tasktype_name'] ?>
68					</strong>
69				<?php else: ?>
70					<select id="tasktype" name="tasktype">
71						<option <?php if ($value['tasktype'] == '') echo 'selected' ?> value=""><?php echo $bezlang['tasks_no_type'] ?></option>
72						<?php foreach ($template['tasktypes'] as $tasktype): ?>
73							<option <?php if ($value['tasktype'] == $tasktype->id) echo 'selected' ?> value="<?php echo $tasktype->id ?>"><?php echo $tasktype->type ?></option>
74						<?php endforeach ?>
75					</select>
76				<?php endif ?>
77			</span>
78			</div>
79
80			<div class="row">
81			<label for="action"><?php echo $bezlang['class'] ?>:</label>
82			<span>
83				<strong>
84					<?php if (!isset($template['issue'])): ?>
85						<?php echo $bezlang['programme'] ?>
86					<?php elseif (!isset($template['cause'])): ?>
87						<?php echo $bezlang['correction'] ?>
88						<input type="hidden" name="action" value="0" />
89					<?php elseif ($template['cause']['potential'] == 0): ?>
90						<?php echo $bezlang['corrective_action'] ?>
91						<input type="hidden" name="action" value="1" />
92					<?php else: ?>
93						<?php echo $bezlang['preventive_action'] ?>
94						<input type="hidden" name="action" value="2" />
95					<?php endif ?>
96				</strong>
97			</span>
98			</div>
99
100			<div class="row">
101				<label for="task"><?php echo $bezlang['description'] ?>:</label>
102				<span><textarea name="task" id="task"><?php echo $value['task'] ?></textarea></span>
103			</div>
104
105			<div class="row task_plan_field">
106				<label for="plan_date"><?php echo $bezlang['plan_date'] ?>:</label>
107				<span>
108					<input name="plan_date" style="width:90px;" value="<?php echo $value['plan_date'] ?>"/> <label><input type="checkbox" name="all_day_event" value="1"
109				<?php if (isset($value['all_day_event']) && $value['all_day_event'] != '0'): ?>
110					checked
111				<?php endif ?> /> <?php echo $bezlang['all_day_event'] ?></label>
112				</span>
113			</div>
114
115			<div class="row task_plan_field">
116				<label for="start_time"><?php echo $bezlang['start_time'] ?>:</label>
117				<span>
118					<input name="start_time" style="width:60px;" class="bez_timepicker" value="<?php echo $value['start_time'] ?>"/>
119				</span>
120			</div>
121
122			<div class="row task_plan_field">
123				<label for="finish_time"><?php echo $bezlang['finish_time'] ?>:</label>
124				<span>
125					<input name="finish_time" style="width:60px;" class="bez_timepicker" value="<?php echo $value['finish_time'] ?>"/>
126				</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 if (isset($nparams['tid'])): ?>
134				<div class="row">
135				<label for="task_state"><?php echo $bezlang['task_state'] ?>:</label>
136				<span>
137					<strong><?php echo $bezlang[$template['state_string']] ?></strong>
138				</span>
139				</div>
140
141				<?php if ($template['state_string'] != 'task_opened'): ?>
142				<div class="row">
143					<label for="reason">
144						<?php if ($template['state_string'] == 'task_done'): ?>
145							<?php echo $bezlang['evaluation'] ?>:
146						<?php else: ?>
147							<?php echo $bezlang['reason'] ?>:
148						<?php endif ?>
149					</label>
150					<span><textarea name="reason" id="reason"><?php echo $value['reason'] ?></textarea></span>
151				</div>
152				<?php endif ?>
153			<?php endif ?>
154		</fieldset>
155		<input type="submit" value="<?php echo $template['task_button'] ?>">
156		<a href="?id=<?php
157			if (!isset($template['issue']))
158				echo $this->id('show_task', 'tid', $nparams['tid']);
159			elseif (isset($nparams[tid]))
160				echo $this->id('issue_task', 'id', $template['issue']['id'], 'tid', $nparams[tid]);
161			else
162				echo $this->id('issue_tasks', 'id', $template['issue']['id']);
163			?>"
164		 class="bez_delete_button bez_link_button">
165			<?php echo $bezlang['cancel'] ?>
166		</a>
167
168	</form>
169
170<a name="z_"></a>
171