[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/tasks/ -> todo_tasks_sub.php (source)

   1  <?php /* $Id: todo_tasks_sub.php 135 2008-04-04 13:49:13Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/tasks/todo_tasks_sub.php $ */
   2  if (!defined('W2P_BASE_DIR')) {
   3      die('You should not access this file directly.');
   4  }
   5  
   6  global $showEditCheckbox, $tasks, $priorities;
   7  global $m, $a, $date, $other_users, $showPinned, $showArcProjs, $showHoldProjs, $showDynTasks, $showLowTasks, $showEmptyDate, $user_id, $task_type;
   8  global $task_sort_item1, $task_sort_type1, $task_sort_order1;
   9  global $task_sort_item2, $task_sort_type2, $task_sort_order2;
  10  $perms = &$AppUI->acl();
  11  $canDelete = $perms->checkModuleItem($m, 'delete');
  12  ?>
  13  <table width="100%" border="0" cellpadding="1" cellspacing="0">
  14  <form name="form_buttons" method="post" action="index.php?<?php echo 'm=' . $m . '&a=' . $a . '&date=' . $date; ?>">
  15  <input type="hidden" name="show_form" value="1" />
  16  
  17  <tr>
  18      <td width="50%">
  19      <?php
  20  if ($other_users) {
  21      echo '<select name="show_user_todo" class="text" onchange="document.form_buttons.submit()">';
  22  
  23      echo '<option value="0" selected="selected">(' . $AppUI->_('Show Todo for') . ')</option>';
  24      if (($rows = w2PgetUsersList())) {
  25          foreach ($rows as $row) {
  26              if ($user_id == $row['user_id']) {
  27                  echo '<option value="' . $row['user_id'] . '" selected="selected">' . $row['contact_first_name'] . ' ' . $row['contact_last_name'] . '</option>';
  28              } else {
  29                  echo '<option value="' . $row['user_id'] . '">' . $row['contact_first_name'] . ' ' . $row['contact_last_name'] . '</option>';
  30              }
  31          }
  32      }
  33  }
  34  ?>
  35          </select>
  36      </td>
  37      <td align="right" width="50%">
  38          <?php echo $AppUI->_('Show'); ?>:
  39      </td>
  40      <td>
  41          <input type="checkbox" name="show_pinned" id="show_pinned" onclick="document.form_buttons.submit()" <?php echo $showPinned ? 'checked="checked"' : ''; ?> />
  42      </td>
  43      <td nowrap="nowrap">
  44          <label for="show_pinned"><?php echo $AppUI->_('Pinned Only'); ?></label>
  45      </td>
  46      <td>
  47          <input type="checkbox" name="show_arc_proj" id="show_arc_proj" onclick="document.form_buttons.submit()" <?php echo $showArcProjs ? 'checked="checked"' : ''; ?> />
  48      </td>
  49      <td nowrap="nowrap">
  50          <label for="show_arc_proj"><?php echo $AppUI->_('Archived/Template Projects'); ?></label>
  51      </td>
  52  <!--    <td>
  53          <input type="checkbox" name="show_hold_proj" id="show_hold_proj" onclick="document.form_buttons.submit()" <?php echo $showHoldProjs ? 'checked="checked"' : ''; ?> />
  54      </td>
  55      <td nowrap="nowrap">
  56          <label for="show_hold_proj"><?php echo $AppUI->_('Projects on Hold'); ?></label>
  57      </td>-->
  58      <td>
  59          <input type="checkbox" name="show_dyn_task" id="show_dyn_task" onclick="document.form_buttons.submit()" <?php echo $showDynTasks ? 'checked="checked"' : ''; ?> />
  60      </td>
  61      <td nowrap="nowrap">
  62          <label for="show_dyn_task"><?php echo $AppUI->_('Dynamic Tasks'); ?></label>
  63      </td>
  64      <td>
  65          <input type="checkbox" name="show_low_task" id="show_low_task" onclick="document.form_buttons.submit()" <?php echo $showLowTasks ? 'checked="checked"' : ''; ?> />
  66      </td>
  67      <td nowrap="nowrap">
  68          <label for="show_low_task"><?php echo $AppUI->_('Low Priority Tasks'); ?></label>
  69      </td>
  70      <td>
  71          <input type="checkbox" name="show_empty_date" id="show_empty_date" onclick="document.form_buttons.submit()" <?php echo $showEmptyDate ? 'checked="checked"' : ''; ?> />
  72      </td>
  73      <td nowrap="nowrap">
  74          <label for="show_empty_date"><?php echo $AppUI->_('Empty Dates'); ?></label>
  75      </td>
  76  </tr>
  77  <tr>
  78      <td colspan = "12" align="right">
  79  <?php
  80      $types = array('' => '(Task Type Filter)') + w2PgetSysVal('TaskType');
  81      echo arraySelect($types, 'task_type', 'class="text" onchange="document.form_buttons.submit()"', $task_type, true);
  82  ?>
  83      </td>
  84  </tr>
  85  </form>
  86  </table>
  87  <table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
  88  <form name="form" method="post" action="index.php?<?php echo "m=$m&a=$a&date=$date"; ?>">
  89  <tr>
  90      <th width="10">&nbsp;</th>
  91      <th width="10"><?php echo $AppUI->_('Pin'); ?></th>
  92      <th width="20" colspan="2"><?php echo $AppUI->_('Progress'); ?></th>
  93      <th width="15" align="center"><?php sort_by_item_title('P', 'task_priority', SORT_NUMERIC, '&a=todo'); ?></th>
  94      <th colspan="2"><?php sort_by_item_title('Task / Project', 'task_name', SORT_STRING, '&a=todo'); ?></th>
  95      <th nowrap="nowrap"><?php sort_by_item_title('Start Date', 'task_start_date', SORT_NUMERIC, '&a=todo'); ?></th>
  96      <th nowrap="nowrap"><?php sort_by_item_title('Duration', 'task_duration', SORT_NUMERIC, '&a=todo'); ?></th>
  97      <th nowrap="nowrap"><?php sort_by_item_title('Finish Date', 'task_end_date', SORT_NUMERIC, '&a=todo'); ?></th>
  98      <th nowrap="nowrap"><?php sort_by_item_title('Due In', 'task_due_in', SORT_NUMERIC, '&a=todo'); ?></th>
  99      <?php if (w2PgetConfig('direct_edit_assignment')) { ?><th width="0">&nbsp;</th><?php } ?>
 100  </tr>
 101  <?php
 102  
 103  /*** Tasks listing ***/

 104  $now = new CDate();
 105  $df = $AppUI->getPref('SHDATEFORMAT');
 106  
 107  // generate the 'due in' value

 108  foreach ($tasks as $tId => $task) {
 109      $sign = 1;
 110      $start = intval($task['task_start_date']) ? new CDate($task['task_start_date']) : null;
 111      $end = intval($task['task_end_date']) ? new CDate($task['task_end_date']) : null;
 112  
 113      if (!$end && $start) {
 114          $end = $start;
 115          $end->addSeconds($task['task_duration'] * $task['task_duration_type'] * SEC_HOUR);
 116      }
 117  
 118      if ($end && $now->after($end)) {
 119          $sign = -1;
 120      }
 121  
 122      $days = $end ? $now->dateDiff($end) * $sign : null;
 123      $tasks[$tId]['task_due_in'] = $days;
 124  
 125  }
 126  
 127  // sorting tasks

 128  if ($task_sort_item1 != '') {
 129      if ($task_sort_item2 != '' && $task_sort_item1 != $task_sort_item2) {
 130          $tasks = array_csort($tasks, $task_sort_item1, $task_sort_order1, $task_sort_type1, $task_sort_item2, $task_sort_order2, $task_sort_type2);
 131      } else {
 132          $tasks = array_csort($tasks, $task_sort_item1, $task_sort_order1, $task_sort_type1);
 133      }
 134  } else { // All this appears to already be handled in todo.php ... should consider deleting this else block
 135      /* we have to calculate the end_date via start_date+duration for

 136      ** end='0000-00-00 00:00:00' if array_csort function is not used

 137      ** as it is normally done in array_csort function in order to economise

 138      ** cpu time as we have to go through the array there anyway

 139      */
 140      for ($j = 0, $j_cmp = count($tasks); $j < $j_cmp; $j++) {
 141          if ($tasks[$j]['task_end_date'] == '0000-00-00 00:00:00' || $tasks[$j]['task_end_date'] == '') {
 142              if ($tasks[$j]['task_start_date'] == '0000-00-00 00:00:00' || $tasks[$j]['task_start_date'] == '') {
 143                  $tasks[$j]['task_start_date'] = '0000-00-00 00:00:00'; //just to be sure start date is "zeroed"

 144                  $tasks[$j]['task_end_date'] = '0000-00-00 00:00:00';
 145              } else {
 146                  $tasks[$j]['task_end_date'] = calcEndByStartAndDuration($tasks[$j]);
 147              }
 148          }
 149      }
 150  }
 151  
 152  $history_active = false;
 153  // showing tasks

 154  foreach ($tasks as $task) {
 155      showtask($task, 0, false, true);
 156  }
 157  if (w2PgetConfig('direct_edit_assignment')) {
 158  ?>
 159  <tr>
 160      <td colspan="9" align="right" height="30">
 161          <input type="submit" class="button" value="<?php echo $AppUI->_('update task'); ?>" />
 162      </td>
 163      <td colspan="3" align="center">
 164  <?php
 165      foreach ($priorities as $k => $v) {
 166          $options[$k] = $AppUI->_('set priority to ' . $v, UI_OUTPUT_RAW);
 167      }
 168      $options['c'] = $AppUI->_('mark as finished', UI_OUTPUT_RAW);
 169      if ($canDelete) {
 170          $options['d'] = $AppUI->_('delete', UI_OUTPUT_RAW);
 171      }
 172      echo arraySelect($options, 'task_priority', 'size="1" class="text"', '0');
 173  }
 174  ?>
 175      </td>
 176  </form>
 177  </table>
 178  <table>
 179  <tr>    
 180      <td>&nbsp; &nbsp;</td>
 181      <td style="border-style:solid;border-width:1px" bgcolor="#ffffff">&nbsp; &nbsp;</td>
 182      <td>=<?php echo $AppUI->_('Future Task'); ?></td>
 183      <td>&nbsp; &nbsp;</td>
 184      <td style="border-style:solid;border-width:1px" bgcolor="#e6eedd">&nbsp; &nbsp;</td>
 185      <td>=<?php echo $AppUI->_('Started and on time'); ?></td>
 186      <td style="border-style:solid;border-width:1px" bgcolor="#ffeebb">&nbsp; &nbsp;</td>
 187      <td>=<?php echo $AppUI->_('Should have started'); ?></td>
 188      <td>&nbsp; &nbsp;</td>
 189      <td style="border-style:solid;border-width:1px" bgcolor="#CC6666">&nbsp; &nbsp;</td>
 190      <td>=<?php echo $AppUI->_('Overdue'); ?></td>    
 191  </tr>
 192  </table>


Generated: Thu Jan 8 03:00:03 2009 Cross-referenced by PHPXref 0.7