create.ipd.html.hook.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php if($project and $project->model == 'ipd' and $plan):?>
  2. <?php
  3. $parents = $this->loadModel('execution')->getPairs($projectID, 'stage', 'all');
  4. $executionTasks = $this->execution->getTaskGroupByExecution(array_keys($parents));
  5. foreach($executionTasks as $executionID => $tasks)
  6. {
  7. if(isset($parents[$executionID])) unset($parents[$executionID]);
  8. }
  9. $parentBox = '<tr class="parentBox ">';
  10. $parentBox .= ' <th class="w-120px">' . $lang->execution->parentStage . '</th>';
  11. $parentBox .= ' <td class="col-main required">';
  12. $parentBox .= html::select('parent', $parents, '', "class='form-control chosen' onchange='loadType(this.value)'");
  13. $parentBox .= ' </td>';
  14. $parentBox .= ' <td colspan="2"></td>';
  15. $parentBox .= '</tr>';
  16. ?>
  17. <script>
  18. $(function()
  19. {
  20. $('#project').closest('tr').after(<?php echo json_encode($parentBox);?>);
  21. $('#parent').chosen();
  22. $('#attribute').parents('tr').remove();
  23. $('#type').removeAttr('onchange');
  24. });
  25. function loadType(parentID)
  26. {
  27. $('#type').load(createLink('execution', 'ajaxGetTypes', 'parentID=' + parentID), function(data)
  28. {
  29. $('#type_chosen').remove();
  30. $('#type').replaceWith(data);
  31. $('#type').chosen();
  32. });
  33. }
  34. </script>
  35. <?php endif;?>