| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- <?php
- Lib::loadClass('RouteBase');
- Lib::loadClass('ProcesHelper');
- Lib::loadClass('Config');
- Lib::loadClass('UI');
- Lib::loadClass('Request');
- Lib::loadClass('ProcesHelper');
- Lib::loadClass('Response');
- class Route_UrlAction_ProcesView extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
- public function getAllAjaxAction(){
- try {
- $rows = DB::getPDO()->fetchAll("
- select `ID`, `PARENT_ID`, `DESC`, `OPIS`, `TYPE`, `IF_TRUE_GOTO`, `IF_TRUE_GOTO_FLAG`
- from CRM_PROCES
- WHERE `PARENT_ID`>=0
- AND `A_STATUS` <> 'DELETED'
- AND `ID` <> `PARENT_ID`
- ORDER BY `SORT_PRIO` ASC, `ID` DESC
- ");
- $state = array();
- foreach($rows as $key => $value){
- $id = intval($value["ID"]);
- $parent_id = intval($value["PARENT_ID"]);
- $state[$id]["ID"] = $value["ID"];
- $state[$id]["DESC"] = $value["DESC"];
- $state[$id]["OPIS"] = $value["OPIS"];
- $state[$id]["TYPE"] = $value["TYPE"];
- $state[$id]["IF_TRUE_GOTO"] = intval($value["IF_TRUE_GOTO"]);
- $state[$id]["IF_TRUE_GOTO_FLAG"] = $value["IF_TRUE_GOTO_FLAG"];
- if(intval($value["PARENT_ID"]) != 0)
- $state[$id]["PARENT_ID"] = intval($value["PARENT_ID"]);
- else
- $state[$id]["PARENT_ID"] = "#";
- if(!isset($state[$id]["childs"]))
- $state[$id]["childs"] = array();
- if(!isset($state[$value["PARENT_ID"]])){
- $state[$parent_id]["childs"] = array();
- }
- $temp = array();
- $temp["ID"] = $id;
- array_push($state[$parent_id]["childs"], $temp);
- }
- //print_r($state);
- Response::sendJsonExit($state);
- } catch (Exception $e) {
- UI::alert('danger', "Error: " . $e->getMessage());
- }
- }
- public function getConnectedProcAjaxAction(){
- try {
- $id = V::get('id', 0, $_REQUEST, 'int');
- $rows = DB::getPDO()->fetchAll("
- SELECT * FROM `CRM_WSKAZNIK` WHERE `ID_ZASOB` = $id AND `A_STATUS` <> 'DELETED'
- ");
- $state = array();
- $state["wsk"] = array();
- foreach($rows as $key => $value){
- $temp["ID"] = $value["ID"];
- $temp["ID_PROCES"] = $value["ID_PROCES"];
- $temp["ID_ZASOB"] = $value["ID_ZASOB"];
- //print_r($temp);
- array_push($state["wsk"], $temp);
- }
- Response::sendJsonExit($state);
- } catch (Exception $e) {
- UI::alert('danger', "Error: " . $e->getMessage());
- }
- }
- public function getDetailsAjaxAction(){
- try {
- $id = V::get('id', 0, $_REQUEST, 'int');
- $rows = DB::getPDO()->fetchAll("
- SELECT * FROM `CRM_WSKAZNIK` WHERE `ID_PROCES` = $id AND `A_STATUS` <> 'DELETED'
- ");
- $state = array();
- $state["wsk"] = array();
- foreach($rows as $key => $value){
- $temp["ID"] = $value["ID"];
- $temp["ID_PROCES"] = $value["ID_PROCES"];
- $temp["ID_ZASOB"] = $value["ID_ZASOB"];
- //print_r($temp);
- array_push($state["wsk"], $temp);
- }
- $count = DB::getPDO()->fetchAll("
- SELECT count(*) as imgCount FROM `CRM_IMAGE` WHERE `REMOTE_ID` = $id AND `REMOTE_TABLE` = 'CRM_PROCES'
- ");
- //print_r($count[0]["c"]);
- //print_r($state);
- $state["IMG_COUNT"] = $count[0]["imgCount"];
- Response::sendJsonExit($state);
- } catch (Exception $e) {
- UI::alert('danger', "Error: " . $e->getMessage());
- }
- }
- public function getAllResAjaxAction(){
- try {
- $rows = DB::getPDO()->fetchAll("
- select `ID`, `PARENT_ID`, `DESC`, `OPIS`, `ALIAS_ID`, `TYPE`
- from CRM_LISTA_ZASOBOW
- WHERE `PARENT_ID`>=0
- AND `A_STATUS` <> 'DELETED'
- AND `ID` <> `PARENT_ID`
- ORDER BY `SORT_PRIO` ASC, `ID` DESC
- ");
- $state = array();
- foreach($rows as $key => $value){
- $id = intval($value["ID"]);
- $parent_id = intval($value["PARENT_ID"]);
- $state[$id]["ALIAS_ID"] = intval($value["ALIAS_ID"]);
- $state[$id]["ID"] = $value["ID"];
- $state[$id]["DESC"] = $value["DESC"];
- $state[$id]["TYPE"] = $value["TYPE"];
- $state[$id]["OPIS"] = $value["OPIS"];
- if(intval($value["PARENT_ID"]) != 0)
- $state[$id]["PARENT_ID"] = intval($value["PARENT_ID"]);
- else
- $state[$id]["PARENT_ID"] = "#";
- if(!isset($state[$id]["childs"]))
- $state[$id]["childs"] = array();
- if(!isset($state[$value["PARENT_ID"]])){
- $state[$parent_id]["childs"] = array();
- }
- $temp = array();
- $temp["ID"] = $id;
- array_push($state[$parent_id]["childs"], $temp);
- }
- //print_r($state);
- Response::sendJsonExit($state);
- } catch (Exception $e) {
- UI::alert('danger', "Error: " . $e->getMessage());
- }
- }
- 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 {
- $start_id = V::get('START_ID', 0, $_REQUEST, 'int');
- $type = V::get('TYPE', 0, $_REQUEST, 'string');
- if($type === "zasoby")
- $type = "res";
- else
- $type = "childs";
- $this->showView($start_id, $type);
- } catch (Exception $e) {
- UI::alert('danger', "Error: " . $e->getMessage());
- }
- UI::dol();
- }
- public function showView($start_id, $type) {
- echo "<div class=container-fluid>";
- echo "<div class=row>";
- echo "<div class=col-md-12 style=padding-top:15px;><a id=toggleMenu style=cursor:pointer;>Przełącz menu</a><a style=float:right;cursor:pointer; id=toggleView>Przełącz widok</a></div>";
- echo "<div class=col-md-12 id=view>";
- echo "";
- echo "</div>";
- echo "</div>";
- echo "<script>var TYPE = '".$type."';var START_ID = '".$start_id."';var BASE_URL = '".Request::getPathUri()."';var ProcesTableId=".ProcesHelper::getZasobTableID('CRM_PROCES').";</script>";
- echo '<script src="static/sweetalert2.min.js"></script>';
- echo '<link rel="stylesheet" type="text/css" href="static/sweetalert2.min.css">';
- echo '<link rel="stylesheet" href="static/jstree-theme/style.min.css" />';
- echo '<script src="static/jstree.min.js"></script>';
- echo '<script src="static/procesView.js?v='.time().'"></script>';
- $this->showViewCss();
- }
- public function showViewCss() {
- ?>
- <style type="text/css">
- .singleAdv{
- float:left;
- padding-bottom:20px;
- display:block;
- width:460px;
- }
- .toggleRoute{
- text-align:center;
- margin-top:10px;
- padding:5px;
- background-color:#ededed;
- opacity:0.6;
- cursor:pointer;
- }
- .route{
- border-style:solid;
- border-width:2px;
- padding:5px;
- display:none;
- border-radius:2px;
- border-color:#ededed;
- }
- .toggleRoute:hover{
- opacity:1;
- }
- .goto{
- }
- .singleAdvList{
- overflow-y:scroll;
- }
- .gotoInfo{
- background-color:#e5a100;
- color:white;
- padding:10px;
- margin-left:50px;
- font-size:1.0em;
- }
- .gotoWay{
- background-color:#ededed;
- padding:10px;
- }
- .normalChilds{
- background-color: #ededed;
- }
- #procCon{
- display:block;
- height:100%;
- }
- .textTable{
- float:left;
- width:400px;
- overflow:hidden;
- display:inline-block;
- }
- .glyph{
- opacity:0.4;
- }
- .glyph:hover{
- opacity:1;
- }
- .detailsTable{
- color:black;
- display:inline-block;
- padding:4px;
- padding-top:1px;
- padding-bottom:1px;
- border-width:1px;
- border-color:grey;
- }
- .detailsTable2{
- color:black;
- display:inline-block;
- padding:3px;
- padding-top:0px;
- padding-bottom:0px;
- border-width:1px;
- border-color:grey;
- height:24px; line-height:22px; border:1px solid #fff;
- }
- #ulproc{
- 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;
- }
- #tree { overflow:hidden; border:1px solid #ddd; }
- </style>
- <?php
- }
- }
|