algo.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. echo "<h3>Алгоритмы для проектов:</h3>";
  3. echo "<div id='addalgo' title='Добавить алгоритм' style='display: inline-block; margin-top: -10px; font-size: 25px;' class='round deepskyblue'>+</div><br><br>";
  4. echo "<div id='result_cont'></div>";
  5. //echo "companyID $companyID";
  6. $ptypes = FindActions();
  7. //\Doctrine\Common\Util\Debug::dump($ptypes);
  8. //var_dump();
  9. echo "<select id='pt_list'>
  10. <option value='0'><Выберите тип проекта></option>";
  11. foreach ($ptypes as $pt)
  12. {
  13. echo "<option value='$pt->id'>$pt->id. $pt->name</option>";
  14. }
  15. echo "</select><p></p>";
  16. //
  17. //$algos;
  18. //$algos = algoList('project_type');
  19. //var_dump($algos);
  20. echo "<select id='algo_list'>";
  21. echo "</select><p></p>";
  22. ?>
  23. <div id="addbutton_template" style="display: none">
  24. <input type='button' id='add' value='Добавить'>
  25. </div>
  26. <div id="cont"
  27. style="display:none; float:left;border: solid; width: 500px; border-width: 1px; border-color: #9cb2c4; border-radius: 15px; margin-right:20px; padding: 15px">
  28. <p style="margin-bottom: 0"><b>Создать новый алгоритм</b>
  29. <br><br>
  30. <form method='post' action='' id="ajax_form">
  31. <div id="cp_desc" style="color: green"></div>
  32. <p><?php
  33. $conds = GetConditions('project_type');
  34. $actions = GetActions();
  35. echo "<b>Условие</b> <select id='cond_list'>
  36. <option value='0'><Выберите условие></option>";
  37. foreach ($conds as $cond)
  38. {
  39. echo "<option value='$cond->c_id'>$cond->c_id. $cond->c_name</option>";
  40. }
  41. echo "</select><br>";
  42. echo "<b>Действие</b> <select id='act_list'>
  43. <option value='0'><Выберите действие></option>";
  44. foreach ($actions as $act)
  45. {
  46. echo "<option value='$act->a_id'>$act->a_id. $act->a_name</option>";
  47. }
  48. echo "</select><p></p>";
  49. ?>
  50. <input type='button' id='send' value='Создать'>
  51. <input type='button' id='close' value='Закрыть'>
  52. </p>
  53. <div id="cbresult"></div>
  54. </form>
  55. </p>
  56. </div>
  57. <div id="result"></div>
  58. <!--<input type='button' id='setlast' value='Посл. элемент'>-->
  59. <?php
  60. function GetConditions($condition_target)
  61. {
  62. global $link;
  63. $query = mysqli_query($link, "select * from algo_conditions where condition_target='$condition_target'");
  64. for ($data = []; $row = mysqli_fetch_object($query); $data[] = $row);
  65. return $data;
  66. }
  67. function GetActions()
  68. {
  69. global $link;
  70. $query = mysqli_query($link, "select * from algo_actions");
  71. for ($data = []; $row = mysqli_fetch_object($query); $data[] = $row);
  72. return $data;
  73. }
  74. ?>