asusg_gantt2.php 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899
  1. <?php
  2. defined('YII_DEBUG') or define('YII_DEBUG', true);
  3. defined('YII_ENV') or define('YII_ENV', 'dev');
  4. require __DIR__ . '/api/vendor/autoload.php';
  5. require __DIR__ . '/api/vendor/yiisoft/yii2/Yii.php';
  6. $config = require __DIR__ . '/api/config/web.php';
  7. (new yii\web\Application($config));
  8. require_once "doctrine/bootstrap.php";
  9. include 'CheckPoint.php';
  10. include 'CheckPointType.php';
  11. use CheckPoints\CheckPoint;
  12. use CheckPointTypes\CheckPointType;
  13. header("Expires: 0");
  14. header("Content-Type: text/html; charset=utf-8");
  15. session_start();
  16. require_once 'PHPExcel-1.8.2/Classes/PHPExcel.php';
  17. $url = explode('?',$_SERVER["REQUEST_URI"])[0];
  18. if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 6000)) {
  19. // last request was more than 30 minutes ago
  20. session_unset(); // unset $_SESSION variable for the run-time
  21. session_destroy(); // destroy session data in storage
  22. }
  23. $_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp
  24. $add = 'Login Area';
  25. foreach (array_keys($_REQUEST) as $var) {
  26. ${$var} = $_REQUEST[$var];
  27. //if ($name == "Admin12") {
  28. // echo "<b>$var:</b> ${$var} <br>";
  29. //}
  30. }
  31. if ($act == "exit")
  32. {
  33. session_unset();
  34. session_destroy();
  35. session_start();
  36. }
  37. if ($_SESSION['cmdlevel'])
  38. $cmdlevel = $_SESSION['cmdlevel'];
  39. if ($_SESSION['hostid'])
  40. $agent_id = $_SESSION['hostid'];
  41. if ($_SESSION['add'])
  42. $add = $_SESSION['add'];
  43. if ($_SESSION['id'])
  44. $id = $_SESSION['id'];
  45. if ($_SESSION['login'])
  46. $login = $_SESSION['login'];
  47. if ($_SESSION['name'])
  48. $name = $_SESSION['name'];
  49. foreach (array_keys($_SESSION) as $var) {
  50. ${$var} = $_SESSION[$var];
  51. //if ($name == "Admin12") {
  52. //echo "from session: <b>$var:</b> ${$var} <br>";
  53. //}
  54. }
  55. include 'functions.php';
  56. include 'auth.php';
  57. $logged_me_in_successfully234 = 0;
  58. $incl = '';
  59. if (!$_SESSION['pass'] && !$_SESSION['login'])
  60. {
  61. $table = 'accounts';
  62. $result=mysqli_query($link, "SELECT id, login, name, cmdlevel FROM $table WHERE login='".$login."' AND password='".md5($pass)."'");
  63. $res1 = mysqli_fetch_array($result);
  64. $cmdlevel = $res1['cmdlevel'];
  65. $name = $res1['name'];
  66. $id = $res1['id'];
  67. if ($cmdlevel == '10')
  68. {
  69. $add = "Head Administrator";
  70. }
  71. else if ($cmdlevel == '1')
  72. {
  73. $add = "Company Administrator";
  74. }
  75. else if ($cmdlevel == '2')
  76. {
  77. $add = "Company Operator";
  78. }
  79. if (mysqli_num_rows($result))
  80. {
  81. $_SESSION['pass']=$pass;
  82. $_SESSION['login']=$login;
  83. $_SESSION['name']=$name;
  84. $_SESSION['add']=$add;
  85. $_SESSION['cmdlevel']=$cmdlevel;
  86. $_SESSION['id']=$id;
  87. $logged_me_in_successfully234 = 1;
  88. }
  89. }
  90. else
  91. $logged_me_in_successfully234 = 1;
  92. $query = mysqli_query($link, "update accounts set last_seen_web =NOW() where id=".$id);
  93. $getincl = GetInclude($act, intval($cmdlevel));
  94. $incl = $getincl[0];
  95. $accnum = $getincl[1];
  96. $project_id = \Yii::$app->request->get('project_id');
  97. $post = \Yii::$app->request->post();
  98. if ( $project_id ) {
  99. \Yii::$app->session->set('ProjectId', $project_id );
  100. } else {
  101. $project_id = \Yii::$app->session->get('ProjectId' );
  102. }
  103. $projEntity = \app\models\entity\ProjectsLocotech::findOne(['id' => $project_id]);
  104. //$taskEntity = \app\models\entity\Tasks::find()->where(['input_id' => $project_id])->orderBy(['parent_id' => SORT_ASC,'priority'=> SORT_ASC,'type'=> SORT_ASC,'text'=> SORT_ASC])->all();
  105. $taskEntity = \app\models\entity\Tasks::find()->where(['input_id' => $project_id])->orderBy(['id'=> SORT_ASC])->all();
  106. $arrayTest = explode(',',$projEntity->tasks);
  107. $priorityarray = [];
  108. $filterSelectArray = [];
  109. $filterParentIdArray = [];
  110. $count = 1;
  111. foreach ( $arrayTest as $m ) {
  112. $priorityarray[$count * 1000] = $m;
  113. $count++;
  114. }
  115. $priorityarray = array_flip($priorityarray);
  116. //var_dump($priorityarray);
  117. $data = '{
  118. "data": [';
  119. $currentTime = strtotime(date("Y-m-d H:i:s"));
  120. $start_date = $currentTime;
  121. $tempArrayForTasks = [];
  122. $tempArrayDuringForTasks = [];
  123. $parent_id = '';
  124. $tempArrayForStartTime = [];
  125. $start_date_str = date ( "d-m-Y H:i",$currentTime );
  126. $tempArrayCountDuringForTasks = [];
  127. $tempArrayDuringForTasksPlus = [];
  128. $progress = 0;
  129. $counter = 0;
  130. // массив с ожидаемой длительностью родительских тасков
  131. foreach ( $taskEntity as $task ) {
  132. $duration = $task->tasktypes->time_to_complete_minutes;
  133. $tempArrayDuringForTasks[$task->parent_id][] = $duration;
  134. }
  135. // массив родительских тасков с ожидаемым временем выполнения в часах
  136. foreach( $tempArrayDuringForTasks as $key => &$a) {
  137. $tempArrayDuringForTasks[$key] = array_sum($a)*60;
  138. }
  139. $e = 0;
  140. foreach ( $taskEntity as $task ) {
  141. $text = \app\models\HelperModel::stripWhitespaces($task->text);
  142. $readonly = 'true';
  143. if ( (null != $task->created) and (null == $task->accepted_time) and (null == $task->finished_time) ) {
  144. $readonly = 'false';
  145. }
  146. if ( 0 == $task->parent_id) {//var_dump($task->id,$task->text);
  147. preg_match('/#(.*)#/', $text, $matches);
  148. $id_job = $matches[1];
  149. if ( null == $tempArrayDuringForTasksPlus[$id_job]) {
  150. $tempArrayForStartTime[$task->id] = 0;
  151. } else {
  152. $tempArrayForStartTime[$task->id] += $tempArrayDuringForTasksPlus[$id_job]/60;
  153. }
  154. if ( null != $task->accepted_time && null == $task->finished_time){
  155. $start_date_str = date ( "d-m-Y H:i",strtotime($task->accepted_time) );
  156. }
  157. }
  158. if ( 0 != $task->parent_id) {
  159. $parent_id = ', "parent": "'.$task->parent_id.'"';
  160. }
  161. switch ($task->status) {
  162. case 5:
  163. $progress = 1.0;
  164. break;
  165. case 1:
  166. $progress = 0.0;
  167. break;
  168. default:
  169. $progress = 0.5;
  170. break;
  171. }
  172. $start_finish_time = '';
  173. $duration = $task->tasktypes->time_to_complete_minutes;
  174. if ( null != $task->accepted_time ){
  175. $start_finish_time = '/' . date ('H:i' , strtotime($task->accepted_time));
  176. }
  177. if ( 'true' === $readonly ) {
  178. $start_finish_time = '/' . date ('H:i' , strtotime($task->accepted_time)). ' - ' . date ('H:i' , strtotime($task->finished_time));
  179. }
  180. // ЕСЛИ ККОМАНДА ЗАВЕРШЕНА НАЧАЛО
  181. if ( null != $task->finished_time ){
  182. $duration_sec = strtotime($task->finished_time) - strtotime($task->accepted_time);
  183. $duration = floor($duration_sec/60);
  184. }
  185. // ЕСЛИ ККОМАНДА ЗАВЕРШЕНА КОНЕЦ
  186. // ЕСЛИ ККОМАНДА ВЫПОЛНЯЕТСЯ НО НЕ ЗАВЕРШЕНА НАЧАЛО
  187. if ( null != $task->accepted_time && null == $task->finished_time){
  188. $duration_sec = $currentTime - strtotime($task->accepted_time);
  189. $duration = floor($duration_sec/60);
  190. }
  191. // ЕСЛИ ККОМАНДА ВЫПОЛНЯЕТСЯ НО НЕ ЗАВЕРШЕНА КОНЕЦ
  192. if ( 0 == $task->parent_id) {
  193. preg_match('/#(.*)#/', $text, $matches);
  194. $id_job = $matches[1];
  195. $query = 'SELECT min(coalesce(accepted_time, NOW())) as time FROM tasks WHERE parent_id = ' . $task->id;
  196. $res = \Yii::$app->db->createCommand($query)->queryOne();
  197. $timeCompare = $start_date_str = date ('d-m-Y H:i' , strtotime($res['time']));
  198. $start_date_str = date ('d-m-Y H:i' ,strtotime($start_date_str)+$tempArrayCountDuringForTasks[$id_job]);
  199. if(strtotime($timeCompare) == (strtotime($start_date_str)+$tempArrayCountDuringForTasks[$id_job])) {
  200. $prior[$id_job] = $priorityarray[$task->id];
  201. } else {
  202. $prior[$id_job] += 100;
  203. }
  204. $priorParent[$task->id] = $prior[$id_job];
  205. $tempArrayCountDuringForTasks[$id_job] += $tempArrayDuringForTasks[$task->id];
  206. $tempArrayDuringForTasksPlus[$id_job] = $tempArrayCountDuringForTasks[$id_job];
  207. // ЕСЛИ ККОМАНДА ЗАВЕРШЕНА НАЧАЛО
  208. $oneTaskEntity = \app\models\entity\Tasks::find()->where(['parent_id' => $task->id])->orderBy(['priority'=> SORT_ASC ])->all();
  209. $Finished = false;
  210. $Accepted = false;
  211. foreach( $oneTaskEntity as $one) {
  212. if ( 1 == $one->priority ){
  213. $Accepted = $one->accepted_time;
  214. }
  215. $Finished = $one->finished_time;
  216. }
  217. if ( null != $Finished and null != $Accepted ){
  218. $duration_sec = strtotime($Finished) - strtotime($Accepted);
  219. $duration = floor($duration_sec/60);
  220. }
  221. if ( null != $Accepted ){
  222. $start_date_str = date ( "d-m-Y H:i",strtotime($Accepted) );
  223. }
  224. // ЕСЛИ ККОМАНДА ЗАВЕРШЕНА КОНЕЦ
  225. }
  226. $text = preg_replace('/#(.*)#/', '', $text);
  227. $text = preg_replace('/([0-9]|[0-9][0-9])\/[АБВГ](.*)$/u', '', $text);
  228. if ( 0 != $task->parent_id && 0 != $task->assignees_arr) {
  229. $accountsEntity = \app\models\entity\Accounts::findOne($task->assignees_arr);
  230. $text = $accountsEntity->name;
  231. }
  232. $tasktypesName = \app\models\HelperModel::stripWhitespaces($task->tasktypes->name);
  233. $tasktypesName = addslashes($tasktypesName);
  234. $prior[$id_job] = sprintf("%08d", $prior[$id_job]);
  235. if ( 0 == $task->parent_id) {
  236. $filterSelectArray[]= $text;
  237. ////////////////////////////////////////////// FILTER
  238. if (!empty($post)) {
  239. if (!letterFilter($post,$tasktypesName) and $post['command'] != 'false') {
  240. $filterParentIdArray = $task->id;
  241. continue;
  242. }
  243. if ( $post['job'] != $text and $post['job'] != 'false') {
  244. continue;
  245. }
  246. }
  247. //var_dump($tempArrayForTasks);
  248. ////////////////////////////////////////////// FILTER
  249. $tempArrayForTasks[$id_job][] = '{ "id": ' . $task->id . ', "calendar_id": "global", "text": " ' . $tasktypesName . ':' . $text . ''.$start_finish_time.' ", "type": "project", "start_date": "' . $start_date_str . '", "duration": "' . $duration . '","progress": '.$progress.', "open": true, "readonly" : '.$readonly.',"sort": "'.$prior[$id_job].'"}';
  250. }
  251. $counter++;
  252. }
  253. $filterSelectArray = array_unique($filterSelectArray);
  254. //var_dump($tempArrayForTasks);
  255. //////////////////////////////////////////////////////////////
  256. $taskEntity = \app\models\entity\Tasks::find()->where(['input_id' => $project_id])->andWhere(['>','parent_id', 0 ])->orderBy(['priority'=> SORT_ASC])->all();
  257. $arrayTest = explode(',',$projEntity->tasks);
  258. $priorityarray = [];
  259. $count = 1;
  260. foreach ( $arrayTest as $m ) {
  261. $priorityarray[$count * 1000] = $m;
  262. $count++;
  263. }
  264. $priorityarray = array_flip($priorityarray);
  265. //var_dump($priorityarray);
  266. //$currentTime = strtotime(date("Y-m-d H:i:s"));
  267. //$start_date = $currentTime;
  268. //$tempArrayDuringForTasks = [];
  269. $parent_id = '';
  270. //$tempArrayForStartTime = [];
  271. //$start_date_str = date ( "d-m-Y H:i",$currentTime );
  272. //$tempArrayCountDuringForTasks = [];
  273. //$tempArrayDuringForTasksPlus = [];
  274. $progress = 0;
  275. $counter = 0;
  276. foreach ( $taskEntity as $task ) {
  277. $duration = $task->tasktypes->time_to_complete_minutes;
  278. $tempArrayDuringForTasks[$task->parent_id][] = $duration;
  279. }
  280. foreach( $tempArrayDuringForTasks as $key => &$a) {
  281. $tempArrayDuringForTasks[$key] = array_sum($a)*60;
  282. }
  283. $e = 0;
  284. foreach ( $taskEntity as $task ) {
  285. $text = \app\models\HelperModel::stripWhitespaces($task->text);
  286. $readonly = 'true';
  287. if ( (null != $task->created) and (null == $task->accepted_time) and (null == $task->finished_time) ) {
  288. $readonly = 'false';
  289. }
  290. if ( 0 == $task->parent_id) {//echo "<br>";
  291. preg_match('/#(.*)#/', $text, $matches);
  292. $id_job = $matches[1];
  293. if ( null == $tempArrayDuringForTasksPlus[$id_job]) {
  294. $tempArrayForStartTime[$task->id] = 0;
  295. } else {
  296. $tempArrayForStartTime[$task->id] += $tempArrayDuringForTasksPlus[$id_job]/60;
  297. }
  298. if ( null != $task->accepted_time && null == $task->finished_time){
  299. $start_date_str = date ( "d-m-Y H:i",strtotime($task->accepted_time) );
  300. }
  301. } else {
  302. $start_date = $currentTime + ($tempArrayForStartTime[$task->parent_id] * 60 );
  303. $start_date_str = date ( "d-m-Y H:i",$start_date ); //echo ' || 2=>' .$start_date_str;
  304. if ( null != $task->finished_time ){
  305. $start_date_str = date ( "d-m-Y H:i",strtotime($task->accepted_time) ); //echo ' || 3 =>' .$start_date_str;
  306. }
  307. if ( null != $task->accepted_time && null == $task->finished_time){
  308. $start_date_str = date ( "d-m-Y H:i",strtotime($task->accepted_time) );
  309. }
  310. //var_dump($tempArrayForStartTime[$task->parent_id]);
  311. $tempArrayForStartTime[$task->parent_id] += $task->tasktypes->time_to_complete_minutes;
  312. }
  313. if ( 0 != $task->parent_id) {
  314. $parent_id = ', "parent": "'.$task->parent_id.'"';
  315. }
  316. switch ($task->status) {
  317. case 5:
  318. $progress = 1.0;
  319. break;
  320. case 1:
  321. $progress = 0.0;
  322. break;
  323. default:
  324. $progress = 0.5;
  325. break;
  326. }
  327. $start_finish_time = '';
  328. $duration = $task->tasktypes->time_to_complete_minutes;
  329. if ( null != $task->accepted_time ){
  330. $start_finish_time = '/' . date ('H:i' , strtotime($task->accepted_time));
  331. }
  332. if ( 'true' === $readonly ) {
  333. $start_finish_time = '/' . date ('H:i' , strtotime($task->accepted_time)). ' - ' . date ('H:i' , strtotime($task->finished_time));
  334. }
  335. // ЕСЛИ ККОМАНДА ЗАВЕРШЕНА НАЧАЛО
  336. if ( null != $task->finished_time ){
  337. $duration_sec = strtotime($task->finished_time) - strtotime($task->accepted_time);
  338. $duration = floor($duration_sec/60);
  339. }
  340. // ЕСЛИ ККОМАНДА ЗАВЕРШЕНА КОНЕЦ
  341. // ЕСЛИ ККОМАНДА ВЫПОЛНЯЕТСЯ НО НЕ ЗАВЕРШЕНА НАЧАЛО
  342. if ( null != $task->accepted_time && null == $task->finished_time){
  343. $duration_sec = $currentTime - strtotime($task->accepted_time);
  344. $duration = floor($duration_sec/60);
  345. }
  346. // ЕСЛИ ККОМАНДА ВЫПОЛНЯЕТСЯ НО НЕ ЗАВЕРШЕНА КОНЕЦ
  347. if ( 0 == $task->parent_id) {
  348. preg_match('/#(.*)#/', $text, $matches);
  349. $id_job = $matches[1];
  350. $query = 'SELECT min(coalesce(accepted_time, NOW())) as time FROM tasks WHERE parent_id = ' . $task->id;
  351. $res = \Yii::$app->db->createCommand($query)->queryOne();
  352. $timeCompare = $start_date_str = date ('d-m-Y H:i' , strtotime($res['time']));
  353. $start_date_str = date ('d-m-Y H:i' ,strtotime($start_date_str)+$tempArrayCountDuringForTasks[$id_job]);
  354. if(strtotime($timeCompare) == (strtotime($start_date_str)+$tempArrayCountDuringForTasks[$id_job])) {
  355. $prior[$id_job] = $priorityarray[$task->id];
  356. //var_dump($prior[$id_job], '$priorityarray['.$task->id.']'); echo "<br>";
  357. } else {//echo $prior[$task->id];
  358. $prior[$id_job] += 100;
  359. //var_dump($prior[$id_job], '$priorityarray['.$task->id.']');
  360. }
  361. //var_dump($task->id);
  362. //var_dump($id_job, $prior[$id_job],$task->id,$priorityarray[$task->id]); echo "<br>";
  363. $priorParent[$task->id] = $prior[$id_job];
  364. $tempArrayCountDuringForTasks[$id_job] += $tempArrayDuringForTasks[$task->id];
  365. $tempArrayDuringForTasksPlus[$id_job] = $tempArrayCountDuringForTasks[$id_job];
  366. //var_dump($prior[$id_job], $task->id, $start_date_str,$text,date ('d-m-Y H:i')); echo "<br>";
  367. } else {
  368. $prior[$id_job] = $priorParent[$task->parent_id] + $task->priority;
  369. }
  370. //var_dump($prior[$id_job], $task->id);
  371. $text = preg_replace('/#(.*)#/', '', $text);
  372. $text = preg_replace('/([0-9]|[0-9][0-9])\/[АБВГ](.*)$/u', '', $text);
  373. if ( 0 != $task->parent_id && 0 != $task->assignees_arr) {
  374. $accountsEntity = \app\models\entity\Accounts::findOne($task->assignees_arr);
  375. $text = $accountsEntity->name;
  376. }
  377. //echo " |name=". $task->id."=>".$prior[$id_job]." |" ;
  378. $tasktypesName = \app\models\HelperModel::stripWhitespaces($task->tasktypes->name);
  379. $tasktypesName = addslashes($tasktypesName);
  380. //echo $tasktypesName.'-';
  381. $prior[$id_job] = sprintf("%08d", $prior[$id_job]);
  382. ////////////////////////////////////////////// FILTER
  383. if ( in_array($task->parent_id,$filterParentIdArray)) {
  384. continue;
  385. }
  386. ////////////////////////////////////////////// FILTER
  387. $tempArrayForTasks[$id_job][] = '{ "id": ' . $task->id . ', "calendar_id": "global", "text": " ' . $tasktypesName . ':' . $text . ''.$start_finish_time.' ", "type": "project", "start_date": "' . $start_date_str . '", "duration": "' . $duration . '","progress": '.$progress.', "open": true, "readonly" : '.$readonly.$parent_id.',"sort": "'.$prior[$id_job].'"}';
  388. $counter++;
  389. //$prior = '';
  390. }
  391. ////////////////////////////////////////////////////////////
  392. foreach( $tempArrayForTasks as &$items){
  393. $items = implode(',', $items);
  394. }
  395. ksort($tempArrayForTasks);
  396. $data .= implode(',', $tempArrayForTasks);
  397. $data .= '],
  398. "links": []
  399. }';
  400. ?>
  401. <!DOCTYPE html>
  402. <head>
  403. <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  404. <title>Project level calendars</title>
  405. <script src="/gantt_source/codebase/dhtmlxgantt.js?v=6.2.7"></script>
  406. <!-- Basic Page Needs
  407. –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  408. <meta charset="utf-8">
  409. <title>ASUSG</title>
  410. <meta name="description" content="">
  411. <meta name="author" content="">
  412. <!-- Mobile Specific Metas
  413. –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  414. <meta name="viewport" content="width=device-width, initial-scale=1">
  415. <!-- FONT
  416. –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  417. <link rel="stylesheet" href="/lte/bower_components/bootstrap/dist/css/bootstrap.min.css">
  418. <!-- Font Awesome -->
  419. <link rel="stylesheet" href="/lte/bower_components/font-awesome/css/font-awesome.min.css">
  420. <!-- Ionicons -->
  421. <link rel="stylesheet" href="/lte/bower_components/Ionicons/css/ionicons.min.css">
  422. <!-- Theme style -->
  423. <link rel="stylesheet" href="/lte/dist/css/AdminLTE.min.css">
  424. <!-- AdminLTE Skins. Choose a skin from the css/skins
  425. folder instead of downloading all of them to reduce the load. -->
  426. <link rel="stylesheet" href="/lte/dist/css/skins/_all-skins.min.css">
  427. <!-- Morris chart -->
  428. <link rel="stylesheet" href="/lte/bower_components/morris.js/morris.css">
  429. <!-- jvectormap -->
  430. <link rel="stylesheet" href="/lte/bower_components/jvectormap/jquery-jvectormap.css">
  431. <!-- Date Picker -->
  432. <link rel="stylesheet" href="/lte/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
  433. <!-- Daterange picker -->
  434. <link rel="stylesheet" href="/lte/bower_components/bootstrap-daterangepicker/daterangepicker.css">
  435. <!-- bootstrap wysihtml5 - text editor -->
  436. <link rel="stylesheet" href="/lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
  437. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
  438. <link rel="stylesheet" href="/lte/bower_components/select2/dist/css/select2.min.css">
  439. <link rel="stylesheet" href="/gantt_source/codebase/dhtmlxgantt.css?v=6.2.7">
  440. <style>
  441. html,
  442. body {
  443. height: 100%;
  444. padding: 0px;
  445. margin: 0px;
  446. overflow: hidden;
  447. }
  448. </style>
  449. <style>
  450. .gantt_task_cell.week_end {
  451. background-color: #e8e8e8;
  452. }
  453. .gantt_task_row.gantt_selected .gantt_task_cell.week_end {
  454. background-color: #e0e0dd;
  455. }
  456. </style>
  457. </head>
  458. <body>
  459. <?
  460. $mycompany = getCompanyByAccount($id);
  461. if (!isset($companyID))
  462. {
  463. if ($_SESSION['company'])
  464. $companyID = $_SESSION['company'];
  465. else
  466. {
  467. $companyID = $mycompany[0];
  468. $_SESSION['company'] = $companyID;
  469. }
  470. }
  471. else
  472. {
  473. $_SESSION['company'] = $companyID;
  474. }
  475. $companyname = getCompanyByID($companyID)[1];
  476. if ((int)$_POST['appMykey'] == 123465) {$logged_me_in_successfully234 = 1;}
  477. if ($logged_me_in_successfully234 == 0)
  478. {
  479. echo "<center>";
  480. GetEnterForm();
  481. echo("<font color='red'><b>Access denied. Incorrect login or password</b><font>");
  482. echo "</center>";
  483. return;
  484. }
  485. $sectionsArray = ['А','Б','В'];
  486. ?>
  487. <div class="wrapper">
  488. <header class="main-header">
  489. <!-- Logo -->
  490. <a href="/asusg_plan.php" class="logo">
  491. <!-- mini logo for sidebar mini 50x50 pixels -->
  492. <span class="logo-mini"><b>A</b>LT</span>
  493. <!-- logo for regular state and mobile devices -->
  494. <span class="logo-lg"><b>АСУ</b>СГ</span>
  495. </a>
  496. <!-- Header Navbar: style can be found in header.less -->
  497. <nav class="navbar navbar-static-top">
  498. <!-- Sidebar toggle button-->
  499. <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
  500. <span class="sr-only">Toggle navigation</span>
  501. </a>
  502. <div class="raw">
  503. <div class="col-md-3">
  504. <div class="box-body">
  505. <form id="filterGantt" method="post" action="<? echo $_SERVER["REQUEST_URI"];?>" role="form" >
  506. <!-- select -->
  507. <select name='command' class="form-control">
  508. <option value="false">Все секции</option>
  509. <? foreach($sectionsArray as $letter):?>
  510. <option value="<? echo $letter;?>" <? if( $post['command'] == $letter ){ echo 'selected=selected'; } ?>><? echo $letter;?></option>
  511. <? endforeach;?>
  512. </select>
  513. </div>
  514. </div>
  515. <div class="col-md-3">
  516. <div class="box-body">
  517. <!-- select -->
  518. <select name='job' class="form-control">
  519. <option value="false">Все должности</option>
  520. <? foreach($filterSelectArray as $job):?>
  521. <option value="<? echo $job;?>" <? if( $post['job'] == $job ){ echo 'selected=selected'; } ?>><? echo $job;?></option>
  522. <? endforeach;?>
  523. </select>
  524. </div>
  525. </div>
  526. <div class="col-md-3">
  527. <div class="box-body" >
  528. <button type="submit" class="btn btn-default">Пофильтровать</button>
  529. </div>
  530. </form>
  531. </div>
  532. </div>
  533. </nav>
  534. </header>
  535. <div id="gantt_here" style='width:100%; height:90%;'></div>
  536. <div class="box-body">
  537. <div class="row">
  538. <div class="col-xs-2">
  539. <div class="form-group">
  540. <button id="gantt_compl_edit" type="button" class="btn btn-block btn-primary" data_id="<?php echo \Yii::$app->request->get('project_id');?>">Сохранить</button><br>
  541. </div>
  542. </div>
  543. </div>
  544. </div>
  545. </div>
  546. <script>
  547. gantt.config.work_time = false;
  548. gantt.config.scale_unit = "day";
  549. gantt.config.date_scale = "%D, %d";
  550. gantt.config.min_column_width = 15;
  551. gantt.config.duration_unit = "minute";
  552. gantt.config.scale_height = 20 * 3;
  553. gantt.config.row_height = 25;
  554. gantt.config.inherit_calendar = true;
  555. //gantt.config.smart_scales = true;
  556. gantt.config.smart_rendering = false;
  557. gantt.config.order_branch = "marker";
  558. gantt.config.order_branch_free = true;
  559. var weekScaleTemplate = function (date) {
  560. var dateToStr = gantt.date.date_to_str("%d %M");
  561. var weekNum = gantt.date.date_to_str("(week %W)");
  562. var endDate = gantt.date.add(gantt.date.add(date, 1, "week"), -1, "day");
  563. return dateToStr(date) + " - " + dateToStr(endDate) + " " + weekNum(date);
  564. };
  565. gantt.config.subscales = [
  566. //{ unit: "month", step: 1, date: "%F, %Y" },
  567. //{ unit: "week", step: 1, template: weekScaleTemplate },
  568. {unit: "hour", step: 1, date: "%G"},
  569. {unit: "minute", step: 5, date: "%i"}
  570. ];
  571. gantt.addCalendar({
  572. id: "custom",
  573. worktime: {
  574. hours: [8, 17],
  575. days: [1, 1, 1, 1, 1, 1, 1]
  576. }
  577. });
  578. gantt.templates.timeline_cell_class = function (task, date) {
  579. if (!gantt.isWorkTime({ date: date, task: task }))
  580. return "week_end";
  581. return "";
  582. };
  583. gantt.templates.task_text = function (syart, end, task) {
  584. var calendar = gantt.getTaskCalendar(task);
  585. return task.text ;//+ ", <b>" + (calendar.id == "custom" ? "Full week" : "Workweek") + "</b> calendar";
  586. };
  587. gantt.locale.labels.section_calendar = "Calendar";
  588. gantt.config.lightbox.project_sections = gantt.config.lightbox.sections = [
  589. { name: "description", height: 38, map_to: "text", type: "textarea", focus: true },
  590. {
  591. name: "calendar", height: 22, map_to: "calendar_id", type: "select", options: [
  592. { key: "", label: "Default" },
  593. { key: "global", label: "Workweek" },
  594. { key: "custom", label: "Full week" }
  595. ]
  596. },
  597. { name: "time", type: "duration", map_to: "auto" }
  598. ];
  599. function updateTaskTiming(task) {
  600. task.start_date = gantt.getClosestWorkTime({
  601. dir: "future",
  602. date: task.start_date,
  603. unit: gantt.config.duration_unit,
  604. task: task
  605. });
  606. task.end_date = gantt.calculateEndDate(task);
  607. }
  608. var summaryCalendarChanged = false;
  609. gantt.attachEvent("onLightboxSave", function (id, task, is_new) {
  610. summaryCalendarChanged = false;
  611. if (gantt.isSummaryTask(task) && gantt.getTaskCalendar(task).id != gantt.getTaskCalendar(gantt.getTask(id)).id) {
  612. summaryCalendarChanged = id;
  613. }
  614. updateTaskTiming(task);
  615. gantt.eachTask(function (child) {
  616. updateTaskTiming(child);
  617. }, id);
  618. return true;
  619. });
  620. gantt.attachEvent("onAfterTaskMove", function (id, parent, tindex) {
  621. var task = gantt.getTask(id);
  622. updateTaskTiming(task);
  623. return true;
  624. });
  625. gantt.attachEvent("onAfterTaskUpdate", function (id, task) {
  626. if (summaryCalendarChanged == id) {
  627. summaryCalendarChanged = false;
  628. gantt.eachTask(function (child) {
  629. updateTaskTiming(child);
  630. gantt.updateTask(child.id)
  631. }, id)
  632. }
  633. });
  634. var det = <?php echo $data;?>;
  635. gantt.init("gantt_here");
  636. gantt.parse(det);
  637. //gantt.sort("text",true);
  638. gantt.sort("sort",false);
  639. </script>
  640. <script src="/lte/bower_components/jquery/dist/jquery.min.js"></script>
  641. <!-- jQuery UI 1.11.4 -->
  642. <script src="/lte/bower_components/jquery-ui/jquery-ui.min.js"></script>
  643. <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
  644. <script>
  645. $.widget.bridge('uibutton', $.ui.button);
  646. </script>
  647. <!-- Bootstrap 3.3.7 -->
  648. <script src="/lte/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  649. <!-- Morris.js charts -->
  650. <script src="/lte/bower_components/raphael/raphael.min.js"></script>
  651. <script src="/lte/bower_components/morris.js/morris.min.js"></script>
  652. <!-- Sparkline -->
  653. <script src="/lte/bower_components/jquery-sparkline/dist/jquery.sparkline.min.js"></script>
  654. <!-- jvectormap -->
  655. <script src="/lte/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
  656. <script src="/lte/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
  657. <!-- jQuery Knob Chart -->
  658. <script src="/lte/bower_components/jquery-knob/dist/jquery.knob.min.js"></script>
  659. <!-- daterangepicker -->
  660. <script src="/lte/bower_components/moment/min/moment.min.js"></script>
  661. <script src="/lte/bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
  662. <!-- datepicker -->
  663. <script src="/lte/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
  664. <!-- Bootstrap WYSIHTML5 -->
  665. <script src="/lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
  666. <!-- Slimscroll -->
  667. <script src="/lte/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
  668. <!-- FastClick -->
  669. <script src="/lte/bower_components/fastclick/lib/fastclick.js"></script>
  670. <!-- AdminLTE App -->
  671. <script src="/lte/dist/js/adminlte.min.js"></script>
  672. <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
  673. <script src="/lte/dist/js/pages/dashboard.js"></script>
  674. <!-- AdminLTE for demo purposes -->
  675. <script src="/lte/dist/js/demo.js"></script>
  676. <script src="/loco.js"></script>
  677. <script src="/mail.js"></script>
  678. <script src="/lte/bower_components/select2/dist/js/select2.full.min.js"></script>
  679. <script>
  680. $( function() {
  681. $( ".sortable" ).sortable();
  682. $( ".sortable" ).disableSelection();
  683. } );
  684. </script>
  685. </body>
  686. <?php
  687. function GetEnterForm()
  688. {
  689. echo "<article>
  690. <form method='post' action='?login'>
  691. <table>
  692. <tr>
  693. <td width=70>
  694. <b>Login</b>
  695. </td>
  696. <td>
  697. &nbsp;
  698. </td>
  699. <td>
  700. <input type='text' name=login value=''><br/>
  701. </td>
  702. </tr>
  703. <tr>
  704. <td>
  705. <b>Password </b>
  706. </td>
  707. <td>
  708. &nbsp;
  709. </td>
  710. <td>
  711. <input type='password' name=pass value=''>
  712. </td>
  713. </tr>
  714. <tr>
  715. <td></td>
  716. <td>&nbsp;</td>
  717. <td>
  718. <input type='submit' value='Enter'>
  719. </td>
  720. </tr>
  721. </table>
  722. </form>
  723. </article>";
  724. }
  725. function letterFilter($post,$tasktypesName){
  726. if (empty($post)){
  727. return false;
  728. }
  729. $letterArr = explode(' ', $tasktypesName);
  730. $letter = substr($letterArr[1],0,-1);
  731. if( 1 == mb_strlen($letter)) {
  732. if( $letter == $post['command']) {
  733. return true;
  734. } else {
  735. return false;
  736. }
  737. }
  738. }
  739. /*
  740. function jobFilter($post,$tasktypesName){
  741. if (empty($post)){
  742. return false;
  743. }
  744. $letter = explode(' ', $tasktypesName);
  745. $letter = substr($letter,0,-1);
  746. if(count($letter)) {
  747. if( $letter == $post['command']) {
  748. return true;
  749. } else {
  750. return false;
  751. }
  752. }
  753. }
  754. */
  755. ?>