ProcesEditor.php 11 KB

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