ProcesEditor.php 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
  1. <?php
  2. Lib::loadClass('RouteBase');
  3. Lib::loadClass('ProcesHelper');
  4. Lib::loadClass('Config');
  5. Lib::loadClass('UI');
  6. Lib::loadClass('User');
  7. Lib::loadClass('Request');
  8. Lib::loadClass('Response');
  9. Lib::loadClass('Api_WfsNs');
  10. class Route_UrlAction_ProcesEditor extends RouteBase {// TODO: UrlActionBase @see Route_UrlAction
  11. public function getProcesListAjaxAction(){
  12. try {
  13. $rows = DB::getPDO()->fetchAll("
  14. SELECT * FROM `CRM_PROCES` WHERE FIND_IN_SET(`ID`, ( SELECT GROUP_CONCAT(Level SEPARATOR ',')
  15. FROM ( SELECT @Ids := ( SELECT GROUP_CONCAT(`ID` SEPARATOR ',') FROM `CRM_PROCES` WHERE FIND_IN_SET(`PARENT_ID`, @Ids)
  16. AND `TYPE` <> 'PROCES_INIT' ) Level FROM `CRM_PROCES` JOIN
  17. (SELECT @Ids := 0) temp1
  18. WHERE FIND_IN_SET(`PARENT_ID`, @Ids) ) temp2 ))
  19. AND `PARENT_ID` >= 0 AND `A_STATUS` <> 'DELETED'
  20. ");
  21. $state = array();
  22. foreach ($rows as $key => $value) {
  23. $id = intval($value["ID"]);
  24. $parent_id = intval($value["PARENT_ID"]);
  25. $state[$id]["ID"] = $value["ID"];
  26. $state[$id]["DESC"] = $value["DESC"];
  27. $state[$id]["OPIS"] = $value["OPIS"];
  28. $state[$id]["TYPE"] = $value["TYPE"];
  29. $state[$id]["IF_TRUE_GOTO"] = intval($value["IF_TRUE_GOTO"]);
  30. $state[$id]["IF_TRUE_GOTO_FLAG"] = $value["IF_TRUE_GOTO_FLAG"];
  31. $state[$id]["PARENT_ID"] = (intval($value["PARENT_ID"]) != 0) ? intval($value["PARENT_ID"]) : "#";
  32. $state[$id]["SORT_PRIO"] = $value["SORT_PRIO"];
  33. if (!isset($state[$id]["childs"])) $state[$id]["childs"] = array();
  34. if (!isset($state[$parent_id]["childs"])) $state[$parent_id]["childs"] = array();
  35. $temp = array();
  36. $temp["ID"] = $id;
  37. array_push($state[$parent_id]["childs"], $temp);
  38. }
  39. Response::sendJsonExit($state);
  40. } catch (Exception $e) {
  41. UI::alert('danger', "Error: " . $e->getMessage());
  42. }
  43. }
  44. public function getPathAjaxAction(){
  45. try {
  46. $video_id = V::get('id', 0, $_GET, 'int');
  47. $rows = DB::getPDO()->fetchAll("
  48. SELECT f.ID, f.DESC
  49. FROM (
  50. SELECT @id AS _id, (SELECT @id := PARENT_ID FROM CRM_PROCES WHERE ID = _id)
  51. FROM (SELECT @id := {$video_id}) tmp1
  52. JOIN CRM_PROCES ON @id <> 0
  53. ) tmp2
  54. JOIN CRM_PROCES f ON tmp2._id = f.ID
  55. ");
  56. $rows = array_reverse($rows);
  57. Response::sendJsonExit($rows);
  58. } catch (Exception $e) {
  59. UI::alert('danger', "Error: " . $e->getMessage());
  60. }
  61. }
  62. private function addWatermark($url){
  63. $watermark_file = "/Library/Server/Web/Data/Sites/Default/SE/stuff/images/play.png"; //to change
  64. $image = new Imagick();
  65. $image->readImage($url);
  66. $watermark = new Imagick();
  67. $watermark->readImage($watermark_file);
  68. $image->resizeImage(500,500,Imagick::FILTER_LANCZOS,1);
  69. $image->compositeImage($watermark, imagick::COMPOSITE_OVER, 0, 0);
  70. $image->writeImage($url);
  71. $image->clear();
  72. $image->destroy();
  73. $watermark->clear();
  74. $watermark->destroy();
  75. }
  76. public function uploadVideoAction() {
  77. if (!User::logged()) return;
  78. $CRM_VIDEO = "/Library/Server/Web/Data/Sites/Default/PLIKI/bartosz_procesy5_pl/CRM_VIDEO/";
  79. $url = $_FILES["files"]["tmp_name"][0];
  80. $size = $_FILES["files"]["size"][0];
  81. $name = $_FILES["files"]["name"][0];
  82. $finfo = new finfo(FILEINFO_MIME_TYPE);
  83. $type = $finfo->file($url);
  84. $ext = pathinfo($name, PATHINFO_EXTENSION);
  85. $imgExtList = array("image/png", "image/jpeg");
  86. $vidExtList = array("video/mp4");
  87. $info;
  88. $statement = DB::getPDO()->prepare("INSERT INTO CRM_IMAGE(NAME, TYPE, REMOTE_TABLE, REMOTE_ID, IMAGE, SIZE)
  89. VALUES(:NAME, :TYPE, :REMOTE_TABLE, :REMOTE_ID, :IMAGE, :SIZE)");
  90. if(in_array($type, $imgExtList)){
  91. $content = 'data:'.$type.';base64,'.base64_encode(file_get_contents($url));//
  92. $statement->execute(array(
  93. ":NAME" => $name,
  94. ":TYPE" => $type,
  95. ":REMOTE_TABLE" => "ADMIN_USERS",
  96. ":REMOTE_ID" => User::getID(),
  97. ":IMAGE" => $content,
  98. ":SIZE" => $size
  99. ));
  100. $info->statusCode = 0;
  101. $info->statusText = "Plik załadowany pomyślnie" ;
  102. }else if(false && in_array($type, $vidExtList)){ //Only image files
  103. $statement_video = DB::getPDO()->prepare("INSERT INTO CRM_VIDEO(NAME, TYPE, REMOTE_TABLE, REMOTE_ID, PARENT_ID, HAS_FILE, EXT, VIDEO_START, VIDEO_END)
  104. VALUES(:NAME, :TYPE, :REMOTE_TABLE, :REMOTE_ID, :PARENT_ID, :HAS_FILE, :EXT, :VIDEO_START, :VIDEO_END)");
  105. $cmd_duration = "/usr/local/bin/ffmpeg -i ".$url." 2>&1 | grep \"Duration\" | cut -d, -f1 | sed 's#Duration\:##' | sed 's# ##' | cut -d. -f1";
  106. $str_time = exec($cmd_duration);
  107. $str_time = preg_replace("/^([\d]{1,2})\:([\d]{2})$/", "00:$1:$2", $str_time);
  108. sscanf($str_time, "%d:%d:%d", $hours, $minutes, $seconds);
  109. $time_seconds = $hours * 3600 + $minutes * 60 + $seconds;
  110. $statement_video->execute(array(
  111. ":NAME" => $name,
  112. ":TYPE" => $type,
  113. ":REMOTE_TABLE" => "ADMIN_USERS",
  114. ":PARENT_ID" => 0,
  115. ":REMOTE_ID" => User::getID(),
  116. ":EXT" => $ext,
  117. ":HAS_FILE" => 1,
  118. ":VIDEO_START" => 0,
  119. ":VIDEO_END" => $time_seconds,
  120. ));
  121. $id = DB::getPDO()->lastInsertId();
  122. $temp_file = tempnam(sys_get_temp_dir(), 'thumbnail_');
  123. rename($temp_file, $temp_file .= '.png');
  124. $cmd = '/usr/local/bin/ffmpeg -y -i '.$url.' -ss 00:00:1 -vframes 1 '.$temp_file.' 2>&1';
  125. shell_exec($cmd);
  126. $this->addWatermark($temp_file);
  127. $img_content = 'data:'."image/png".';base64,'.base64_encode(file_get_contents($temp_file));
  128. $img_size = filesize($temp_file);
  129. $statement->execute(array(
  130. ":NAME" => "Miniaturka dla ".$name,
  131. ":TYPE" => "image/png",
  132. ":REMOTE_TABLE" => "CRM_VIDEO",
  133. ":REMOTE_ID" => $id,
  134. ":IMAGE" => $img_content,
  135. ":SIZE" => $img_size
  136. ));
  137. move_uploaded_file ( $url, $CRM_VIDEO.$id.".".$ext );
  138. $info->statusCode = 0;
  139. $info->statusText = "Plik załadowany pomyślnie" ;
  140. }else{
  141. $info->statusCode = 1;
  142. $info->statusText = "Nieobsługiwany format pliku ".$type ;
  143. }
  144. Response::sendJsonExit($info);
  145. }
  146. public function getVideoFileAjaxAction(){
  147. try {
  148. $video_id = V::get('id', 0, $_GET, 'int');
  149. if ($video_id <= 0) throw new Exception("ID is not set.");
  150. $sqlVideoId = DB::getPDO()->quote($video_id, PDO::PARAM_INT);
  151. $rows = DB::getPDO()->fetchAll("
  152. SELECT f.VIDEO_ID
  153. FROM (
  154. SELECT @id AS _id, (SELECT @id := PARENT_ID FROM CRM_VIDEO WHERE VIDEO_ID = _id)
  155. FROM (SELECT @id := {$sqlVideoId}) tmp1
  156. JOIN CRM_VIDEO ON @id <> 0
  157. ) tmp2
  158. JOIN CRM_VIDEO f ON tmp2._id = f.VIDEO_ID
  159. WHERE f.HAS_FILE = 1 and f.TYPE = 'video/mp4'
  160. ");
  161. $rows_time = DB::getPDO()->fetchAll("
  162. SELECT `VIDEO_START`, `VIDEO_END` FROM `CRM_VIDEO` WHERE `VIDEO_ID` = {$sqlVideoId}
  163. ");
  164. $id = $rows[0]["VIDEO_ID"];
  165. $CRM_VIDEO = "/PLIKI/bartosz_procesy5_pl/CRM_VIDEO/";
  166. $result["src"] = $CRM_VIDEO.$id.".mp4";
  167. $result["VIDEO_START"] = $rows_time[0]["VIDEO_START"];
  168. $result["VIDEO_END"] = $rows_time[0]["VIDEO_END"];
  169. Response::sendJsonExit($result);
  170. } catch (Exception $e) {
  171. UI::alert('danger', "Error: " . $e->getMessage());
  172. }
  173. }
  174. public function getThumbnailAjaxAction($video_id = -1){
  175. try {
  176. $doReturn = false;
  177. if($video_id <= 0)
  178. $video_id = V::get('id', 0, $_GET, 'int');
  179. else
  180. $doReturn = true;
  181. if ($video_id <= 0) throw new Exception("ID is not set.");
  182. $sqlVideoId = DB::getPDO()->quote($video_id, PDO::PARAM_INT);
  183. $rows = DB::getPDO()->fetchAll("
  184. SELECT f.VIDEO_ID
  185. FROM (
  186. SELECT @id AS _id, (SELECT @id := PARENT_ID FROM CRM_VIDEO WHERE VIDEO_ID = _id)
  187. FROM (SELECT @id := {$sqlVideoId}) tmp1
  188. JOIN CRM_VIDEO ON @id <> 0
  189. ) tmp2
  190. JOIN CRM_VIDEO f ON tmp2._id = f.VIDEO_ID
  191. WHERE f.PARENT_ID = 0
  192. ");
  193. if(isset($rows[0]["VIDEO_ID"])){
  194. $video_parent_id = $rows[0]["VIDEO_ID"];
  195. $sqlVideoParentId = DB::getPDO()->quote($video_parent_id , PDO::PARAM_INT);
  196. $rows = DB::getPDO()->fetchAll("
  197. SELECT * FROM CRM_IMAGE WHERE REMOTE_TABLE = 'CRM_VIDEO' AND REMOTE_ID = {$sqlVideoParentId}
  198. ");
  199. if($doReturn)
  200. return $rows;
  201. else
  202. Response::sendJsonExit($rows);
  203. }
  204. } catch (Exception $e) {
  205. UI::alert('danger', "Error: " . $e->getMessage());
  206. }
  207. }
  208. public function getVideosClipboardAjaxAction(){
  209. try {
  210. $id = User::getID();
  211. if ($id <= 0) throw new Exception("ID is not set.");
  212. $sqlId = DB::getPDO()->quote($id, PDO::PARAM_INT);
  213. $rows = DB::getPDO()->fetchAll("
  214. SELECT *
  215. FROM CRM_VIDEO
  216. WHERE REMOTE_TABLE = 'ADMIN_USERS' and REMOTE_ID = {$sqlId}
  217. ");
  218. foreach($rows as $key=>$value){
  219. $rows[$key]["THUMBNAIL"] = $this->getThumbnailAjaxAction($value["VIDEO_ID"])[0];
  220. }
  221. Response::sendJsonExit($rows);
  222. } catch (Exception $e) {
  223. UI::alert('danger', "Error: " . $e->getMessage());
  224. }
  225. }
  226. public function getResByParentAjaxAction() {
  227. try {
  228. $idParent = V::get('parent_id', 0, $_GET, 'int');
  229. if ($idParent <= 0) throw new Exception("ID is not set.");
  230. $sqlIdParent = DB::getPDO()->quote($idParent, PDO::PARAM_INT);
  231. $rows = DB::getPDO()->fetchAll("
  232. select g.*, p1.ID as p1_ID, p1.DESC as p1_DESC,p2.ID as p2_ID, p2.DESC as p2_DESC, p3.ID as p3_ID, p3.DESC as p3_DESC
  233. from CRM_LISTA_ZASOBOW g
  234. left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
  235. left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
  236. left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
  237. where g.`PARENT_ID` = {$sqlIdParent}
  238. ORDER BY g.SORT_PRIO ASC, g.ID DESC
  239. ");
  240. Response::sendJsonExit($rows);
  241. } catch (Exception $e) {
  242. UI::alert('danger', "Error: " . $e->getMessage());
  243. }
  244. }
  245. public function getResTreeAjaxAction() {
  246. try {
  247. $id = V::get('id', '', $_GET);
  248. $sql = "
  249. select p1.ID as p1_ID, p1.DESC as p1_DESC,p2.ID as p2_ID, p2.DESC as p2_DESC, p3.ID as p3_ID, p3.DESC as p3_DESC
  250. from CRM_LISTA_ZASOBOW g
  251. left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
  252. left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
  253. left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
  254. where g.`A_STATUS` not in ('DELETED')
  255. and (p1.ID is null or p1.`A_STATUS` not in ('DELETED'))
  256. and (p2.ID is null or p2.`A_STATUS` not in ('DELETED'))
  257. and (p3.ID is null or p3.`A_STATUS` not in ('DELETED'))
  258. and g.ID = {$id}
  259. limit 1
  260. ";
  261. DBG::_('DBG_SQL', '>1', 'sql', $sql, __CLASS__, __FUNCTION__, __LINE__);
  262. $rows = DB::getPDO()->fetchAll($sql);
  263. Response::sendJsonExit($rows);
  264. } catch (Exception $e) {
  265. UI::alert('danger', "Error: " . $e->getMessage());
  266. }
  267. }
  268. public function getResAjaxAction() {
  269. try {
  270. $word = V::get('word', '', $_GET);
  271. $filter = isset($_GET['filter']) ? (int)$_GET['filter'] : 0;
  272. $sqlFilter = "";
  273. if (!empty($word)) {
  274. $sqlWord = DB::getPDO()->quote("%{$word}%", PDO::PARAM_STR);
  275. if (is_numeric($word)) {
  276. $sqlFilter .= "AND (g.`DESC` LIKE {$sqlWord} OR g.`ID` LIKE {$sqlWord})" . "\n";
  277. } else {
  278. $sqlFilter .= "AND g.`DESC` LIKE {$sqlWord}" . "\n";
  279. }
  280. }
  281. switch ($filter) {
  282. case 2: $sqlFilter .= "AND (g.`TYPE` = 'TABELA' OR g.`TYPE` = 'KOMORKA')" . "\n"; break;
  283. case 1: $sqlFilter .= "AND (g.`TYPE` = 'STANOWISKO' OR g.`TYPE` = 'DZIAL' OR g.`TYPE` = 'PODMIOT')" . "\n"; break;
  284. }
  285. $sql = "
  286. select g.*, p1.ID as p1_ID, p1.DESC as p1_DESC,p2.ID as p2_ID, p2.DESC as p2_DESC, p3.ID as p3_ID, p3.DESC as p3_DESC
  287. from CRM_LISTA_ZASOBOW g
  288. left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
  289. left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
  290. left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
  291. where g.`A_STATUS` not in ('DELETED')
  292. and (p1.ID is null or p1.`A_STATUS` not in ('DELETED'))
  293. and (p2.ID is null or p2.`A_STATUS` not in ('DELETED'))
  294. and (p3.ID is null or p3.`A_STATUS` not in ('DELETED'))
  295. {$sqlFilter}
  296. limit 100
  297. ";
  298. DBG::_('DBG_SQL', '>1', 'sql', $sql, __CLASS__, __FUNCTION__, __LINE__);
  299. $rows = DB::getPDO()->fetchAll($sql);
  300. Response::sendJsonExit($rows);
  301. } catch (Exception $e) {
  302. UI::alert('danger', "Error: " . $e->getMessage());
  303. }
  304. }
  305. public function getSingleResAjaxReponseCallback() {
  306. if (!isset($_POST['data'])) throw new Exception("data is not set.");
  307. $ids = V::get('data', null, $_POST, 'uint_array');
  308. if (empty($ids)) throw new Exception("data is not correct.");
  309. $sqlWhereIdIn = array();
  310. foreach ($ids as $value) {
  311. $sqlWhereIdIn[] = DB::getPDO()->quote($value, PDO::PARAM_INT);
  312. }
  313. $sqlWhereIdIn = "g.ID in(" . implode(", ", $sqlWhereIdIn) . ")";
  314. $rows = DB::getPDO()->fetchAll("
  315. select g.*, p1.ID as p1_ID, p1.DESC as p1_DESC,p2.ID as p2_ID, p2.DESC as p2_DESC, p3.ID as p3_ID, p3.DESC as p3_DESC
  316. from CRM_LISTA_ZASOBOW g
  317. left join CRM_LISTA_ZASOBOW p1 on(p1.ID = g.PARENT_ID)
  318. left join CRM_LISTA_ZASOBOW p2 on(p2.ID = p1.PARENT_ID)
  319. left join CRM_LISTA_ZASOBOW p3 on(p3.ID = p2.PARENT_ID)
  320. where {$sqlWhereIdIn}
  321. ");
  322. return $rows;
  323. }
  324. public function getSingleResAjaxAction() {
  325. Response::sendTryCatchJson(array($this, 'getSingleResAjaxReponseCallback'));
  326. }
  327. public function handleAuth() {
  328. if (!User::logged()) {
  329. //throw new HttpException('Unauthorized', 401);
  330. User::authByRequest();
  331. }
  332. // zapisać jsona w sesji
  333. }
  334. public function reinstallAction(){
  335. DB::getPDO()->execSql("
  336. CREATE TABLE IF NOT EXISTS `CRM_IMAGE` (
  337. `ID` int(11) NOT NULL,
  338. `NAME` varchar(50) NOT NULL,
  339. `SIZE` int(11) NOT NULL,
  340. `TYPE` varchar(25) NOT NULL,
  341. `IMAGE` mediumblob NOT NULL,
  342. `ICON` tinyblob,
  343. `WIDTH` int(11) NOT NULL,
  344. `HEIGHT` int(11) NOT NULL,
  345. `REMOTE_TABLE` enum('CRM_LISTA_ZASOBOW','CRM_PROCES','CRM_WSKAZNIK','ADMIN_USERS','CRM_VIDEO') NOT NULL,
  346. `REMOTE_ID` int(11) NOT NULL,
  347. `DEST` varchar(16) NOT NULL,
  348. `A_CREATE_DATE` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  349. `A_RECORD_CREATE_AUTHOR` varchar(100) NOT NULL,
  350. `SYNC_SQIX_STATUS` varchar(255) NOT NULL,
  351. `A_RECORD_CREATE_DATE` varchar(20) NOT NULL DEFAULT '0000-00-00 00:00:00',
  352. `A_RECORD_UPDATE_DATE` varchar(255) NOT NULL,
  353. `A_RECORD_UPDATE_AUTHOR` varchar(50) NOT NULL
  354. ) ENGINE=MyISAM DEFAULT CHARSET=latin2
  355. ");
  356. try {
  357. DB::getPDO()->execSql("
  358. ALTER table `CRM_IMAGE` CHANGE `REMOTE_TABLE` `REMOTE_TABLE` enum('CRM_LISTA_ZASOBOW','CRM_PROCES','CRM_WSKAZNIK','ADMIN_USERS','CRM_VIDEO') NOT NULL
  359. ");
  360. } catch (Exception $e) {
  361. DBG::log($e);
  362. }
  363. }
  364. public function defaultAction() {
  365. UI::gora();
  366. UI::menu();
  367. try {
  368. $id = V::get('id', 0, $_REQUEST, 'int');
  369. if ($id <= 0) $id = -1;
  370. if($id >= 0)
  371. UI::setTitleJsTag("Edytor Procesu {{$id}}");
  372. else
  373. UI::setTitleJsTag("Tworzenie nowego procesu}");
  374. $this->showEditor($id);
  375. } catch (Exception $e) {
  376. UI::alert('danger', "Error: " . $e->getMessage());
  377. }
  378. UI::dol();
  379. }
  380. public function showEditor($id) {
  381. echo '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/9.8.1/css/bootstrap-slider.min.css" crossorigin="anonymous">';
  382. echo '<link rel="stylesheet" type="text/css" href="static/sweetalert2.min.css">';
  383. echo '<link rel="stylesheet" href="static/jstree-theme/style.min.css" />';
  384. echo '<script src="static/jstree.min.js"></script>';
  385. $this->showEditorCss();
  386. ?>
  387. <div id="wrapper" class="toggled" style="overflow:hidden">
  388. <div id='sidebar-wrapper'><div id="side"></div></div>
  389. <div id='page-content-wrapper'>
  390. <div id="left">
  391. <button class='lButton btn btn-default' id="btnZasoby" style="top:150px"><p>Zasoby</p></button>
  392. <button class='lButton btn btn-default' style="top:315px" id="btnProcesy"><p>Procesy</p></button>
  393. <button class='lButton btn btn-default' id="btnPhotos" style="top:480px"><p>Media</p></button>
  394. </div>
  395. <div class=col-md-12 >
  396. <div class=col-md-12 ><a id=toggleMenu style=cursor:pointer;>Przełącz menu</a>
  397. </div>
  398. <hr>
  399. <div class="col-md-12 path" style=border-width:1px;text-align:center;>
  400. </div>
  401. </div>
  402. <div id="main" style="margin-left:40px">
  403. <center>Uruchamianie aplikacji.</center>
  404. </div>
  405. </div>
  406. </div>
  407. <script>var USER_ID = '<?= User::getID(); ?>';var BASE_URL = '<?= Request::getPathUri(); ?>';var BASE_WFS_URL = '<?= Api_WfsNs::getBaseWfsUri(); ?>';var mainProces_id = <?= $id; ?>;</script>
  408. <script src="static/sweetalert2.min.js"></script>
  409. <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-slider/9.8.1/bootstrap-slider.min.js" crossorigin="anonymous"></script>
  410. <script src="static/videoPlayer.js?v=?<?php echo time(); if (V::get('DBG', '', $_GET)) echo "&_time=" . time(); ?>"></script>
  411. <script src="static/jquery.fileupload.js"></script>
  412. <script src="static/procesEditor.js?<?php echo time(); if (V::get('DBG', '', $_GET)) echo "&_time=" . time(); ?>"></script>
  413. <?php
  414. }
  415. public function showEditorCss() {
  416. ?>
  417. <style type="text/css">
  418. #p5BModalBack{
  419. width:100%;
  420. position:fixed;
  421. height:100%;
  422. background-color:rgba(0,0,0,0.9);
  423. z-index:2000;
  424. text-align:center;
  425. }
  426. .p5BModalModal{
  427. display: inline-block;
  428. width:800px;
  429. opacity:1;
  430. box-shadow:0 5px 15px rgba(0,0,0,.5);
  431. background-color:white;
  432. -webkit-background-clip: padding-box;
  433. background-clip: padding-box;
  434. border: 1px solid #999;
  435. border: 1px solid rgba(0,0,0,.2);
  436. border-radius: 6px;
  437. outline: 0;
  438. }
  439. .p5BModalContent{
  440. text-align:left;
  441. padding:5px;
  442. }
  443. #pathList{
  444. min-height:400px;
  445. max-height:650px;
  446. overflow-y:scroll;
  447. overflow-x:hidden;
  448. }
  449. .p5BModalHeader{
  450. text-align:left;
  451. font-size: 18px;
  452. margin-bottom: 10px;
  453. font-family: inherit;
  454. font-weight: 500;
  455. cursor:move;
  456. height:30px;
  457. border-bottom:1px solid silver;
  458. font-size:1.5em;
  459. padding-left:10px;
  460. }
  461. .p5BModalHeader span{
  462. display:inline-block;
  463. padding-top:5px;
  464. }
  465. .p5BModalHeader div{
  466. font-family:verdana;
  467. float:right;
  468. padding-top:5px;
  469. cursor:pointer;
  470. border-color:black;
  471. font-weight:bold;
  472. padding-right:10px;
  473. padding-top:6px;
  474. color:gray;
  475. height:100%;
  476. padding-left:7px;
  477. border-top-left-radius:3px;
  478. border-bottom-left-radius:3px;
  479. font-size:0.9em;
  480. }
  481. .p5BModalHeader div:hover{
  482. color:#e74c3c;
  483. }
  484. .hide{
  485. display:none;
  486. }
  487. .p5BModalButton{
  488. float:right;
  489. margin:3px;
  490. }
  491. .pathList{
  492. max-height:700px;
  493. min-height:300px;
  494. overflow-y:scroll;
  495. }
  496. .activeDrop{
  497. background-color:#f1f1f1;
  498. }
  499. .treeInfo{
  500. overflow: hidden;
  501. text-align: right;
  502. display:inline-block;
  503. color:grey;
  504. font-size:0.9em;
  505. white-space: nowrap;
  506. max-width: 90%;
  507. }
  508. .treeInfo div{
  509. float:right;
  510. }
  511. #left{
  512. padding:0px;
  513. }
  514. .sDescAdd, .hDescAdd, .step{
  515. padding-left:10px;
  516. }
  517. #clipboard{
  518. color:black;
  519. }
  520. .no-draggable .dragIcon{
  521. display:none;
  522. }
  523. .no-draggable .imgTitle{
  524. cursor:auto !important;
  525. }
  526. .attImg, .attVid{
  527. position:relative;
  528. display:inline-block;
  529. margin-top:5px;
  530. margin-left:10px;
  531. }
  532. .attImg .img, .attVid .img{
  533. height:100%;
  534. display: flex;
  535. position:relative;
  536. background-color:black;
  537. vertical-align: middle;
  538. }
  539. .attImg img, .attVid img{
  540. align-items: stretch;
  541. max-width:100%;
  542. width: auto;
  543. height: auto;
  544. }
  545. .attImg .imgTitle, .attVid .imgTitle{
  546. background-color:white;
  547. cursor: move;
  548. text-align:left;
  549. }
  550. .remImg{
  551. cursor:pointer;
  552. padding-left:2px;
  553. padding-right:3px;
  554. }
  555. .noRemove .remImg{
  556. display:none;
  557. }
  558. .remImg:hover{
  559. color:red;
  560. }
  561. .attImg div, .attVid div{
  562. font-family:tahoma;
  563. text-align:center;
  564. }
  565. .lButton{
  566. -webkit-transform: translate3d(0,0,0);
  567. position:fixed;
  568. padding:0px;
  569. outline:none;
  570. margin:0px;
  571. width: 40px;
  572. height:160px;
  573. z-index:30;
  574. border-top-left-radius: 0px;
  575. border-bottom-left-radius: 0px;
  576. }
  577. .lButton p
  578. {
  579. margin-bottom:-50px;
  580. -moz-transform:rotate(-90deg);
  581. -ms-transform:rotate(-90deg);
  582. -o-transform:rotate(-90deg);
  583. -webkit-transform:rotate(-90deg);
  584. }
  585. .ico {
  586. margin-top: 3px;
  587. margin-left: 5px;
  588. cursor: pointer;
  589. }
  590. #wrapper {
  591. padding-left: 0;
  592. -webkit-transition: all 0.5s ease;
  593. -moz-transition: all 0.5s ease;
  594. -o-transition: all 0.5s ease;
  595. transition: all 0.5s ease;
  596. }
  597. #wrapper.toggled {
  598. padding-left: 600px;
  599. }
  600. #wrapper #left { width:40px }
  601. #wrapper #left .lButton {
  602. width:40px;
  603. -webkit-transition: all 0.5s ease;
  604. -moz-transition: all 0.5s ease;
  605. -o-transition: all 0.5s ease;
  606. transition: all 0.5s ease;
  607. }
  608. #wrapper.toggled #left .lButton { width:39px }
  609. #side {
  610. padding: 15px;
  611. height: 100%;
  612. border-top-style:solid;
  613. border-top-width:1px;
  614. border-right-style: solid;
  615. border-color: #A61C2E;
  616. border-width: 2px;
  617. }
  618. ul {
  619. list-style: none;
  620. }
  621. #advCon{
  622. width:870px;
  623. min-width:100%;
  624. }
  625. .detailsTable{
  626. color:grey;
  627. float:left;
  628. display:inline;
  629. text-align:center;
  630. margin-left:5px;
  631. height:23px;
  632. }
  633. .tree{
  634. color:grey;
  635. text-overflow:ellipsis;
  636. white-space:nowrap;
  637. overflow:hidden;
  638. display:block;
  639. cursor:pointer;
  640. }
  641. .detailsTable2{
  642. color:grey;
  643. display:block;
  644. font-size:0.8em;
  645. text-align:left;
  646. margin-left:5px;
  647. height:23px;
  648. }
  649. .textTable{
  650. float:left;
  651. width:200px;
  652. text-overflow:ellipsis;
  653. white-space:nowrap;
  654. overflow:hidden;
  655. cursor:pointer;
  656. display:inline-block;
  657. }
  658. #dropPic{
  659. height:250px;
  660. border-radius:5px;
  661. border-style:solid;
  662. border-color:#ededed;
  663. background-color: #fbfbfb;
  664. border-width:1px;
  665. }
  666. .incorrect{
  667. border-style:solid !important;
  668. border-color:#e74c3c !important;
  669. }
  670. .focused{
  671. border-style:solid !important;
  672. border-color:#3498db !important;
  673. }
  674. /* skin.css Style*/
  675. #inp {
  676. height: 100px;
  677. border-width: 2px;
  678. margin-bottom: 0px;
  679. color: #ccc;
  680. border-style: dashed;
  681. border-color: #ccc;
  682. line-height: 100px;
  683. text-align: center;
  684. display:block;
  685. width:100%;
  686. }
  687. .upload-drop-zone.drop {
  688. color: #222;
  689. border-color: #222;
  690. }
  691. .anim-refresh {
  692. -animation: spin .7s infinite linear;
  693. -webkit-animation: spin2 .7s infinite linear;
  694. }
  695. @-webkit-keyframes spin2 {
  696. from { -webkit-transform: rotate(0deg);}
  697. to { -webkit-transform: rotate(360deg);}
  698. }
  699. @keyframes spin {
  700. from { transform: scale(1) rotate(0deg);}
  701. to { transform: scale(1) rotate(360deg);}
  702. }
  703. .list-group-item{
  704. cursor:pointer;
  705. }
  706. .list-group-item:hover{
  707. background-color:#eeeeee;
  708. }
  709. .list-group-item:hover .glyphicon{
  710. opacity:1 !important;
  711. }
  712. .textTable2{
  713. float:left;
  714. width:230px;
  715. text-overflow:ellipsis;
  716. white-space:nowrap;
  717. overflow:hidden;
  718. cursor:pointer;
  719. display:inline-block;
  720. }
  721. .pbody{
  722. padding-left:20px;
  723. padding-right:20px;
  724. text-align:justify;
  725. }
  726. .singleAdv{
  727. float:left;
  728. height:100%;
  729. width:290px;
  730. }
  731. #side #adv{
  732. }
  733. #side #ulcon, #side #ulproc, #side #adv {
  734. background-color: white;
  735. overflow-y: scroll;
  736. height: 70% !important;
  737. border-style:solid;
  738. border-width:1px;
  739. border-color:grey;
  740. margin-top: 10px;
  741. border-radius: 5px;
  742. padding-bottom: 10px;
  743. border-style: solid;
  744. border-width: 1px;
  745. border-color: #e5e5e5;
  746. color: black;
  747. padding-left: 0px;
  748. font-family: tahoma;
  749. font-size: 13px;
  750. }
  751. .selectedAdv{
  752. background-color:#e4e4e4;
  753. }
  754. .selectedAdv:hover{
  755. background-color:#e4e4e4;
  756. }
  757. #side .dragStyle {
  758. padding-left: 8px;
  759. padding-top: 4px;
  760. padding-bottom: 4px;
  761. border-bottom-style: dotted;
  762. border-width: 1px;
  763. cursor: pointer;
  764. border-color: #e5e5e5;
  765. background-color: white;
  766. display: block;
  767. }
  768. #side .showMore {
  769. padding-left: 2px;
  770. padding-top: 4px;
  771. padding-bottom: 4px;
  772. border-width: 1px;
  773. border-color: #e5e5e5;
  774. }
  775. #side .gIco {
  776. padding-left: 2px;
  777. padding-top: 4px;
  778. padding-bottom: 4px;
  779. border-width: 1px;
  780. border-color: #e5e5e5;
  781. cursor: pointer;
  782. }
  783. #side .hov,
  784. #side .grad {
  785. cursor: pointer;
  786. }
  787. .vakata-context {
  788. z-index:3000 !important;
  789. }
  790. #side .click {
  791. float: left;
  792. color: grey;
  793. font-size: 10px;
  794. cursor: pointer;
  795. }
  796. .delRes,
  797. .btnEdit,
  798. .hdesc,
  799. .sdesc {
  800. cursor: pointer;
  801. }
  802. .goto{
  803. padding-left:10px;
  804. }
  805. .imagesDrop{
  806. border-style:dashed;
  807. border-width:1px;
  808. border-color:#bdc3c7;
  809. }
  810. .sdesc{
  811. min-height:20px;
  812. }
  813. #side .tabelaName {
  814. white-space: nowrap;
  815. margin-right: 10px;
  816. overflow: hidden;
  817. width: 350px;
  818. float: left;
  819. text-overflow: ellipsis;
  820. display: block;
  821. cursor: pointer;
  822. }
  823. #side .hov:hover {
  824. background-color: #e5e5e5;
  825. }
  826. #sidebar-wrapper {
  827. position: fixed;
  828. left: 600px;
  829. width: 0;
  830. height: 100%;
  831. color: white;
  832. margin-left: -600px;
  833. overflow-y: auto;
  834. background: #222;
  835. -webkit-transition: all 0.5s ease;
  836. -moz-transition: all 0.5s ease;
  837. -o-transition: all 0.5s ease;
  838. transition: all 0.5s ease;
  839. }
  840. #wrapper.toggled #sidebar-wrapper {
  841. width: 600px;
  842. }
  843. #page-content-wrapper {
  844. width: 100%;
  845. position: absolute;
  846. z-index:0 !important;
  847. padding-top: 15px;
  848. padding-left:0px !important;
  849. }
  850. #wrapper.toggled #page-content-wrapper {
  851. position: absolute;
  852. margin-right: -600px;
  853. }
  854. #wrapper {
  855. padding-left: 600px;
  856. }
  857. #wrapper.toggled {
  858. padding-left: 0 !important;
  859. }
  860. #sidebar-wrapper {
  861. width: 600px;
  862. }
  863. #wrapper.toggled #sidebar-wrapper {
  864. width: 0 !important;
  865. }
  866. #page-content-wrapper {
  867. padding: 20px;
  868. position: relative;
  869. }
  870. #wrapper.toggled #page-content-wrapper {
  871. position: relative;
  872. margin-right: 0;
  873. }
  874. .drop {
  875. margin-top: 10px;
  876. }
  877. .sdesc{
  878. margin-bottom:10px;
  879. }
  880. .hdesc textarea,
  881. .sdesc textarea {
  882. min-width: 100%;
  883. padding: 10px;
  884. }
  885. .step,
  886. .sDescAdd {
  887. margin-top:5px;
  888. color: grey;
  889. cursor: pointer;
  890. display:block;
  891. font-size:10px;
  892. }
  893. .sDescAdd:hover{
  894. color:black;
  895. }
  896. .goto{
  897. }
  898. .editGoto{
  899. cursor:pointer;
  900. }
  901. .sdesc {
  902. display: block;
  903. }
  904. .hDescAdd {
  905. cursor: pointer;
  906. }
  907. #saveBtn {} .changable {
  908. padding-left: 10px;
  909. }
  910. .export{
  911. min-height:200px;
  912. }
  913. .changed {
  914. border-left-style: solid;
  915. border-width: 3px;
  916. border-color: #ffc107;
  917. padding-left: 7px;
  918. }
  919. .del {
  920. }
  921. .liRes:hover{
  922. background-color:#fafafa;
  923. }
  924. span.glyphicon{
  925. opacity:0.6;
  926. cursor:pointer;
  927. margin-left:3px;
  928. }
  929. span.glyphicon:hover{
  930. opacity:1;
  931. }
  932. .delRes:hover{
  933. color:red;
  934. }
  935. .delGoto:hover{
  936. color:red;
  937. cursor:pointer;
  938. }
  939. .del:hover{
  940. color:red;
  941. }
  942. .ids {
  943. color: grey;
  944. font-size: 12px;
  945. }
  946. .more {
  947. margin-left: 15px;
  948. }
  949. .resSelected {
  950. background-color: #d3d3d3;
  951. }
  952. .slider .slider-handle {
  953. background-color: red;
  954. width: 8px;
  955. margin-left: -4px !important;
  956. }
  957. .slider .slider-handle {} .p5VideoPlayer_vid {
  958. background-color: black;
  959. height: 100%;
  960. width: 100%;
  961. }
  962. .p5VideoPlayer {
  963. width:100%;
  964. height:calc(100% - 18px);
  965. }
  966. .p5VideoPlayer .ico {
  967. font-size: 12px;
  968. margin-left: 4px;
  969. margin-right: 4px;
  970. cursor: pointer;
  971. opacity: 0.8;
  972. }
  973. .ico:hover {
  974. opacity: 1;
  975. }
  976. .p5VideoPlayer_video-controls {
  977. background-color: powderblue;
  978. position:relative;
  979. }
  980. .p5VideoPlayer_video-controls:not(.p5VideoPlayer_video-controls-fs) {
  981. top:-25px;
  982. }
  983. .p5VideoPlayer_video-controls .only_fullscreen{
  984. display:none;
  985. }
  986. .p5VideoPlayer_video-controls-fs .only_fullscreen{
  987. display:table-cell;
  988. }
  989. .p5VideoPlayer_video-controls-fs {
  990. opacity: 0;
  991. position: absolute;
  992. bottom: 0;
  993. left: 0;
  994. right: 0;
  995. color: white;
  996. font-size: .8em;
  997. color:black;
  998. width: 100%;
  999. height: 20px;
  1000. z-index: 2147483647;
  1001. }
  1002. .p5VideoPlayer:hover .p5VideoPlayer_video-controls-fs {
  1003. opacity: 1;
  1004. }
  1005. .p5VideoPlayer_video-controls td {
  1006. padding: 0px;
  1007. padding-left:5px;
  1008. padding-right:5px;
  1009. }
  1010. .p5VideoPlayer_video-controls .slider {
  1011. width: 100%;
  1012. }
  1013. .przycinanie .slider {
  1014. width: 100%;
  1015. }
  1016. .slider .slider-selection {
  1017. background: #01b7ce;
  1018. }
  1019. video::-webkit-media-controls {
  1020. display: none !important;
  1021. }
  1022. video::-webkit-media-controls-enclosure {
  1023. display: none !important;
  1024. }
  1025. </style>
  1026. <?php
  1027. }
  1028. }