xref: /plugin/bez/tpl/task_form.php (revision 668b614a46c0c824640cdab0720452c86477700f)
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			<select name="executor" id="executor">
43				<option value="">--- <?php echo $bezlang['select'] ?>---</option>
44			<?php foreach ($template['users'] as $nick => $name): ?>
45				<option <?php if ($value['executor'] == $nick) echo 'selected' ?>
46				 value="<?php echo $nick ?>"><?php echo $name ?></option>
47			<?php endforeach ?>
48			</select>
49			</span>
50			</div>
51
52			<?php if (!isset($template['issue']) || isset($template['cause'])): ?>
53				<div class="row">
54				<label for="tasktype"><?php echo $bezlang['task_type'] ?>:</label>
55				<span>
56					<?php if (isset($nparams['tasktype']) && $template['auth_level'] < 20): ?>
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 id="tasktype" 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			<?php endif ?>
72
73			<div class="row">
74			<label for="action"><?php echo $bezlang['class'] ?>:</label>
75			<span>
76				<strong>
77					<?php if (!isset($template['issue'])): ?>
78						<?php echo $bezlang['programme'] ?>
79					<?php elseif (!isset($template['cause'])): ?>
80						<?php echo $bezlang['correction'] ?>
81						<input type="hidden" name="action" value="0" />
82					<?php elseif ($template['cause']['potential'] == 0): ?>
83						<?php echo $bezlang['corrective_action'] ?>
84						<input type="hidden" name="action" value="1" />
85					<?php else: ?>
86						<?php echo $bezlang['preventive_action'] ?>
87						<input type="hidden" name="action" value="2" />
88					<?php endif ?>
89				</strong>
90			</span>
91			</div>
92
93			<div class="row">
94				<label for="task"><?php echo $bezlang['description'] ?>:</label>
95				<span><textarea name="task" id="task"><?php echo $value['task'] ?></textarea></span>
96			</div>
97
98			<div class="row task_plan_field">
99				<label for="plan_date"><?php echo $bezlang['plan_date'] ?>:</label>
100				<span>
101					<input name="plan_date" style="width:90px;" value="<?php echo $value['plan_date'] ?>"/> <label><input type="checkbox" name="all_day_event" value="1"
102				<?php if (isset($value['all_day_event']) && $value['all_day_event'] != '0'): ?>
103					checked
104				<?php endif ?> /> <?php echo $bezlang['all_day_event'] ?></label>
105				</span>
106			</div>
107
108			<div class="row task_plan_field">
109				<label for="start_time"><?php echo $bezlang['start_time'] ?>:</label>
110				<span>
111					<input name="start_time" style="width:60px;" class="bez_timepicker" value="<?php echo $value['start_time'] ?>"/>
112				</span>
113			</div>
114
115			<div class="row task_plan_field">
116				<label for="finish_time"><?php echo $bezlang['finish_time'] ?>:</label>
117				<span>
118					<input name="finish_time" style="width:60px;" class="bez_timepicker" value="<?php echo $value['finish_time'] ?>"/>
119				</span>
120			</div>
121
122			<div class="row">
123				<label for="cost"><?php echo $bezlang['cost'] ?>:</label>
124				<span><input name="cost" id="cost" value="<?php echo $value['cost'] ?>"></span>
125			</div>
126			<?php if (isset($nparams['tid'])): ?>
127				<div class="row">
128				<label for="task_state"><?php echo $bezlang['task_state'] ?>:</label>
129				<span>
130					<strong><?php echo $template['state'] ?></strong>
131				</span>
132				</div>
133				<?php if ($template['raw_state'] != 0): ?>
134				<div class="row">
135					<label for="reason">
136						<?php if ($template['raw_state'] == 1): ?>
137							<?php echo $bezlang['evaluation'] ?>
138						<?php else: ?>
139							<?php echo $bezlang['reason'] ?>
140						<?php endif ?>
141					</label>
142					<span><textarea name="reason" id="reason"><?php echo $value['reason'] ?></textarea></span>
143				</div>
144				<?php endif ?>
145			<?php endif ?>
146		</fieldset>
147		<input type="submit" value="<?php echo $template['task_button'] ?>">
148		<a href="?id=<?php
149			if (!isset($template['issue']))
150				echo $this->id('show_task', 'tid', $nparams['tid']);
151			elseif (isset($nparams[tid]))
152				echo $this->id('issue_task', 'id', $template['issue']['id'], 'tid', $nparams[tid]);
153			else
154				echo $this->id('issue_tasks', 'id', $template['issue']['id']);
155			?>"
156		 class="bez_delete_button bez_link_button">
157			<?php echo $bezlang['cancel'] ?>
158		</a>
159
160	</form>
161
162<a name="z_"></a>
163