|
39 | 39 | $showhgrid = ''; |
40 | 40 |
|
41 | 41 | if ($a == 'todo') { |
42 | | - if (isset($_POST['show_form'])) { |
43 | | - $AppUI->setState('TaskDayShowArc', w2PgetParam($_POST, 'showArcProjs', 0)); |
44 | | - $AppUI->setState('TaskDayShowLow', w2PgetParam($_POST, 'showLowTasks', 0)); |
45 | | - $AppUI->setState('TaskDayShowHold', w2PgetParam($_POST, 'showHoldProjs', 0)); |
46 | | - $AppUI->setState('TaskDayShowDyn', w2PgetParam($_POST, 'showDynTasks', 0)); |
47 | | - $AppUI->setState('TaskDayShowPin', w2PgetParam($_POST, 'showPinned', 0)); |
48 | | - } |
49 | | - |
50 | | - $showArcProjs = $AppUI->getState('TaskDayShowArc', 0); |
51 | | - $showLowTasks = $AppUI->getState('TaskDayShowLow', 1); |
52 | | - $showHoldProjs = $AppUI->getState('TaskDayShowHold', 0); |
53 | | - $showDynTasks = $AppUI->getState('TaskDayShowDyn', 0); |
54 | | - $showPinned = $AppUI->getState('TaskDayShowPin', 0); |
| 42 | + // todo.php has already saved the posted filters (the form below uses the |
| 43 | + // same field names as the My Tasks tab). The values go into the chart URL, |
| 44 | + // where gantt.php casts them to int, so pass them as 1/0 rather than the |
| 45 | + // checkbox value "on". |
| 46 | + $showArcProjs = $AppUI->getState('TaskDayShowArc', 0) ? 1 : 0; |
| 47 | + $showLowTasks = $AppUI->getState('TaskDayShowLow', 1) ? 1 : 0; |
| 48 | + $showHoldProjs = $AppUI->getState('TaskDayShowHold', 0) ? 1 : 0; |
| 49 | + $showDynTasks = $AppUI->getState('TaskDayShowDyn', 0) ? 1 : 0; |
| 50 | + $showPinned = $AppUI->getState('TaskDayShowPin', 0) ? 1 : 0; |
55 | 51 | } else { |
56 | 52 | $showPinned = w2PgetParam($_POST, 'showPinned', '0'); |
57 | 53 | $showPinned = (($showPinned != '0') ? '1' : $showPinned); |
@@ -270,49 +266,27 @@ function submitIt() { |
270 | 266 | </div> |
271 | 267 | <?php if ($a == 'todo') { ?> |
272 | 268 | <input type="hidden" name="show_form" value="1" /> |
| 269 | + <?php // Not shown on this tab, but todo.php resets any filter that is not posted. ?> |
| 270 | + <input type="hidden" name="show_empty_date" value="<?php echo $AppUI->getState('TaskDayShowEmptyDate', 0) ? 1 : 0; ?>" /> |
| 271 | + <input type="hidden" name="show_inprogress" value="<?php echo $AppUI->getState('TaskDayShowInProgress', 0) ? 1 : 0; ?>" /> |
273 | 272 | <div class="d-flex flex-wrap justify-content-center gap-3 mt-2"> |
274 | | - <span class="text-nowrap"> |
275 | | - <input type="checkbox" name="showPinned" id="showPinned" <?php echo $showPinned ? 'checked="checked"' : ''; ?> /> |
276 | | - <label for="showPinned"><?php echo $AppUI->_('Pinned Only'); ?></label> |
277 | | - </span> |
278 | | - <span class="text-nowrap"> |
279 | | - <input type="checkbox" name="showArcProjs" id="showArcProjs" <?php echo $showArcProjs ? 'checked="checked"' : ''; ?> /> |
280 | | - <label for="showArcProjs"><?php echo $AppUI->_('Archived/Template Projects'); ?></label> |
281 | | - </span> |
282 | | - <span class="text-nowrap"> |
283 | | - <input type="checkbox" name="showDynTasks" id="showDynTasks" <?php echo $showDynTasks ? 'checked="checked"' : ''; ?> /> |
284 | | - <label for="showDynTasks"><?php echo $AppUI->_('Dynamic Tasks'); ?></label> |
285 | | - </span> |
286 | | - <span class="text-nowrap"> |
287 | | - <input type="checkbox" name="showLowTasks" id="showLowTasks" <?php echo $showLowTasks ? 'checked="checked"' : ''; ?> /> |
288 | | - <label for="showLowTasks"><?php echo $AppUI->_('Low Priority Tasks'); ?></label> |
289 | | - </span> |
290 | | - </div> |
291 | | - <div id="ganttoptions" style="display:none"> |
292 | | - <input type="hidden" name="show_form" value="1" /> |
293 | | - <div class="d-flex flex-wrap gap-3"> |
294 | | - <span> To Do Options: </span> |
295 | | - <span class="text-nowrap"> |
296 | | - <input type="checkbox" name="showPinned" id="showPinned" <?php echo $showPinned ? 'checked="checked"' : ''; ?> /> |
297 | | - <label for="showPinned"><?php echo $AppUI->_('Pinned Only'); ?></label> |
298 | | - </span> |
299 | | - <span class="text-nowrap"> |
300 | | - <input type="checkbox" name="showArcProjs" id="showArcProjs" <?php echo $showArcProjs ? 'checked="checked"' : ''; ?> /> |
301 | | - <label for="showArcProjs"><?php echo $AppUI->_('Archived Projects'); ?></label> |
302 | | - </span> |
303 | | - <span class="text-nowrap"> |
304 | | - <input type="checkbox" name="showHoldProjs" id="showHoldProjs" <?php echo $showHoldProjs ? 'checked="checked"' : ''; ?> /> |
305 | | - <label for="showHoldProjs"><?php echo $AppUI->_('Projects on Hold'); ?></label> |
306 | | - </span> |
307 | | - <span class="text-nowrap"> |
308 | | - <input type="checkbox" name="showDynTasks" id="showDynTasks" <?php echo $showDynTasks ? 'checked="checked"' : ''; ?> /> |
309 | | - <label for="showDynTasks"><?php echo $AppUI->_('Dynamic Tasks'); ?></label> |
310 | | - </span> |
| 273 | + <?php |
| 274 | + $todoFilters = array( |
| 275 | + 'show_pinned' => array($showPinned, 'Pinned Only'), |
| 276 | + 'show_arc_proj' => array($showArcProjs, 'Archived/Template Projects'), |
| 277 | + 'show_hold_proj' => array($showHoldProjs, 'Projects on Hold'), |
| 278 | + 'show_dyn_task' => array($showDynTasks, 'Dynamic Tasks'), |
| 279 | + 'show_low_task' => array($showLowTasks, 'Low Priority Tasks'), |
| 280 | + ); |
| 281 | + foreach ($todoFilters as $name => $filter) { |
| 282 | + ?> |
311 | 283 | <span class="text-nowrap"> |
312 | | - <input type="checkbox" name="showLowTasks" id="showLowTasks" <?php echo $showLowTasks ? 'checked="checked"' : ''; ?> /> |
313 | | - <label for="showLowTasks"><?php echo $AppUI->_('Low Priority Tasks'); ?></label> |
| 284 | + <input type="checkbox" name="<?php echo $name; ?>" id="gantt_<?php echo $name; ?>" value="1" <?php echo $filter[0] ? 'checked="checked"' : ''; ?> /> |
| 285 | + <label for="gantt_<?php echo $name; ?>"><?php echo $AppUI->_($filter[1]); ?></label> |
314 | 286 | </span> |
315 | | - </div> |
| 287 | + <?php |
| 288 | + } |
| 289 | + ?> |
316 | 290 | </div> |
317 | 291 | <?php } ?> |
318 | 292 | <div class="text-center mt-2"> |
|
0 commit comments