1<?php 2/* @var \dokuwiki\plugin\bez\meta\Tpl $tpl */ 3if ($tpl->action() == 'thread') { 4 $url = $tpl->url('thread', 'id', $tpl->get('thread')->id, 'action', $tpl->param('action', 'add'), 'tid', $tpl->param('tid'), 'kid', $tpl->param('kid')); 5 $id = 'bez:thread' . $tpl->get('thread')->id; 6} elseif ($tpl->action() == 'task_form') { 7 $url = $tpl->url('task_form', 'action', $tpl->param('action', 'add'), 'tid', $tpl->param('tid')); 8 $id = 'bez:tasks'; 9} else { 10 $url = $tpl->url('task', 'action', $tpl->param('action', 'add'), 'tid', $tpl->param('tid')); 11 $id = 'bez:tasks'; 12} 13?> 14<a name="z_"></a> 15<form class="bez_form bez_task_form" 16 action="<?php echo $url ?>" method="POST"> 17 <input type="hidden" name="id" value="<?php echo $id ?>"> 18 19 <fieldset class="bds_form"> 20 <?php if ($tpl->param('tid') != ''): ?> 21 <div class="row"> 22 <label for="id"><?php echo $tpl->getLang('id') ?>:</label> 23 <span><strong>#z<?php echo $tpl->get('task')->id ?></strong></span> 24 </div> 25 26 <?php if ($tpl->get('thread') != '' && 27 $tpl->get('task')->acl_of('thread_comment_id') >= BEZ_PERMISSION_CHANGE): ?> 28 <div class="row"> 29 <label for="thread_comment_id"><?php echo ucfirst($tpl->getLang('cause')) ?>:</label> 30 <span> 31 <select name="thread_comment_id" id="thread_comment_id"> 32 <option <?php if ($tpl->value('thread_comment_id') == '') echo 'selected' ?> 33 value="">--- <?php echo $tpl->getLang('correction') ?> ---</option> 34 35 <?php foreach ($tpl->get('thread')->get_causes() as $cause_id): ?> 36 <option <?php if ($tpl->value('thread_comment_id') == $cause_id) echo 'selected' ?> 37 value="<?php echo $cause_id ?>">#k<?php echo $cause_id ?></option> 38 <?php endforeach ?> 39 </select> 40 </span> 41 </div> 42 <?php endif ?> 43 <?php endif ?> 44 45 <?php if ($tpl->get('task')->thread_comment_id != ''): ?> 46 <div class="row"> 47 <label for="type"><?php echo $tpl->getLang('just_type') ?>:</label> 48 <span> 49 <select name="type" id="type" data-validation="required"> 50 <option <?php if ($tpl->value('type') == 'corrective') echo 'selected' ?> 51 value="corrective"><?php echo $tpl->getLang('corrective_action') ?></option> 52 <option <?php if ($tpl->value('type') == 'preventive') echo 'selected' ?> 53 value="preventive"><?php echo $tpl->getLang('preventive_action') ?></option> 54 </select> 55 </span> 56 </div> 57 <?php endif ?> 58 59 <div class="row"> 60 <label for="assignee"><?php echo $tpl->getLang('executor') ?>:</label> 61 <span> 62 <?php if ($tpl->get('task')->acl_of('assignee') >= BEZ_PERMISSION_CHANGE): ?> 63 <select name="assignee" id="assignee" data-validation="required"> 64 <option value="">--- <?php echo $tpl->getLang('select') ?>---</option> 65 <?php foreach ($tpl->get('users') as $nick => $name): ?> 66 <option <?php if ($tpl->value('assignee') == $nick) echo 'selected' ?> 67 value="<?php echo $nick ?>"><?php echo $name ?></option> 68 <?php endforeach ?> 69 </select> 70 <?php else: ?> 71 <strong> 72 <?php echo $tpl->user_name() ?> 73 </strong> 74 <?php endif ?> 75 76 77 </span> 78 </div> 79 80 <div class="row"> 81 <label for="content"><?php echo $tpl->getLang('description') ?>:</label> 82 <span> 83 <?php if ($tpl->get('task')->acl_of('content') >= BEZ_PERMISSION_CHANGE): ?> 84 <div class="bez_toolbar"></div> 85 <?php endif ?> 86 <textarea name="content" id="content" data-validation="required" <?php if ($tpl->get('task')->acl_of('content') < BEZ_PERMISSION_CHANGE) echo 'disabled' ?>><?php echo $tpl->value('content') ?></textarea> 87 </span> 88 </div> 89 90 <div class="row task_plan_field"> 91 <label for="plan_date"><?php echo $tpl->getLang('plan_date') ?>:</label> 92 <span> 93 <input name="plan_date" style="width:90px;" data-validation="required,date" value="<?php echo $tpl->value('plan_date') ?>" 94 <?php if ($tpl->get('task')->acl_of('plan_date') < BEZ_PERMISSION_CHANGE) echo 'disabled' ?> 95 /> 96 <div style="display:inline" id="task_datapair"> 97 <?php echo $tpl->getLang('from_hour') ?> 98 <input name="start_time" style="width:60px;" class="time start" value="<?php echo $tpl->value('start_time') ?>" 99 data-validation="required,custom" 100 data-validation-regexp="^(\d{1,2}):(\d{1,2})$" 101 data-validation-depends-on="all_day_event" 102 <?php if ($tpl->get('task')->acl_of('plan_date') < BEZ_PERMISSION_CHANGE) echo 'disabled' ?> 103 /> 104 <?php echo $tpl->getLang('to_hour') ?> 105 <input name="finish_time" style="width:60px;" class="time end" value="<?php echo $tpl->value('finish_time') ?>" 106 data-validation="required,custom" 107 data-validation-regexp="^(\d{1,2}):(\d{1,2})$" 108 data-validation-depends-on="all_day_event" 109 <?php if ($tpl->get('task')->acl_of('plan_date') < BEZ_PERMISSION_CHANGE) echo 'disabled' ?> 110 /> 111 </div> 112 </span> 113 </div> 114 115 <div class="row"> 116 <label></label> 117 <span> 118 <label> 119 <?php if ($tpl->get('task')->acl_of('all_day_event') >= BEZ_PERMISSION_CHANGE): ?> 120 <input type="checkbox" name="all_day_event" value="1" 121 <?php if ($tpl->value('all_day_event') == '' || 122 $tpl->value('all_day_event') == '1'): ?> 123 checked 124 <?php endif ?> /> 125 <?php else: ?> 126 <input type="checkbox" disabled 127 <?php if ($tpl->get('task')->all_day_event == '1'): ?> 128 checked 129 <?php endif ?> /> 130 <?php endif ?> <?php echo $tpl->getLang('all_day_event') ?> 131 </label> 132 133 </span> 134 </div> 135 136 <div class="row"> 137 <label for="tasktype"><?php echo $tpl->getLang('task_type') ?>:</label> 138 <span> 139 <select id="task_program_id" name="task_program_id" 140 <?php if ($tpl->get('task')->acl_of('task_program_id') < BEZ_PERMISSION_CHANGE) echo 'disabled' ?> 141 <?php if (!$tpl->get('task')->can_be_null('task_program_id')) echo 'data-validation="required"' ?>> 142 <?php if ($tpl->get('task')->can_be_null('task_program_id')): ?> 143 <option <?php if ($tpl->value('task_program_id') == '') echo 'selected' ?> value=""> 144 <?php echo $tpl->getLang('tasks_no_type') ?> 145 </option> 146 <?php else: ?> 147 <option value="">--- <?php echo $tpl->getLang('select') ?>---</option> 148 <?php endif ?> 149 150 <?php foreach ($tpl->get('task_programs') as $task_program): ?> 151 <option <?php if ($tpl->value('task_program_id') == $task_program->id) echo 'selected' ?> value="<?php echo $task_program->id ?>"><?php echo $task_program->name ?></option> 152 <?php endforeach ?> 153 </select> 154 </span> 155 </div> 156 157 <div class="row"> 158 <label for="cost"><?php echo $tpl->getLang('cost') ?>:</label> 159 <span><input type="number" name="cost" id="cost" 160 min="0" step="0.01" 161 value="<?php echo $tpl->value('cost') ?>" 162 <?php if ($tpl->get('task')->acl_of('plan_date') < BEZ_PERMISSION_CHANGE) echo 'disabled' ?>></span> 163 </div> 164 <?php if ($tpl->param('tid') != ''): ?> 165 <div class="row"> 166 <label for="task_state"><?php echo $tpl->getLang('task_state') ?>:</label> 167 <span> 168 <strong><?php echo $tpl->getLang('task_' . $tpl->get('task')->state) ?></strong> 169 </span> 170 </div> 171 <?php endif ?> 172 <div class="row"> 173 <label></label> 174 <span style="padding-top:10px;"> 175 <input type="submit" value="<?php echo $tpl->param('tid') == '' ? $tpl->getLang('add') : $tpl->getLang('correct') ?>"> 176 <a href="<?php 177 if ($tpl->action() == 'thread') { 178 echo $tpl->url('thread', 'id', $tpl->get('thread')->id); 179 } else if ($tpl->action() == 'task' && $tpl->get('task')->id != '') { 180 echo $tpl->url('task', 'tid', $tpl->get('task')->id); 181 } else if ($tpl->get('task')->task_program_id != '') { 182 echo $tpl->url('tasks', 'task_program_id', $tpl->get('task')->task_program_id); 183 } else { 184 echo $tpl->url('tasks'); 185 } 186 ?><?php if ($tpl->param('tid') != '') echo '#z'.$tpl->param('tid') ?>" 187 class="bez_delete_button bez_link_button"> 188 <?php echo $tpl->getLang('cancel') ?> 189 </a> 190 </span> 191 </div> 192 </fieldset> 193</form> 194