6000)) { // last request was more than 30 minutes ago session_unset(); // unset $_SESSION variable for the run-time session_destroy(); // destroy session data in storage } $_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp $add = 'Login Area'; foreach (array_keys($_REQUEST) as $var) { ${$var} = $_REQUEST[$var]; //if ($name == "Admin12") { // echo "$var: ${$var}
"; //} } $arr1 = array( [1,2,3], [2,2,5], [1,2,3], [1,2,3], [1,2,3,4] ); $arr2 = array( [5,6], [1,2,3], [2,2,5], [1,2,3], [1,2,3], [1,2,3,4] ); function merge($arr1,$arr2){ $arr3 = array_merge($arr1,$arr2); foreach( $arr3 as &$item){ $item = json_encode($item); } $arr3 = array_unique($arr3); foreach( $arr3 as &$item){ $item = json_decode($item); } return $arr3; } echo "
";
    var_dump(merge($arr1,$arr2));
    echo "
"; //echo "
";
   // var_dump($arr3);
   // echo "
"; exit; if ($act == "exit") { session_unset(); session_destroy(); session_start(); } if ($_SESSION['cmdlevel']) $cmdlevel = $_SESSION['cmdlevel']; if ($_SESSION['hostid']) $agent_id = $_SESSION['hostid']; if ($_SESSION['add']) $add = $_SESSION['add']; if ($_SESSION['id']) $id = $_SESSION['id']; if ($_SESSION['login']) $login = $_SESSION['login']; if ($_SESSION['name']) $name = $_SESSION['name']; foreach (array_keys($_SESSION) as $var) { ${$var} = $_SESSION[$var]; //if ($name == "Admin12") { //echo "from session: $var: ${$var}
"; //} } include 'functions.php'; include 'auth.php'; $logged_me_in_successfully234 = 0; $incl = ''; if (!$_SESSION['pass'] && !$_SESSION['login']) { $table = 'accounts'; $result=mysqli_query($link, "SELECT id, login, name, cmdlevel FROM $table WHERE login='".$login."' AND password='".md5($pass)."'"); $res1 = mysqli_fetch_array($result); $cmdlevel = $res1['cmdlevel']; $name = $res1['name']; $id = $res1['id']; if ($cmdlevel == '10') { $add = "Head Administrator"; } else if ($cmdlevel == '1') { $add = "Company Administrator"; } else if ($cmdlevel == '2') { $add = "Company Operator"; } if (mysqli_num_rows($result)) { $_SESSION['pass']=$pass; $_SESSION['login']=$login; $_SESSION['name']=$name; $_SESSION['add']=$add; $_SESSION['cmdlevel']=$cmdlevel; $_SESSION['id']=$id; $logged_me_in_successfully234 = 1; } } else $logged_me_in_successfully234 = 1; $query = mysqli_query($link, "update accounts set last_seen_web =NOW() where id=".$id); $getincl = GetInclude($act, intval($cmdlevel)); $incl = $getincl[0]; $accnum = $getincl[1]; $project_id = \Yii::$app->request->get('project_id'); $taskEntity = \app\models\entity\Tasks::find()->where(['input_id' => $project_id])->orderBy(['parent_id' => SORT_ASC,'priority'=> SORT_ASC])->all(); $data = '{ "data": ['; //date("Y-m-d H:i:s"); $currentTime = strtotime(date("Y-m-d H:i:s")); //echo "
";
$start_date = $currentTime;
$tempArrayForTasks = [];
$parent_id = '';
$tempArrayForStartTime = [];
$start_date_str = date ( "d-m-Y H:i",$currentTime );
$progress = 0;
$counter = 0;
foreach ( $taskEntity as $task ) {
    $readonly = 'true';
    if ( (null != $task->created)  and (null == $task->accepted_time) and (null == $task->finished_time) ) {
        $readonly = 'false';
    }
    if ( 0 == $task->parent_id) {
        $tempArrayForStartTime[$task->id] = 0;
        if ( null != $task->accepted_time && null == $task->finished_time){
            $start_date_str = date ( "d-m-Y H:i",strtotime($task->accepted_time) );
        }
    } else {
        $start_date = $currentTime + ($tempArrayForStartTime[$task->parent_id] * 60 );
        $start_date_str = date ( "d-m-Y H:i",$start_date );
        
        if ( null != $task->finished_time ){
            $start_date_str = date ( "d-m-Y H:i",strtotime($task->accepted_time) );
        }
        if ( null != $task->accepted_time && null == $task->finished_time){
            $start_date_str = date ( "d-m-Y H:i",strtotime($task->accepted_time) );
        }
        
        $tempArrayForStartTime[$task->parent_id] += $task->tasktypes->time_to_complete_minutes;
    }
    if ( 0 != $task->parent_id) {
        $parent_id = ', "parent": "'.$task->parent_id.'"';
    }
    
    switch ($task->status) {
    case 5:
        $progress = 1.0;
        break;
    case 1:
        $progress = 0.0;
        break;
    default:
        $progress = 0.5;
        break;
    }
    $start_finish_time = '';
    $duration = $task->tasktypes->time_to_complete_minutes;
    if ( null != $task->accepted_time ){
        $start_finish_time = '/' . date ('H:i' , strtotime($task->accepted_time));
    }
    if ( 'true' === $readonly  ) {
        $start_finish_time = '/' . date ('H:i' , strtotime($task->accepted_time)). ' - ' . date ('H:i' , strtotime($task->finished_time));
        //$duration =  (strtotime($task->finished_time) - strtotime($task->accepted_time)) / 60 ;
        //$duration = floor($duration);
        //$start_date_str = date ( "d-m-Y H:i",$task->accepted_time );
    } 
    
//  ЕСЛИ ККОМАНДА ЗАВЕРШЕНА НАЧАЛО   
    if ( null != $task->finished_time ){
        $duration_sec = strtotime($task->finished_time) - strtotime($task->accepted_time);
        $duration = floor($duration_sec/60);
    }
//  ЕСЛИ ККОМАНДА ЗАВЕРШЕНА КОНЕЦ

//  ЕСЛИ ККОМАНДА ВЫПОЛНЯЕТСЯ НО НЕ ЗАВЕРШЕНА  НАЧАЛО   
    if ( null != $task->accepted_time && null == $task->finished_time){
        $duration_sec = $currentTime - strtotime($task->accepted_time);
        $duration = floor($duration_sec/60);
    }

//  ЕСЛИ ККОМАНДА ВЫПОЛНЯЕТСЯ НО НЕ ЗАВЕРШЕНА  КОНЕЦ


    if ( 0 == $task->parent_id) {
        $query = 'SELECT min(coalesce(accepted_time, NOW())) as time  FROM tasks WHERE parent_id = ' . $task->id;
        $res = \Yii::$app->db->createCommand($query)->queryOne();
        $start_date_str = date ('d-m-Y H:i' , strtotime($res['time']));
        //var_dump($res);
        //var_dump(date("Y-m-d H:i:s").' -'. $task->accepted_time);echo "
"; //if ( null != $task->accepted_time && null == $task->finished_time){ // $start_date_str = date ( "d-m-Y H:i",strtotime($task->accepted_time) ); //} } //var_dump($start_date_str); //var_dump($duration);echo "
"; //if ( $counter == 182 ){ continue; } $tasktypesName = \app\models\HelperModel::stripWhitespaces($task->tasktypes->name); $text = \app\models\HelperModel::stripWhitespaces($task->text); $tempArrayForTasks[] = '{ "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.' }'; //var_dump($task->tasktypes->name); $counter++; } //if ( $counter == 182 ){ echo '{ "id": ' . $task->id . ', "calendar_id": "global", "text": "'.$task->tasktypes->name.':' .$task->text. ''.$start_finish_time.' ", "type": "project", "start_date": "' . $start_date_str . '", "duration": "' . $duration . '","progress": '.$progress.', "open": true, "readonly" : '.$readonly.$parent_id.' }'; exit; } $data .= implode(',', $tempArrayForTasks); $data .= '], "links": [] }'; // echo "
";
  //          var_dump($data);
//echo "
"; /* $data = '{ "data": [ { "id": 11, "calendar_id": "global", "text": "Project #1", "type": "project", "start_date": "28-03-2018 02:15", "duration": "11", "progress": 0.6, "open": true }, { "id": 1, "calendar_id": "", "text": "Project #2", "type": "project", "start_date": "01-04-2018", "duration": "18", "progress": 0.4, "open": true }, { "id": 2, "calendar_id": "", "text": "Task #1", "start_date": "28-03-2018 02:20", "duration": "8", "parent": "1", "progress": 0.5, "open": true , "readonly" : true }, { "id": 3, "calendar_id": "", "text": "Task #2", "type": "project", "start_date": "28-03-2018 02:20", "duration": "8", "parent": "1", "progress": 0.6, "open": true , "editable" : false}, { "id": 4, "calendar_id": "", "text": "Task #3", "type": "project", "start_date": "28-03-2018 02:20", "duration": "6", "parent": "1", "progress": 0.5, "open": true , "editable" : true}, { "id": 5, "calendar_id": "", "text": "Task #1.1", "start_date": "02-04-2018", "duration": "7", "parent": "2", "progress": 0.6, "open": true }, { "id": 6, "calendar_id": "", "text": "Task #1.2", "start_date": "03-04-2018", "duration": "7", "parent": "2", "progress": 0.6, "open": true }, { "id": 7, "calendar_id": "", "text": "Task #2.1", "start_date": "11-04-2018", "duration": "8", "parent": "3", "progress": 0.6, "open": true }, { "id": 8, "calendar_id": "", "text": "Task #3.1", "start_date": "14-04-2018", "duration": "5", "parent": "4", "progress": 0.5, "open": true }, { "id": 9, "calendar_id": "", "text": "Task #3.2", "start_date": "14-04-2018", "duration": "4", "parent": "4", "progress": 0.5, "open": true }, { "id": 10, "calendar_id": "", "text": "Task #3.3", "start_date": "14-04-2018", "duration": "3", "parent": "4", "progress": 0.5, "open": true }, { "id": 12, "calendar_id": "", "text": "Task #1", "start_date": "03-04-2018", "duration": "5", "parent": "11", "progress": 1, "open": true }, { "id": 13, "calendar_id": "", "text": "Task #2", "type": "project", "start_date": "02-04-2018", "duration": "7", "parent": "11", "progress": 0.5, "open": true }, { "id": 14, "calendar_id": "", "text": "Task #3", "start_date": "02-04-2018", "duration": "6", "parent": "11", "progress": 0.8, "open": true }, { "id": 15, "calendar_id": "", "text": "Task #4", "type": "project", "start_date": "02-04-2018", "duration": "5", "parent": "11", "progress": 0.2, "open": true }, { "id": 16, "calendar_id": "", "text": "Task #5", "start_date": "02-04-2018", "duration": "7", "parent": "11", "progress": 0, "open": true }, { "id": 17, "calendar_id": "", "text": "Task #2.1", "start_date": "03-04-2018", "duration": "3", "parent": "13", "progress": 1, "open": true }, { "id": 18, "calendar_id": "", "text": "Task #2.2", "start_date": "06-04-2018", "duration": "3", "parent": "13", "progress": 0.8, "open": true }, { "id": 19, "calendar_id": "", "text": "Task #2.3", "start_date": "11-04-2018", "duration": "4", "parent": "13", "progress": 0.2, "open": true }, { "id": 20, "calendar_id": "", "text": "Task #2.4", "start_date": "13-04-2018", "duration": "4", "parent": "13", "progress": 0, "open": true }, { "id": 21, "calendar_id": "", "text": "Task #4.1", "start_date": "03-04-2018", "duration": "4", "parent": "15", "progress": 0.5, "open": true }, { "id": 22, "calendar_id": "", "text": "Task #4.2", "start_date": "03-04-2018", "duration": "4", "parent": "15", "progress": 0.1, "open": true }, { "id": 23, "calendar_id": "", "text": "Task #4.3", "start_date": "03-04-2018", "duration": "5", "parent": "15", "progress": 0, "open": true } ], "links": [] }'; */ //exit; ?> Project level calendars ASUSG "; GetEnterForm(); echo("Access denied. Incorrect login or password"); echo ""; return; } ?>
Login  
Password  
 
"; } ?>