procesy5.php 106 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927
  1. <?php
  2. //version 2010-06-01 - addding limits and searches
  3. //version 2010-06-13 - by plabudda login by AUTH MODULE (.config.php $AUTH_API)
  4. //version 2010-09-22 - by abinder, drobne poprawki z wyszukiwaniem i pokazywaniem tabeli
  5. //version 2010-09-30 - by abinder, drobne poprawki z wyszukiwanie w PROCESACH do edycji...
  6. //version 2011-09-12 - by pl, TODO: Obowiazki - menu
  7. require_once dirname(__FILE__) . '/se-lib/bootstrap.php';
  8. if (!Request::isHttps()) {
  9. header("Location: https://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
  10. exit();
  11. }
  12. error_reporting(E_ALL & ~E_NOTICE);
  13. //session_save_path("../session") ;
  14. session_start();
  15. date_default_timezone_set('Europe/Warsaw');// PHP 5 >= 5.1.0 required by date functions
  16. if (file_exists(".config.php")) include(".config.php");
  17. SEF('DEBUG_S');
  18. SEF('ZAP_SQL');
  19. SEF('ZAP_SQL_UPDATE');
  20. SEF('USERS_COLUMN_INIT');
  21. SEF('GETFORMITEM');
  22. SEF('T_WORKPOINTS_USER_SELECT');
  23. Lib::loadClass('App');
  24. Lib::loadClass('ProcesHelper');
  25. Lib::loadClass('Tree');
  26. Lib::loadClass('TreeHelper');
  27. Lib::loadClass('DB_Image');
  28. Lib::loadClass('TreeSortChildren');
  29. Lib::loadClass('UI');
  30. // ========== Task functions ==============
  31. require_once APP_PATH_ROOT . DS . 'procesy' . DS . 'legacy.php';
  32. require_once APP_PATH_ROOT . DS . 'procesy' . DS . 'proces.php';
  33. require_once APP_PATH_ROOT . DS . 'procesy' . DS . 'zasob.php';
  34. require_once APP_PATH_ROOT . DS . 'procesy' . DS . 'testy.php';// CRM_TESTY_WYNIKI
  35. require_once APP_PATH_ROOT . DS . 'procesy' . DS . 'proces_log.php';
  36. require_once APP_PATH_ROOT . DS . 'procesy' . DS . 'user.php';
  37. require_once APP_PATH_ROOT . DS . 'procesy' . DS . 'ext_ids.php';
  38. require_once APP_PATH_ROOT . DS . 'procesy' . DS . 'search.php';// CRM_SEARCH
  39. // TODO: if (App::is_ajax_request())
  40. require_once APP_PATH_ROOT . DS . 'procesy' . DS . 'ajax.php';
  41. require_once APP_PATH_ROOT . DS . 'se-lib' . DS . 'SE_Layout.php';// CRM_SEARCH
  42. // ========== SESSION set default session values ==============
  43. S::init();
  44. if (!isset($_SESSION['HIDE_ZASOBY'])) $_SESSION['HIDE_ZASOBY'] = true;
  45. if (!isset($_SESSION['HIDE_PROCESY'])) $_SESSION['HIDE_PROCESY'] = true;
  46. if (!isset($_SESSION['ZWIN_DRZEWO'])) $_SESSION['ZWIN_DRZEWO'] = false;
  47. if (!isset($_SESSION['TREE_OPEN_ARRAY'])) $_SESSION['TREE_OPEN_ARRAY'] = array();
  48. if (!isset($_SESSION['TREE_SHOW_P_ID2'])) $_SESSION['TREE_SHOW_P_ID2'] = false;
  49. if (!isset($_SESSION['TREE_SHOW_P_ID3'])) $_SESSION['TREE_SHOW_P_ID3'] = false;
  50. if (!isset($_SESSION['ROZWIN'])) $_SESSION['ROZWIN'] = false;
  51. if (!isset($_SESSION['ROZWIN_OPIS'])) $_SESSION['ROZWIN_OPIS'] = false;
  52. if (!isset($_SESSION['ROZWIN_ZASOBY'])) $_SESSION['ROZWIN_ZASOBY'] = false;
  53. if (!isset($_SESSION['TREE-ZASOBY'])) $_SESSION['TREE-ZASOBY'] = array();
  54. if (!isset($_SESSION['TREE-PROCESY'])) $_SESSION['TREE-PROCESY'] = array();
  55. if (!isset($_SESSION['USER_PARAMS'])) $_SESSION['USER_PARAMS'] = array();
  56. // ========== SESSION set values from request ==============
  57. if(isset($_GET['HIDE_ZASOBY']) && $_GET['HIDE_ZASOBY']) $_SESSION['HIDE_ZASOBY'] = true;
  58. if(isset($_GET['UNHIDE_ZASOBY']) && $_GET['UNHIDE_ZASOBY']) $_SESSION['HIDE_ZASOBY'] = false;
  59. if(isset($_GET['HIDE_PROCESY']) && $_GET['HIDE_PROCESY']) $_SESSION['HIDE_PROCESY'] = true;
  60. if(isset($_GET['UNHIDE_PROCESY']) && $_GET['UNHIDE_PROCESY']) $_SESSION['HIDE_PROCESY'] = false;
  61. if(isset($_GET['ZWIN_DRZEWO']) && $_GET['ZWIN_DRZEWO']) $_SESSION['ZWIN_DRZEWO'] = true;
  62. if(isset($_GET['ROZWIN_DRZEWO']) && $_GET['ROZWIN_DRZEWO']) $_SESSION['ZWIN_DRZEWO'] = false;
  63. if(isset($_GET['TREE_OPEN']) && $_GET['TREE_OPEN']) $_SESSION['TREE_OPEN_ARRAY'][$_GET['TREE_OPEN']] = true;
  64. if(isset($_GET['TREE_CLOSE']) && $_GET['TREE_CLOSE']) $_SESSION['TREE_OPEN_ARRAY'][$_GET['TREE_CLOSE']] = false;
  65. if(isset($_GET['TREE_SHOW_P_ID2']) && $_GET['TREE_SHOW_P_ID2']) $_SESSION['TREE_SHOW_P_ID2'] = true;
  66. if(isset($_GET['TREE_HIDE_P_ID2']) && $_GET['TREE_HIDE_P_ID2']) $_SESSION['TREE_SHOW_P_ID2'] = false;
  67. if(isset($_GET['TREE_SHOW_P_ID3']) && $_GET['TREE_SHOW_P_ID3']) $_SESSION['TREE_SHOW_P_ID3'] = true;
  68. if(isset($_GET['TREE_HIDE_P_ID3']) && $_GET['TREE_HIDE_P_ID3']) $_SESSION['TREE_SHOW_P_ID3'] = false;
  69. if(isset($_GET['TREE_ROZWIN']) && $_GET['TREE_ROZWIN']) $_SESSION['ROZWIN'] = true;
  70. if(isset($_GET['TREE_ZWIN']) && $_GET['TREE_ZWIN']) $_SESSION['ROZWIN'] = false;
  71. if(isset($_GET['TREE_OPISY_ROZWIN']) && $_GET['TREE_OPISY_ROZWIN']) $_SESSION['ROZWIN_OPIS'] = true;
  72. if(isset($_GET['TREE_OPISY_ZWIN']) && $_GET['TREE_OPISY_ZWIN']) $_SESSION['ROZWIN_OPIS'] = false;
  73. if(isset($_GET['TREE_ZASOBY_ROZWIN']) && $_GET['TREE_ZASOBY_ROZWIN']) $_SESSION['ROZWIN_ZASOBY'] = true;
  74. if(isset($_GET['TREE_ZASOBY_ZWIN']) && $_GET['TREE_ZASOBY_ZWIN']) $_SESSION['ROZWIN_ZASOBY'] = false;
  75. // ========== SESSION timeout ==============
  76. S::timeout_update();
  77. // ========== App state ==============
  78. App::set_default_task('CRM_PROCES');
  79. // ========== DB connection ==============
  80. //$conn = DB::connect();// TODO: needed?
  81. // ========== App auth ==============
  82. User::auth();// die if not logged in
  83. // ========== FUNCTION_INIT ==============
  84. // ?_ajax_request=FUNCTION
  85. // TODO: if (App::is_ajax_request())
  86. App::exec_ajax_request();
  87. // ?function_init=FUNCTION
  88. //echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">';var_dump( headers_sent() );echo'</pre>';
  89. App::exec_function_init();
  90. // column init
  91. Lib::loadClass('Column');
  92. Column::init('CRM_PROCES');
  93. Column::init('CRM_LISTA_ZASOBOW');
  94. //Column::init('CRM_TESTY');
  95. /**
  96. * Perm/access function.
  97. *
  98. * admin - kierownik, $_SESSION['ADM_ADMIN_LEVEL'] in (0,1)
  99. */
  100. function User_is_admin() {
  101. return User::hasAccess('procesy_admin');
  102. }
  103. function User_procesy5_check_access() {
  104. if (!User::hasAccess('procesy')) {
  105. ?>
  106. <div class="container">
  107. <div class="alert alert-danger">
  108. Brak dostępu!
  109. </div>
  110. </div>
  111. <br>.
  112. <?php
  113. lay_procesy_dol();
  114. die();
  115. }
  116. }
  117. function lay_procesy_gora() {
  118. $title = SE_Layout::getTitle().' procesy';
  119. if (($id_proces = V::get('id_proces', 0, $_GET, 'int')) > 0) {
  120. $title = "Proces {{$id_proces}}";
  121. }
  122. ?><!DOCTYPE html>
  123. <html>
  124. <head>
  125. <meta charset="utf-8" />
  126. <title><?php echo $title; ?></title>
  127. <link rel="shortcut icon" type="image/x-icon" href="./favicon.png?v=0.1">
  128. <meta name="author" content="Piotr Labudda <piotrl86@gmail.com>" />
  129. <link rel="stylesheet" href="stuff/bootstrap/css/bootstrap.min.css" type="text/css" />
  130. <link rel="stylesheet" href="stuff/jquery-ui-smoothness/jquery-ui-1.10.4.custom.min.css" type="text/css">
  131. <link rel="stylesheet" href="stuff/main.css" type="text/css" />
  132. <style type="text/css">
  133. body { <?php echo UI::fixFooterPosition('body_style'); ?> }
  134. </style>
  135. <style type="text/css">
  136. .popover-with-html .popover-heading {display:none;}
  137. .popover-with-html .popover-body {display:none;}
  138. </style>
  139. <script src="stuff/jquery-2.1.0.min.js"></script>
  140. <script src="stuff/jquery-plugins.js"></script>
  141. <script src="stuff/bootstrap/js/bootstrap.min.js"></script>
  142. <script src="stuff/jquery-ui-1.10.4.custom.min.js"></script>
  143. <script>
  144. jQuery(document).ready(function(){
  145. jQuery(".popover-with-html").popover({
  146. html: true,
  147. trigger: 'hover',
  148. animation: false,
  149. container: 'body',
  150. placement: 'top',
  151. content: function() {
  152. return jQuery(this).children(".popover-body").html();
  153. },
  154. title: function() {
  155. return jQuery(this).children(".popover-heading").html();
  156. }
  157. });
  158. });
  159. </script>
  160. <link rel="stylesheet" href="stuff/jquery.selectize/css/selectize.bootstrap3.css" type="text/css" />
  161. <script src="stuff/jquery.selectize/js/standalone/selectize.min.js"></script>
  162. <style type="text/css">
  163. .typepsecial .selectize-input { width:366px; padding:4px 6px; }
  164. .typepsecial .selectize-control::before {
  165. -moz-transition: opacity 0.2s;
  166. -webkit-transition: opacity 0.2s;
  167. transition: opacity 0.2s;
  168. content: ' ';
  169. z-index: 2;
  170. position: absolute;
  171. display: block;
  172. top: 12px;
  173. right: 34px;
  174. width: 16px;
  175. height: 16px;
  176. background: url(stuff/i/loading.gif);
  177. background-size: 16px 16px;
  178. opacity: 0;
  179. }
  180. .typepsecial .selectize-control.loading::before {
  181. opacity: 0.4;
  182. }
  183. .typepsecial .selectize-control.single .selectize-input {
  184. color: #333;
  185. text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
  186. background-color: #fff;
  187. background-image: none;
  188. background-repeat: none;
  189. border-color: #ccc;
  190. filter: none;
  191. -webkit-box-shadow: none;
  192. -moz-box-shadow: none;
  193. box-shadow: none;
  194. }
  195. </style>
  196. <?php
  197. lay_procesy_css();
  198. App::show_head_css();
  199. App::show_head_js();
  200. S::timeout_update_js();
  201. echo'</head>'."\n";
  202. echo'<body>'."\n";
  203. }
  204. if ('YES' != V::get('HEADER_NOT_INIT', '', $_REQUEST))
  205. lay_procesy_gora();
  206. function ECHOO($VAR) {
  207. echo "$VAR";
  208. }
  209. //INICJALIZACJA_KOLUMN
  210. if (!isset($_SESSION['CRM_LISTA_ZASOBOW_COLUMN'])) {
  211. $COLUMN="CRM_LISTA_ZASOBOW";
  212. $res = DB::query("show fields from $COLUMN");
  213. $KEY=0;
  214. while ($h = DB::fetch_row( $res )) {
  215. $_SESSION[$COLUMN."_COLUMN"]['DESC']["$KEY"] = $h[0];
  216. $_SESSION[$COLUMN."_COLUMN"]['TYPE'][$_SESSION[$COLUMN."_COLUMN"]['DESC']["$KEY"]] = $h[1];
  217. if(!isset($_SESSION[$COLUMN."_COLUMN"]['PERMEDIT'][$h[0]])) $_SESSION[$COLUMN."_COLUMN"]['PERMEDIT'][$h[0]] = "RW" ;
  218. $_SESSION[$COLUMN."_COLUMN"]['DESC_TO_KEY'][$h[0]] = $KEY;
  219. $_SESSION[$COLUMN."_COLUMN"]['ID']["$KEY"]=$KEY;
  220. if($_SESSION['USER_PROFILE'][$COLUMN."_COLUMN"]["$KEY"] == "HIDE") {
  221. $_SESSION[$COLUMN."_COLUMN"]['HIDE']["$KEY"]='HIDE';
  222. }
  223. $KEY++;
  224. }
  225. // echo "<br>Zainicjalizowano kolumne $COLUMN<br>";
  226. }
  227. //EOF INICJALIZACJA KOLUMN
  228. // ========== MENU ==============
  229. lay_procesy_user_panel();
  230. // ========== TASK ==============
  231. App::exec_task();
  232. // ========== function_init - funkcje ==============
  233. function SESSION_DEBUG() {
  234. if (isset($_GET['arg1_val'])) {
  235. $_SESSION['DEBUG'] = intval($_GET['arg1_val']);
  236. }
  237. }
  238. function SESSION_USER_PARAMS() {
  239. $allowed_user_params = array();
  240. $allowed_user_params['SHOW_PANEL']= 'int';
  241. $allowed_user_params['PROCESY_TREE_TYPE_HTML']= 'int';
  242. $allowed_user_params['ZASOBY_TREE_TYPE_HTML']= 'int';
  243. if (!isset($_GET['arg1']) || !isset($_GET['arg1_val'])) {
  244. return;
  245. } else if (array_key_exists($_GET['arg1'], $allowed_user_params)) {
  246. $_SESSION['USER_PARAMS'][ $_GET['arg1'] ] = intval($_GET['arg1_val']);
  247. }
  248. }
  249. function SORT_PRIO_ZASOB() {
  250. $id = V::get('arg1', '', $_GET, 'int');
  251. $sort_prio_dir = V::get('arg1_val', '', $_GET);
  252. TreeSortChildren::sortPrio($id, 'CRM_LISTA_ZASOBOW', 'PARENT_ID', $sort_prio_dir);
  253. }
  254. function SORT_PRIO_WSKAZNIK() {
  255. $id = V::get('arg1', '', $_GET, 'int');
  256. $sort_prio_dir = V::get('arg1_val', '', $_GET);
  257. TreeSortChildren::sortPrio($id, 'CRM_WSKAZNIK', 'ID_PROCES', $sort_prio_dir);
  258. }
  259. function SORT_PRIO_PROCES() {
  260. $id = V::get('arg1', '', $_GET, 'int');
  261. //$_GET['arg1_val'] = ($_GET['arg1_val'] == 'up')? 'dw' : 'up';// procesy w odwrotnej kolejnosci, w SQL order by SORT_PRIO DESC
  262. $sort_prio_dir = V::get('arg1_val', '', $_GET);
  263. TreeSortChildren::sortPrio($id, 'CRM_PROCES', 'PARENT_ID', $sort_prio_dir);
  264. }
  265. // ========== TASK - funkcje ==============
  266. function task_CRM_ADD_CRM_WSKAZNIK() {
  267. User_procesy5_check_access();
  268. // submit form - add wskaznik
  269. if (V::get('ADD_ID_CRM_PRZYPADEK', '', $_POST)) {
  270. $sql_obj = new stdClass();
  271. $sql_obj->ID_PROCES = V::get('ADD_ID_PROCES', '', $_POST);
  272. $sql_obj->ID_ZASOB = V::get('ADD_ID_ZASOB', '', $_POST);
  273. $sql_obj->TYP = V::get('ADD_CRM_WSKAZNIK_TYP', '', $_POST);
  274. $sql_obj->ID_PRZYPADEK = V::get('ADD_ID_CRM_PRZYPADEK', '', $_POST);
  275. $sql_obj->OPIS_ZASOB = V::get('ADD_CRM_WSKAZNIK_OPIS_ZASOB', '', $_POST);
  276. $sql_obj->SORT_PRIO = 0;
  277. // nowy wskaznik na koniec listy pod procesem
  278. $sql = "select max(cw.`SORT_PRIO`) as MAX_SORT_PRIO
  279. from `CRM_WSKAZNIK` as cw
  280. where
  281. cw.`ID_PROCES`='".$sql_obj->ID_PROCES."'
  282. ";
  283. $res = DB::query( $sql );
  284. while ($r = DB::fetch( $res )) {
  285. $sql_obj->SORT_PRIO = $r->MAX_SORT_PRIO + 1;
  286. }
  287. //TODO: POST_VERIFY
  288. $new_id = DB::ADD_NEW_OBJ('CRM_WSKAZNIK', $sql_obj);
  289. if (V::get('DEBUG', '', $_SESSION)) echo"PASSED(1) NEW RECORD ID($new_id)<hr>";
  290. if ($new_id > 0) {
  291. echo '<p class="sql-msg box box-green">'."Dodano nowy rekord";
  292. } else {
  293. echo '<p class="sql-msg box box-red">'."Error przy dodawaniu rekordu";
  294. }
  295. echo'<br />'."Wroc do ".App::link("procesow", "?task=CRM_PROCES");
  296. echo'<br />'."lub ".App::link("dodaj kolejny zasob do procesu ".$sql_obj->ID_PROCES, "?task=ADD_PROCES_ID&id=".$sql_obj->ID_PROCES);
  297. echo'</p>';// .box
  298. }
  299. // show form - add wskaznik
  300. if (V::get('ADD_ID_ZASOB', '', $_GET)) {
  301. $id_proces = V::get('ADD_ID_PROCES', 0, $_REQUEST, 'int');
  302. $id_zasob = V::get('ADD_ID_ZASOB', 0, $_REQUEST, 'int');
  303. if ($id_proces <= 0) {
  304. echo'<p class="err">'."Wrong id!".'</p>';
  305. return;
  306. }
  307. if ($id_zasob <= 0) {
  308. echo'<p class="err">'."Wrong zasob id!".'</p>';
  309. return;
  310. }
  311. $proces = DB::get_by_id( 'CRM_PROCES', $id_proces );
  312. if (!$proces) {
  313. echo'<div class="box box-red">';
  314. echo "Proces [".$id_proces."] not exists.";
  315. echo'</div>';
  316. return;
  317. }
  318. $zasob = DB::get_by_id( 'CRM_LISTA_ZASOBOW', $id_zasob );
  319. if (!$zasob) {
  320. echo'<div class="box box-red">';
  321. echo "Proces [".$id_zasob."] not exists.";
  322. echo'</div>';
  323. return;
  324. }
  325. {// pathway
  326. echo'<h1>';
  327. echo App::link("Procesy", array('task'=>"CRM_PROCES"));
  328. if ($id_proces > 0) {
  329. echo ' &raquo; '.App::link("Dodaj zasob do procesu [".$id_proces."]", array('task'=>'ADD_PROCES_ID', 'id'=>$id_proces));
  330. if ($id_zasob > 0) {
  331. echo ' &raquo; '.App::link("Dodaj zasob [".$id_zasob."]", array('task'=>'CRM_ADD_CRM_WSKAZNIK', 'ADD_ID_PROCES'=>$id_proces, 'ADD_ID_ZASOB'=>$id_zasob));
  332. }
  333. }
  334. echo'</h1>';
  335. }// pathway
  336. Lib::loadClass('ProcesHelper');
  337. {// proces info
  338. $wsk = ProcesHelper::get_wskazniki( $proces->ID );
  339. echo'<div class="tree-wrap">';
  340. echo'<ul>';
  341. echo'<li class="tree-last">';
  342. echo'<dl>';
  343. echo'<dt>';
  344. if (!empty($wsk)) echo'<div class="has_wsk">';
  345. echo'<b class="item_id btn-box">'.$proces->ID.'</b>';
  346. echo'<span class="desc"><b>'.$proces->DESC.'</b>';
  347. echo'<span class="more-desc"> '.$proces->OPIS.' </span>';
  348. echo'</span>';
  349. if (!empty($wsk)) echo'</div>';
  350. echo'</dt>';
  351. if (!empty($wsk)) {
  352. $zasoby_id = array();
  353. echo'<dd>';
  354. echo'<ul>';
  355. $wsk_cnt = count( $wsk );
  356. foreach ($wsk as $w) {
  357. $w_parents_out = '';
  358. $w_title_parents_out = '';
  359. echo'<li'.((--$wsk_cnt)? '' : ' class="tree-last"').'>';
  360. echo'<p>';
  361. echo ' <span class="btn-box btn-box-silver">'.$w->CW_ID.'</span>';
  362. echo'<span class="green"'.$w_title_parents_out.'>['.$w->ID.']</span>';
  363. echo' <i title="'.$w->CP_PYTANIE.' '.$w->CP_OPIS.'">'.$w->CP_FORM_TREAT.'</i>';
  364. echo'';
  365. echo ' '.$w->TYPE.'';
  366. echo ' <b>'.$w->DESC.'</b> ';
  367. //if ($tree->get_param('rozwin_opis'))
  368. echo ' <span class="green">'.$w->OPIS.'</span>';// opis zasobu
  369. //if ($tree->get_param('rozwin_opis'))
  370. echo ' <span style="color:#000;">'.$w->OPIS_ZASOB.'</span>';// komentarz wskaznika
  371. echo'</p>';
  372. echo'</li>';
  373. }
  374. echo'</ul>';
  375. }
  376. echo'</dl>';
  377. echo'</li>';
  378. echo'</ul>';
  379. echo'</div>';// .tree-wrap
  380. }// proces info
  381. // echo '<h3>Wybierz okolicznosci procesu <b style="color:red">'.V::get('ADD_ID_PROCES', '', $_GET).'</b> do zasobu <b style="color:green">'.V::get('ADD_ID_ZASOB', '', $_GET).'</b></h3>';
  382. echo'<h3>'."Wybierz okolicznosci powiazania zasobu ".'<b style="color:green">'.$zasob->ID.'</b>'." do procesu ".'<b style="color:red">'.$proces->ID.'</b>'.'</h3>';
  383. echo'<div class="tree-wrap">';
  384. echo'<p> <span class="btn-box btn-box-silver"></span>';
  385. echo' <span class="green">['.$zasob->ID.']</span>';
  386. echo' '.$zasob->TYPE.' <b>'.$zasob->DESC.'</b> <span class="green">'.$zasob->OPIS.'</span>';
  387. echo'</p>';
  388. echo'</div>';
  389. $ZAP_SQL = "select * from CRM_PRZYPADEK ";
  390. $res = DB::query( $ZAP_SQL );
  391. echo'<form action="'."?task=CRM_ADD_CRM_WSKAZNIK&ADD_ID_ZASOB=".$_GET['ADD_ID_ZASOB']."&ADD_ID_PROCES=".$_GET['ADD_ID_PROCES'].'" method="POST">';
  392. echo'<input type="hidden" name="ADD_ID_ZASOB" value="'.V::get('ADD_ID_ZASOB', '', $_GET).'">';
  393. echo'<input type="hidden" name="ADD_ID_PROCES" value="'.V::get('ADD_ID_PROCES', '', $_GET).'">';
  394. echo'Rodzaj : <select name="ADD_CRM_WSKAZNIK_TYP"><option value="R">RZECZOWNIK</option><option value="C">CZASOWNIK</option></select><br>Przypadki rzeczownika:';
  395. echo'<select name="ADD_ID_CRM_PRZYPADEK">';
  396. while ($DWA = DB::fetch( $res )) {
  397. echo'<option value="'.$DWA->ID.'">'.$DWA->FORM_TREAT.' | '.$DWA->NAZWA.' | '.$DWA->PYTANIE.' | '.$DWA->OPIS.'</option>'."\n";
  398. }
  399. echo'</select>';
  400. //echo'<br />Komentarz: <input type="text" name="ADD_CRM_WSKAZNIK_OPIS_ZASOB" value="'.$_GET['ADD_CRM_WSKAZNIK_OPIS_ZASOB'].'" size=50>';
  401. echo'<br />Komentarz:';
  402. echo'<br /><textarea name="ADD_CRM_WSKAZNIK_OPIS_ZASOB" cols="80" rows="6">'.V::get('ADD_CRM_WSKAZNIK_OPIS_ZASOB', '', $_GET).'</textarea>';
  403. echo'<br><input type="SUBMIT" value="DODAJ"></form>';
  404. echo'<hr>';
  405. }
  406. }
  407. /**
  408. * @param $_GET['ID'] - ID rekordu do edycji
  409. */
  410. function task_CRM_EDIT_CRM_WSKAZNIK() {
  411. global $error;
  412. User_procesy5_check_access();
  413. $id = V::get('ID', '', $_GET, 'int');
  414. if ($id <= 0) {
  415. echo'<p class="err">'."Wrong ID".'</p>';
  416. return;
  417. }
  418. $R = null;
  419. $sql = "select * from `CRM_WSKAZNIK` where `ID`='".$id."' limit 1; ";// TODO: use DB::get_by_id
  420. $res = DB::query($sql);
  421. if (!$res) die("sql query error $sql");
  422. $R = DB::fetch($res);
  423. if (!$R) {
  424. echo'<p class="err">'."Wrong ID - not exists".'</p>';
  425. return;
  426. }
  427. //echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">';print_r($R);echo'</pre>';
  428. // form submit
  429. if (V::get('EDIT_SUBMIT', '', $_POST)) {
  430. $sql_obj = new stdClass();
  431. $sql_obj->ID = $R->ID;
  432. //$sql_obj->PARENT_ID = V::get('EDIT_PARENT_ID', '', $_POST);
  433. $sql_obj->TYP = V::get('EDIT_TYP', '', $_POST);
  434. $sql_obj->ID_PRZYPADEK = V::get('EDIT_ID_PRZYPADEK', '', $_POST);
  435. $sql_obj->OPIS_ZASOB = V::get('EDIT_OPIS_ZASOB', '', $_POST);
  436. $sql_obj->ID_PROCES = V::get('EDIT_ID_PROCES', '', $_POST, 'int');
  437. $sql_obj->ID_ZASOB = V::get('EDIT_ID_ZASOB', '', $_POST, 'int');
  438. $sql_obj->PARENT_ID = V::get('PARENT_ID', '', $_POST);//todo trzeba sprawdzic czy jest taki wskaznik uzyty w tym procesie
  439. $sql_obj->EXPORT_WSKAZNIK = V::get('EXPORT_WSKAZNIK', '', $_POST, 'int');//todo musi byc weryfikacja czy jest taki wskaznik w odwolujacej sie funkcji
  440. //TODO: POST_VERIFY
  441. $affected = DB::UPDATE_OBJ( 'CRM_WSKAZNIK', $sql_obj );
  442. if (V::get('DEBUG', '', $_SESSION)) echo"PASSED($affected)<hr>";
  443. if ($affected == 2) {
  444. echo '<p class="green box box-green">'."Zmienio rekord";
  445. } else if ($affected == 1) {
  446. echo '<p class="err box box-red">'."Zmieniono rekord (Error: nie zapisano hostorii)";
  447. } else if ($affected < 0) {
  448. echo '<p class="err box box-red">'."Blad podczas edytowania rekordu - nic nie zmieniono";
  449. }
  450. echo'<br />'."Wroc do ".App::link("procesow", "?task=CRM_PROCES");
  451. echo'</p>';// .box
  452. }
  453. // show form - edit wskaznik
  454. if (V::get('EDIT', '', $_GET)) {
  455. // overwrite data from POST
  456. if ($_POST) {
  457. if (isset($_POST['EDIT_ID_PROCES'])) $R->ID_PROCES = $_POST['EDIT_ID_PROCES'];
  458. if (isset($_POST['EDIT_ID_ZASOB'])) $R->ID_ZASOB = $_POST['EDIT_ID_ZASOB'];
  459. if (isset($_POST['EDIT_TYP'])) $R->TYP = $_POST['EDIT_TYP'];
  460. if (isset($_POST['EDIT_ID_PRZYPADEK'])) $R->ID_PRZYPADEK = $_POST['EDIT_ID_PRZYPADEK'];
  461. if (isset($_POST['EDIT_OPIS_ZASOB'])) $R->OPIS_ZASOB = $_POST['EDIT_OPIS_ZASOB'];
  462. if (isset($_POST['PARENT_ID'])) $R->PARENT_ID = $_POST['PARENT_ID'];
  463. if (isset($_POST['EXPORT_WSKAZNIK'])) $R->EXPORT_WSKAZNIK = $_POST['EXPORT_WSKAZNIK'];
  464. }
  465. echo '<h3>Edytuj wskaznik procesu <b style="color:red">'.$R->ID_PROCES.'</b> do zasobu <b style="color:green">'.$R->ID_ZASOB.'</b></h3>';
  466. $frm_edit_action = "?task=CRM_EDIT_CRM_WSKAZNIK&EDIT=".$R->ID."&ID=".$R->ID;
  467. echo "<h6>Dane bieżącego rekordu: Stworzono: {$R->A_RECORD_CREATE_DATE}, Stworzył: {$R->A_RECORD_CREATE_AUTHOR} , Aktualizował: {$R->A_RECORD_UPDATE_DATE}, data:{$R->A_RECORD_UPDATE_DATE} </h6>";
  468. echo '<form action="'.$frm_edit_action.'" method="POST">';
  469. echo'<input type="hidden" name="EDIT_SUBMIT" value="1">';
  470. echo '<br />'."Proces ID: ";
  471. echo'<input type="text" name="EDIT_ID_PROCES" value="'.$R->ID_PROCES.'">';
  472. echo '<br />'."Zasob ID: ";
  473. echo'<input type="text" name="EDIT_ID_ZASOB" value="'.$R->ID_ZASOB.'">';
  474. // TODO: rodzaj array selected - typespecial
  475. echo'<br />'."Rodzaj: ";
  476. echo'<select name="EDIT_TYP"><option value="R">RZECZOWNIK</option><option value="C">CZASOWNIK</option></select>';
  477. echo'<br>Przypadki rzeczownika:';
  478. echo'<select name="EDIT_ID_PRZYPADEK">';
  479. $ZAP_SQL = "select * from CRM_PRZYPADEK ";
  480. $res = DB::query( $ZAP_SQL );
  481. while ($DWA = DB::fetch( $res )) {
  482. $sel = ($R->ID_PRZYPADEK == $DWA->ID)? ' selected="selected"' : '';
  483. echo'<option value="'.$DWA->ID.'"'.$sel.'>'.$DWA->FORM_TREAT.' | '.$DWA->NAZWA.' | '.$DWA->PYTANIE.' | '.$DWA->OPIS.'</option>'."\n";
  484. }
  485. echo'</select>';
  486. //echo'<br />Komentarz: <input type="text" name="EDIT_OPIS_ZASOB" value="'.$R->OPIS_ZASOB.'" size=50>';
  487. echo'<br />Komentarz:';
  488. echo'<br /><textarea name="EDIT_OPIS_ZASOB" cols="80" rows="6">'.$R->OPIS_ZASOB.'</textarea>';
  489. echo'<br><input type="SUBMIT" value="'."ZAPISZ".'">';
  490. echo'</form>';
  491. echo'<hr>';
  492. }
  493. }
  494. function task_CRM_DEL_CRM_WSKAZNIK() {
  495. User_procesy5_check_access();
  496. $sql_obj = new stdClass();
  497. $sql_obj->ID = V::get('ID', '', $_GET, 'int');
  498. $sql_obj->A_STATUS = 'DELETED';
  499. //TODO: POST_VERIFY
  500. if ($sql_obj->ID <= 0) {
  501. echo'<p class="err">'."Wrong ID".'</p>';
  502. return;
  503. }
  504. $db = DB::getDB();
  505. $affected = $db->UPDATE_OBJ('CRM_WSKAZNIK', $sql_obj);
  506. if ($affected == 2) {
  507. echo '<p class="green box box-green">'."Usunieto wskaznik";
  508. } else if ($affected == 1) {
  509. echo '<p class="err box box-red">'."Usunieto wskaznik (Error: nie zapisano hostorii)";
  510. } else if ($affected < 0) {
  511. if ($db->has_errors()) {
  512. try {
  513. $dsErrors = array();
  514. $errorsSql = $db->get_errors();
  515. foreach ($errorsSql as $vErr) {
  516. if ('SQL QUERY FAILED: ' == substr($vErr, 0, 18)) {
  517. $vErr = substr($vErr, 18);
  518. }
  519. $dsErrors[] = $vErr;
  520. }
  521. if (!empty($dsErrors)) {
  522. Lib::loadClass('StorageException');
  523. throw new StorageException($dsErrors);
  524. }
  525. } catch (Exception $e) {
  526. ?><div class="alert alert-danger">
  527. Wystąpiły błędy: <?php echo $e->getMessage(); ?>
  528. </div><?php
  529. }
  530. } else {
  531. echo '<p class="err box box-red">'."Blad podczas usuwaniu wskaznika - nic nie zmieniono";
  532. }
  533. }
  534. echo'<br />'."Wroc do ".App::link("procesow", "?task=CRM_PROCES");
  535. echo'</p>';// .box
  536. }
  537. /**
  538. * @param $tree_callback - tree item show function callback
  539. * @param $tree_params - array of tree params
  540. */
  541. function action_VIEW_SUBTREE( $tbl, $proces_id, $tree_callback, $tree_params ) {
  542. $tree = new Tree( $tbl );
  543. $tree->set_param('show_item_callback', $tree_callback);
  544. foreach ($tree_params as $key => $val) {
  545. $tree->set_param($key, $val);
  546. }
  547. $tree->showSubTree( $proces_id );
  548. }
  549. function task_VIEW_PROCES_MAP() {
  550. User_procesy5_check_access();
  551. $procesMap = new stdClass();
  552. $procesMap->procesInitAll = array();
  553. $procesMap->gotoAll = array();
  554. $procesMap->treeFlat = array();
  555. $db = DB::getDB();
  556. $sql = "select p.`ID`, p.`PARENT_ID`
  557. -- , p.`OPIS`
  558. , p.`TYPE`, p.`IF_TRUE_GOTO`, p.`IF_TRUE_GOTO_FLAG`
  559. from `CRM_PROCES` as p
  560. where
  561. p.`A_STATUS` in('WAITING', 'NORMAL')
  562. -- and (p.`TYPE`='PROCES_INIT' or p.`IF_TRUE_GOTO`>0)
  563. ";
  564. $res = $db->query($sql);
  565. while ($r = $db->fetch($res)) {
  566. if ($r->IF_TRUE_GOTO > 0) {
  567. $procesMap->gotoAll[$r->ID] = $r;
  568. }
  569. if ($r->TYPE == 'PROCES_INIT') {
  570. $procesMap->procesInitAll[$r->ID] = $r;
  571. }
  572. $procesMap->treeFlat[$r->PARENT_ID][] = $r->ID;
  573. }
  574. // validate goto - goto only to PROCES_INIT
  575. $procesMap->gotoErrors = array();
  576. foreach ($procesMap->gotoAll as $kId => $vStep) {
  577. if (!array_key_exists($vStep->IF_TRUE_GOTO, $procesMap->procesInitAll)) {
  578. $procesMap->gotoErrors[$kId] = $vStep;
  579. }
  580. }
  581. foreach ($procesMap->gotoErrors as $kId => $vStep) {
  582. unset($procesMap->gotoAll[$kId]);
  583. }
  584. foreach ($procesMap->procesInitAll as $kId => $vProces) {
  585. $vProces->gotoLinks = array();
  586. $vProces->sub = array();
  587. if (array_key_exists($kId, $procesMap->treeFlat)) {
  588. foreach ($procesMap->treeFlat[$kId] as $childId) {
  589. $vProces->sub[$childId] = true;
  590. }
  591. }
  592. //$procesMap->procesInitAll[$kId] = $vProces;
  593. }
  594. if(V::get('DBG', '', $_GET)){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">procesMap (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($procesMap);echo'</pre>';}
  595. $loopLimit = 50;// max ilość zagłębień w procesie
  596. for ($i = 0; $i < $loopLimit; $i++) {
  597. $breakLoop = true;
  598. foreach ($procesMap->procesInitAll as $kId => $vProces) {
  599. if (!empty($vProces->sub)) {
  600. $breakLoop = false;
  601. $childrens = array_keys($vProces->sub);
  602. $vProces->sub = array();
  603. foreach ($childrens as $childId) {
  604. if (array_key_exists($childId, $procesMap->treeFlat)) {
  605. foreach ($procesMap->treeFlat[$childId] as $vId) {
  606. $vProces->sub[$vId] = true;
  607. }
  608. }
  609. if (array_key_exists($childId, $procesMap->gotoAll)) {
  610. $gotoId = $procesMap->gotoAll[$childId]->IF_TRUE_GOTO;
  611. $vProces->gotoLinks[$gotoId] = $procesMap->procesInitAll[$gotoId];
  612. $procesMap->gotoFrom[$gotoId][$vProces->ID] = $vProces->ID;
  613. }
  614. }
  615. }
  616. }
  617. if ($breakLoop) {
  618. if(V::get('DBG', '', $_GET)){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">breakLoop (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r("end by {$i} loops");echo'</pre>';}
  619. break;
  620. }
  621. }
  622. // fetch DESC i OPIS laters
  623. $sqlIds = array_keys($procesMap->procesInitAll);
  624. if (!empty($sqlIds)) {
  625. $sqlIds = implode(",", $sqlIds);
  626. $sql = "select p.`ID`, p.`DESC`, p.`OPIS`
  627. from `CRM_PROCES` as p
  628. where
  629. p.`A_STATUS` in('WAITING', 'NORMAL')
  630. and p.`ID` in({$sqlIds})
  631. ";
  632. $res = $db->query($sql);
  633. while ($r = $db->fetch($res)) {
  634. $procesMap->procesInitAll[$r->ID]->DESC = $r->DESC;
  635. $procesMap->procesInitAll[$r->ID]->OPIS = $r->OPIS;
  636. }
  637. }
  638. if(V::get('DBG', '', $_GET)){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">procesMap (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($procesMap);echo'</pre>';}
  639. ?>
  640. <style type="text/css">
  641. .procesMapItem { padding:20px 6px; border-bottom:1px solid #eee; color:rgba(51, 51, 51, 0.6); }
  642. .procesMapItem:hover { color:#333; }
  643. .procesMapItem li { width:100%; overflow:hidden; clear:left; text-align:left; text-overflow:ellipsis; white-space:nowrap; }
  644. @media print {
  645. .procesMapItem { color:rgb(51, 51, 51); }
  646. }
  647. </style>
  648. <div class="container">
  649. <?php if (!empty($procesMap->gotoErrors) && !V::get('HIDE_PANEL', 0, $_GET, 'int')) : ?>
  650. <div class="alert alert-danger">
  651. <button type="button" class="close" data-dismiss="alert">×</button>
  652. <strong>Uwaga błędy w GOTO!</strong> GOTO może wywołać jedynie PROCES_INIT. <?php echo count($procesMap->gotoErrors); ?> błędów.
  653. <ul>
  654. <?php foreach ($procesMap->gotoErrors as $vStep) : ?>
  655. <li>Krok <?php echo $vStep->ID; ?> <?php echo $vStep->IF_TRUE_GOTO_FLAG; ?> {<?php echo $vStep->IF_TRUE_GOTO; ?>}</li>
  656. <?php endforeach; ?>
  657. </ul>
  658. </div>
  659. <?php endif; ?>
  660. <h1>Mapa procesów
  661. <?php
  662. if (!V::get('HIDE_PANEL', 0, $_GET, 'int')) {
  663. echo App::link("drukuj", array('task'=>'VIEW_PROCES_MAP', 'HIDE_PANEL'=>1), array('target'=>'_blank', 'ico_after_text'=>'print', 'style'=>'font-size:small;'));
  664. }
  665. ?>
  666. </h1>
  667. <?php foreach ($procesMap->procesInitAll as $kId => $vProces) : ?>
  668. <div class="procesMapItem">
  669. <h4 id="procesMapId-<?php echo $vProces->ID; ?>">{<?php echo $vProces->ID; ?>} <?php echo $vProces->DESC; ?></h4>
  670. <p><?php echo strip_tags($vProces->OPIS); ?></p>
  671. <?php if ($vProces->gotoLinks) : ?>
  672. <dl>
  673. <dt>Może wywołać:</dt>
  674. <dd>
  675. <ul>
  676. <?php foreach ($vProces->gotoLinks as $kGotoProcesId => $gotoProces) : ?>
  677. <li><a href="#procesMapId-<?php echo $gotoProces->ID; ?>">{<?php echo $gotoProces->ID; ?>}</a> <?php echo $gotoProces->DESC; ?></li>
  678. <?php endforeach; ?>
  679. </ul>
  680. </dd>
  681. </dl>
  682. <?php endif; ?>
  683. <?php if (!empty($procesMap->gotoFrom[$vProces->ID])) : ?>
  684. <dl>
  685. <dt>Może zostać wywołany przez:</dt>
  686. <dd>
  687. <ul>
  688. <?php foreach ($procesMap->gotoFrom[$vProces->ID] as $kGotoProcesId) : $gotoProces = $procesMap->procesInitAll[$kGotoProcesId]; ?>
  689. <li><a href="#procesMapId-<?php echo $gotoProces->ID; ?>">{<?php echo $gotoProces->ID; ?>}</a> <?php echo $gotoProces->DESC; ?></li>
  690. <?php endforeach; ?>
  691. </ul>
  692. </dd>
  693. </dl>
  694. <?php endif; ?>
  695. </div>
  696. <?php endforeach; ?>
  697. </div>
  698. <?php
  699. if (V::get('HIDE_PANEL', 0, $_GET, 'int') == 1) {
  700. ?>
  701. <script>jQuery(document).ready(function(){
  702. window.print();
  703. });
  704. </script>
  705. <?php
  706. }
  707. }
  708. function task_PROCES_VIEW_LIST() {
  709. $tbl = 'CRM_PROCES';
  710. $id_proces = V::get('id_proces', '', $_REQUEST, 'int');
  711. if ($id_proces <= 0) {
  712. echo '<div class="alert alert-danger">' . "Wrong ID" . '</div>';
  713. return;
  714. }
  715. $p = DB::get_by_id('CRM_PROCES', $id_proces);
  716. if (!$p) {
  717. echo '<div class="alert alert-danger">' . "Proces {$id_proces} nie istnieje" . '</div>';
  718. return;
  719. }
  720. $userAcl = User::getAcl();
  721. if (!$userAcl->canViewProces($id_proces)) {
  722. echo '<div class="alert alert-danger">' . "Brak uprawnień do procesu" . '</div>';
  723. return;
  724. }
  725. if (!V::get('HIDE_PANEL', 0, $_GET, 'int')) {
  726. // pathway
  727. echo'<h1>'.App::link("Menu", "?task=CRM_MENU");
  728. echo' - ';
  729. echo "Przegladaj proces <b>".$id_proces."</b>";
  730. echo ' ';
  731. echo App::link("drukuj", array('task'=>'PROCES_VIEW_LIST', 'id_proces'=>$id_proces, 'HIDE_PANEL'=>1), array('target'=>'_blank', 'ico_after_text'=>'print', 'style'=>'font-size:small;'));
  732. echo'</h1>';
  733. }
  734. Lib::loadClass('TreeList');
  735. $treeList = new TreeList('CRM_PROCES', $id_proces, 'PARENT_ID');
  736. $treeList->fetchTreeFlat();
  737. $listFlat = $treeList->generateListFlat();
  738. $treeList->fetchData();
  739. $ids = $treeList->getListIds();
  740. $wskazniki = ProcesHelper::getWskaznikiByIds($ids, array('group_stanowiska' => 1));
  741. if(V::get('DBG_TF', '', $_GET) > 1){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">$wskazniki (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($wskazniki);echo'</pre>';}
  742. $gotoLinks = array();
  743. $gotoIds = array();
  744. foreach ($listFlat as $vItem) {
  745. $item = $treeList->getData($vItem->ID);
  746. if ($item->IF_TRUE_GOTO > 0) {
  747. $gotoIds[] = $item->IF_TRUE_GOTO;
  748. }
  749. }
  750. if (!empty($gotoIds)) {
  751. $db = DB::getDB();
  752. $sqlIds = implode(",", $gotoIds);
  753. $sql = "select p.`ID`, p.`DESC`, p.`OPIS`
  754. from `CRM_PROCES` as p
  755. where
  756. p.`A_STATUS` in('WAITING', 'NORMAL')
  757. and p.`ID` in({$sqlIds})
  758. ";
  759. $res = $db->query($sql);
  760. while ($r = $db->fetch($res)) {
  761. $gotoLinks[$r->ID] = $r->DESC;
  762. }
  763. }
  764. foreach ($listFlat as $vItem) {
  765. $item = $treeList->getData($vItem->ID);
  766. if(V::get('DBG_TF', '', $_GET) > 0){echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">wskazniki['.$item->ID.'] (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($wskazniki[$item->ID]);echo'</pre>';}
  767. $vItem->gotoOut = '';
  768. if ($item->IF_TRUE_GOTO > 0) {
  769. $gotoLink = "{{$item->IF_TRUE_GOTO}}";
  770. if (!V::get('HIDE_PANEL', 0, $_GET, 'int')) {
  771. $gotoLink = App::link($gotoLink, array('task'=>'PROCES_VIEW_LIST', 'id_proces'=>$item->IF_TRUE_GOTO));
  772. }
  773. if ($item->IF_TRUE_GOTO_FLAG == 'GOTO') {
  774. $vItem->gotoOut .= " {$gotoLink}"; //usunąłem Przejdz do Procesu, bo w instrukcji/umowie nie jest to potrzebne
  775. } else if ($item->IF_TRUE_GOTO_FLAG == 'GOTO_AND_RETURN') {
  776. $vItem->gotoOut .= "Przejdź do procesu {$gotoLink} i wróć po jego zakończeniu";
  777. } else if ($item->IF_TRUE_GOTO_FLAG == 'FORK') {
  778. $vItem->gotoOut .= "Uruchom propces {$gotoLink}";
  779. }
  780. if (!empty($vItem->gotoOut) && !empty($gotoLinks[$item->IF_TRUE_GOTO])) {
  781. $vItem->gotoOut .= ": {$gotoLinks[$item->IF_TRUE_GOTO]}";
  782. }
  783. $vItem->gotoOut .= ".";
  784. }
  785. }
  786. $imgSize = (V::get('show_big_img', '', $_GET))? '600x600' : '200x200';
  787. ?>
  788. <style type="text/css">
  789. .proces-list-item-view { clear:both; }
  790. .proces-list-view-image { float:right; padding:0 0 8px 8px; clear:right; }
  791. </style>
  792. <div class="container">
  793. <?php foreach ($listFlat as $vItem) {
  794. $item = $treeList->getData($vItem->ID);
  795. ?>
  796. <div class="proces-list-item-view">
  797. <h4><?php
  798. if($item->TYPE=='PROCES_INIT') echo "{".$item->ID."}";
  799. else if(in_array($item->TYPE,array('TEXT_BREAK'))) echo "&nbsp;&nbsp;&nbsp;";
  800. else if(strstr($item->TYPE,'PROCES_GROUP')) echo "<font size=+2>§".$vItem->listNrNUM."";
  801. else
  802. echo $vItem->listNrNUM."."; ?> <?php echo $item->DESC; ?> <span class="muted"><font size=-2 color=grey><i><?php if(!in_array($item->TYPE,array('TEXT_BREAK','PROCES_INIT'))) echo "{".$item->ID."}"; ?></i></font></span></h4>
  803. <?php if($item->TYPE=='PROCES_INIT')
  804. if(!empty($item->A_RECORD_UPDATE_DATE))
  805. echo "<font size=-5>akt. {$item->A_RECORD_UPDATE_DATE} przez {$item->A_RECORD_UPDATE_AUTHOR}</font>"; //TODO nalezy zabrac informacje o procesie z klasy
  806. else
  807. echo "<font size=-5>utw. {$item->A_RECORD_CREATE_DATE} przez {$item->A_RECORD_CREATE_AUTHOR}</font>"; //TODO nalezy zabrac informacje o procesie z klasy
  808. ?>
  809. <p style="overflow:hidden">
  810. <?php if ($item->A_HAS_IMAGE > 0) : ?>
  811. <?php $tbl = 'CRM_PROCES'; ?>
  812. <?php for ($i = 0; $i < $item->A_HAS_IMAGE; $i++) : ?>
  813. <a href="procesy5.php?function_init=fun_SHOW_EXTERNAL_IMAGE&tbl=<?php echo $tbl; ?>&id=<?php echo $item->ID; ?>&number=<?php echo $i; ?>" target="_blank" class="proces-list-view-image lightbox">
  814. <img src="procesy5.php?function_init=fun_SHOW_EXTERNAL_IMAGE&tbl=<?php echo $tbl; ?>&id=<?php echo $item->ID; ?>&number=<?php echo $i; ?>&resize=<?php echo $imgSize; ?>" />
  815. </a>
  816. <?php endfor; ?>
  817. <?php endif; ?>
  818. <?php echo $item->OPIS; ?>
  819. </p>
  820. <?php
  821. if(strstr($item->TYPE,'PROCES_GROUP')) echo "</font>";
  822. ?></p>
  823. <?php if (array_key_exists($item->ID, $wskazniki)) : ?>
  824. <dl class="dl-horizontal">
  825. <?php if (!empty($wskazniki[$item->ID]['stanowiska'])) : ?>
  826. <dt>Stanowiska:</dt>
  827. <dd>
  828. <ul>
  829. <?php foreach ($wskazniki[$item->ID]['stanowiska'] as $vWsk) : ?>
  830. <li><?php echo $vWsk->DESC; ?> <span class="muted">[<?php echo $vWsk->ID; ?>]</span></li>
  831. <?php endforeach; ?>
  832. </ul>
  833. </dd>
  834. <?php endif; ?>
  835. <?php if (!empty($wskazniki[$item->ID]['inne'])) : ?>
  836. <dt>Użyte zasoby:</dt>
  837. <dd>
  838. <ul>
  839. <?php foreach ($wskazniki[$item->ID]['inne'] as $vWsk) : ?>
  840. <li style="clear:both;">
  841. <?php if ($vWsk->A_HAS_IMAGE > 0) : ?>
  842. <?php $tbl = 'CRM_LISTA_ZASOBOW'; ?>
  843. <?php for ($i = 0; $i < $vWsk->A_HAS_IMAGE; $i++) : ?>
  844. <a href="procesy5.php?function_init=fun_SHOW_EXTERNAL_IMAGE&tbl=<?php echo $tbl; ?>&id=<?php echo $vWsk->ID; ?>&number=<?php echo $i; ?>" target="_blank" class="proces-list-view-image lightbox">
  845. <img src="procesy5.php?function_init=fun_SHOW_EXTERNAL_IMAGE&tbl=<?php echo $tbl; ?>&id=<?php echo $vWsk->ID; ?>&number=<?php echo $i; ?>&resize=<?php echo $imgSize; ?>" />
  846. </a>
  847. <?php endfor; ?>
  848. <?php endif; ?>
  849. <?php if ($vWsk->CW_A_HAS_IMAGE > 0) : ?>
  850. <?php $tbl = 'CRM_WSKAZNIK'; ?>
  851. <?php for ($i = 0; $i < $vWsk->CW_A_HAS_IMAGE; $i++) : ?>
  852. <a href="procesy5.php?function_init=fun_SHOW_EXTERNAL_IMAGE&tbl=<?php echo $tbl; ?>&id=<?php echo $vWsk->CW_ID; ?>&number=<?php echo $i; ?>" target="_blank" class="proces-list-view-image lightbox">
  853. <img src="procesy5.php?function_init=fun_SHOW_EXTERNAL_IMAGE&tbl=<?php echo $tbl; ?>&id=<?php echo $vWsk->CW_ID; ?>&number=<?php echo $i; ?>&resize=<?php echo $imgSize; ?>" />
  854. </a>
  855. <?php endfor; ?>
  856. <?php endif; ?>
  857. <strong><?php echo (!empty($vWsk->DESC_PL))? $vWsk->DESC_PL : $vWsk->DESC; ?></strong>
  858. <?php echo (!empty($vWsk->OPIS))? " <em>({$vWsk->OPIS})</em>." : ''; ?>
  859. <?php echo (!empty($vWsk->OPIS_ZASOB))? "<br>{$vWsk->OPIS_ZASOB}" : ''; ?>
  860. <span class="muted">[<?php echo $vWsk->ID; ?>]</span>
  861. </li>
  862. <?php endforeach; ?>
  863. </ul>
  864. </dd>
  865. <?php endif; ?>
  866. </dl>
  867. <?php endif; ?>
  868. <?php if ($vItem->gotoOut) : ?>
  869. <blockquote>
  870. <small>
  871. <?php echo $vItem->gotoOut; ?>
  872. </small>
  873. </blockquote>
  874. <?php endif; ?>
  875. </div>
  876. <?php
  877. }
  878. echo '</div>';// .container
  879. }
  880. function task_PROCES_VIEW() {
  881. User_procesy5_check_access();
  882. $id_proces = V::get('id_proces', '', $_REQUEST, 'int');
  883. if ($id_proces <= 0) {
  884. echo'<p class="err box box-red">'."Wrong ID".'</p>';
  885. return;
  886. }
  887. if (1 != V::get('HIDE_PANEL', 0, $_GET, 'int')) {
  888. // pathway
  889. echo'<h1>'.App::link("Menu", "?task=CRM_MENU");
  890. echo' - ';
  891. echo "Przegladaj proces <b>".$id_proces."</b>";
  892. echo ' ';
  893. echo App::link("drukuj", array('task'=>'PROCES_VIEW', 'id_proces'=>$id_proces, 'HIDE_PANEL'=>1), array('target'=>'_blank', 'ico_after_text'=>'print', 'style'=>'font-size:small;'));
  894. echo ' ';
  895. echo App::link("drukuj większe zdjęcia", array('task'=>'PROCES_VIEW', 'id_proces'=>$id_proces, 'HIDE_PANEL'=>1, 'show_big_img'=>1, 'group_stanowiska'=>1), array('target'=>'_blank', 'ico_after_text'=>'print', 'style'=>'font-size:small;'));
  896. echo ' ';
  897. echo App::link("widok listy", array('task'=>'PROCES_VIEW_LIST', 'id_proces'=>$id_proces), array('style'=>'font-size:small;'));
  898. echo ' ';
  899. echo "<font size=-1><a href=index.php?FUNCTION_INIT=GRAPH_VIEW_PROCES&id_proces={$id_proces} target=blank>Widok mapy</a></font>";
  900. echo'</h1>';
  901. }
  902. $p = DB::get_by_id( 'CRM_PROCES', $id_proces );
  903. if (!$p) {
  904. echo'<p class="err box box-red">'."Process ".$id_proces." not exists".'</p>';
  905. return;
  906. }
  907. $tbl = 'CRM_PROCES';
  908. $clbk = 'tree_callback__show_item_from_'.$tbl;
  909. $tree_params = array();
  910. $tree_params['rozwin'] = true;
  911. $tree_params['editable'] = false;
  912. $tree_params['rozwin_proces'] = true;
  913. $tree_params['filtr_img'] = true;
  914. $tree_params['rozwin_zasoby'] = true;
  915. $tree_params['rozwin_opis'] = true;
  916. $tree_params['style'] = 'NOWY';
  917. action_VIEW_SUBTREE($tbl, $p->ID, $clbk, $tree_params);
  918. }
  919. function task_CRM_WYSWIETL_OBOWIAZKI() {
  920. User_procesy5_check_access();
  921. $_GET['TYPE'] = V::get('TYPE', "%", $_REQUEST);
  922. $_GET['DESC'] = V::get('DESC', "%", $_REQUEST);
  923. $_GET['OPIS'] = V::get('OPIS', "%", $_REQUEST);
  924. $_GET['ADM_AREA'] = V::get('ADM_AREA', "BN%", $_REQUEST);
  925. $_GET['CLZ_ID'] = V::get('CLZ_ID', '', $_REQUEST);
  926. if (!$_GET['CLZ_ID']) {
  927. //echo'<p class="err">'."Brak ID".'</p>';
  928. task_CRM_MENU();
  929. //TEST:// echo App::link_ajax_load_on_ready('user menu', 'task_CRM_MENU');
  930. return;
  931. }
  932. $zasob = DB::get_by_id('CRM_LISTA_ZASOBOW', $_GET['CLZ_ID']);
  933. if (!$zasob) {
  934. echo'<p class="err">'."Brak danych - zasob ".$_GET['CLZ_ID']." nie istnieje.".'</p>';
  935. return;
  936. }
  937. echo'<p>';
  938. echo "Procesy powiazane z zasobem: ";
  939. echo'<b>['.$zasob->ID.']</b>';
  940. echo'<br />';
  941. echo ' <b>'.$zasob->TYPE.'</b>';
  942. echo ' <span>'.$zasob->DESC.'</span>';
  943. echo '<br /><span>'.$zasob->OPIS.'</span>';
  944. echo '<br> <a href=index.php?FUNCTION_INIT=GRAPH_VIEW_PROCES&PROCES_INIT_SCAN=1&id_zasob='.$zasob->ID.'&RESOURCES=1><span>Wyświetl mapę </span>';
  945. echo'</p>';
  946. $db = DB::getDB();
  947. $sql = "select
  948. w.`ID_PROCES` as w__ID_PROCES
  949. , w.`OPIS_ZASOB` as w__OPIS_ZASOB
  950. , p.`ID` as p__ID
  951. , p.`DESC` as p__DESC
  952. , p.`OPIS` as p__OPIS
  953. , p_root.`ID` as p_root__ID
  954. , p_root.`DESC` as p_root__DESC
  955. , p_root.`OPIS` as p_root__OPIS
  956. from `CRM_WSKAZNIK` as w
  957. left join `CRM_PROCES` as p on (p.`ID`=w.`ID_PROCES`)
  958. left join `CRM_PROCES` as p_root on (p_root.`ID`=p.`PARENT_ID`)
  959. where
  960. w.`ID_ZASOB`=".$_GET['CLZ_ID']."
  961. and w.`A_STATUS` in('WAITING','NORMAL')
  962. and p.`A_STATUS` in('WAITING','NORMAL')
  963. order by p.SORT_PRIO
  964. ";
  965. $res = $db->query($sql);
  966. while ($r = $db->fetch($res)) {
  967. $arr [$r->w__ID_PROCES][] = $r;
  968. }
  969. echo'<table border="1" cellspacing="0" cellpadding="0" class="tbl-view">';
  970. echo'<thead>';
  971. echo'<tr>';
  972. echo'<th>'."PROCES ID".'</th>';
  973. echo'<th style="text-align:left">'."NAZWA / OPIS".'</th>';
  974. echo'</tr>';
  975. echo'</thead>';
  976. echo'<tbody>';
  977. $t = 0;
  978. foreach ($arr as $k_id => $v_arr) {
  979. echo'<tr class="row-'.($t = 1 - $t).'">';
  980. echo'<td>';
  981. echo App::link($k_id, array('task'=>"CRM_PROCES", 'filtr_id'=>$k_id));
  982. echo'</td>';
  983. echo'<td>';
  984. foreach ($v_arr as $r) {
  985. echo'<p>';
  986. echo' <b>'.$r->p__DESC.'</b>';
  987. echo'<br />';
  988. echo'<em>'.$r->p__OPIS.'</em>';
  989. if ($r->w__OPIS_ZASOB) echo'<span class="silver">'.$r->w__OPIS_ZASOB.'</span>';
  990. echo'</p>';
  991. }
  992. echo'</td>';
  993. echo'</tr>';
  994. }
  995. echo'</tbody>';
  996. echo'</table>';
  997. }
  998. function task_ADD_PROCES_ID() {
  999. User_procesy5_check_access();
  1000. $id_proces = (isset($_REQUEST['id']))? intval($_REQUEST['id']) : 0;
  1001. //$id_zasob = 0;//(isset($_REQUEST['id']))? intval($_REQUEST['id']) : 0;
  1002. if ($id_proces <= 0) {
  1003. echo'<p class="err">'."Wrong id!".'</p>';
  1004. return;
  1005. }
  1006. $proces = DB::get_by_id( 'CRM_PROCES', $id_proces );
  1007. if (!$proces) {
  1008. echo'<div class="box box-red">';
  1009. echo "Proces [".$id_proces."] not exists.";
  1010. echo'</div>';
  1011. return;
  1012. }
  1013. {// pathway
  1014. echo'<h1>';
  1015. echo App::link("Procesy", array('task'=>"CRM_PROCES"));
  1016. if ($id_proces > 0) {
  1017. echo ' &raquo; '.App::link("Dodaj zasob do procesu [".$id_proces."]", array('task'=>'ADD_PROCES_ID', 'id'=>$id_proces));
  1018. //if ($id_zasob > 0) {
  1019. // echo ' &raquo; '.App::link("Dodaj zasob [".$id_zasob."]", array('task'=>'CRM_ADD_CRM_WSKAZNIK', 'ADD_ID_PROCES'=>$id_proces, 'ADD_ID_ZASOB'=>$id_zasob));
  1020. //}
  1021. }
  1022. echo'</h1>';
  1023. }// pathway
  1024. Lib::loadClass('ProcesHelper');
  1025. {// proces info
  1026. $wsk = ProcesHelper::get_wskazniki( $proces->ID );
  1027. echo'<div class="tree-wrap">';
  1028. echo'<ul>';
  1029. echo'<li class="tree-last">';
  1030. echo'<dl>';
  1031. echo'<dt>';
  1032. if (!empty($wsk)) echo'<div class="has_wsk">';
  1033. echo'<b class="item_id btn-box">'.$proces->ID.'</b>';
  1034. echo'<span class="desc"><b>'.$proces->DESC.'</b>';
  1035. echo'<span class="more-desc"> '.$proces->OPIS.' </span>';
  1036. echo'</span>';
  1037. if (!empty($wsk)) echo'</div>';
  1038. echo'</dt>';
  1039. if (!empty($wsk)) {
  1040. $zasoby_id = array();
  1041. echo'<dd>';
  1042. echo'<ul>';
  1043. $wsk_cnt = count( $wsk );
  1044. foreach ($wsk as $w) {
  1045. $w_parents_out = '';
  1046. $w_title_parents_out = '';
  1047. echo'<li'.((--$wsk_cnt)? '' : ' class="tree-last"').'>';
  1048. echo'<p>';
  1049. echo ' <span class="btn-box btn-box-silver">'.$w->CW_ID.'</span>';
  1050. echo'<span class="green"'.$w_title_parents_out.'>['.$w->ID.']</span>';
  1051. echo' <i title="'.$w->CP_PYTANIE.' '.$w->CP_OPIS.'">'.$w->CP_FORM_TREAT.'</i>';
  1052. echo'';
  1053. echo ' '.$w->TYPE.'';
  1054. echo ' <b>'.$w->DESC.'</b> ';
  1055. //if ($tree->get_param('rozwin_opis'))
  1056. echo ' <span class="green">'.$w->OPIS.'</span>';// opis zasobu
  1057. //if ($tree->get_param('rozwin_opis'))
  1058. echo ' <span style="color:#000;">'.$w->OPIS_ZASOB.'</span>';// komentarz wskaznika
  1059. echo'</p>';
  1060. echo'</li>';
  1061. }
  1062. echo'</ul>';
  1063. }
  1064. echo'</dl>';
  1065. echo'</li>';
  1066. echo'</ul>';
  1067. echo'</div>';// .tree-wrap
  1068. }// proces info
  1069. echo'<form action="" method="GET">';
  1070. echo'<input type="hidden" name="'."task".'" value="'."CRM_ADD_CRM_WSKAZNIK".'" />';
  1071. echo'<input type="hidden" name="'."ADD_ID_PROCES".'" value="'.$proces->ID.'" />';
  1072. echo'<p>'."Podaj numer zasobu: ";
  1073. echo'<input type="text" name="'."ADD_ID_ZASOB".'" value="'."".'" />';
  1074. echo'<input type="submit" value="'."OK".'" />';
  1075. echo '<br />'." lub wyszukaj ponizej:";
  1076. echo'</p>';
  1077. echo'</form>';
  1078. echo'<pre id="tree">';
  1079. echo "DRZEWO ";
  1080. if ($_SESSION['ZWIN_DRZEWO']) {
  1081. echo App::link("ROZWIN", "?ROZWIN_DRZEWO=1&id={$id_proces}#tree");
  1082. } else {
  1083. echo App::link("ZWIN", "?ZWIN_DRZEWO=1&id={$id_proces}#tree");
  1084. }
  1085. echo " / ";
  1086. $js = "window.location.href='#TREE'+this.form.id.value;return false;";
  1087. echo '<form style="display:inline" action="#" method="GET">';
  1088. echo "Zasob ID: ";
  1089. echo'<input type="text" name="id" value="" />';
  1090. echo'<button onclick="'.$js.'">'."Wyszukaj ID".'</button>';
  1091. echo'</form>'."\n";
  1092. tree_listuj_zasoby(0,0,0);
  1093. echo'</pre>';
  1094. }
  1095. function fun_SHOW_EXTERNAL_IMAGE() {
  1096. $remote_table = V::get('tbl', '', $_REQUEST);
  1097. $remote_id = V::get('id', '', $_REQUEST, 'int');
  1098. $number = V::get('number', '', $_REQUEST, 'int');
  1099. $imageResize = V::get('resize', '', $_REQUEST);
  1100. $DBG = (V::get('DBG', 0, $_REQUEST, 'int') > 0);
  1101. if ($remote_id <= 0) {
  1102. header('HTTP/1.1 400: Bad Request');
  1103. header('Warning: wrong ID L.' . __LINE__);
  1104. exit;
  1105. }
  1106. if (!DB_Image::tableIsAllowed($remote_table)) {
  1107. header('HTTP/1.1 400: Bad Request');
  1108. header('Warning: table not allowed L.' . __LINE__);
  1109. exit;
  1110. }
  1111. $image_row = DB_Image::getImage($remote_table, $remote_id, $number);
  1112. if (!$image_row) {
  1113. header('HTTP/1.1 400: Bad Request');
  1114. header('Warning: image not found in db L.' . __LINE__);
  1115. exit;
  1116. }
  1117. $etag = md5($image_row->ID . $image_row->A_CREATE_DATE_TS);
  1118. if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $image_row->A_CREATE_DATE_TS
  1119. || trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
  1120. //header("HTTP/1.1 304 Not Modified");
  1121. //exit;
  1122. }
  1123. $expire_date = mktime(0, 0, 0, date('m') + 3, date('d'), date('Y'));
  1124. $maxWidth = 0;
  1125. $maxHeight = 0;
  1126. if ($imageResize) {
  1127. list($maxWidth, $maxHeight) = explode('x', $imageResize, 2);
  1128. $maxWidth = intval($maxWidth);
  1129. $maxHeight = intval($maxHeight);
  1130. if ($maxWidth <= 0 || $maxHeight <= 0) {
  1131. header('HTTP/1.1 400: Bad Request');
  1132. echo'ERROR wrong param resize (WxH)';
  1133. exit;
  1134. }
  1135. }
  1136. if (!$DBG) {
  1137. header("Content-type: {$image_row->TYPE}");
  1138. header("Cache-control: public");
  1139. header("Pragma: public");// default 'no-cache'
  1140. header("Etag: {$etag}");
  1141. if (!$imageResize) {
  1142. header("Content-length: {$image_row->SIZE}");
  1143. }
  1144. header("Expires: " . gmdate("D, d M Y H:i:s", $expire_date) . " GMT");
  1145. header("Last-Modified: " . gmdate("D, d M Y H:i:s", $image_row->A_CREATE_DATE_TS) . " GMT");
  1146. }
  1147. if ($imageResize) {
  1148. print DB_Image::resizeImageFromBlob($image_row->IMAGE, $image_row->TYPE, $maxWidth, $maxHeight);
  1149. } else {
  1150. print $image_row->IMAGE;
  1151. }
  1152. exit;
  1153. }
  1154. function fun_SHOW_IMAGE() {
  1155. $image_id = V::get('image_id', 0, $_REQUEST, 'int');
  1156. if ($image_id <= 0) {
  1157. header('HTTP/1.1 400: Bad Request');
  1158. header('Warning: wrong id ' . __LINE__);
  1159. exit;
  1160. }
  1161. $image_row = DB_Image::getImageById($image_id);
  1162. if (!$image_row) {
  1163. header('HTTP/1.1 400: Bad Request');
  1164. header('Warning: image not found in db L.' . __LINE__);
  1165. exit;
  1166. }
  1167. header("Content-type: ".$image_row->TYPE);
  1168. header("Content-length: ".$image_row->SIZE);
  1169. print $image_row->IMAGE;
  1170. exit;
  1171. }
  1172. function fun_IMAGE_ADD() {
  1173. $remote_table = V::get('tbl', '', $_REQUEST);
  1174. $remote_id = V::get('id', 0, $_REQUEST, 'int');
  1175. $task = V::get('task', '', $_REQUEST);
  1176. $thiss = new stdClass();
  1177. $thiss->DETECT_TABLE_NAME = $remote_table;
  1178. $errors = array();
  1179. $msgs = array();
  1180. // check remote id
  1181. if ($remote_id <= 0) {
  1182. echo'<p>';
  1183. echo "Error wrong ID";
  1184. echo'<br />';
  1185. //echo App::link();// TODO: link do ???
  1186. echo'</p>';
  1187. return;
  1188. }
  1189. // check remote table
  1190. if (!DB_Image::tableIsAllowed($remote_table)) {
  1191. $errors[] = "Error table not allowed to add image";
  1192. }
  1193. // task
  1194. $task = V::get('task', '', $_REQUEST);
  1195. if ($task == 'REMOVE') {// TODO: przerobic na funkcje, zwrocic msg, pokazac w body
  1196. $req = array();
  1197. $req['ID'] = V::get('ID', '', $_REQUEST, 'int');
  1198. $req['REMOTE_ID'] = V::get('REMOTE_ID', '', $_REQUEST, 'int');
  1199. $req['REMOTE_TABLE'] = V::get('REMOTE_TABLE', '', $_REQUEST);
  1200. // validate
  1201. if ($req['ID'] <= 0) {
  1202. $errors[] = 'error ID';
  1203. }
  1204. if ($req['REMOTE_ID'] <= 0) {
  1205. $errors[] = 'error REMOTE_ID';
  1206. }
  1207. if ($req['REMOTE_TABLE'] != $remote_table) {
  1208. $errors[] = 'error REMOTE_TABLE';
  1209. }
  1210. if (empty($errors)) {
  1211. $affected = DB_Image::deleteImage($req['ID'], $req['REMOTE_TABLE'], $req['REMOTE_ID']);
  1212. if ($affected == 1) {
  1213. $msgs[] = '<p>'."Usunieto zdjecie ID=".$req['ID'].'</p>';
  1214. } else {
  1215. $erros[] = '<p>'."Wystapil blad podczas usuwania zdjecia ID=".$req['ID'].'</p>';
  1216. }
  1217. }
  1218. }
  1219. // check if a file was submitted
  1220. if (!isset($_FILES['userfile'])) {
  1221. //echo '<p>Please select a file</p>';
  1222. }
  1223. else {
  1224. $errors = DB_Image::uploadImage($remote_table, $remote_id, $_FILES['userfile']);
  1225. // give praise and thanks to the php gods
  1226. if (empty($errors)) {
  1227. $msgs[] = '<p>Thank you for submitting</p>';
  1228. } else {
  1229. $msgs[] = '<p style="border:1px solid red;">' . "Sorry, could not upload file:" . '<br />' . implode('<br />', $errors) .'</p>';
  1230. }
  1231. }
  1232. $title = 'Dodaj plik do rekordu ID='.$remote_id.' z tabeli '.$remote_table;
  1233. lay_procesy_gora();
  1234. echo'<h3>'.$title.'</h3>';
  1235. // show masgs
  1236. if (!empty($msgs)) {
  1237. echo'<div class="box box-green">';
  1238. echo implode('<br />', $msgs);
  1239. echo'</div>';
  1240. }
  1241. // show errors
  1242. if (!empty($errors)) {
  1243. echo'<div class="box box-red">';
  1244. echo implode('<br />', $errors);
  1245. echo'</div>';
  1246. echo'<br /><br />'.'<a href="javascript:window.close()">'."Zamknij to okno".'</a>';
  1247. return;
  1248. }
  1249. echo'<div class="box box-silver">';
  1250. echo'<form enctype="multipart/form-data" action="" method="post">';
  1251. echo'<input type="hidden" name="function_init" value="'. __FUNCTION__ .'" />';
  1252. echo'<input type="hidden" name="REMOTE_ID" value="'.$remote_id.'" />';
  1253. echo'<input type="hidden" name="REMOTE_TABLE" value="'.$remote_table.'" />';
  1254. //echo'<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />';
  1255. echo"Rodzaj obrazka: ";
  1256. echo'<input type="text" name="'."DEST".'" value="'."".'" />';
  1257. $select_arr = array();
  1258. $select_arr = DB_Image::conf_get_options($thiss->DETECT_TABLE_NAME);
  1259. if (!empty($select_arr)) {
  1260. echo' ';
  1261. $js = "if(this.selectedIndex>0){this.form.DEST.value=this.value}";
  1262. echo'<select onchange="'.$js.'">';
  1263. echo'<option value="">'."Wybierz".'</option>';
  1264. foreach ($select_arr as $key => $val) {
  1265. echo'<option value="'.$key.'">'.$val.'</option>';
  1266. }
  1267. echo'</select>';
  1268. }
  1269. echo'<br />';
  1270. echo'<input name="userfile" type="file" />';
  1271. echo'<br />';
  1272. echo'<input type="submit" value="'."Dodaj obrazek".'" />';
  1273. echo'</form>';
  1274. echo'</div>';// .box-silver
  1275. // TODO: show images, mv to function {
  1276. $images = DB_Image::getImages($thiss->DETECT_TABLE_NAME, $remote_id);
  1277. echo'<div class="box box-blue" style="overflow:hidden">';
  1278. if (empty($images)) {
  1279. echo'<p class="err">'."Brak obrazkow".'</p>';
  1280. } else {
  1281. echo'<h3>'."Wgrane pliki:".'</h3>';
  1282. foreach ($images as $r) {
  1283. $link_src = '?function_init=fun_SHOW_IMAGE&image_id='.$r->ID.'&HEADER_NOT_INIT=YES';
  1284. $st = array();
  1285. if ($r->WIDTH > 100 || $r->HEIGHT > 100) {
  1286. if ($r->WIDTH > $r->HEIGHT) {
  1287. $st[] = 'width:100px';
  1288. } else {
  1289. $st[] = 'height:100px';
  1290. }
  1291. }
  1292. $st = (empty($st))? '' : ' style="'.implode(';', $st).'"';
  1293. echo'<table style="float:left;border:1px solid silver;">';
  1294. echo'<tr>';
  1295. echo'<td>';
  1296. echo''.$r->NAME.'<br />';
  1297. echo''.$r->DEST.'<br />';
  1298. echo''.$r->A_CREATE_DATE.'<br />';
  1299. echo''.DB_Image::showSize($r->SIZE).' '.$r->WIDTH.'x'.$r->HEIGHT.'<br />';
  1300. echo'<img src="'.$link_src.'" '.$st.'/>';
  1301. echo'</td>';
  1302. echo'</tr>';
  1303. echo'<tr>';
  1304. echo'<td style="text-align:center;">';
  1305. echo'<form action="" method="post" style="display:inline">';
  1306. echo'<input type="hidden" name="task" value="'."REMOVE".'" />';
  1307. echo'<input type="hidden" name="ID" value="'.$r->ID.'" />';
  1308. echo'<input type="hidden" name="REMOTE_ID" value="'.$remote_id.'" />';
  1309. echo'<input type="hidden" name="REMOTE_TABLE" value="'.$remote_table.'" />';
  1310. $js = "if(!confirm('Czy na pewno chcesz usunac obrazek?')) return false;";
  1311. echo'<input type="submit" value="Usun" onclick="'.$js.'" />';
  1312. echo'</form>';
  1313. if (0) {// TODO: edytuj
  1314. echo'<form action="" method="post" style="display:inline">';
  1315. echo'<input type="hidden" name="task" value="'."EDIT".'" />';
  1316. echo'<input type="hidden" name="ID" value="'.$r->ID.'" />';
  1317. echo'<input type="hidden" name="REMOTE_ID" value="'.$remote_id.'" />';
  1318. echo'<input type="hidden" name="REMOTE_TABLE" value="'.$remote_table.'" />';
  1319. echo'<input type="submit" value="Edytuj" />';
  1320. echo'</form>';
  1321. }
  1322. echo'</td>';
  1323. echo'</tr>';
  1324. echo'</table>';
  1325. }
  1326. }
  1327. echo'</div>';// .box-blue
  1328. // } function show images
  1329. echo'<br /><br />'.'<a href="javascript:window.close()">'."Zamknij to okno".'</a>';
  1330. die("\n".'<!-- EOF L.' . __LINE__ . ' -->');
  1331. }
  1332. // http://se.dev.webone.pl/se-dev/procesy5.php?function_init=fun_SHOW_VIDEO&id=2314&task=CRM_PROCES
  1333. function fun_SHOW_VIDEO() {
  1334. $zasob_id = V::get('id', '', $_GET);
  1335. $zasob = DB::get_by_id('CRM_LISTA_ZASOBOW', $zasob_id);
  1336. if ($zasob->TYPE != 'PLIK') {
  1337. die('Wrong type!');
  1338. }
  1339. $movie_ext = array('avi', 'mov', 'm4v');
  1340. if (!in_array(end(explode('.', $zasob->DESC)), $movie_ext)) {
  1341. die('Wrong file name!');
  1342. }
  1343. $zasob_parent = DB::get_by_id('CRM_LISTA_ZASOBOW', $zasob->PARENT_ID);
  1344. if (!$zasob_parent) {
  1345. die('Parent not exists!');
  1346. }
  1347. $zasob_parent2 = DB::get_by_id('CRM_LISTA_ZASOBOW', $zasob_parent->PARENT_ID);
  1348. if (!$zasob_parent2) {
  1349. die('Parent2 not exists!');
  1350. }
  1351. echo'<p>'."[".$zasob->ID."] ".'<i>'.$zasob->TYPE.'</i> '.$zasob->DESC.'</p>';
  1352. echo'<p>'."[".$zasob_parent->ID."] ".'<i>'.$zasob_parent->TYPE.'</i> '.$zasob_parent->DESC.'</p>';
  1353. echo'<p>'."[".$zasob_parent2->ID."] ".'<i>'.$zasob_parent2->TYPE.'</i> '.$zasob_parent2->DESC.'</p>';
  1354. exit;
  1355. }
  1356. // ======== TREE =========
  1357. DEBUG_S(5,'SES.USER_PARAMS', $_SESSION['USER_PARAMS'], __FILE__, __FUNCTION__, __LINE__);
  1358. DEBUG_S(6,'SES', $_SESSION, __FILE__, __FUNCTION__, __LINE__);
  1359. DEBUG_S(6,'SRV', $_SERVER, __FILE__, __FUNCTION__, __LINE__);
  1360. echo'<br>.';
  1361. lay_procesy_dol();
  1362. function lay_procesy_dol() {
  1363. if (1 == V::get('HIDE_PANEL', 0, $_REQUEST, 'int')) {
  1364. return;
  1365. }
  1366. SE_Layout::dol();
  1367. }
  1368. function lay_procesy_user_panel() {
  1369. //echo 'ST-"'.ini_get('session.gc_maxlifetime').'", req_time="'.date('H:i:s').'", end_time="'.date('H:i:s', time() + ini_get('session.gc_maxlifetime')).'", ID="'.session_id().'"<br />'."\n";
  1370. if (!V::get('SHOW_PANEL', '', $_SESSION['USER_PARAMS'])) {
  1371. // return;
  1372. }
  1373. if (1 == V::get('HIDE_PANEL', 0, $_REQUEST, 'int')) {
  1374. return;
  1375. }
  1376. Lib::loadClass('SE_Layout');
  1377. SE_Layout::menu();
  1378. return;
  1379. echo "\n".'<div id="GORA">'."\n";
  1380. echo'<table cellspacing="0" cellpadding="0" style="width:100%"><tbody>';
  1381. echo'<tr>';
  1382. echo '<th class="logo" style="width:5%; white-space:nowrap;">';
  1383. echo '<a href="index.php">SE</a>';
  1384. echo ' / ';
  1385. echo App::link("ODSWIEZ", '');
  1386. echo'</th>';
  1387. echo'<td class="main-menu">';// center
  1388. $menu = array();
  1389. /*
  1390. * ADM_ADMIN_LEVEL = 6;
  1391. * A_STATUS = 'WAITING';
  1392. * ADM_ACCOUNT = 'Kandydat';
  1393. * ADM_AREA = 'KANDYDAT';
  1394. * ADM_ADMIN_DESC = 'Kandydat';
  1395. */
  1396. if (User::get('ADM_ADMIN_LEVEL') == 6) {
  1397. $menu ['CRM_TESTY'] = array("TESTY", "?task=CRM_TESTY", array('title'=>'Wyswietlenie testów'));
  1398. } else {
  1399. $menu ['CRM_PROCES'] = array("PROCESY", array('task'=>'CRM_PROCES'), array('title'=>'Wyswietlenie procesow'));
  1400. $menu ['CRM_LISTA_ZASOBOW'] = array("ZASOBY", "?task=CRM_LISTA_ZASOBOW", array('title'=>'Wyswietlenie zasobow'));
  1401. $menu ['CRM_WYSWIETL_OBOWIAZKI'] = array("OBOWIAZKI", "?task=CRM_WYSWIETL_OBOWIAZKI", array('title'=>'Wyswietlenie OBOWIAZKOW'));
  1402. $menu ['CRM_TESTY'] = array("TESTY", "?task=CRM_TESTY", array('title'=>'Wyswietlenie testów'));
  1403. if (User::hasAccess('testy_wyniki_read')) {
  1404. $menu ['CRM_TESTY_WYNIKI'] = array("WYNIKI", "?task=CRM_TESTY_WYNIKI", array('title'=>'Wyswietlenie wyników testów'));
  1405. }
  1406. $menu ['USERS'] = array("KONTAKTY", "?task=USERS", array('title'=>'Kontakty'));
  1407. }
  1408. foreach ($menu as $k_task => $v_menu) {
  1409. if ($k_task == App::get_task()) $v_menu[2] ['class'] = 'current';
  1410. echo App::link($v_menu[0], $v_menu[1], $v_menu[2]);
  1411. }
  1412. echo'</td>'."\n";
  1413. echo'<td class="user" style="text-align:right">'."\n";
  1414. {
  1415. $q = V::get('q', '', $_REQUEST);
  1416. echo '<form action="' . "?task=CRM_SEARCH" . '" method="post" class="panel-search">';
  1417. //echo '<input type="hidden" name="task" value="CRM_SEARCH" />';
  1418. echo '<input type="text" name="q" value="' . htmlspecialchars($q) . '" class="q" />';
  1419. echo '<input type="image" src="icon/search.png" class="s" />';
  1420. echo '</form>';
  1421. echo' | ';
  1422. }
  1423. S::show_session_timer();
  1424. //echo'<a href="?function_init=SCREEN">Ekran</a> | ';
  1425. if (V::get('DEBUG', '', $_SESSION)) {
  1426. echo'<b title="'.$_SESSION['DEBUG'].'">DBG('.$_SESSION['DEBUG'].')</b>';
  1427. $js = "if(jQuery(document.body).hasClass('show-DEBUG_S')){jQuery(document.body).removeClass('show-DEBUG_S');this.innerHTML='+';}else{jQuery(document.body).addClass('show-DEBUG_S');this.innerHTML='-'};return false;";
  1428. echo ' <a href="#" onclick="' . $js . '">' . "+" . '</a>';
  1429. echo' | ';
  1430. }
  1431. echo App::link($_SESSION['AUTHORIZE_USER'], array('task'=>"USER"), array('title'=>$_SESSION['ADM_ACCOUNT']));
  1432. echo' | '.User::get('ADM_ADMIN_LEVEL').'';
  1433. echo' | ';
  1434. echo App::link("Wyloguj", "?LOGIN=LOGOUT");
  1435. echo'</td>';
  1436. echo'</tr></tbody></table>';
  1437. echo "\n".'</div>'."\n";// #GORA
  1438. }
  1439. function lay_procesy_css() {
  1440. echo'<style type="text/css">';
  1441. echo"
  1442. body { margin:0; font-size:small; }
  1443. #body_content { padding:10px; }
  1444. #body_content h1{ margin:13px 0;color:#000; }
  1445. #body_content h1 a{ color:#C53000; }
  1446. .err{color:#f00;}
  1447. p {margin:6px 0;}
  1448. li p {margin:3px 0;}
  1449. .panel-search {display:inline; margin:0; padding:0;}
  1450. .panel-search .q {margin:0 2px; padding:0 5px; border:0; background:#eee;}
  1451. .panel-search .s {margin:0 2px; padding:0; border:0; vertical-align:bottom;}
  1452. .tbl-view th,
  1453. .tbl-view td {font-size:small;border-color:#eee;padding:0 1px;}
  1454. .tbl-view thead th,
  1455. .tbl-view thead td {background:#f3f3f3;}
  1456. .tbl-view tbody tr:hover td {background:#E6FFE6;}
  1457. .tbl-view tbody tr.row-0 {background:#f3f3f3;}
  1458. .tbl-view tbody tr.row-1 {background:#fff;}
  1459. .tbl-view tbody th {text-align:center;}
  1460. .tbl-view tbody td {padding:0 2px;}
  1461. .tbl-view form {margin:0;padding:0;}
  1462. .tbl-view .find th,
  1463. .tbl-view .find td,
  1464. .tbl-view tfoot th,
  1465. .tbl-view tfoot td {background:#E3E3E3;}
  1466. .tbl-view .i {margin:0;padding:0;border:1px solid #999;}
  1467. .tbl-view .add td .i,
  1468. .tbl-view .find td .i {width:100%;}
  1469. .tbl-view .find td.selected {border-bottom:2px solid #FF0000;}
  1470. .tbl-wsk-view{border-collapse:separate;border:1px solid #fff;}
  1471. .tbl-wsk-view th,
  1472. .tbl-wsk-view td{padding:0px;border-spacing:1px;background:#E6FFE6;font-size:small;border:1px solid #008000;}
  1473. .tree-wrap dd .tbl-wsk-view{margin:0 0 0 10px;}
  1474. .tree-wrap .tbl-wsk-view .btn-box{margin:0;}
  1475. .tree-wrap .wsk-cell{background:#fff;padding:2px;}
  1476. #GORA {margin:0;padding:0;background:#000;color:#fff;border-bottom:2px solid #969696;overflow:hidden;}
  1477. /*
  1478. #GORA {position:fixed;top:0;left:0;width:100%;}
  1479. */
  1480. #GORA a {margin:0;padding:0px;color:#fff;text-decoration:none;font-size:12px;}
  1481. #GORA a:hover {text-decoration:underline;}
  1482. #GORA th, #GORA td {color:#fff;font-size:12px;}
  1483. #GORA th.logo {padding:2px 3px;background:#C53000;}
  1484. #GORA td.user {padding:2px 3px;}
  1485. #GORA .main-menu {}
  1486. #GORA .main-menu {margin:0;padding:0;list-style:none;}
  1487. #GORA .main-menu li {margin:0;padding:0;display:inline;}
  1488. #GORA .main-menu a {display:block;float:left;margin:0;padding:4px;text-decoration:none;border-top:3px solid #000;font-size:12px;font-weight:bold;font-family:arial;}
  1489. #GORA .main-menu a:hover {border-color:#C53000;text-decoration:none;background:#555;}
  1490. #GORA .main-menu a.current {border-color:#C53000;}
  1491. #GORA .main-menu a.last {border-top:2px solid #C53000;}
  1492. fieldset.main { border:1px solid #000; }
  1493. fieldset.main, fieldset.main legend { background-color:#eee; }
  1494. fieldset.main legend { padding:0 5px; border:1px solid #000; }
  1495. p.sql-msg { color:green; }
  1496. p.sql-msg-err { color:red; }
  1497. tr.add { background-color:#eee; }
  1498. tr.edit { background-color:#ffa; }
  1499. a.external {padding:0 13px 0 0;background: url(icon/external.png) center right no-repeat;}
  1500. a.btn-p5 {background:#eee;color:#000;text-decoration:none;font-weight:bold;padding:0 3px;border:1px solid #666;white-space:nowrap;}
  1501. a.btn-p5:hover {background:#eee;color:#00f;}
  1502. a.btn-clean {background:#fff;color:#00f;text-decoration:none;font-weight:bold;padding:0;border:none;}
  1503. a.btn-clean:hover {background:#fff;color:#f00;}
  1504. a.btn-sm {font-size:x-small;}
  1505. .P_ID {color:#f00;}
  1506. .P_ID_ACCESS {color:#0E7E0E;}
  1507. .P_ID_MAP {color:#A020F0;}
  1508. .ALIAS_ID {color:#FF6900;}
  1509. .red{color:#f00;}
  1510. .green{color:#008000;}
  1511. .blue{color:#00f;}
  1512. .silver{color:#666;}
  1513. .box{border:1px solid #999;padding:5px;margin:5px;}
  1514. .box-center{border:1px solid #999;padding:5px;margin:5px auto;}
  1515. .box-silver{border-color:#999;}
  1516. .box-red{border-color:#f00;}
  1517. .box-blue{border-color:#00f;}
  1518. .box-green{border-color:#008000;}
  1519. .box-hover-active{background:#fff;border-color:#999;}
  1520. .box-hover-active:hover{background:#eee;border-color:#000;}
  1521. .cmnt {color:#eee;}
  1522. .cmnt-small {font-size:small;color:#eee;}
  1523. #body_content .pathway{margin:0 0 10px 0;padding:3px 8px;border:1px solid #aaa;font-size:medium;font-weight:bold;background-color:#efefef;}
  1524. #body_content .pathway a{text-decoration:none;}
  1525. #body_content .pathway a:hover{text-decoration:underline;}
  1526. .flexigrid{font-size:small;}
  1527. .flexigrid td,
  1528. .flexigrid th{font-size:small;}
  1529. .flexigrid .tDiv .add { background:url(stuff/i/add.png) no-repeat center left; }
  1530. .flexigrid .tDiv .delete { background:url(stuff/i/del.png) no-repeat center left; }
  1531. .flexigrid .tDiv .edit { background:url(stuff/i/edit.gif) no-repeat center left; }
  1532. .filters{margin:0;padding:2px;background:#F0F0F0 url(./stuff/flexigrid/css/images/bg.gif) repeat-x top;border:1px solid #ccc;border-style:solid solid none solid;clear:both;overflow:hidden;}
  1533. .filters {font-size:13px; line-height:16px;}
  1534. .filters input {font-size:13px; line-height:16px;}
  1535. .filters .btnseparator{float:left;height:22px;border-left:1px solid #CCC;border-right:1px solid #fff;margin:1px;}
  1536. .filters form{margin:0;padding:0;}
  1537. .filters nobr{display:block;float:left;margin:0;padding:2px;font-weight:normal;font-size:13px;}
  1538. .filters nobr:hover{text-decoration:underline;}
  1539. .filters nobr.active{color:#f00;font-weight:normal;}
  1540. .filters nobr input,
  1541. .filters nobr select,
  1542. .filters nobr button{margin:0 1px;padding:0 2px;font-size:13px;}
  1543. .btn-box{margin:0 2px 0 0;padding:0 3px;background:#bbb;color:#fff;text-decoration:none;border:0;font-weight:bold;}
  1544. .btn-box-blue{background:#3A3AFF;color:#fff;}
  1545. .btn-box-green{background:#008A00;color:#fff;}
  1546. .btn-box-lgreen{background:#97CF97;color:#fff;}
  1547. .btn-box-red{background:#FF4646;color:#fff;}
  1548. .btn-box-group1{background-color:#9F9FCB;color:#fff;}
  1549. .btn-box-group2{background-color:#B8B879;color:#fff;}
  1550. /*.tree-wrap .btn-p5{border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;}*/
  1551. /*.btn-box{border-radius:3px;-webkit-border-radius:3px;-moz-border-radius:3px;}*/
  1552. .user-menu-tree {color:#666;font-weight:normal;}
  1553. .user-menu-PROCES_INIT {color:#f00;font-weight:bold;}
  1554. ";
  1555. echo'</style>' . "\n";
  1556. }
  1557. function tree_callback__show_item_from_CRM_PROCES( &$r, &$tree ) {
  1558. // $dbg=debug_backtrace();
  1559. // DEBUG_S(-3,'backtrace',$dbg);
  1560. $db = DB::getDB();
  1561. $wsk = array();
  1562. Lib::loadClass('ProcesHelper');
  1563. $tree->log('show item - start');
  1564. if ($tree->get_param('rozwin_proces')) {
  1565. $wsk = ProcesHelper::get_wskazniki($r->ID);
  1566. $tree->log('show item -> get_wskazniki', array('get_wskazniki'));
  1567. foreach ($wsk as $idx => $w) $wsk[$idx]->ACL_TYPE = in_array($w->TYPE, ['STANOWISKO', 'DZIAL', 'PODMIOT']) ? 'GROUP' : '';
  1568. // UI::table([ 'rows' => array_map(function ($w) {
  1569. // unset($w->path);
  1570. // unset($w->OPIS);
  1571. // return (array)$w;
  1572. // }, $wsk) ]);
  1573. $fixedWskList = array();
  1574. foreach ($wsk as $w) {
  1575. if ('GROUP' == $w->ACL_TYPE) $fixedWskList[] = $w;
  1576. }
  1577. if ('PROCES_INIT' == $r->TYPE) {// fetch INHERIT acl groups
  1578. $idGroups = array_reduce($wsk, function ($carry, $w) {
  1579. if ('GROUP' != $w->ACL_TYPE) return $carry;
  1580. return (!empty($carry)) ? "{$carry},{$w->ID}" : $w->ID;
  1581. }, "");
  1582. $sqlFilterIdGroups = (!empty($idGroups)) ? " and gp.ID_GROUP not in({$idGroups})" : "";
  1583. foreach (DB::getPDO()->fetchAll("select z.ID
  1584. , z.PARENT_ID
  1585. , z.`TYPE`
  1586. , z.`DESC`
  1587. , 'INHERIT' as ACL_TYPE
  1588. from CRM_PROCES_idx_GROUP_to_PROCES gp
  1589. join CRM_LISTA_ZASOBOW z on(z.ID = gp.ID_GROUP)
  1590. where gp.ID_PROCES = {$r->ID}
  1591. {$sqlFilterIdGroups}
  1592. ") as $aclW) {
  1593. $fixedWskList[] = (object)$aclW;
  1594. }
  1595. }
  1596. foreach ($wsk as $w) {
  1597. if ('GROUP' != $w->ACL_TYPE) $fixedWskList[] = $w;
  1598. }
  1599. $wsk = $fixedWskList;
  1600. $tree->log('show item -> get_wskazniki inherit', array('get_wskazniki'));
  1601. }
  1602. $pytania = array();
  1603. $tblPytaniaId = $tree->get_param('PytaniaTblId');
  1604. if ($tree->get_param('editable') && $tree->get_param('HasAclPytaniaTbl')) {
  1605. $userAcl = User::getAcl();
  1606. $tblAcl = $userAcl->getTableAcl($tblPytaniaId);
  1607. $dataSource = $tblAcl->getDataSource();
  1608. $params = array();
  1609. $params['f_ID_PROCES'] = $r->ID;
  1610. $pytania = $dataSource->getItems($params);
  1611. $tree->log('show item -> fetch-pytania', array('fetch-pytania'));
  1612. }
  1613. $show_form = ($tree->get_param('show_form_at_item') == $r->ID);
  1614. $show_form = ($tree->get_param('show_form_at_item') > 0);// TODO: RMME
  1615. $cls = array();
  1616. if (($search_id = $tree->get_param('search_id')) > 0 && $search_id == $r->ID) {
  1617. $cls[] = 'search_id';
  1618. }
  1619. $cls = (!empty($cls))? ' class="'.implode(' ', $cls).'"' : '';
  1620. echo '<dl'.$cls.'>';
  1621. echo '<dt>';
  1622. if (!empty($wsk)) echo'<div class="has_wsk">';
  1623. $out_id = ($r->ID < 10)? '&nbsp;'.$r->ID.'' : $r->ID;
  1624. $proces_type_css_class = null;
  1625. if ($r->TYPE == 'PROCES_INIT') {
  1626. $proces_type_css_class = 'red';
  1627. } else if ($r->TYPE == 'PROCES_GROUP_1') {
  1628. $proces_type_css_class = 'group1';
  1629. } else if ($r->TYPE == 'PROCES_GROUP_2') {
  1630. $proces_type_css_class = 'group2';
  1631. }
  1632. $cls = array();
  1633. $cls[] = 'item_id';
  1634. $cls[] = 'btn-box';
  1635. if ($proces_type_css_class) $cls[] = 'btn-box-'.$proces_type_css_class;
  1636. echo App::link($out_id, array('task'=>"CRM_PROCES", 'filtr_id'=>$r->ID, '#'=>'TREE'.$r->ID), array('class'=>implode(' ', $cls)));
  1637. //if($r->TYPE == 'PROCES_INIT') {
  1638. $tree->log('show item -> fetch-IF_TRUE_GOTO start');
  1639. $gotoList = ProcesHelper::getGoToProces($r->ID);
  1640. foreach ($gotoList as $gotoId => $gotoFlag) {
  1641. $popupIcon = 'glyphicon glyphicon-chevron-left';
  1642. $popupLink = "procesy5.php?task=PROCES_VIEW&id_proces={$gotoId}";
  1643. $popupTitle = "GOTO";
  1644. $popupContent = "{$gotoId} {$gotoFlag} {$r->ID}";
  1645. $linkStyle = '';
  1646. if ('popover' == $linkStyle) {
  1647. ?>
  1648. <a href="<?php echo $popupLink; ?>"><i class="<?php echo $popupIcon; ?> wsk-help popover-with-html">
  1649. <span class="popover-heading"><?php echo $popupTitle; ?></span>
  1650. <span class="popover-body"><?php echo $popupContent; ?></span>
  1651. </i><?php echo $gotoId; ?></a>
  1652. <?php
  1653. } else {
  1654. echo ' ';
  1655. echo App::link("&lt;{$gotoId}", array('task'=>'PROCES_VIEW', 'id_proces'=>$gotoId), array('title'=>$popupContent));
  1656. echo ' ';
  1657. }
  1658. }
  1659. $tree->log('show item -> fetch-IF_TRUE_GOTO', array('fetch-IF_TRUE_GOTO'));
  1660. //}
  1661. //echo App::link("&#9873;", array('task'=>"CRM_PROCES", 'filtr_id'=>$r->ID, '#'=>'TREE'.$r->ID), array('class'=>''));
  1662. //echo App::link("&#9872;", array('task'=>"CRM_PROCES", 'filtr_id'=>$r->ID, '#'=>'TREE'.$r->ID), array('class'=>''));
  1663. if ($tree->get_param('editable')) {
  1664. //echo'('.$r->SORT_PRIO.')';//TODO: DBG
  1665. echo App::link("<b>^</b>", array('task'=>'CRM_PROCES', 'function_init'=>'SORT_PRIO_PROCES', 'arg1'=>$r->ID, 'arg1_val'=>'upup','#'=>'TREE'.$r->ID), array('class'=>"btn-clean", 'title'=>"w gore o 5 pol"));
  1666. echo App::link("^", array('task'=>'CRM_PROCES', 'function_init'=>'SORT_PRIO_PROCES', 'arg1'=>$r->ID, 'arg1_val'=>'up','#'=>'TREE'.$r->ID), array('class'=>"btn-clean", 'title'=>"w gore"));
  1667. echo App::link("v", array('task'=>'CRM_PROCES', 'function_init'=>'SORT_PRIO_PROCES', 'arg1'=>$r->ID, 'arg1_val'=>'dw','#'=>'TREE'.$r->ID), array('class'=>"btn-clean", 'title'=>"w dol"));
  1668. echo App::link("V", array('task'=>'CRM_PROCES', 'function_init'=>'SORT_PRIO_PROCES', 'arg1'=>$r->ID, 'arg1_val'=>'downdown','#'=>'TREE'.$r->ID), array('class'=>"btn-clean", 'title'=>"w dol o 5 pol"));
  1669. echo' ';
  1670. if ($tree->get_param('ProcesTblId') > 0) {
  1671. // rem@2016-08 sqix link do nowy edytor:
  1672. if($r->TYPE == 'PROCES_INIT') {
  1673. echo App::link("E", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('ProcesTblId')."#EDIT/".$r->ID, array('title'=>'Edytuj', 'class'=>'btn-p5'));
  1674. echo App::link("e", "index.php?_route=UrlAction_ProcesEditor&id=".$r->ID, array('title'=>'Edytuj', 'class'=>'btn-p5'));
  1675. } else {
  1676. echo App::link("E", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('ProcesTblId')."#EDIT/".$r->ID, array('title'=>'Edytuj', 'class'=>'btn-p5'));
  1677. }
  1678. }
  1679. else {
  1680. echo App::link("E", array('task'=>"CRM_PROCES", 'EDIT'=>$r->ID), array('title'=>'Edytuj', 'class'=>'btn-p5'));
  1681. }
  1682. if ($tree->get_param('ProcesTblId') > 0) {
  1683. echo App::link("F", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('ProcesTblId')."#FILES/".$r->ID, array('title'=>'Pliki', 'class'=>'btn-p5'));
  1684. }
  1685. if (!in_array($r->TYPE, array('PROCES_GROUP_1', 'PROCES_GROUP_2'))) {
  1686. if (!$r->TEST_PYTANIE) {
  1687. echo App::link("P+", array('task'=>"CRM_TESTY_ADD_PYTANIA", 'id_proces'=>$r->ID), array('title'=>'Dodaj pytanie do testow', 'class'=>'btn-p5 btn-red'));
  1688. } else {
  1689. echo App::link("P+", array('task'=>"CRM_TESTY_ADD_PYTANIA", 'id_proces'=>$r->ID), array('title'=>'Dodaj pytanie do testow', 'class'=>'btn-p5'));
  1690. if (!empty($pytania)) {
  1691. foreach ($pytania as $pytanie) {
  1692. if ($tree->get_param('rozwin_proces') && $pytanie->ID_WSKAZNIK != 0) {
  1693. continue;
  1694. }
  1695. $odpowiedzi = array();
  1696. for ($i = 0; $i < 5; $i++) {
  1697. $fldTxt = "ODP_{$i}";
  1698. $fldOdp = "ODP_{$i}_ODP";
  1699. if (!empty($pytanie->{$fldTxt})) {
  1700. if ($pytanie->{$fldOdp} == 'TAK') {
  1701. $odpowiedzi[] = '<span class="text-success">' . htmlspecialchars($pytanie->{$fldTxt}) . '</span>';
  1702. } else {
  1703. $odpowiedzi[] = '<span class="text-error">' . htmlspecialchars($pytanie->{$fldTxt}) . '</span>';
  1704. }
  1705. }
  1706. }
  1707. $popupIcon = ($pytanie->TEST_TYPE=='TEORETYCZNY')? 'glyphicon glyphicon-question-sign' : 'glyphicon glyphicon-exclamation-sign';
  1708. $popupLink = "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID={$tblPytaniaId}&task=CRM_PROCES#EDIT/{$pytanie->ID}";// TODO: add rand _hash?
  1709. $popupTitle = "#{$pytanie->ID} " . htmlspecialchars($pytanie->PYTANIE);
  1710. $popupContent = implode('<hr style="margin:0.5em 0;">', $odpowiedzi);
  1711. ?>
  1712. <a target="_blank" href="<?php echo $popupLink; ?>"><i class="<?php echo $popupIcon; ?> wsk-help popover-with-html">
  1713. <span class="popover-heading"><?php echo $popupTitle; ?></span>
  1714. <span class="popover-body"><?php echo $popupContent; ?></span>
  1715. </i></a>
  1716. <?php
  1717. }
  1718. }
  1719. }
  1720. }
  1721. }
  1722. $bold = false;
  1723. if ((!empty($_GET['arg1']) && $_GET['arg1'] == $r->ID)
  1724. || (!empty($_GET['EDIT']) && $_GET['EDIT'] == $r->ID)
  1725. ) {
  1726. $bold = true;
  1727. }
  1728. //if ($bold) echo "***";
  1729. if ($r->IF_TRUE_GOTO > 0) {
  1730. $tree->log('show item -> fetch-proces_flag - start');
  1731. $link_out = ProcesHelper::proces_flag($r->ID, $r->IF_TRUE_GOTO, $r->IF_TRUE_GOTO_FLAG);
  1732. $tree->log('show item -> fetch-proces_flag', array('fetch-proces_flag'));
  1733. echo App::link($link_out, "#TREE".$r->IF_TRUE_GOTO, array('onclick'=>"return scrollToProces('".$r->IF_TRUE_GOTO."');", 'title'=>$r->IF_TRUE_GOTO_FLAG." ".$r->IF_TRUE_GOTO, 'class'=>'btn-p5'));
  1734. echo "<a href=procesy5.php?task=PROCES_VIEW&id_proces=".$r->IF_TRUE_GOTO.">&gt;&gt;</a>";
  1735. if (empty($r->DESC)) {
  1736. $sql = "select `DESC`,`OPIS` from CRM_PROCES where ID='".$r->IF_TRUE_GOTO."' limit 1";
  1737. $rs = DB::query($sql);
  1738. while ($h = DB::fetch($rs)) {
  1739. echo "<font color=grey><b>".$h->DESC."</b>";
  1740. if ($tree->get_param('rozwin_opis') && $h->OPIS) echo ' '.$h->OPIS;
  1741. echo "</font>";
  1742. }
  1743. }
  1744. }
  1745. if ($r->has_childrens) {
  1746. if (!$tree->get_param('rozwin')) {
  1747. $js = "return " . $tree->js_tree_open_rec_fun . "(this," . $r->ID . ");";
  1748. //echo'<a class="open-rec" href="#" onclick="'.$js.'">'."L".'</a>';
  1749. echo App::link("L", '#', array('title'=>'Rozwin wszystko', 'class'=>'btn-p5 open-rec', 'onclick'=>$js));
  1750. }
  1751. }
  1752. echo'<span class="desc">';
  1753. $cls = ($proces_type_css_class)? ' class="desc-'.$proces_type_css_class.'"' : '';
  1754. echo'<b'.$cls.'>'.$r->DESC.'</b>';
  1755. {// status ico
  1756. if ($r->TYPE == 'PROCES_INIT') {
  1757. $status_ico = ($r->A_STATUS == 'NORMAL')? "icon/status-ok.gif" : "icon/status-notok.gif";
  1758. echo'<img src="'.$status_ico.'" alt="'.$r->A_STATUS.'" width="16" title="'."Status: ".$r->A_STATUS." ".$r->L_APPOITMENT_DATE.'" style="vertical-align:middle;cursor:help" />';
  1759. echo "<a href=?task=PROCES_VIEW&id_proces=".$r->ID."&HIDE_PANEL=0&show_big_img=1&group_stanowiska=1>P</a>";
  1760. echo "<a href=?task=PROCES_VIEW_LIST&id_proces=".$r->ID."&HIDE_PANEL=0&show_big_img=1&group_stanowiska=1>L</a>";
  1761. echo "<a href=index.php?FUNCTION_INIT=GRAPH_VIEW_PROCES&id_proces={$r->ID} target=blank>M</a>";
  1762. } else {
  1763. if ( strstr($r->TYPE,'PROCES_GROUP')) {
  1764. echo "&nbsp;<a href=?task=PROCES_VIEW_LIST&id_proces=".$r->ID."&HIDE_PANEL=0&show_big_img=1&group_stanowiska=1>L</a>";
  1765. echo " <a href=index.php?FUNCTION_INIT=GRAPH_VIEW_PROCES&id_proces={$r->ID}&PROCES_INIT_SCAN=1 target=blank>M</a>";
  1766. }
  1767. }
  1768. }
  1769. //if ($bold) echo "***";
  1770. if ($tree->get_param('editable')) { echo App::link("Z+", "index.php?MENU_INIT=PROCES_ADD_ZASOB&procesID=".$r->ID, array('title'=>'Dodaj', 'class'=>'btn-p5'));
  1771. echo App::link("↵+", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('ProcesTblId')."&ff_PARENT_ID=".$r->ID."#CREATE", array('class'=>'btn-p5', 'title'=>'Dodaj dziecko', 'onclick'=>null));
  1772. }
  1773. $opis_before = ''; $opis_after = '';
  1774. $tbl = 'CRM_PROCES';
  1775. if ($tree->get_param('filtr_img')) {
  1776. if ($r->A_HAS_IMAGE) {
  1777. echo'<br />';
  1778. $imgSize = (V::get('show_big_img', '', $_GET))? '600x600' : '200x200';
  1779. for ($i = 0; $i < $r->A_HAS_IMAGE; $i++) {
  1780. $opis_before .= '<a href="'."?function_init=fun_SHOW_EXTERNAL_IMAGE&tbl=".$tbl."&id=".$r->ID."&number=".$i.'" target="_blank" class="lightbox">';
  1781. $opis_before .= '<img src="'."?function_init=fun_SHOW_EXTERNAL_IMAGE&tbl=".$tbl."&id=".$r->ID."&number=".$i."&resize={$imgSize}".'" style="float:left" />';
  1782. $opis_before .= '</a>';
  1783. }
  1784. }
  1785. if ($opis_before != '') $opis_after = '<br style="clear:both"/>';
  1786. }
  1787. echo' <span class="more-desc">';
  1788. echo $opis_before;
  1789. if ($tree->get_param('rozwin_opis') && $r->OPIS) {
  1790. echo ' '.$r->OPIS;
  1791. }
  1792. else if (!empty($r->OPIS)) {
  1793. ?>
  1794. <i class="glyphicon glyphicon-info-sign wsk-help popover-with-html">
  1795. <span class="popover-heading"><?php echo "[{$r->ID}] " . $r->DESC; ?></span>
  1796. <span class="popover-body"><?php echo $r->OPIS; ?></span>
  1797. </i>
  1798. <?php
  1799. }
  1800. echo $opis_after;
  1801. echo '</span>';
  1802. echo'</span>';
  1803. $tbl = 'CRM_PROCES';
  1804. if ($tree->get_param('filtr_img')) {
  1805. if ($r->A_HAS_IMAGE || $tree->get_param('editable')) {
  1806. echo' <span class="external-ids">{';
  1807. for ($i = 0; $i < $r->A_HAS_IMAGE; $i++) {
  1808. echo App::link("I", array('function_init'=>'fun_SHOW_EXTERNAL_IMAGE', 'tbl'=>$tbl,'id'=>$r->ID, 'number'=>$i), array('target'=>'_blank', 'title'=>"Zdjecie ".($i+1), 'iconBootstrap'=>'glyphicon glyphicon-camera', 'class'=>'lightbox'));
  1809. //echo'<img src="'."?function_init=fun_SHOW_EXTERNAL_IMAGE&tbl=".$tbl."&id=".$r->ID."&number=".$i."&resize=200x200".'" />';
  1810. }
  1811. if ($tree->get_param('editable')) echo App::link("+", "?function_init=fun_IMAGE_ADD&tbl=".$tbl."&id=".$r->ID, array('target'=>'_blank', 'title'=>"Dodaj zdjecia", 'iconBootstrap'=>'glyphicon glyphicon-plus'));
  1812. echo'}</span>';
  1813. }
  1814. }
  1815. if (!empty($wsk)) echo'</div>';// .has_wsk
  1816. echo'</dt>'."\n";
  1817. if (!empty($wsk)) {
  1818. $zasoby_id = array();
  1819. echo'<dd>';
  1820. echo'<ul>';
  1821. if (V::get('group_stanowiska', '', $_GET)) {
  1822. $wsk_stanowiska = array();
  1823. $wsk_inne = array();
  1824. foreach ($wsk as $w) {
  1825. if ($w->TYPE == 'STANOWISKO') {
  1826. $wsk_stanowiska[] = $w;
  1827. } else {
  1828. $wsk_inne[] = $w;
  1829. }
  1830. }
  1831. $wsk = array();
  1832. if (!empty($wsk_stanowiska)) {
  1833. $wsk[] = $wsk_stanowiska;
  1834. }
  1835. if (!empty($wsk_inne)) {
  1836. foreach ($wsk_inne as $w) {
  1837. $wsk[] = $w;
  1838. }
  1839. }
  1840. }
  1841. $wsk_cnt = count( $wsk );
  1842. foreach ($wsk as $w) {
  1843. if (is_array($w)) {// if $_GET['group_stanowiska']
  1844. $stanowiska = array();
  1845. foreach ($w as $vStanowisko) {
  1846. $stanowiska[] = "[{$vStanowisko->ID}] {$vStanowisko->DESC}";
  1847. }
  1848. echo '<li'.((--$wsk_cnt)? '' : ' class="tree-last"').'>';
  1849. echo '<p>';
  1850. echo ' <span class="btn-box btn-box-silver">'."STANOWISKA:".'</span>';
  1851. echo ' <b>' . implode(', ', $stanowiska) . '</b> ';
  1852. echo '</p>';
  1853. echo '</li>';
  1854. continue;
  1855. }
  1856. $w_parents_out = '';
  1857. $w_title_parents_out = '';
  1858. if ($tree->get_param('rozwin_zasoby')) {
  1859. $tree->log('show item -> fetch-get_all_parents - start');
  1860. $w->_parents = TreeHelper::get_all_parents( 'CRM_LISTA_ZASOBOW', $w->PARENT_ID );
  1861. $tree->log('show item -> fetch-get_all_parents', array('fetch-get_all_parents'));
  1862. $w_parents_out = array();
  1863. foreach ($w->_parents as $w_p_id => $w_p) {
  1864. $w_parents_out[] = '[<b>'.$w_p->ID.'</b> '.$w_p->TYPE.' '.$w_p->DESC.']';
  1865. $w_title_parents_out[] = ''.$w_p->ID.' '.$w_p->TYPE.' '.$w_p->DESC.'';
  1866. }
  1867. $w_parents_out = ' <span class="wsk_parents">'.implode(' / ', $w_parents_out).'</span>';
  1868. $w_title_parents_out = (!empty($w_title_parents_out))? implode(' / ', $w_title_parents_out) : '';
  1869. }
  1870. echo'<li'.((--$wsk_cnt)? '' : ' class="tree-last"').'>';
  1871. if ('INHERIT' == $w->ACL_TYPE) {
  1872. UI::startTag('p', ['style' => "color:#aaa", 'title' => "Stanowiska dziedziczone z procesu/ów wywołujących (GOTO)"]);
  1873. UI::tag('span', ['title' => $w_title_parents_out], "[{$w->ID}]");
  1874. echo " {$w->TYPE} ";
  1875. UI::tag('span', [], $w->DESC);
  1876. UI::endTag('p');
  1877. continue;
  1878. } else {
  1879. }
  1880. echo'<p>';
  1881. // echo ' <span class="btn-box btn-box-silver">'.$w->CW_ID.'</span>';
  1882. ('GROUP' == $w->ACL_TYPE)
  1883. ? UI::startTag('p', ['style' => "color:#daa520"])
  1884. : UI::startTag('p', []);
  1885. ('GROUP' == $w->ACL_TYPE)
  1886. ? UI::tag('span', ['style' => "color:#daa520", 'title' => $w_title_parents_out], "[{$w->ID}]")
  1887. : UI::tag('span', ['class' => "green", 'title' => $w_title_parents_out], "[{$w->ID}]");
  1888. if ($tree->get_param('editable')) {
  1889. echo App::link("<b>^</b>", array('function_init'=>'SORT_PRIO_WSKAZNIK', 'arg1'=>$w->CW_ID, 'arg1_val'=>'upup','_hash'=>rand(0,9999),'#'=>'TREE'.$r->ID), array('class'=>"btn-clean", 'title'=>"w gore o 5 pol"));
  1890. echo App::link("^", array('function_init'=>'SORT_PRIO_WSKAZNIK', 'arg1'=>$w->CW_ID, 'arg1_val'=>'up','_hash'=>rand(0,9999),'#'=>'TREE'.$r->ID), array('class'=>"btn-clean", 'title'=>"w gore"));
  1891. echo App::link("v", array('function_init'=>'SORT_PRIO_WSKAZNIK', 'arg1'=> $w->CW_ID, 'arg1_val'=>'dw','_hash'=>rand(0,9999),'#'=>'TREE'.$r->ID), array('class'=>"btn-clean", 'title'=>"w dol"));
  1892. echo App::link("V", array('function_init'=>'SORT_PRIO_WSKAZNIK', 'arg1'=> $w->CW_ID, 'arg1_val'=>'downdown','_hash'=>rand(0,9999),'#'=>'TREE'.$r->ID), array('class'=>"btn-clean", 'title'=>"w dol o 5 pol"));
  1893. echo' ';
  1894. if ($tree->get_param('WskaznikTblId')) {
  1895. echo App::link("E", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('WskaznikTblId')."#EDIT/".$w->CW_ID, array('title'=>'Edytuj', 'class'=>'btn-p5'));
  1896. } else {
  1897. echo App::link("E", "?task=CRM_EDIT_CRM_WSKAZNIK&EDIT=".$w->CW_ID."&ID=".$w->CW_ID, array('title'=>'Edytuj', 'class'=>'btn-p5'));
  1898. }
  1899. if ($tree->get_param('ZasobTblId') > 0) {
  1900. echo App::link("F", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('ZasobTblId')."#FILES/".$w->ID, array('title'=>'Pliki', 'class'=>'btn-p5'));
  1901. }
  1902. }
  1903. if (!empty($pytania)) {
  1904. foreach ($pytania as $pytanie) {
  1905. if ($pytanie->ID_WSKAZNIK != $w->CW_ID) {
  1906. continue;
  1907. }
  1908. $odpowiedzi = array();
  1909. for ($i = 0; $i < 5; $i++) {
  1910. $fldTxt = "ODP_{$i}";
  1911. $fldOdp = "ODP_{$i}_ODP";
  1912. if (!empty($pytanie->{$fldTxt})) {
  1913. if ($pytanie->{$fldOdp} == 'TAK') {
  1914. $odpowiedzi[] = '<span class="text-success">' . htmlspecialchars($pytanie->{$fldTxt}) . '</span>';
  1915. } else {
  1916. $odpowiedzi[] = '<span class="text-error">' . htmlspecialchars($pytanie->{$fldTxt}) . '</span>';
  1917. }
  1918. }
  1919. }
  1920. $popupIcon = ($pytanie->TEST_TYPE=='TEORETYCZNY')? 'glyphicon glyphicon-question-sign' : 'glyphicon glyphicon-exclamation-sign';
  1921. $popupLink = "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID={$tblPytaniaId}&task=CRM_PROCES#EDIT/{$pytanie->ID}";// TODO: add rand _hash?
  1922. $popupTitle = "#{$pytanie->ID} " . htmlspecialchars($pytanie->PYTANIE);
  1923. $popupContent = implode('<hr style="margin:0.5em 0">', $odpowiedzi);
  1924. ?>
  1925. <a target="_blank" href="<?php echo $popupLink; ?>"><i class="<?php echo $popupIcon; ?> wsk-help popover-with-html">
  1926. <span class="popover-heading"><?php echo $popupTitle; ?></span>
  1927. <span class="popover-body"><?php echo $popupContent; ?></span>
  1928. </i></a>
  1929. <?php
  1930. }
  1931. }
  1932. if (!empty($w->CP_FORM_TREAT)) echo' <span title="'.$w->CP_PYTANIE.' '.$w->CP_OPIS.'" style="color:#999">'.str_replace(',', '', $w->CP_FORM_TREAT).'</span>';
  1933. echo ' '.$w->TYPE.'';
  1934. echo ' <b>'.$w->DESC.'</b> ';
  1935. if ($tree->get_param('editable')) {
  1936. $js_onclick = "if(!confirm('Czy na pewno usunac wskaznik ".$w->CW_ID." do zasobu ".$w->ID." w procesie ".$r->ID."?')){return false;}";
  1937. echo App::link("Z-", "?task=CRM_DEL_CRM_WSKAZNIK&ID=".$w->CW_ID, array('title'=>'Usun', 'class'=>'btn-p5', 'onclick'=>$js_onclick));
  1938. }
  1939. if ($tree->get_param('filtr_img')) {
  1940. // wskaznik images
  1941. $tbl = 'CRM_WSKAZNIK';
  1942. if ($w->CW_A_HAS_IMAGE > 0 || $tree->get_param('editable')) {
  1943. for ($i = 0; $i < $w->CW_A_HAS_IMAGE; $i++) {
  1944. echo App::link("I", array('function_init'=>'fun_SHOW_EXTERNAL_IMAGE', 'tbl'=>$tbl,'id'=>$w->CW_ID, 'number'=>$i), array('target'=>'_blank', 'title'=>"Zdjecie ".($i+1), 'iconBootstrap'=>'glyphicon glyphicon-camera', 'class'=>'lightbox'));
  1945. }
  1946. if ($tree->get_param('editable')) echo App::link("+", "?function_init=fun_IMAGE_ADD&tbl=".$tbl."&id=".$w->CW_ID, array('target'=>'_blank', 'title'=>"Dodaj zdjecia", 'iconBootstrap'=>'glyphicon glyphicon-plus'));
  1947. }
  1948. // zasob images
  1949. $tbl = 'CRM_LISTA_ZASOBOW';
  1950. if ($w->A_HAS_IMAGE) {
  1951. for ($i = 0; $i < $w->A_HAS_IMAGE; $i++) {
  1952. echo App::link("I", array('function_init'=>'fun_SHOW_EXTERNAL_IMAGE', 'tbl'=>$tbl,'id'=>$w->ID, 'number'=>$i), array('target'=>'_blank', 'title'=>"Zdjecie ".($i+1), 'iconBootstrap'=>'glyphicon glyphicon-camera', 'class'=>'lightbox'));
  1953. }
  1954. }
  1955. // show video link if file is movie type
  1956. if ($w->TYPE == 'PLIK') {
  1957. $movieExtAllowed = array('avi', 'mov', 'm4v');
  1958. $movieExt = explode('.', $w->DESC);
  1959. $movieExt = end($movieExt);
  1960. if (in_array($movie_ext, $movieExtAllowed)) {
  1961. //echo App::link("V", array('function_init'=>'fun_SHOW_VIDEO','id'=>$w->ID), array('target'=>'_blank', 'title'=>"Film", 'ico'=>'video', 'class'=>''));//lightbox video
  1962. }
  1963. }
  1964. }
  1965. if ($tree->get_param('rozwin_opis')) {
  1966. if ($w->TYPE == 'STANOWISKO') {
  1967. if (!empty($w->OPIS)) {
  1968. if (strlen($w->OPIS) > 300) {
  1969. ?>
  1970. <!-- Button to trigger modal -->
  1971. <a href="#wsk-<?php echo $w->CW_ID; ?>-Modal" class="wsk-long-desc" data-toggle="modal">
  1972. <i class="glyphicon glyphicon-info-sign" title="Opis stanowiska"></i>
  1973. </a>
  1974. <!-- Modal -->
  1975. <div id="wsk-<?php echo $w->CW_ID; ?>-Modal" class="wsk-modal modal fade" tabindex="-1" role="dialog" aria-labelledby="wsk-<?php echo $w->CW_ID; ?>-ModalLabel" aria-hidden="true">
  1976. <div class="modal-dialog">
  1977. <div class="modal-content">
  1978. <div class="modal-header">
  1979. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  1980. <h3 id="wsk-<?php echo $w->CW_ID; ?>-ModalLabel"><?php echo "[{$w->CW_ID}] {$w->DESC}"; ?></h3>
  1981. </div>
  1982. <div class="modal-body">
  1983. <?php echo $w->OPIS; ?>
  1984. </div>
  1985. <div class="modal-footer">
  1986. <button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Zamknij</button>
  1987. </div>
  1988. </div>
  1989. </div>
  1990. </div>
  1991. <?php
  1992. } else {
  1993. ?>
  1994. <i class="glyphicon glyphicon-info-sign wsk-help popover-with-html">
  1995. <span class="popover-heading"><?php echo "[{$w->CW_ID}] " . $w->OPIS; ?></span>
  1996. <span class="popover-body"><?php echo $w->OPIS_ZASOB; ?></span>
  1997. </i>
  1998. <?php
  1999. }
  2000. }
  2001. } else {
  2002. echo ' <span class="green">'.$w->OPIS.'</span>';// opis zasobu
  2003. }
  2004. }
  2005. if ($tree->get_param('rozwin_opis')) {
  2006. echo ' <span style="color:#000;">'.$w->OPIS_ZASOB.'</span>';// komentarz wskaznika
  2007. }
  2008. else if (!empty($w->OPIS_ZASOB)) {
  2009. ?>
  2010. <i class="glyphicon glyphicon-info-sign wsk-help popover-with-html">
  2011. <span class="popover-heading"><?php echo "[" . $w->CW_ID . "] " . $w->OPIS; ?></span>
  2012. <span class="popover-body"><?php echo "[{$w->ID}]" . $w->OPIS_ZASOB; ?></span>
  2013. </i>
  2014. <?php
  2015. }
  2016. if ($show_form) $zasoby_id[$w->TYPE][$w->ID] = $w->CW_ID;
  2017. if ($tree->get_param('rozwin_zasoby')) {
  2018. echo $w_parents_out;
  2019. }
  2020. echo'</p>';
  2021. echo'</li>';
  2022. }
  2023. echo'</ul>';
  2024. if(0) {// TODO: grupuj zasoby
  2025. echo'<hr />';
  2026. $zasoby_id = array();
  2027. $wsk_cnt = count( $wsk );
  2028. echo'<pre style="max-height:100px;overflow:auto;border:1px solid red;">wsk = ';print_r($wsk);echo'</pre>';
  2029. // TEST parents
  2030. $wsk_parents = array();
  2031. $max_deep = 0;// max parents deep
  2032. foreach ($wsk as $k_wsk_id => $w) {
  2033. $wsk_parents_cur = array_reverse(array_keys($w->_parents));
  2034. $wsk_parents_cur[] = $w->ID;
  2035. if (count($wsk_parents_cur) > $max_deep) $max_deep = count($wsk_parents_cur);
  2036. $wsk_parents_cur ['wsk_id'] = $k_wsk_id;
  2037. $wsk_parents[] = $wsk_parents_cur;
  2038. echo'parents ['.implode(',', $wsk_parents_cur).']<br />';
  2039. }
  2040. $wsk_parents_cnt = count($wsk_parents);
  2041. echo'<pre style="max-height:100px;overflow:auto;border:1px solid red;">parents('.$wsk_parents_cnt.'); max_deep('.$max_deep.'); wsk_parents = ';print_r($wsk_parents);echo'</pre>';
  2042. $zasoby_id = array();
  2043. foreach ($wsk as $k_wsk_id => $w) {
  2044. $zasoby_id [$w->ID] =& $wsk[$k_wsk_id];
  2045. foreach ($w->_parents as $k_z_id => $z) {
  2046. $zasoby_id [$k_z_id] =& $wsk[$k_wsk_id]->_parents[$k_z_id];
  2047. }
  2048. }
  2049. $wsk_parents_map = array();// table td: rowspan, colspan, wsk_id
  2050. /*
  2051. for ($x = 0, $last_x = 0, $last_y = 0; $x < $max_deep; $x++, $last_x = $x) {
  2052. for ($y = 0; $y < $wsk_parents_cnt; $y++) {
  2053. $z_id = 'x';
  2054. if (isset($wsk_parents[$y][$x])) {
  2055. $z_id = $wsk_parents[$y][$x];
  2056. }
  2057. $wsk_parents_map[$y][$x] = array('rowspan'=>1, 'colspan'=>1, 'z_id'=>$z_id);// default content is 'x'
  2058. }
  2059. }
  2060. */
  2061. for ($y = 0, $last_y = 0, $last_x = 0; $y < $wsk_parents_cnt; $y++, $last_y = $y) {
  2062. for ($x = 0; $x < $max_deep; $x++) {
  2063. $z_id = 'x';
  2064. $wsk_parents_map[$y][$x] = array('rowspan'=>1, 'colspan'=>1, 'z_id'=>$z_id);// default content is 'x'
  2065. if (isset($wsk_parents[$y][$x])) {
  2066. $wsk_parents_map[$y][$x]['z_id'] = $wsk_parents[$y][$x];
  2067. } else if ($x > 0 && $wsk_parents_map[$y][$x - 1]['z_id'] != 'x') {
  2068. //$wsk_parents_map[$y][$x - 1]['z_id'] = 'x';
  2069. $wsk_parents_map[$y][$x - 1]['wsk_id'] = $wsk_parents[$y]['wsk_id'];
  2070. }
  2071. }
  2072. // dodaj wsk_id do ostatniego elementu
  2073. $x = $max_deep - 1;
  2074. if ($wsk_parents_map[$y][$x]['z_id'] != 'x') {
  2075. $wsk_parents_map[$y][$x]['wsk_id'] = $wsk_parents[$y]['wsk_id'];
  2076. }
  2077. }
  2078. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">1:wsk_parents_map = ';print_r($wsk_parents_map);echo'</pre>';
  2079. // set rowspan
  2080. for ($x = 0, $last_x = 0; $x < $max_deep; $x++, $last_x = $x) {
  2081. for ($y = 1, $last_y = 0; $y < $wsk_parents_cnt; $y++) {
  2082. $last_cell_map =& $wsk_parents_map[$last_y][$x];
  2083. $curr_cell_map =& $wsk_parents_map[$y][$x];
  2084. if ($last_cell_map['z_id'] != $curr_cell_map['z_id']) {
  2085. $last_y = $y;
  2086. } else if (isset($last_cell_map['wsk_id'])) {
  2087. $last_y = $y;
  2088. } else {
  2089. $curr_cell_map['z_id'] = 'x';
  2090. $last_cell_map['rowspan'] += 1;
  2091. }
  2092. }
  2093. }
  2094. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">2:wsk_parents_map = ';print_r($wsk_parents_map);echo'</pre>';
  2095. // set colspan
  2096. for ($y = 0, $last_y = 0; $y < $wsk_parents_cnt; $y++, $last_y = $y) {
  2097. for ($x = 1, $last_x = 0; $x < $max_deep; $x++) {
  2098. $last_cell_map =& $wsk_parents_map[$y][$last_x];
  2099. $curr_cell_map =& $wsk_parents_map[$y][$x];
  2100. if ($curr_cell_map['z_id'] == 'x') {
  2101. $curr_cell_map['z_id'] = 'x';
  2102. $last_cell_map['colspan'] += 1;
  2103. } else {
  2104. $last_x = $x;
  2105. }
  2106. }
  2107. }
  2108. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">wsk_parents_map = ';print_r($wsk_parents_map);echo'</pre>';
  2109. /*
  2110. foreach ($wsk_parents as $k_i => $v_map) {
  2111. $last_p_id = 0; $last_map_ind = -1;
  2112. foreach ($v_map as $wsk_i => $parent_id) {
  2113. if ($last_map_ind == -1) {
  2114. $last_map_ind = 0;
  2115. $wsk_parents_map[$k_i][$last_map_ind] = array('p_id'=>$parent_id, 'rowspan'=>1);
  2116. } else if ($last_p_id != $parent_id) {
  2117. $last_map_ind++;
  2118. $wsk_parents_map[$k_i][$last_map_ind] = array('p_id'=>$parent_id, 'rowspan'=>1);
  2119. } else {
  2120. $wsk_parents_map[$k_i][$last_map_ind]['rowspan'] += 1;
  2121. }
  2122. $last_p_id = $parent_id;
  2123. }
  2124. }
  2125. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">wsk_parents_map = ';print_r($wsk_parents_map);echo'</pre>';
  2126. */
  2127. /*
  2128. parents [27,35,57,79 ]
  2129. parents [27,35,57,79 ]
  2130. parents [27,14,31,355,1070,2365]
  2131. parents [27,35,57,79 ]
  2132. wsk_parents_map = Array(
  2133. [0] => Array(
  2134. [0] => Array(
  2135. [p_id] => 27
  2136. [rowspan] => 3
  2137. <table>
  2138. <tr>
  2139. <td rowspan=4> 27 </td>
  2140. <td rowspan=2> 35 </td>
  2141. <td rowspan=2> 57 </td>
  2142. <td rowspan=2> 79 </td>
  2143. </tr>
  2144. <tr>
  2145. <td> 14 </td>
  2146. <td> 31 </td>
  2147. <td> 355 </td>
  2148. </tr>
  2149. <tr>
  2150. <td> 27 </td>
  2151. <td> 35 </td>
  2152. <td> 57 </td>
  2153. </tr>
  2154. </table>
  2155. */
  2156. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">zasoby_id: ';print_r($zasoby_id);echo'</pre>';
  2157. echo'<table class="tbl-wsk-view" border="1">';
  2158. echo'<tbody>';
  2159. foreach ($wsk_parents_map as $k_map_y => $v_map_line) {
  2160. $out_row = '';
  2161. foreach ($v_map_line as $k_map_x => $v_map) {
  2162. if ($v_map['z_id'] == 'x') {
  2163. continue;
  2164. }
  2165. $cls = '';
  2166. $out_zasob = '';
  2167. $out_rowspan = ($v_map['rowspan'] > 1)? ' rowspan="'.$v_map['rowspan'].'"' : '';
  2168. $out_colspan = ($v_map['colspan'] > 1)? ' colspan="'.$v_map['colspan'].'"' : '';
  2169. {// get zasob info
  2170. //[TYPE] => NARZEDZIE
  2171. //[DESC] => SUPEREDIT-WWW
  2172. //[OPIS] => http://se.dev.webone.pl/
  2173. $curr_z = V::get($v_map['z_id'], null, $zasoby_id);
  2174. if (!$curr_z) {
  2175. $out_zasob .= 'error brak zasobu {'.$v_map['z_id'].'}';
  2176. } else {
  2177. $out_zasob_title = array();
  2178. $out_zasob_title[] = V::get('DESC', '', $curr_z);
  2179. $out_zasob_title[] = V::get('OPIS', '', $curr_z);
  2180. $out_zasob_title = ''.implode(' ', $out_zasob_title).'';
  2181. $out_zasob .= '<b class="btn-box btn-box-green" title="'.$out_zasob_title.'">'.$v_map['z_id'].'</b>';
  2182. }
  2183. }
  2184. if (isset($v_map['wsk_id'])) {
  2185. $curr_wsk = V::get($v_map['wsk_id'], null, $wsk);
  2186. if (!$curr_wsk) {
  2187. $out_zasob .= 'error brak wskaznika {'.$v_map['wsk_id'].'}';
  2188. } else {
  2189. $out_zasob_opis = V::get('OPIS_ZASOB', '', $curr_wsk);
  2190. $out_zasob .= ' <b class="btn-box" title="'."Wskaznik [".$v_map['wsk_id']."]".'">'.$v_map['wsk_id'].'</b>';
  2191. // TODO: if edit, etc.
  2192. $out_zasob .= ' '.$out_zasob_opis;
  2193. }
  2194. //$out_row .= '<td'.$out_rowspan.''.$out_colspan.'>'.$out_zasob.'</td>';
  2195. $cls = ' class="wsk-cell"';
  2196. }
  2197. $out_row .= '<td'.$cls.''.$out_rowspan.''.$out_colspan.'>'.$out_zasob.'</td>';
  2198. }
  2199. if ($out_row) {
  2200. echo'<tr>';
  2201. echo $out_row;
  2202. echo'</tr>';
  2203. }
  2204. }
  2205. echo'</tbody>';
  2206. echo'</table>';
  2207. }// grupuj zasoby
  2208. if ($show_form) {
  2209. //echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;">zasoby_id = ';print_r($zasoby_id);echo'</pre>';
  2210. if (!empty($zasoby_id['KOMORKA'])) {
  2211. $komorki = array();
  2212. foreach ($zasoby_id['KOMORKA'] as $z_id => $w_id) {
  2213. $komorki[] = $wsk[ $w_id ];
  2214. }
  2215. DEBUG_S(4,'komorki',$komorki, __FILE__, __FUNCTION__, __LINE__);
  2216. // zasoby pobierz info o komorkach: tabela, baza danych; host,login,passwd z configa
  2217. // BAZA_DANYCH -> TABELA -> KOMORKA
  2218. $zasoby_tabele = array();
  2219. $zasoby_db_conf = array();
  2220. $sql = "select
  2221. z.ID as KOMORKA_ID
  2222. , z.DESC as KOMORKA_DESC
  2223. , z.OPIS as KOMORKA_OPIS
  2224. , z2.ID as TABELA_ID
  2225. , z2.DESC as TABELA_DESC
  2226. , z2.OPIS as TABELA_OPIS
  2227. , z3.ID as DB_ID
  2228. , z3.DESC as DB_DESC
  2229. , z3.OPIS as DB_OPIS
  2230. from `CRM_LISTA_ZASOBOW` as z
  2231. left join `CRM_LISTA_ZASOBOW` as z2 on(z2.`ID`=z.`PARENT_ID`)
  2232. left join `CRM_LISTA_ZASOBOW` as z3 on(z3.`ID`=z2.`PARENT_ID`)
  2233. where
  2234. z.`ID` in (".implode(',', array_keys($zasoby_id['KOMORKA'])).")
  2235. and z2.`TYPE`='TABELA'
  2236. -- and z3.`TYPE`='BAZA_DANYCH' -- lub DATABASE_MYSQL, DATABASE_MSSQL
  2237. ";
  2238. DEBUG_S(5,'sql', $sql, __FILE__, __FUNCTION__, __LINE__);
  2239. $res = DB::query( $sql );
  2240. while ($z = DB::fetch( $res )) {
  2241. $zasoby_db_conf [$z->DB_ID][] = array($z->KOMORKA_ID, $z->DB_ID, $z->DB_DESC, $z->DB_OPIS);
  2242. $zasoby_tabele [$z->TABELA_ID][] = array($z->KOMORKA_ID, $z->TABELA_ID, $z->TABELA_DESC, $z->TABELA_OPIS);
  2243. }
  2244. DEBUG_S(4,'zasoby_db_conf ['.implode(',',array_keys($zasoby_db_conf)).']', $zasoby_db_conf, __FILE__, __FUNCTION__, __LINE__);
  2245. DEBUG_S(4,'zasoby_tabele ['.implode(',',array_keys($zasoby_tabele)).']', $zasoby_tabele, __FILE__, __FUNCTION__, __LINE__);
  2246. // pogrupuj komorki wg tabel
  2247. // permy z $zasob->CW_TYP
  2248. }
  2249. }
  2250. echo'</dd>';
  2251. }
  2252. echo'</dl>'."\n";
  2253. $tree->log('show item -> end');
  2254. }
  2255. function tree_callback__show_item_from_CRM_LISTA_ZASOBOW( &$r, &$tree ) {
  2256. // TODO: btn-box zasob type from PARENT_ID
  2257. $cls = array();
  2258. if (($search_id = $tree->get_param('search_id')) > 0 && $search_id == $r->ID) {
  2259. $cls[] = 'search_id';
  2260. }
  2261. if ($tree->_table == 'CRM_LISTA_ZASOBOW') {
  2262. $cls[] = 'type-'.(($r->ALIAS_ID > 0)? 'ALIAS_ID' : $r->PARENT_TYPE);// TODO: Undefined property: stdClass::$PARENT_TYPE przy Filtr ID
  2263. }
  2264. $cls = (!empty($cls))? ' class="'.implode(' ', $cls).'"' : '';
  2265. echo'<dl'.$cls.'>';
  2266. echo'<dt>';
  2267. $out_id = ($r->ID < 10)? '&nbsp;'.$r->ID.'' : $r->ID;
  2268. echo App::link($out_id, array('task'=>"CRM_LISTA_ZASOBOW", 'filtr_id'=>$r->ID, '#'=>'TREE'.$r->ID), array('class'=>'item_id btn-box'));
  2269. if ($tree->get_param('editable')) {
  2270. //echo'('.$r->SORT_PRIO.')';// TODO: DBG
  2271. echo App::link("<b>^</b>", array('task'=>'CRM_LISTA_ZASOBOW', 'function_init'=>'SORT_PRIO_ZASOB', 'arg1'=>$r->ID, 'arg1_val'=>'upup'), array('class'=>"btn-clean", 'title'=>"w gore szybko"));
  2272. echo App::link("^", array('task'=>'CRM_LISTA_ZASOBOW', 'function_init'=>'SORT_PRIO_ZASOB', 'arg1'=>$r->ID, 'arg1_val'=>'up'), array('class'=>"btn-clean", 'title'=>"w gore"));
  2273. echo App::link("v", array('task'=>'CRM_LISTA_ZASOBOW', 'function_init'=>'SORT_PRIO_ZASOB', 'arg1'=>$r->ID, 'arg1_val'=>'dw'), array('class'=>"btn-clean", 'title'=>"w dol"));
  2274. echo App::link("V", array('task'=>'CRM_LISTA_ZASOBOW', 'function_init'=>'SORT_PRIO_ZASOB', 'arg1'=>$r->ID, 'arg1_val'=>'downdown'), array('class'=>"btn-clean", 'title'=>"w dol szybko"));
  2275. echo '('.$r->SORT_PRIO.')';
  2276. }
  2277. if ($tree->get_param('editable')) {
  2278. if($tree->get_param('hasFieldPerm__ID'))
  2279. echo App::link("E", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('getZasobTableID')."#EDIT/".$r->ID, array('title'=>'Pliki', 'class'=>'btn-p5'));
  2280. else echo App::link("E", "?task=CRM_LISTA_ZASOBOW&EDIT=".$r->ID."#".$r->ID, array('title'=>'Edytuj', 'class'=>'btn-p5'));
  2281. }
  2282. if ($tree->get_param('hasFieldPerm__ID')) echo App::link("F", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('getZasobTableID')."#FILES/".$r->ID, array('title'=>'Pliki', 'class'=>'btn-p5'));
  2283. // TODO: dodaj obrazek w okienku/ajax
  2284. //if ($tree->get_param('editable')) echo App::link_ajax("+IMG", 'ajax_add_image', array('tbl'=>"CRM_LISTA_ZASOBOW", 'id'=>$r->ID), array('js_result_type'=>'popup', 'class'=>'btn-p5', 'title'=>'Dodaj zdjecie'));
  2285. if ($r->has_childrens) {
  2286. if (!$tree->get_param('rozwin')) {
  2287. $js = "return " . $tree->js_tree_open_rec_fun . "(this," . $r->ID . ");";
  2288. //echo'<a class="open-rec" href="#" onclick="'.$js.'">'."L".'</a>';
  2289. echo App::link("L", '#', array('title'=>'Rozwin wszystko', 'class'=>'btn-p5 open-rec', 'onclick'=>$js));
  2290. }
  2291. }
  2292. if(($r->minOccurs!=1)or ($r->maxOccurs!=1)) echo '('.$r->minOccurs."/".$r->maxOccurs.")";
  2293. else echo "(1)";
  2294. echo'<span class="desc">';
  2295. {
  2296. $outAliasStyle = 'color:#999';
  2297. $outAliasTitle = 'ALIAS INFO';
  2298. $outAliasLink .= '<i class="glyphicon glyphicon-share-alt"></i>';
  2299. if ($r->ALIAS_ID > 0) {
  2300. $outAliasLink .= "{$r->ALIAS_ID}";
  2301. // '<a href="#TREE'.$r->ALIAS_ID.'">'.$r->ALIAS_ID.'</a>'
  2302. // '<a href="#TREE'.$r->ALIAS_ID.'">'.$r->ALIAS_ID.'</a>'
  2303. if ('VIRTUAL' == $r->ALIAS_MODE) {
  2304. $outAliasStyle = 'color:#CA06E2';
  2305. $outAliasTitle = "ALIAS WIRTUALNY DO {$r->ALIAS_ID}";
  2306. } else {
  2307. $outAliasStyle = 'color:#FF6900';
  2308. $outAliasTitle = "ALIAS DO {$r->ALIAS_ID}";
  2309. }
  2310. }
  2311. echo '<span style="' . $outAliasStyle . '">
  2312. <a href="#"
  2313. style="' . $outAliasStyle . '"
  2314. title="' . $outAliasTitle . '"
  2315. data-id="' . $r->ID . '"
  2316. onclick="return showZasobAliasTooltip(this);"
  2317. >' . "{$outAliasLink}" . '</a>'
  2318. . ' <span class="alias-description"></span>'
  2319. . '</span>'
  2320. ;
  2321. }
  2322. echo '<b>'.$r->TYPE.'</b>';
  2323. if($r->A_STATUS=='DELETED') echo " (D) ";
  2324. $bold=false;
  2325. if ((!empty($_GET['arg1']) && $_GET['arg1'] == $r->ID)
  2326. || (!empty($_GET['EDIT']) && $_GET['EDIT']==$r->ID)
  2327. ) {
  2328. $bold = true;
  2329. }
  2330. if ($bold) echo "<b>";
  2331. echo ' '.$r->DESC;
  2332. if ($bold) echo "</b>";
  2333. echo '<font size=-3 color=grey> '.$r->DESC_PL.'</font>';
  2334. $opis_before = ''; $opis_after = '';
  2335. $tbl = 'CRM_LISTA_ZASOBOW';
  2336. if ($tree->get_param('filtr_img')) {
  2337. if ($r->A_HAS_IMAGE) {
  2338. echo'<br />';
  2339. for ($i = 0; $i < $r->A_HAS_IMAGE; $i++) {
  2340. $opis_before .= '<a href="'."?function_init=fun_SHOW_EXTERNAL_IMAGE&tbl=".$tbl."&id=".$r->ID."&number=".$i.'" target="_blank" class="lightbox">';
  2341. $opis_before .= '<img src="'."?function_init=fun_SHOW_EXTERNAL_IMAGE&tbl=".$tbl."&id=".$r->ID."&number=".$i."&resize=200x200".'" style="float:left" />';
  2342. $opis_before .= '</a>';
  2343. }
  2344. }
  2345. if ($opis_before != '') $opis_after = '<br style="clear:both"/>';
  2346. }
  2347. echo' <span class="more-desc">';
  2348. echo $opis_before;
  2349. if ($tree->get_param('rozwin_opis') && $r->OPIS) echo ' '.$r->OPIS;
  2350. echo $opis_after;
  2351. echo '</span>';
  2352. echo'</span>';
  2353. $tbl = 'CRM_LISTA_ZASOBOW';
  2354. if ($tree->get_param('filtr_img')) {
  2355. if ($r->A_HAS_IMAGE || $tree->get_param('editable')) {
  2356. echo' <span class="external-ids">{';
  2357. //echo App::link("IMG", array('function_init'=>'ajax_show_images', 'tbl'=>'CRM_LISTA_ZASOBOW','id'=>$r->ID), array('target'=>'_blank', 'title'=>"Zdjecia (".$r->A_HAS_IMAGE.")"));
  2358. //echo App::link_ajax("IMG", 'ajax_show_images', array('tbl'=>'CRM_LISTA_ZASOBOW','id'=>$r->ID), array('js_result_type'=>'override', 'js_result'=>'', 'title'=>"Zdjecia (".$r->A_HAS_IMAGE.")"));
  2359. // TODO: A_HAS_IMAGE - count images, show img icons to show image in new window
  2360. for ($i = 0; $i < $r->A_HAS_IMAGE; $i++) {
  2361. echo App::link("I", array('function_init'=>'fun_SHOW_EXTERNAL_IMAGE', 'tbl'=>$tbl,'id'=>$r->ID, 'number'=>$i), array('target'=>'_blank', 'title'=>"Zdjecie ".($i+1), 'iconBootstrap'=>'glyphicon glyphicon-camera', 'class'=>'lightbox'));
  2362. }
  2363. if ($tree->get_param('editable')) echo App::link("+", "?function_init=fun_IMAGE_ADD&tbl=".$tbl."&id=".$r->ID, array('target'=>'_blank', 'title'=>"Dodaj zdjecia", 'iconBootstrap'=>'glyphicon glyphicon-plus'));
  2364. echo'}</span>';
  2365. }
  2366. }
  2367. if ($tree->get_param('editable')) {
  2368. // TODO: check table
  2369. $allowed_check_database = array();
  2370. $allowed_check_database[] = 'BAZA_DANYCH';
  2371. $allowed_check_database[] = 'DATABASE_MYSQL';
  2372. $allowed_check_database[] = 'DATABASE_MSSQL';
  2373. if ($r->TYPE == 'TABELA') {
  2374. //echo'{';
  2375. //echo App::link_ajax("check", "ajax_zasob_check_table", array('zasob_id'=>$r->ID), array('js_result_type'=>'override', 'js_result'=>''));
  2376. //echo'}';
  2377. }
  2378. else if (in_array($r->TYPE, $allowed_check_database)) {
  2379. //echo'{';
  2380. //echo App::link_ajax("check", "ajax_zasob_check_db", array('zasob_id'=>$r->ID), array('js_result_type'=>'override', 'js_result'=>''));
  2381. //echo'}';
  2382. }
  2383. }
  2384. // obowiazki
  2385. if ($tree->get_param('filtr_ob')) {
  2386. echo' <span class="external-ids">{';
  2387. echo App::link_ajax("OB", "ajax_zasob_get_obowiazki", array('zasob_id'=>$r->ID), array('js_result_type'=>'override', 'js_result'=>'', 'title'=>"Obowiazki"));
  2388. echo'}</span>';
  2389. }
  2390. // get external ids
  2391. if ($tree->get_param('filtr_ids')) {
  2392. if (in_array($r->TYPE, array('STANOWISKO', 'DZIAL', 'PODMIOT'))) {
  2393. echo '<span class="external-ids">' . "{";
  2394. echo App::link_ajax("kontakty", "ajax_zasob_stanowisko_search_kontakty", array('zasob_id'=>$r->ID), array('js_result_type'=>'override', 'js_result'=>''));
  2395. echo "}" . '</span>';
  2396. } else {
  2397. $external_ids_allowed_type = array();
  2398. $external_ids_allowed_type[] = 'NARZEDZIE';
  2399. $external_ids_allowed_type[] = 'TELBOX';
  2400. $external_ids_allowed_type[] = 'URZADZENIE';
  2401. $external_ids_allowed_type[] = 'SERWER';
  2402. $external_ids_allowed_type[] = 'SEGREGATOR';
  2403. $external_ids_allowed_type[] = 'MAGAZYN';
  2404. $external_ids_allowed_type[] = 'POMIESZCZENIE';
  2405. $external_ids_allowed_type[] = 'ALARM-SATEL';
  2406. $external_ids_allowed_type[] = 'DOSTEP-ZAMEK';
  2407. $external_ids_allowed_type[] = 'DOSTEP-KLUCZ';
  2408. $external_ids_allowed_type[] = 'SZAFA';
  2409. $external_ids_allowed_type[] = 'PIECZATKA';
  2410. $external_ids_allowed_type[] = 'MATERIAL_REKLAMOWY';
  2411. $external_ids_allowed_type[] = 'INNE';
  2412. $external_ids_allowed_type[] = 'DANE';
  2413. $external_ids_allowed_type[] = 'SIP_ACCOUNT';
  2414. $external_ids_allowed_type[] = 'PODMIOT';
  2415. $external_ids_allowed_type[] = 'URZADZENIA_I_OZNACZENIA_BHP';
  2416. $external_ids_allowed_type[] = 'SOFTWARE';
  2417. $external_ids_allowed_type[] = 'WYPOSAZENIE_LOKALU';
  2418. $external_ids_allowed_type[] = 'KUWETA';
  2419. $external_ids_allowed_type[] = 'DOSTEP-UPRAWNIENIA';
  2420. $external_ids_allowed_type[] = 'APLIKACJA';
  2421. $external_ids_allowed_type[] = 'LOKALIZACJA';
  2422. $external_ids_allowed_type[] = 'KOMPUTER';
  2423. $external_ids_allowed_type[] = 'MATERIAL_EKSPLOATACYJNY';
  2424. $external_ids_allowed_type[] = 'SOFTWARE';
  2425. $external_ids_allowed_type[] = 'OBSZAR';
  2426. $external_ids_allowed_type[] = 'REWIR';
  2427. $external_ids_allowed_type[] = 'DOKUMENTY';
  2428. $external_ids_allowed_type[] = 'SEJF';
  2429. $external_ids_allowed_type[] = 'DOSTEP-UPRAWNIENIA';
  2430. $external_ids_allowed_type[] = 'PLYTA_CD';
  2431. $external_ids_allowed_type[] = 'PROJEKT';
  2432. $external_ids_allowed_type[] = 'SPRAWA';
  2433. $external_ids_allowed_type[] = 'DOSTEP-KARTA';
  2434. $external_ids_allowed_type[] = 'OZNACZENIE_LOKALIZACJI';
  2435. $external_ids_allowed_type[] = 'DOSTEP-ZAMEK-ELEKTRONICZNY';
  2436. $external_ids_allowed_type[] = 'POLKA';
  2437. $external_ids_allowed_type[] = 'LOKALIZACJA_USLUGI';
  2438. $external_ids_allowed_type[] = 'SERVICE_POINT';
  2439. $external_ids_allowed_type[] = 'OFFER_GROUP';
  2440. $external_ids_allowed_type[] = 'OFFER';
  2441. $external_ids_allowed_type[] = 'OFFER_COSTS_GROUP';
  2442. $external_ids_allowed_type[] = 'OFFER_COST';
  2443. if (in_array($r->TYPE, $external_ids_allowed_type)) {
  2444. echo '<span class="external-ids">' . "{";
  2445. echo App::link_ajax("get IDS", "ajax_zasob_search_external_ids", array('zasob_id'=>$r->ID), array('js_result_type'=>'override', 'js_result'=>''));
  2446. echo "}" . '</span>';
  2447. }
  2448. }
  2449. }
  2450. if($tree->get_param('editable'))
  2451. echo App::link("↵+", "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID=".$tree->get_param('getZasobTableID')."&ff_PARENT_ID=".$r->ID."#CREATE", array('class'=>'btn-p5', 'title'=>'Dodaj dziecko', 'onclick'=>null));
  2452. echo'</dt>';
  2453. echo'</dl>'."\n";
  2454. }
  2455. // ========== typespecial functions
  2456. // function typespecial_{$FUN}( $field_name, $cmd, $value, $attrs = array() ) {
  2457. // switch ($cmd) {
  2458. // case 'show': {// show field in form
  2459. // $out = '';
  2460. // return $out;
  2461. // }
  2462. // break;
  2463. // case 'update': {// return field value
  2464. // return $value;
  2465. // }
  2466. // break;
  2467. // default:
  2468. //
  2469. // }
  2470. // }
  2471. function typespecial_L_APPOITMENT_USER($field_name, $cmd, $user_value, $attrs = array()) {
  2472. static $_users_list;
  2473. if (!$_users_list) {
  2474. $_users_list = array();
  2475. $sql = "select u.*
  2476. from `ADMIN_USERS` as u
  2477. where
  2478. u.`A_STATUS`='NORMAL'
  2479. and u.`ADM_TECH_WORKER`!='NO'
  2480. -- and u.`ADM_COMPANY` like '" . $_SESSION['ADM_COMPANY'] . "'
  2481. order by u.`ADM_NAME`
  2482. ";
  2483. $res = DB::query( $sql );
  2484. while ($r = DB::fetch( $res )) {
  2485. $_users_list [$r->ADM_ACCOUNT] = "" . $r->ADM_NAME . " (" . $r->ADM_ACCOUNT . ")";
  2486. }
  2487. }
  2488. $out = '';
  2489. switch ($cmd) {
  2490. case 'show': {
  2491. $out .= '<select name="' . $field_name . '">';
  2492. $out .= ' <option value="">' . " " . '</option>';
  2493. foreach ($_users_list as $key => $val) {
  2494. $sel = ($user_value == $key)? ' selected="selected"' : '';
  2495. $out .= '<option value="' . $key . '"' . $sel . '>' . $val . '</option>';
  2496. }
  2497. $out .= '</select>';
  2498. }
  2499. break;
  2500. case 'search': {
  2501. $out .= '<select name="' . $field_name . '">';
  2502. $out .= ' <option value="'."%".'">' . " % " . '</option>';
  2503. foreach ($_users_list as $key => $val) {
  2504. $sel = ($user_value == $key)? ' selected="selected"' : '';
  2505. $out .= '<option value="' . $key . '"' . $sel . '>' . $val . '</option>';
  2506. }
  2507. $out .= '</select>';
  2508. }
  2509. break;
  2510. case 'update': {
  2511. echo 'TODO: ' . __FUNCTION__ . '(update, '.$field_name.')';
  2512. return $value;
  2513. }
  2514. break;
  2515. default:
  2516. }
  2517. return $out;
  2518. }
  2519. function typespecial_CRM_TESTY__ID_ORGANIZER( $field_name, $cmd, $user_value, $attrs = array() ) {
  2520. static $_users_list;
  2521. if (!$_users_list) {
  2522. $_users_list = array();
  2523. Lib::loadClass('UsersHelper');
  2524. $params = array();
  2525. $params['ADM_ADMIN_LEVEL'] = 0;
  2526. $organizer_list = UsersHelper::get_users_list( $params, 100, 0, 'ADM_NAME', 'ASC' );
  2527. foreach ($organizer_list as $k => $v_organizer) {
  2528. $_users_list [$v_organizer->ID] = "" . $v_organizer->ADM_NAME . " (" . $v_organizer->ID . ")";
  2529. }
  2530. }
  2531. $out = '';
  2532. switch ($cmd) {
  2533. case 'show': {
  2534. $out .= '<select name="' . $field_name . '">';
  2535. $out .= ' <option value="">' . " " . '</option>';
  2536. foreach ($_users_list as $key => $val) {
  2537. $sel = ($user_value == $key)? ' selected="selected"' : '';
  2538. $out .= '<option value="' . $key . '"' . $sel . '>' . $val . '</option>';
  2539. }
  2540. $out .= '</select>';
  2541. }
  2542. break;
  2543. case 'search': {
  2544. $out .= '<select name="' . $field_name . '">';
  2545. $out .= ' <option value="'."%".'">' . " % " . '</option>';
  2546. foreach ($_users_list as $key => $val) {
  2547. $sel = ($user_value == $key)? ' selected="selected"' : '';
  2548. $out .= '<option value="' . $key . '"' . $sel . '>' . $val . '</option>';
  2549. }
  2550. $out .= '</select>';
  2551. }
  2552. break;
  2553. case 'update': {
  2554. echo 'TODO: ' . __FUNCTION__ . '(update, '.$field_name.')';
  2555. return $value;
  2556. }
  2557. break;
  2558. default:
  2559. }
  2560. return $out;
  2561. }
  2562. //2007-04-28 KOMENTARZ arek@tx.pl
  2563. //
  2564. // PROCES(X,Y)
  2565. // KROK_1 <-(CRM_WSKAZNIK)-----ZASOB(1)
  2566. // KROK_1 <-(CRM_WSKAZNIK)-----CZYNNOSC(1)
  2567. // KROK_2 <-(CRM_WSKAZNIK)-----ZASOB(2)
  2568. // KROK_2 <-(CRM_WSKAZNIK)--ZASOB(3)
  2569. // KROK_2 <-(CRM_WSKAZNIK)--CZYNNOSC(2)
  2570. // KROK_2 <-(CRM_WSKAZNIK)--ZASOB(4)
  2571. //
  2572. //
  2573. // dodatkowo ZASOBY i CZYNNOSCI maja miec strukture drzewa ID/PARENT_ID
  2574. // i przy rysowaniu procesu ma sie wyswietlac pelne drzewo
  2575. //
  2576. //
  2577. // czyli jest SERWER/DANE/arkusz_zalegllosci, uzyty do procesu windykacji, z flaga UZYWANIE
  2578. // a inny proces jest typu zasob=SERWER , ale uzyta jest flaga SERWIS
  2579. //
  2580. // czyli widac, ze jest serwer serwisowany, oraz kto go uzywa itp...
  2581. //
  2582. // trzeba bedzie dobrac odpowiednie flagi oraz odpowiednie elementy,
  2583. // i na tej podstawie opisac wszystkie zdarzenia w firmie i do nich wyrysowac procesy
  2584. // zobaczymy jak to sie ulozy organizacyjnie, bo w zasadzie moga wyjsc z tego niezle procedury
  2585. // w tym i do prowadzenia inwestycji i wszystkiego.
  2586. //Pozdro 600 , zrob do tego ladniejszy interfejs, zeby dalo sie ustalac strukture zasobow, czynnosci oraz procesow