createforobject.html.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <?php
  2. /**
  3. * The create view of effort module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2012 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license business(商业软件)
  7. * @author Yangyang Shi <shiyangyang@cnezsoft.com>
  8. * @package effort
  9. * @version $Id$
  10. * @link http://www.zentao.net
  11. */
  12. ?>
  13. <?php include $app->getModuleRoot() . 'common/view/header.lite.html.php';?>
  14. <?php include $app->getModuleRoot() . 'common/view/datepicker.html.php';?>
  15. <?php if($objectType == 'task' and !$this->task->canOperateEffort($task) and empty($myOrders)):?>
  16. <style>#mainContent {min-height: unset;}</style>
  17. <?php endif;?>
  18. <?php if($objectType == 'task'):?>
  19. <?php js::set('taskID', $objectID);?>
  20. <?php js::set('foldEffort', $lang->task->foldEffort);?>
  21. <?php js::set('unfoldEffort', $lang->task->unfoldEffort);?>
  22. <?php endif;?>
  23. <?php js::set('noticeSaveRecord', $this->lang->effort->noticeSaveRecord);?>
  24. <?php js::set('objectType', $objectType);?>
  25. <?php js::set('objectID', $objectID);?>
  26. <?php js::set('today', helper::today());?>
  27. <div id='mainContent' class='main-content'>
  28. <div class='main-header'>
  29. <h2>
  30. <span class="label label-id"><?php echo $objectID;?></span>
  31. <span title='<?php echo $modalTitle;?>'><?php echo $modalTitle;?></span>
  32. </h2>
  33. <?php if($objectType == 'task'):?>
  34. <ul class='nav nav-default hours'>
  35. <li><span><?php echo $lang->task->estimate;?></span> </li>
  36. <li><span class='estimateTotally'><?php echo $task->estimate . 'h';?></span></li>
  37. <li>,</li>
  38. <li><span><?php echo $lang->task->consumed;?></span> </li>
  39. <li><span class='consumedTotally'><?php echo $task->consumed . 'h';?></span></li>
  40. </ul>
  41. <?php endif;?>
  42. </div>
  43. <?php if($efforts):?>
  44. <?php if($objectType == 'task' and !empty($task->team) and $task->mode == 'linear'):?>
  45. <?php include $this->app->getModuleRoot() . 'task/view/lineareffort.html.php';?>
  46. <?php else:?>
  47. <?php $tableClass = $objectType == 'task' ? 'taskEffort' : '';?>
  48. <table class="table table-bordered table-fixed table-recorded has-sort-head <?php echo $tableClass;?>" id='objectTable' style='margin-bottom:10px;'>
  49. <thead>
  50. <tr>
  51. <?php if($objectType == 'task'):?>
  52. <?php $vars = "objectType=$objectType&taskID=$task->id&from=$from&orderBy=%s";?>
  53. <th class="w-120px"><?php common::printOrderLink('date', !strpos($orderBy, ',') ? $orderBy : 'date_asc', $vars, $lang->task->date);?></th>
  54. <?php else:?>
  55. <th class="w-120px"><?php echo $lang->effort->date;?></th>
  56. <?php endif;?>
  57. <th class='w-120px'><?php echo $lang->effort->account;?></th>
  58. <th><?php echo $lang->effort->work;?></th>
  59. <th class='thWidth'><?php echo $lang->effort->consumed;?></th>
  60. <?php if($objectType == 'task'):?>
  61. <th class='thWidth'><?php echo $lang->effort->left;?></th>
  62. <?php endif;?>
  63. <th class='w-80px'><?php echo $lang->actions;?></th>
  64. </tr>
  65. </thead>
  66. <tbody>
  67. <?php $i = 1;?>
  68. <?php foreach($efforts as $effort):?>
  69. <?php $hidden = ($objectType == 'task' and $taskEffortFold and $i > 3) ? 'hidden' : ''?>
  70. <?php
  71. $canOperateEffort = $objectType == 'task' ? $this->task->canOperateEffort($task, $effort) : $this->loadModel('common')->canOperateEffort($effort);
  72. ?>
  73. <tr class="<?php echo $hidden;?>">
  74. <td class='text-center'><?php echo $effort->date?></td>
  75. <td class='text-center'><?php echo zget($users, $effort->account);?></td>
  76. <td title='<?php echo $effort->work;?>'><?php echo $effort->work;?></td>
  77. <td class='text-center' title="<?php echo $effort->consumed . ' ' . $lang->effort->workHour;?>"><?php echo $effort->consumed . ' h'?></td>
  78. <?php if($objectType == 'task'):?>
  79. <td class='text-center' title="<?php echo $effort->left . ' ' . $lang->effort->workHour;?>"><?php echo $effort->left . ' h';?></td>
  80. <?php endif;?>
  81. <td class='text-center c-actions'>
  82. <?php
  83. $tipsLang = (!empty($effort->project) || !empty($effort->execution)) ? $lang->task->effortOperateTips : $lang->effort->operateTips;
  84. $operateTips = (!$canOperateEffort && (($objectType == 'task' && empty($taks->team)) || $objectType != 'task')) ? $tipsLang : '';
  85. common::printIcon('effort', 'edit', "effortID=$effort->id", '', 'list', 'edit', '', 'showinonlybody', true, $canOperateEffort ? '' : 'disabled', $operateTips ? sprintf($operateTips, $lang->task->update) : '');
  86. common::printIcon('effort', 'delete', "effortID=$effort->id", '', 'list', 'trash', 'hiddenwin', 'showinonlybody', false, $canOperateEffort ? '' : 'disabled', $operateTips ? sprintf($operateTips, $lang->delete) : '');
  87. ?>
  88. </td>
  89. </tr>
  90. <?php $i ++;?>
  91. <?php endforeach;?>
  92. </tbody>
  93. </table>
  94. <?php if($objectType == 'task' and count($efforts) > 3):?>
  95. <div id='toggleFoldIcon'>
  96. <?php $icon = $taskEffortFold ? 'icon-angle-down' : 'icon-angle-top'?>
  97. <?php $iconText = $taskEffortFold ? $lang->task->unfoldEffort : $lang->task->foldEffort;?>
  98. <span class='icon-border'><i class="icon <?php echo $icon;?>"></i></span>
  99. <span class='text'><?php echo $iconText;?></span>
  100. </div>
  101. <?php endif;?>
  102. <?php endif;?>
  103. <?php endif;?>
  104. <?php if($objectType == 'task' and !$this->task->canOperateEffort($task) and empty($myOrders)):?>
  105. <div class="alert with-icon">
  106. <i class="icon-exclamation-sign icon-rotate-180"></i>
  107. <div class="content">
  108. <?php if(!isset($task->members[$app->user->account])):?>
  109. <p><?php echo sprintf($lang->task->deniedNotice, '<strong>' . $lang->task->teamMember . '</strong>', $lang->task->logEfforts);?></p>
  110. <?php elseif($task->assignedTo != $app->user->account and $task->mode == 'linear'):?>
  111. <p><?php echo sprintf($lang->task->deniedNotice, '<strong>' . $task->assignedToRealName . '</strong>', $lang->task->logEfforts);?></p>
  112. <?php endif;?>
  113. </div>
  114. </div>
  115. <?php else:?>
  116. <form method='post' target='hiddenwin' id='createEffort' class='hidden'>
  117. <?php
  118. $readonly = '';
  119. $left = '';
  120. if($objectType == 'task' and ($task->assignedTo != $app->user->account or strpos('closed,cancel,done,pause', $task->status) !== false) and !empty($task->team) and $task->mode == 'linear' and !empty($myOrders))
  121. {
  122. $readonly = ' readonly';
  123. $left = 0;
  124. $reverseOrders = array_reverse($myOrders, true);
  125. foreach($reverseOrders as $order => $count) $reverseOrders[$order] = $order + 1;
  126. }
  127. ?>
  128. <?php $thClass = $objectType == 'task' ? 'required' : '';?>
  129. <table class='table table-form table-fixed table-record'>
  130. <thead class='text-center'>
  131. <tr>
  132. <th class='w-30px'><?php echo $lang->idAB;?></th>
  133. <th class="w-150px <?php echo $thClass;?>"><?php echo $lang->effort->date;?></th>
  134. <?php if($readonly):?>
  135. <th class="w-60px <?php if(count($reverseOrders) == 1) echo "hidden"?>"><?php echo $lang->task->teamOrder;?></th>
  136. <?php endif;?>
  137. <th class="<?php echo $thClass;?>"><?php echo $lang->effort->work;?></th>
  138. <th class="thWidth <?php echo $thClass;?>"><?php echo $lang->effort->consumed;?></th>
  139. <?php if($objectType == 'task'):?>
  140. <th class="thWidth <?php if(empty($readonly)) echo 'required'?>"><?php echo $lang->effort->left;?></th>
  141. <?php endif;?>
  142. </tr>
  143. </thead>
  144. <tbody>
  145. <?php $today = date(DT_DATE1);?>
  146. <?php for($i = 1; $i <= 5; $i++):?>
  147. <tr class='text-top'>
  148. <td class='text-center'><?php echo $i . html::hidden("id[$i]", $i);?></td>
  149. <td class='text-center'>
  150. <div class='input-group date-group'>
  151. <?php echo html::input("dates[$i]", $today, "class='form-control form-date'");?>
  152. <span class='input-group-addon'><i class='icon icon-calendar'></i></span>
  153. </div>
  154. </td>
  155. <?php if($readonly):?>
  156. <td class='<?php if(count($reverseOrders) == 1) echo "hidden"?>'><?php echo html::select("order[$i]", $reverseOrders, '', "class='form-control'")?></td>
  157. <?php endif;?>
  158. <td>
  159. <?php
  160. echo html::hidden("objectType[$i]", $objectType);
  161. echo html::hidden("objectID[$i]", $objectID);
  162. echo html::textarea("work[$i]", '', "class='form-control' rows=1");
  163. ?>
  164. </td>
  165. <td class='text-center'>
  166. <div class='input-group'>
  167. <?php echo html::input("consumed[$i]", '', "class='form-control text-center' autocomplete='off'");?>
  168. <span class='input-group-addon'>h</span>
  169. </div>
  170. </td>
  171. <?php if($objectType == 'task'):?>
  172. <td class='text-center'>
  173. <div class='input-group'>
  174. <?php echo html::input("left[$i]", $left, "class='form-control text-center' autocomplete='off' {$readonly}");?>
  175. <span class='input-group-addon'>h</span>
  176. </div>
  177. </td>
  178. <?php endif;?>
  179. </tr>
  180. <?php endfor;?>
  181. </tbody>
  182. </table>
  183. <div class='table-footer text-center form-actions'>
  184. <?php
  185. if($objectType == 'task')
  186. {
  187. $noticeFinish = $lang->effort->noticeFinish;
  188. if(!empty($task->team) and $task->mode == 'linear')
  189. {
  190. $nextAccount = '';
  191. $isCurrent = false;
  192. foreach($task->team as $taskTeam)
  193. {
  194. if($isCurrent)
  195. {
  196. $nextAccount = $taskTeam->account;
  197. break;
  198. }
  199. if($task->assignedTo == $taskTeam->account and $taskTeam->account == $app->user->account and $taskTeam->status != 'done') $isCurrent = true;
  200. }
  201. if($nextAccount) $noticeFinish = sprintf($lang->task->confirmTransfer, zget($users, $nextAccount));
  202. }
  203. js::set('noticeFinish', $noticeFinish);
  204. }
  205. ?>
  206. <?php echo html::submitButton();?>
  207. <?php echo html::backButton();?>
  208. </div>
  209. </form>
  210. <?php endif;?>
  211. </div>
  212. <?php if($objectType == 'task' and count($efforts) > 3):?>
  213. <style>.taskEffort {margin-bottom: 5px !important;}</style>
  214. <?php endif;?>
  215. <?php include $app->getModuleRoot() . 'common/view/footer.lite.html.php'?>