[ Index ]

Source Code Reference for V1.00

title

Body

[close]

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

   1  <?php /* $Id: ae_resource.php 56 2008-02-19 18:39:18Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/tasks/ae_resource.php $ */
   2  if (!defined('W2P_BASE_DIR')) {
   3      die('You should not access this file directly.');
   4  }
   5  
   6  // $Id: ae_resource.php 56 2008-02-19 18:39:18Z pedroix $

   7  global $AppUI, $users, $task_id, $task_project, $obj, $projTasksWithEndDates, $tab, $loadFromTab;
   8  
   9  // Make sure that we can see users that are allocated to the task.

  10  
  11  if ($task_id == 0) {
  12      // Add task creator to assigned users by default

  13      $assigned_perc = array($AppUI->user_id => array('contact_name' => $users[$AppUI->user_id], 'perc_assignment' => '100'));
  14  } else {
  15      // Pull users on this task

  16      $q = new DBQuery;
  17      $q->addTable('user_tasks');
  18      $q->addQuery('user_tasks.user_id, perc_assignment, concat_ws(\' \', contact_first_name, contact_last_name) as contact_name');
  19      $q->addWhere('task_id = ' . (int)$task_id);
  20      $q->addWhere('task_id <> 0');
  21      $q->addJoin('users', '', 'users.user_id = user_tasks.user_id', 'inner');
  22      $q->addJoin('contacts', '', 'contacts.contact_id = users.user_contact', 'inner');
  23      $assigned_perc = $q->loadHashList('user_id');
  24      $q->clear();
  25  }
  26  
  27  $initPercAsignment = '';
  28  $assigned = array();
  29  foreach ($assigned_perc as $user_id => $data) {
  30      $assigned[$user_id] = $data['contact_name'] . ' [' . $data['perc_assignment'] . '%]';
  31      $initPercAsignment .= "$user_id={$data['perc_assignment']};";
  32  }
  33  
  34  ?>
  35  <script language="javascript">
  36  <?php
  37  echo "var projTasksWithEndDates=new Array();\n";
  38  $keys = array_keys($projTasksWithEndDates);
  39  for ($i = 1, $i_cmp = sizeof($keys); $i < $i_cmp; $i++) {
  40      //array[task_is] = end_date, end_hour, end_minutes

  41      echo 'projTasksWithEndDates[' . $keys[$i] . "]=new Array(\"" . $projTasksWithEndDates[$keys[$i]][1] . "\", \"" . $projTasksWithEndDates[$keys[$i]][2] . "\", \"" . $projTasksWithEndDates[$keys[$i]][3] . "\");\n";
  42  }
  43  ?>
  44  </script>
  45  <form action="?m=tasks&a=addedit&task_project=<?php echo $task_project; ?>" method="post" name="resourceFrm">
  46  <input type="hidden" name="sub_form" value="1" />
  47  <input type="hidden" name="task_id" value="<?php echo $task_id; ?>" />
  48  <input type="hidden" name="dosql" value="do_task_aed" />
  49  <input name="hperc_assign" type="hidden" value="<?php echo $initPercAsignment; ?>"/>
  50  <table width="100%" border="1" cellpadding="4" cellspacing="0" class="std">
  51  <tr>
  52      <td valign="top" align="center">
  53          <table cellspacing="0" cellpadding="2" border="0">
  54              <tr>
  55                  <td><?php echo $AppUI->_('Human Resources'); ?>:</td>
  56                  <td><?php echo $AppUI->_('Assigned to Task'); ?>:</td>
  57              </tr>
  58              <tr>
  59                  <td>
  60                      <?php echo arraySelect($users, 'resources', 'style="width:220px" size="10" class="text" multiple="multiple" ', null); ?>
  61                  </td>
  62                  <td>
  63                      <?php echo arraySelect($assigned, 'assigned', 'style="width:220px" size="10" class="text" multiple="multiple" ', null); ?>
  64                  </td>
  65              <tr>
  66                  <td colspan="2" align="center">
  67                      <table>
  68                      <tr>
  69                          <td align="right"><input type="button" class="button" value="&gt;" onclick="addUser(document.resourceFrm)" /></td>
  70                          <td>
  71                              <select name="percentage_assignment" class="text">
  72                              <?php
  73  for ($i = 5; $i <= 100; $i += 5) {
  74      echo '<option ' . (($i == 100) ? 'selected="true"' : '') . ' value="' . $i . '">' . $i . '%</option>';
  75  }
  76  ?>
  77                              </select>
  78                          </td>                
  79                          <td align="left"><input type="button" class="button" value="&lt;" onclick="removeUser(document.resourceFrm)" /></td>                    
  80                      </tr>
  81                      </table>
  82                  </td>
  83              </tr>
  84              </tr>
  85  <!--             <tr>
  86                  <td colspan=3 align="center">
  87                      <input type="checkbox" name="task_notify" value="1" <?php //if($obj->task_notify!="0") echo "checked" ?> /> <?php //echo $AppUI->_( 'notifyChange' ); ?>
  88                  </td>
  89              </tr> -->
  90          </table>
  91      </td>
  92      <td valign="top" align="center">
  93          <table><tr><td align="left">
  94          <?php echo $AppUI->_('Additional Email Comments'); ?>:        
  95          <br />
  96          <textarea name="email_comment" class="textarea" cols="60" rows="10"></textarea><br />
  97          <input type="checkbox" name="task_notify" id="task_notify" value="1" <?php if ($obj->task_notify != '0') echo 'checked="checked"' ?> /> 
  98          <label for="task_notify"><?php echo $AppUI->_('notifyChange'); ?></label>
  99          </td></tr></table><br />        
 100      </td>
 101  </tr>
 102  </table>
 103  <input type="hidden" name="hassign" />
 104  </form>
 105  <script language="javascript">
 106      subForm.push(new FormDefinition(<?php echo $tab; ?>, document.resourceFrm, checkResource, saveResource));
 107  </script>


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