view.cmmi.html.hook.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. $designName = $task->design ? zget($designs, $task->design) : '';
  3. $designLink = $designName ? html::a($this->createLink('design', 'view', "id=$task->design"), $designName) : '';
  4. $html = '<tr>';
  5. $html .= '<th>';
  6. $html .= $lang->task->design;
  7. $html .= '</th>';
  8. $html .= '<td>';
  9. $html .= $designLink;
  10. $html .= '</td>';
  11. $html .= '</tr>';
  12. $onItem = $version ? $version : $task->version;
  13. $versionUl = '<small class="dropdown">';
  14. $versionUl .= html::a('#', '#' . $onItem . '<span class="caret"></span>', '', 'data-toggle="dropdown" class="text-muted"');
  15. $versionUl .= '<ul class="dropdown-menu">';
  16. for ($i = $task->version; $i > 0; $i--)
  17. {
  18. ($onItem == $i) ? $active = 'class="active"' : $active = '';
  19. $linkVersion = html::a($this->createLink('task', 'view', "taskID=$task->id&version=$i"), "#$i");
  20. $versionUl .= '<li ' . $active . '>' . $linkVersion . '</li>';
  21. }
  22. $versionUl .= '</ul></small>';
  23. $delayDesc = '';
  24. if($version)
  25. {
  26. $today = helper::today();
  27. $delay = helper::diffDate($today, $taskSpec->deadline);
  28. if($delay > 0) $delayDesc = sprintf($lang->task->delayWarning, $delay);
  29. }
  30. js::set('delayDesc', $delayDesc);
  31. js::set('versionUl', $versionUl);
  32. js::set('version', $version);
  33. js::set('taskSpec', $taskSpec);
  34. js::set('executionType', $execution->type);
  35. js::set('attribute', $execution->attribute);
  36. ?>
  37. <script>
  38. $(function()
  39. {
  40. if(executionType == 'stage') $('.col-4 #legendBasic table tr').eq(2).after(<?php echo json_encode($html);?>);
  41. $(".page-title").append(versionUl);
  42. if(version)
  43. {
  44. $(".page-title").children().eq(1).html(taskSpec.name).attr('title',taskSpec.name);
  45. $("[class='side-col col-4']").children().eq(1).find('tbody').children().eq(3).children().eq(1).html(taskSpec.estStarted);
  46. $("[class='side-col col-4']").children().eq(1).find('tbody').children().eq(5).children().eq(1).html(taskSpec.deadline + delayDesc);
  47. }
  48. if(attribute == 'request' || attribute == 'review') $('.nofixed').hide();
  49. })
  50. </script>