| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596 |
- <?php
- Lib::loadClass('RouteBase');
- Lib::loadClass('ProcesHelper');
- Lib::loadClass('Config');
- Lib::loadClass('UI');
- Lib::loadClass('User');
- Lib::loadClass('Request');
- Lib::loadClass('Response');
- Lib::loadClass('Api_WfsNs');
- class Route_UrlAction_ProcesEditor extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
- public function getResByParentAjaxAction() {
- try {
- $idParent = V::get('parent_id', 0, $_GET, 'int');
- if ($idParent <= 0) throw new Exception("ID is not set.");
- $sqlIdParent = DB::getPDO()->quote($idParent, PDO::PARAM_INT);
- $rows = DB::getPDO()->fetchAll("
- 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
- from CRM_LISTA_ZASOBOW g
- left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
- left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
- left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
- where g.`PARENT_ID` = {$sqlIdParent}
- ORDER BY g.SORT_PRIO ASC, g.ID DESC
- ");
- Response::sendJsonExit($rows);
- } catch (Exception $e) {
- UI::alert('danger', "Error: " . $e->getMessage());
- }
- }
- public function getResAjaxAction() {
- try {
- $word = V::get('word', '', $_GET);
- $filter = isset($_GET['filter']) ? (int)$_GET['filter'] : 0;
- $sqlFilter = "";
- if (!empty($word)) {
- $sqlWord = DB::getPDO()->quote("%{$word}%", PDO::PARAM_STR);
- if (is_numeric($word)) {
- $sqlFilter .= "AND (g.`DESC` LIKE {$sqlWord} OR g.`ID` LIKE {$sqlWord})" . "\n";
- } else {
- $sqlFilter .= "AND g.`DESC` LIKE {$sqlWord}" . "\n";
- }
- }
- switch ($filter) {
- case 2: $sqlFilter .= "AND (g.`TYPE` = 'TABELA' OR g.`TYPE` = 'KOMORKA')" . "\n"; break;
- case 1: $sqlFilter .= "AND (g.`TYPE` = 'STANOWISKO' OR g.`TYPE` = 'DZIAL' OR g.`TYPE` = 'PODMIOT')" . "\n"; break;
- }
- $sql = "
- 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
- from CRM_LISTA_ZASOBOW g
- left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
- left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
- left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
- where g.`A_STATUS` not in ('DELETED')
- and (p1.ID is null or p1.`A_STATUS` not in ('DELETED'))
- and (p2.ID is null or p2.`A_STATUS` not in ('DELETED'))
- and (p3.ID is null or p3.`A_STATUS` not in ('DELETED'))
- {$sqlFilter}
- limit 100
- ";
- DBG::_('DBG_SQL', '>1', 'sql', $sql, __CLASS__, __FUNCTION__, __LINE__);
- $rows = DB::getPDO()->fetchAll($sql);
- Response::sendJsonExit($rows);
- } catch (Exception $e) {
- UI::alert('danger', "Error: " . $e->getMessage());
- }
- }
- public function getSingleResAjaxReponseCallback() {
- if (!isset($_POST['data'])) throw new Exception("data is not set.");
- $ids = V::get('data', null, $_POST, 'uint_array');
- if (empty($ids)) throw new Exception("data is not correct.");
- $sqlWhereIdIn = array();
- foreach ($ids as $value) {
- $sqlWhereIdIn[] = DB::getPDO()->quote($value, PDO::PARAM_INT);
- }
- $sqlWhereIdIn = "g.ID in(" . implode(", ", $sqlWhereIdIn) . ")";
- $rows = DB::getPDO()->fetchAll("
- 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
- from CRM_LISTA_ZASOBOW g
- left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
- left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
- left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
- where {$sqlWhereIdIn}
- ");
- return $rows;
- }
- public function getSingleResAjaxAction() {
- Response::sendTryCatchJson(array($this, 'getSingleResAjaxReponseCallback'));
- }
- public function handleAuth() {
- if (!User::logged()) {
- //throw new HttpException('Unauthorized', 401);
- User::authByRequest();
- }
- // zapisać jsona w sesji
- }
- public function defaultAction() {
- UI::gora();
- UI::menu();
- try {
- $id = V::get('id', 0, $_REQUEST, 'int');
- if ($id <= 0) throw new Exception("Wrong ID");
- UI::setTitleJsTag("Edytor Procesu {{$id}}");
- $this->showEditor($id);
- } catch (Exception $e) {
- UI::alert('danger', "Error: " . $e->getMessage());
- }
- UI::dol();
- }
- public function showEditor($id) {
- echo '<link rel="stylesheet" type="text/css" href="static/sweetalert2.min.css">';
- $this->showEditorCss();
- ?>
- <div id="wrapper" class="toggled" style="overflow:hidden">
- <div id='sidebar-wrapper'><div id="side"></div></div>
- <div id='page-content-wrapper'>
- <div id="left">
- <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>
- <button class='lButton btn btn-default' id="btnPhotos" style="top:480px"><p>Zdjęcia</p></button>
- </div>
- <div class=col-md-12 ><a id=toggleMenu style=cursor:pointer;>Przełącz menu</a></div>
- <div id="main" style="margin-left:40px">
- <center>Uruchamianie aplikacji.</center>
- </div>
- </div>
- </div>
- <script>var USER_ID = '<?= User::getID(); ?>';var BASE_URL = '<?= Request::getPathUri(); ?>';var BASE_WFS_URL = '<?= Api_WfsNs::getBaseWfsUri(); ?>';var mainProces_id = <?= $id; ?>;</script>
- <script src="static/sweetalert2.min.js"></script>
- <script src="static/procesEditor.js?v=21<?php echo "&_time=" . time(); ?><?php if (V::get('DBG', '', $_GET)) echo "&_time=" . time(); ?>"></script>
- <?php
- }
- public function showEditorCss() {
- ?>
- <style type="text/css">
- .activeDrop{
- background-color:#f1f1f1;
- }
- .treeInfo{
- overflow: hidden;
- text-align: right;
- display:inline-block;
- color:grey;
- font-size:0.9em;
- white-space: nowrap;
- max-width: 90%;
- }
- .treeInfo div{
- float:right;
- }
- #left{
- padding:0px;
- }
- .sDescAdd, .hDescAdd, .step{
- padding-left:10px;
- }
- #clipboard{
- color:black;
- }
- .lButton{
- -webkit-transform: translate3d(0,0,0);
- position:fixed;
- padding:0px;
- outline:none;
- margin:0px;
- width: 40px;
- height:160px;
- z-index:30;
- border-top-left-radius: 0px;
- border-bottom-left-radius: 0px;
- }
- .lButton p
- {
- margin-bottom:-50px;
- -moz-transform:rotate(-90deg);
- -ms-transform:rotate(-90deg);
- -o-transform:rotate(-90deg);
- -webkit-transform:rotate(-90deg);
- }
- .ico {
- float: right;
- margin-top: 10px;
- margin-left: 5px;
- cursor: pointer;
- }
- #wrapper {
- padding-left: 0;
- -webkit-transition: all 0.5s ease;
- -moz-transition: all 0.5s ease;
- -o-transition: all 0.5s ease;
- transition: all 0.5s ease;
- }
- #wrapper.toggled {
- padding-left: 600px;
- }
- #wrapper #left { width:40px }
- #wrapper #left .lButton {
- width:40px;
- -webkit-transition: all 0.5s ease;
- -moz-transition: all 0.5s ease;
- -o-transition: all 0.5s ease;
- transition: all 0.5s ease;
- }
- #wrapper.toggled #left .lButton { width:39px }
- #side {
- padding: 15px;
- height: 100%;
- border-top-style:solid;
- border-top-width:1px;
- border-right-style: solid;
- border-color: #A61C2E;
- border-width: 2px;
- }
- ul {
- list-style: none;
- }
- #advCon{
- width:870px;
- min-width:100%;
- }
- .detailsTable{
- color:grey;
- float:left;
- display:inline;
- text-align:center;
- margin-left:5px;
- height:23px;
- }
- .tree{
- color:grey;
- text-overflow:ellipsis;
- white-space:nowrap;
- overflow:hidden;
- display:block;
- cursor:pointer;
- }
- .detailsTable2{
- color:grey;
- display:block;
- font-size:0.8em;
- text-align:left;
- margin-left:5px;
- height:23px;
- }
- .textTable{
- float:left;
- width:200px;
- text-overflow:ellipsis;
- white-space:nowrap;
- overflow:hidden;
- cursor:pointer;
- display:inline-block;
- }
- #dropPic{
- height:250px;
- border-radius:5px;
- border-style:solid;
- border-color:#ededed;
- background-color: #fbfbfb;
- border-width:1px;
- }
- /* skin.css Style*/
- #inp {
- height: 100px;
- border-width: 2px;
- margin-bottom: 0px;
- color: #ccc;
- border-style: dashed;
- border-color: #ccc;
- line-height: 100px;
- text-align: center;
- display:block;
- width:100%;
- }
- .upload-drop-zone.drop {
- color: #222;
- border-color: #222;
- }
- .anim-refresh {
- -animation: spin .7s infinite linear;
- -webkit-animation: spin2 .7s infinite linear;
- }
- @-webkit-keyframes spin2 {
- from { -webkit-transform: rotate(0deg);}
- to { -webkit-transform: rotate(360deg);}
- }
- @keyframes spin {
- from { transform: scale(1) rotate(0deg);}
- to { transform: scale(1) rotate(360deg);}
- }
- .list-group-item{
- cursor:pointer;
- }
- .list-group-item:hover{
- background-color:#eeeeee;
- }
- .list-group-item:hover .glyphicon{
- opacity:1 !important;
- }
- .textTable2{
- float:left;
- width:230px;
- text-overflow:ellipsis;
- white-space:nowrap;
- overflow:hidden;
- cursor:pointer;
- display:inline-block;
- }
- .pbody{
- padding-left:20px;
- padding-right:20px;
- text-align:justify;
- }
- .singleAdv{
- float:left;
- height:100%;
- width:290px;
- }
- #side #adv{
- }
- #side #ulcon, #side #ulproc, #side #adv {
- background-color: white;
- overflow-y: scroll;
- height: 70% !important;
- border-style:solid;
- border-width:1px;
- border-color:grey;
- margin-top: 10px;
- border-radius: 5px;
- padding-bottom: 10px;
- border-style: solid;
- border-width: 1px;
- border-color: #e5e5e5;
- color: black;
- padding-left: 0px;
- font-family: tahoma;
- font-size: 13px;
- }
- .selectedAdv{
- background-color:#e4e4e4;
- }
- .selectedAdv:hover{
- background-color:#e4e4e4;
- }
- #side .dragStyle {
- padding-left: 8px;
- padding-top: 4px;
- padding-bottom: 4px;
- border-bottom-style: dotted;
- border-width: 1px;
- cursor: pointer;
- border-color: #e5e5e5;
- background-color: white;
- display: block;
- }
- #side .showMore {
- padding-left: 2px;
- padding-top: 4px;
- padding-bottom: 4px;
- border-width: 1px;
- border-color: #e5e5e5;
- }
- #side .gIco {
- padding-left: 2px;
- padding-top: 4px;
- padding-bottom: 4px;
- border-width: 1px;
- border-color: #e5e5e5;
- cursor: pointer;
- }
- #side .hov,
- #side .grad {
- cursor: pointer;
- }
- #side .click {
- float: left;
- color: grey;
- font-size: 10px;
- cursor: pointer;
- }
- .delRes,
- .btnEdit,
- .hdesc,
- .sdesc {
- cursor: pointer;
- }
- .goto{
- padding-left:10px;
- }
- #side .tabelaName {
- white-space: nowrap;
- margin-right: 10px;
- overflow: hidden;
- width: 350px;
- float: left;
- text-overflow: ellipsis;
- display: block;
- cursor: pointer;
- }
- #side .hov:hover {
- background-color: #e5e5e5;
- }
- #sidebar-wrapper {
- position: fixed;
- left: 600px;
- width: 0;
- height: 100%;
- color: white;
- margin-left: -600px;
- overflow-y: auto;
- background: #222;
- -webkit-transition: all 0.5s ease;
- -moz-transition: all 0.5s ease;
- -o-transition: all 0.5s ease;
- transition: all 0.5s ease;
- }
- #wrapper.toggled #sidebar-wrapper {
- width: 600px;
- }
- #page-content-wrapper {
- width: 100%;
- position: absolute;
- z-index:0 !important;
- padding-top: 15px;
- padding-left:0px !important;
- }
- #wrapper.toggled #page-content-wrapper {
- position: absolute;
- margin-right: -600px;
- }
- #wrapper {
- padding-left: 600px;
- }
- #wrapper.toggled {
- padding-left: 0 !important;
- }
- #sidebar-wrapper {
- width: 600px;
- }
- #wrapper.toggled #sidebar-wrapper {
- width: 0 !important;
- }
- #page-content-wrapper {
- padding: 20px;
- position: relative;
- }
- #wrapper.toggled #page-content-wrapper {
- position: relative;
- margin-right: 0;
- }
- .drop {
- margin-top: 10px;
- }
- .sdesc{
- margin-bottom:10px;
- }
- .hdesc textarea,
- .sdesc textarea {
- min-width: 100%;
- padding: 10px;
- }
- .step,
- .sDescAdd {
- margin-top:5px;
- color: grey;
- cursor: pointer;
- display:block;
- font-size:10px;
- }
- .sDescAdd:hover{
- color:black;
- }
- .goto{
- }
- .editGoto{
- cursor:pointer;
- }
- .sdesc {
- display: block;
- }
- .hDescAdd {
- cursor: pointer;
- }
- #saveBtn {} .changable {
- padding-left: 10px;
- }
- .export{
- min-height:200px;
- }
- .changed {
- border-left-style: solid;
- border-width: 3px;
- border-color: #ffc107;
- padding-left: 7px;
- }
- .del {
- }
- .liRes:hover{
- background-color:#fafafa;
- }
- span.glyphicon{
- opacity:0.6;
- cursor:pointer;
- margin-left:3px;
- }
- span.glyphicon:hover{
- opacity:1;
- }
- .delRes:hover{
- color:red;
- }
- .delGoto:hover{
- color:red;
- cursor:pointer;
- }
- .del:hover{
- color:red;
- }
- .ids {
- color: grey;
- font-size: 12px;
- }
- .more {
- margin-left: 15px;
- }
- .resSelected {
- background-color: #d3d3d3;
- }
- </style>
- <?php
- }
- }
|