xref: /plugin/bez/tpl/task_form.php (revision d6002863ed649bcc6a7301ca988622c05c6727b3)
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				<?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				<div class="row">
91					<label for="task_plan"><?php echo $bezlang['task_plan'] ?>:</label>
92					<span><input name="task_plan" id="task_plan" type="checkbox"
93					<?php if ($value['plan_date'] != ''): ?>
94						checked
95					<?php endif ?>
96					<?php echo $disabled ?>></span>
97				</div>
98
99				<div class="row task_plan_field">
100					<label for="plan_date"><?php echo $bezlang['plan_date'] ?>:</label>
101					<span>
102						<input name="plan_date" style="width:90px;" value="<?php echo $value['plan_date'] ?>"/> <label><input type="checkbox" name="all_day_event" value="1"
103					<?php if (isset($value['all_day_event']) && $value['all_day_event'] != '0'): ?>
104						checked
105					<?php endif ?> /> <?php echo $bezlang['all_day_event'] ?></label>
106					</span>
107				</div>
108
109				<div class="row task_plan_field">
110					<label for="start_time"><?php echo $bezlang['start_time'] ?>:</label>
111					<span>
112						<input name="start_time" style="width:60px;" class="bez_timepicker" value="<?php echo $value['start_time'] ?>"/>
113					</span>
114				</div>
115
116				<div class="row task_plan_field">
117					<label for="finish_time"><?php echo $bezlang['finish_time'] ?>:</label>
118					<span>
119						<input name="finish_time" style="width:60px;" class="bez_timepicker" value="<?php echo $value['finish_time'] ?>"/>
120					</span>
121				</div>
122
123				<div class="row">
124					<label for="cost"><?php echo $bezlang['cost'] ?>:</label>
125					<span><input name="cost" id="cost" value="<?php echo $value['cost'] ?>" <?php echo $disabled ?>></span>
126				</div>
127				<?php if (isset($nparams['tid'])): ?>
128					<div class="row">
129					<label for="task_state"><?php echo $bezlang['task_state'] ?>:</label>
130					<span>
131						<strong><?php echo $template['state'] ?></strong>
132					</span>
133					</div>
134					<?php if ($template['raw_state'] != 0): ?>
135					<div class="row">
136						<label for="reason">
137							<?php if ($template['raw_state'] == 1): ?>
138								<?php echo $bezlang['evaluation'] ?>
139							<?php else: ?>
140								<?php echo $bezlang['reason'] ?>
141							<?php endif ?>
142						</label>
143						<span><textarea name="reason" id="reason"><?php echo $value['reason'] ?></textarea></span>
144					</div>
145					<?php endif ?>
146				<?php endif ?>
147			</fieldset>
148			<input type="submit" value="<?php echo $template['task_button'] ?>">
149			<a href="?id=<?php
150				if (!isset($template['issue']))
151					echo $this->id('show_task', 'tid', $nparams['tid']);
152				elseif (isset($nparams[tid]))
153					echo $this->id('issue_task', 'id', $template['issue']['id'], 'tid', $nparams[tid]);
154				else
155					echo $this->id('issue_tasks', 'id', $template['issue']['id']);
156				?>"
157			 class="bez_delete_button bez_link_button">
158				<?php echo $bezlang['cancel'] ?>
159			</a>
160
161		</form>
162<?php endif ?>
163<a name="z_"></a>
164