ProcesEditor.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. <?php
  2. Lib::loadClass('RouteBase');
  3. Lib::loadClass('ProcesHelper');
  4. Lib::loadClass('Config');
  5. Lib::loadClass('UI');
  6. Lib::loadClass('Request');
  7. Lib::loadClass('Response');
  8. class Route_UrlAction_ProcesEditor extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
  9. public function getResByParentAjaxAction(){
  10. try {
  11. if(!isset($_GET['parent_id'])) throw new Exception("ID is not set.");
  12. $parent_id = DB::getPDO()->quote($_GET['parent_id'], PDO::PARAM_INT);
  13. $rows = DB::getPDO()->fetchAll("
  14. select g.*, p1.ID as p1_ID, p1.DESC as p1_DESC,p2.ID as p2_ID, p2.DESC as p2_DESC, p3.ID as p3_ID, p3.DESC as p3_DESC
  15. from CRM_LISTA_ZASOBOW g
  16. left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
  17. left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
  18. left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
  19. where g.`PARENT_ID` = ".$parent_id." ORDER BY g.SORT_PRIO
  20. ");
  21. Response::sendJsonExit($rows);
  22. } catch (Exception $e) {
  23. UI::alert('danger', "Error: " . $e->getMessage());
  24. }
  25. }
  26. public function getResAjaxAction(){
  27. try {
  28. if(!isset($_GET['word'])) throw new Exception("word is not set.");
  29. $word = DB::getPDO()->quote("%".$_GET['word']."%", PDO::PARAM_STR);
  30. $filter = isset($_GET['filter']) ? (int)$_GET['filter'] : 0;
  31. $sqlFilter = "";
  32. switch($filter){
  33. case 2: $sqlFilter = "AND (g.`TYPE` = 'TABELA' OR g.`TYPE` = 'KOMORKA')";break;
  34. case 1: $sqlFilter = "AND (g.`TYPE` = 'STANOWISKO' OR g.`TYPE` = 'DZIAL' OR g.`TYPE` = 'PODMIOT')";break;
  35. }
  36. $rows = DB::getPDO()->fetchAll("
  37. select g.*, p1.ID as p1_ID, p1.DESC as p1_DESC,p2.ID as p2_ID, p2.DESC as p2_DESC, p3.ID as p3_ID, p3.DESC as p3_DESC
  38. from CRM_LISTA_ZASOBOW g
  39. left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
  40. left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
  41. left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
  42. where (g.`DESC` LIKE ".$word." OR g.`ID` LIKE ".$word.")
  43. ".$sqlFilter."
  44. LIMIT 0,100
  45. ");
  46. Response::sendJsonExit($rows);
  47. } catch (Exception $e) {
  48. UI::alert('danger', "Error: " . $e->getMessage());
  49. }
  50. }
  51. public function getSingleResAjaxAction(){
  52. try {
  53. if (!isset($_POST['data'])) throw new Exception("data is not set.");
  54. $data = $_POST['data'];
  55. $sqlWhereIdIn = array();
  56. foreach ($data as $value) {
  57. $sqlWhereIdIn[] = DB::getPDO()->quote($value, PDO::PARAM_INT);
  58. }
  59. $sqlWhereIdIn = (!empty($sqlWhereIdIn)) ? "g.ID in(" . implode(", ", $sqlWhereIdIn) . ")" : "1=1";
  60. $rows = DB::getPDO()->fetchAll("
  61. select g.*, p1.ID as p1_ID, p1.DESC as p1_DESC,p2.ID as p2_ID, p2.DESC as p2_DESC, p3.ID as p3_ID, p3.DESC as p3_DESC
  62. from CRM_LISTA_ZASOBOW g
  63. left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
  64. left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
  65. left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
  66. where {$sqlWhereIdIn}");
  67. Response::sendJsonExit($rows);
  68. } catch (Exception $e) {
  69. UI::alert('danger', "Error: " . $e->getMessage());
  70. }
  71. }
  72. public function handleAuth() {
  73. if (!User::logged()) {
  74. //throw new HttpException('Unauthorized', 401);
  75. User::authByRequest();
  76. }
  77. // zapisać jsona w sesji
  78. }
  79. public function defaultAction() {
  80. UI::gora();
  81. UI::menu();
  82. try {
  83. $id = V::get('id', 0, $_REQUEST, 'int');
  84. if ($id <= 0) throw new Exception("Wrong ID");
  85. $this->showEditor($id);
  86. } catch (Exception $e) {
  87. UI::alert('danger', "Error: " . $e->getMessage());
  88. }
  89. UI::dol();
  90. }
  91. public function showEditor($id) {
  92. echo '<link rel="stylesheet" type="text/css" href="static/sweetalert2.min.css">';
  93. $this->showEditorCss();
  94. echo "<div id=wrapper class=toggled>";
  95. echo "<div id='sidebar-wrapper'><div id=side>";
  96. echo "";
  97. echo "</div></div>";
  98. echo "<div id='page-content-wrapper'><div class=col-xs-1 id=left style='width:40px;'>";
  99. echo "<button class='lButton btn btn-default' id=btnZasoby style=top:150px; ><p>Zasoby</p></button><button class='lButton btn btn-default' style=top:315px; id=btnProcesy><p>Procesy</p></button>";
  100. echo "</div><div class=col-xs-11 id=main>";
  101. echo '<center>Uruchamianie aplikacji.</center>';
  102. echo "</div></div>";
  103. echo "<div class=clearfix></div>";
  104. echo "</div>";
  105. echo "<script>var BASE_URL = '".Request::getPathUri()."';var mainProces_id = ".$id.";</script>";
  106. echo '<script src="static/sweetalert2.min.js"></script>';
  107. echo '<script src="static/procesEditor.js?'.time().'"></script>';
  108. }
  109. public function showEditorCss() {
  110. ?>
  111. <style type="text/css">
  112. .activeDrop{
  113. background-color:#f1f1f1;
  114. }
  115. .treeInfo{
  116. overflow: hidden;
  117. text-align: right;
  118. display:inline-block;
  119. color:grey;
  120. font-size:0.9em;
  121. white-space: nowrap;
  122. max-width: 90%;
  123. }
  124. .treeInfo div{
  125. float:right;
  126. }
  127. #left{
  128. padding:0px;
  129. }
  130. .sDescAdd, .hDescAdd, .step{
  131. padding-left:10px;
  132. }
  133. .lButton{
  134. -webkit-transform: translate3d(0,0,0);
  135. position:fixed;
  136. padding:0px;
  137. outline:none;
  138. margin:0px;
  139. width: 40px;
  140. height:160px;
  141. z-index:30;
  142. border-top-left-radius: 0px;
  143. border-bottom-left-radius: 0px;
  144. }
  145. .lButton p
  146. {
  147. margin-bottom:-50px;
  148. -moz-transform:rotate(-90deg);
  149. -ms-transform:rotate(-90deg);
  150. -o-transform:rotate(-90deg);
  151. -webkit-transform:rotate(-90deg);
  152. }
  153. .ico {
  154. float: right;
  155. margin-top: 10px;
  156. margin-left: 5px;
  157. cursor: pointer;
  158. }
  159. .options {
  160. min-width: 120px;
  161. width: auto !important;
  162. width: 120px;
  163. }
  164. #wrapper {
  165. padding-left: 0;
  166. -webkit-transition: all 0.5s ease;
  167. -moz-transition: all 0.5s ease;
  168. -o-transition: all 0.5s ease;
  169. transition: all 0.5s ease;
  170. }
  171. #wrapper.toggled {
  172. padding-left: 600px;
  173. }
  174. #side {
  175. padding: 15px;
  176. height: 100%;
  177. border-top-style:solid;
  178. border-top-width:1px;
  179. border-right-style: solid;
  180. border-color: #A61C2E;
  181. border-width: 2px;
  182. }
  183. ul {
  184. list-style: none;
  185. }
  186. #advCon{
  187. width:870px;
  188. min-width:100%;
  189. }
  190. .detailsTable{
  191. color:grey;
  192. float:left;
  193. display:inline;
  194. text-align:center;
  195. margin-left:5px;
  196. height:23px;
  197. }
  198. .tree{
  199. color:grey;
  200. text-overflow:ellipsis;
  201. white-space:nowrap;
  202. overflow:hidden;
  203. display:block;
  204. cursor:pointer;
  205. }
  206. .detailsTable2{
  207. color:grey;
  208. display:block;
  209. font-size:0.8em;
  210. text-align:left;
  211. margin-left:5px;
  212. height:23px;
  213. }
  214. .textTable{
  215. float:left;
  216. width:200px;
  217. text-overflow:ellipsis;
  218. white-space:nowrap;
  219. overflow:hidden;
  220. cursor:pointer;
  221. display:inline-block;
  222. }
  223. .anim-refresh {
  224. -animation: spin .7s infinite linear;
  225. -webkit-animation: spin2 .7s infinite linear;
  226. }
  227. @-webkit-keyframes spin2 {
  228. from { -webkit-transform: rotate(0deg);}
  229. to { -webkit-transform: rotate(360deg);}
  230. }
  231. @keyframes spin {
  232. from { transform: scale(1) rotate(0deg);}
  233. to { transform: scale(1) rotate(360deg);}
  234. }
  235. .list-group-item{
  236. cursor:pointer;
  237. }
  238. .list-group-item:hover{
  239. background-color:#eeeeee;
  240. }
  241. .list-group-item:hover .glyphicon{
  242. opacity:1 !important;
  243. }
  244. .textTable2{
  245. float:left;
  246. width:230px;
  247. text-overflow:ellipsis;
  248. white-space:nowrap;
  249. overflow:hidden;
  250. cursor:pointer;
  251. display:inline-block;
  252. }
  253. .pbody{
  254. padding-left:20px;
  255. padding-right:20px;
  256. text-align:justify;
  257. }
  258. .singleAdv{
  259. float:left;
  260. height:100%;
  261. width:290px;
  262. }
  263. #side #adv{
  264. }
  265. #side #ulcon, #side #ulproc, #side #adv {
  266. background-color: white;
  267. overflow-y: scroll;
  268. height: 70% !important;
  269. border-style:solid;
  270. border-width:1px;
  271. border-color:grey;
  272. margin-top: 10px;
  273. border-radius: 5px;
  274. padding-bottom: 10px;
  275. border-style: solid;
  276. border-width: 1px;
  277. border-color: #e5e5e5;
  278. color: black;
  279. padding-left: 0px;
  280. font-family: tahoma;
  281. font-size: 13px;
  282. }
  283. .selectedAdv{
  284. background-color:#e4e4e4;
  285. }
  286. .selectedAdv:hover{
  287. background-color:#e4e4e4;
  288. }
  289. #side .dragStyle {
  290. padding-left: 8px;
  291. padding-top: 4px;
  292. padding-bottom: 4px;
  293. border-bottom-style: dotted;
  294. border-width: 1px;
  295. cursor: pointer;
  296. border-color: #e5e5e5;
  297. background-color: white;
  298. display: block;
  299. }
  300. #side .showMore {
  301. padding-left: 2px;
  302. padding-top: 4px;
  303. padding-bottom: 4px;
  304. border-width: 1px;
  305. border-color: #e5e5e5;
  306. }
  307. #side .gIco {
  308. padding-left: 2px;
  309. padding-top: 4px;
  310. padding-bottom: 4px;
  311. border-width: 1px;
  312. border-color: #e5e5e5;
  313. cursor: pointer;
  314. }
  315. #side .hov,
  316. #side .grad {
  317. cursor: pointer;
  318. }
  319. #side .click {
  320. float: left;
  321. color: grey;
  322. font-size: 10px;
  323. cursor: pointer;
  324. }
  325. .delRes,
  326. .btnEdit,
  327. .hdesc,
  328. .sdesc {
  329. cursor: pointer;
  330. }
  331. .goto{
  332. padding-left:10px;
  333. }
  334. #side .tabelaName {
  335. white-space: nowrap;
  336. margin-right: 10px;
  337. overflow: hidden;
  338. width: 350px;
  339. float: left;
  340. text-overflow: ellipsis;
  341. display: block;
  342. cursor: pointer;
  343. }
  344. #side .hov:hover {
  345. background-color: #e5e5e5;
  346. }
  347. #sidebar-wrapper {
  348. position: fixed;
  349. left: 600px;
  350. width: 0;
  351. height: 100%;
  352. color: white;
  353. margin-left: -600px;
  354. overflow-y: auto;
  355. background: #222;
  356. -webkit-transition: all 0.5s ease;
  357. -moz-transition: all 0.5s ease;
  358. -o-transition: all 0.5s ease;
  359. transition: all 0.5s ease;
  360. }
  361. #wrapper.toggled #sidebar-wrapper {
  362. width: 600px;
  363. }
  364. #page-content-wrapper {
  365. width: 100%;
  366. position: absolute;
  367. z-index:0 !important;
  368. padding-top: 15px;
  369. padding-left:0px !important;
  370. }
  371. #wrapper.toggled #page-content-wrapper {
  372. position: absolute;
  373. margin-right: -600px;
  374. }
  375. #wrapper {
  376. padding-left: 600px;
  377. }
  378. #wrapper.toggled {
  379. padding-left: 0 !important;
  380. }
  381. #sidebar-wrapper {
  382. width: 600px;
  383. }
  384. #wrapper.toggled #sidebar-wrapper {
  385. width: 0 !important;
  386. }
  387. #page-content-wrapper {
  388. padding: 20px;
  389. position: relative;
  390. }
  391. #wrapper.toggled #page-content-wrapper {
  392. position: relative;
  393. margin-right: 0;
  394. }
  395. .drop {
  396. margin-top: 10px;
  397. }
  398. .sdesc{
  399. margin-bottom:10px;
  400. }
  401. .hdesc textarea,
  402. .sdesc textarea {
  403. min-width: 100%;
  404. padding: 10px;
  405. }
  406. .step,
  407. .sDescAdd {
  408. margin-top:5px;
  409. color: grey;
  410. cursor: pointer;
  411. display:block;
  412. }
  413. .sDescAdd:hover{
  414. color:black;
  415. }
  416. .goto{
  417. }
  418. .editGoto{
  419. cursor:pointer;
  420. }
  421. .sdesc {
  422. display: block;
  423. }
  424. .hDescAdd {
  425. cursor: pointer;
  426. }
  427. #saveBtn {} .changable {
  428. padding-left: 10px;
  429. }
  430. .changed {
  431. border-left-style: solid;
  432. border-width: 3px;
  433. border-color: #ffc107;
  434. padding-left: 7px;
  435. }
  436. .del {
  437. }
  438. .liRes:hover{
  439. background-color:#fafafa;
  440. }
  441. span.glyphicon{
  442. opacity:0.6;
  443. cursor:pointer;
  444. margin-left:3px;
  445. }
  446. span.glyphicon:hover{
  447. opacity:1;
  448. }
  449. .delRes:hover{
  450. color:red;
  451. }
  452. .delGoto:hover{
  453. color:red;
  454. cursor:pointer;
  455. }
  456. .del:hover{
  457. color:red;
  458. }
  459. .ids {
  460. color: grey;
  461. font-size: 12px;
  462. }
  463. .more {
  464. margin-left: 15px;
  465. }
  466. .resSelected {
  467. background-color: #d3d3d3;
  468. }
  469. </style>
  470. <?php
  471. }
  472. }