ProcesEditor.php 11 KB

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