$var: ${$var}
";
}
if (isset($get_user_tasks))
{
$retarr = array();
$str = "select id, input_id, accepted_time, finished_time from tasks where assignees_arr = $get_user_tasks";
$query = mysqli_query($link, $str);
while ($res = mysqli_fetch_assoc($query))
{
$retarr[] = [$res['id'], $res['input_id'], $res['accepted_time'], $res['finished_time']];
}
echo json_encode($retarr);
}
if (isset($quitaccount))
{
require_once "server.php";
Quit($quitaccount, true);
}
if (isset($seturgent))
{
/**
* @var $proj Project
*/
$proj = Project::Find($seturgent);
if ($proj != null)
{
$proj->urgent = abs($proj->urgent-1);
$proj->Save();
}
}
if (isset($newjob_accid))
{
$acc = Account::Find($newjob_accid);
if ($acc != null) {
$acc->UpdateJob($jobvalue, $index, $previous);
}
else
echo "Account not found";
}
if (isset($basic_count))
{
$acc = Account::Find($accid);
$acc->basic_jobs_count = $basic_count;
$acc->Save();
echo $basic_count;
}
if (isset($beacons_loc))
{
$query = mysqli_query($link,"select * from beacons where location_id=$beacons_loc");
$arr = array();
while ($query && $res = mysqli_fetch_array($query))
{
$x = $res['x'];
$y = $res['y'];
$uuid = $res['uuid'];
$myarr = array("id"=>$uuid, 'x'=>$x,'y'=>$y);
array_push($arr, $myarr);
// echo "
[$uuid] X: $x Y: $y
";
}
echo json_encode($arr);
//echo "No beacons";
}
if (isset($users_loc))
{
if ($users_loc == '22') {
$query = mysqli_query($link,"select * from user_positions ORDER BY id DESC LIMIT 1");
if ($query && $res = mysqli_fetch_row($query))
{
$x = $res[1];
$y = $res[2];
$zone = $res[6];
}
$query = mysqli_query($link,"select * from zones where id=$zone");
if ($query && $res = mysqli_fetch_row($query))
{
$zone = $res[2];
}
$arr = array("id"=>9, "name"=>'Петр Петров','x'=>$x,'y'=>$y,'Zone'=>$zone);
echo json_encode($arr);
// echo "[9] Петр Петров X: $x Y: $y Зона: $zone";
}
else
echo "No users";
}
/*
if (isset($users_markers))
{
$contTime = date('Y-m-d H:i:s');
$beginTime = strtotime($contTime) - 3600;
$beginTime = date('Y-m-d H:i:s', $beginTime);
if ($users_markers != null && $depo_markers != null ) {//&& $time_markers != null
if ($date_start != null && $date_stop != null){
$beginTime = $date_start;
$contTime = $date_stop;
} else {
echo json_encode('');
}
//if ($date_stop != null ){
// $contTime = $date_stop;
//}
$queryString = "select * from user_positions WHERE `acc_id` = " . $users_markers . " AND `location_id` = " . $depo_markers . " AND `ts` BETWEEN '" . $beginTime . "' AND '" . $contTime . "' ORDER BY id DESC ";
//$query = mysqli_query($link,"select * from user_positions WHERE `acc_id` = " . $users_markers . " AND `location_id` = " . $depo_markers . " ORDER BY id DESC ");
$query = mysqli_query($link,$queryString);
//2019-07-08 15:22:28
//$query = mysqli_query($link,"select * from user_positions ORDER BY id DESC LIMIT 1");
$result = [];
$num_rows = mysqli_num_rows($query);
$module = round(1/$num_rows, 4 , PHP_ROUND_HALF_DOWN);
$i = 0;
while ($query && $res = mysqli_fetch_assoc($query))
{
$red = ( 255 * (1 - $moduleTemp)) + ( 0 * $moduleTemp );
$blue = ( 0 * (1 - $moduleTemp)) + ( 255 * $moduleTemp );
//$count = round($red) . ', 0 ,' . round($blue);
$moduleTemp += $module;
$res['c'] = $module;//$count;
$res['num'] = $num_rows;
$res['rgb'] = fromRGB(round($red), 0, round($blue));//$count;
$res['radius'] = 4;
$res['tip'] = 'You are over 100,100';
$result[$i] = $res;
$i++;
}
//$result['datetime'] = $queryString;
echo json_encode($result);
//echo json_encode($arr);
// echo "[9] Петр Петров X: $x Y: $y Зона: $zone";
}
//else
// echo "No users";
}
*/
if (isset($users_markers))
{
$contTime = date('Y-m-d H:i:s');
$beginTime = strtotime($contTime) - 3600;
$beginTime = date('Y-m-d H:i:s', $beginTime);
if ($users_markers != null && $depo_markers != null ) {//&& $time_markers != null
if ($date_start != null && $date_stop != null){
$beginTime = $date_start;
$contTime = $date_stop;
} else {
echo json_encode('');
}
//if ($date_stop != null ){
// $contTime = $date_stop;
//}
$smooth = 5;
/*
$queryString = "select * from user_positions WHERE `acc_id` = " . $users_markers . " AND `location_id` = " . $depo_markers . " AND `ts` BETWEEN '" . $beginTime . "' AND '" . $contTime . "' ORDER BY id DESC ";*/
$queryString = "select up.coord_x ,up.coord_y, ts from user_positions as up LEFT JOIN locations as l ON l.id = up.location_id WHERE up.acc_id = " . $users_markers . " AND l.company_id = " . $depo_markers . " AND up.ts BETWEEN '" . $beginTime . "' AND '" . $contTime . "' ORDER BY up.id ASC";
$query = mysqli_query($link,$queryString);
//2019-07-08 15:22:28
//$query = mysqli_query($link,"select * from user_positions ORDER BY id DESC LIMIT 1");
$result = [];
$resultTest = [];
$num_rows = mysqli_num_rows($query);
$module = round(1/$num_rows, 4 , PHP_ROUND_HALF_DOWN);
$i = 0;
while ($query && $res = mysqli_fetch_assoc($query))
{
$red = ( 255 * (1 - $moduleTemp)) + ( 0 * $moduleTemp );
$blue = ( 0 * (1 - $moduleTemp)) + ( 255 * $moduleTemp );
//$count = round($red) . ', 0 ,' . round($blue);
$moduleTemp += $module;
$res['c'] = $module;//$count;
$res['num'] = $num_rows;
$res['rgb'] = fromRGB(round($red), 0, round($blue));//$count;
$res['radius'] = 4;
$resultTest[] = [ 'time' => $res['ts'], 'coord_x' => ($res['coord_x']*8), 'coord_y' => ($res['coord_y']*8)];
$res['tip'] = 'You are over 100,100';
$result[$i] = $res;
$i++;
}
//$result['datetime'] = $queryString;
$curResult = [];
$i = 0;
foreach( $resultTest as $key =>$coord ){
//if( $key < $smooth) {
$curResult[] = $coord;
$result[$i]['coord_x'] = $coord['coord_x'];
$result[$i]['coord_y'] = $coord['coord_y'];
$i++;
continue;
//}
$begin = $key - $smooth;
//echo "";
$sumX = 0;
$sumY = 0;
for($r = 0;$r < $smooth; $r++){
$sumX += $resultTest[$i + $r]["coord_x"];
$sumY += $resultTest[$i + $r]["coord_y"];
}
$sumX = $sumX/$smooth;
$sumY = $sumY/$smooth;
$result[$i]['coord_x'] = $sumX;//$sumX*8;
$result[$i]['coord_y'] = $sumY;//$sumY*8;
$result[$i]['time'] = $coord['time'];//$sumY*8;
//var_dump((int)round($sumX, 0),(int)round($sumY, 0));
//echo "
";
$i++;
}
//$result['f'] = $result
//$result = $queryString;
echo json_encode($result);
//echo json_encode($arr);
// echo "[9] Петр Петров X: $x Y: $y Зона: $zone";
}
//else
// echo "No users";
}
if (isset($beacon_item)){
$taskType = mysqli_query($link, "insert into `beacons` (`x`, `y` ,`location_id` , `uuid`) values ($x, $y,$location_id,'$uuid')");
if ('' == mysqli_error($link)){
echo json_encode("good");
} else {
echo json_encode(mysqli_error($link));
}
}
if (isset($dwnl_beacons)){
//$repair = 'asdasdasd';
/*
$filePath = $_SERVER['DOCUMENT_ROOT'].'/uploads/coord.xlsx';
$Excel = \PHPExcel_IOFactory::load($filePath);
$maxCell = $Excel->setActiveSheetIndex(0);
$repair = $Excel->getActiveSheet()->getCell('A3')->getValue();
$result = [];
for( $i = 3 ; $i < 36; $i++){
//$tempArray = [];
$minor = $Excel->getActiveSheet()->getCell('A'.$i)->getValue();
$x = $Excel->getActiveSheet()->getCell('B'.$i)->getValue();
$y = $Excel->getActiveSheet()->getCell('C'.$i)->getValue();
$query = "insert into `beacons` (`x`, `y` ,`location_id` , `uuid`,`major`,`minor`,`enabled`) values ($x, $y,1,'e2c56db5-dffb-48d2-b060-d0f5a71096e0',5 , $minor,1)";
$taskType = mysqli_query($link, $query);
}
*/
//echo "";
// var_dump('repair');
// var_dump($query);
//echo "
";
echo json_encode($_FILES['file']);
}
if (isset($get_img)){
$result = [];
if ( $depo_markers ) {
$queryString = "select * from locations WHERE `company_id` = " . $depo_markers . "";
$query = mysqli_query($link,$queryString);
if ($query && $res = mysqli_fetch_assoc($query))
{
$result['image'] = $res['img'];
} else {
$result['image'] = '';
}
}
$queryString = "select `x`,`y` from beacons WHERE `location_id` = " . $depo_markers . "";
$query = mysqli_query($link,$queryString);
$result['point_beacons'] = [];
while ($res = mysqli_fetch_assoc($query))
{
$result['point_beacons'][] = ['x' => $res['x'],'y'=>$res['y']];
}
$queryString = "select * from zones WHERE `location_id` = " . $depo_markers . "";
$query = mysqli_query($link,$queryString);
$result['point_zones'] = [];
while ($res = mysqli_fetch_assoc($query))
{
$result['point_zones'][] = $res;
}
$query = mysqli_query($link, "select uuid from beacons");
while ($res = mysqli_fetch_row($query)) {
$result['uuids'][] = $res['uuid'];
}
echo json_encode($result);
}
if (isset($depo_zone)){
$result = [];
$depo_zone = json_encode($depo_zone);
mysqli_query($link, "insert into `zones` (`description`, `borders` ,`location_id`) values ('$depo_name', '$depo_zone' , $depo_num )");
if ('' == mysqli_error($link)){
echo json_encode(["good"]);
} else {
echo json_encode(mysqli_error($link));
}
echo json_encode($result);
}
/// получение списка точек для сотрудников находящихся в онлайне
if (isset($depo_markers_ol)) {
$dd = TempFuncInsert();
$company = Company::Find($depo_markers_ol);
$accounts = $company->accounts;
$result = [];
$userList = [];
foreach( $accounts as $account ) {
$last_seen_mobile = $account->getLastSeenMobile();
$online_mobile = OnlineAccountCheck(TimeString($last_seen_mobile));
//$userList[] = [$account->id,$online_mobile];
if ($online_mobile) {
$userList[] = $account->id;
}
}
$queryString = "select * from locations WHERE `company_id` = " . $depo_markers_ol;
$query = mysqli_query($link,$queryString);
$comp = mysqli_fetch_assoc($query);
$query1 = "SELECT max(ts) AS date, acc_id, max(id) AS id FROM user_positions WHERE acc_id IN (".implode(',', $userList).") AND `location_id` = " .$comp['id']. " GROUP BY acc_id";
$query = mysqli_query($link,$query1);
$idList = [];
while ($res = mysqli_fetch_assoc($query)) {
$idList[] = $res['id'];
}
$queryString = "select `ts`, `acc_id`,`coord_x`,`coord_y` from user_positions WHERE `id` IN (".implode(',', $idList).")";
$query = mysqli_query($link,$queryString);
$i = 0;
while ($query && $res = mysqli_fetch_assoc($query))
{
$result[$i] = $res;
//$result = $res;
$i++;
}
//$result['req'] = $query1;//$result;
echo json_encode($result);
}
function TempFuncInsert(){
global $link;
$x = 100;
$y = 200;
$rand = rand(1,10);
switch ($rand) {
case 1:
$x -= 10;
$y += 10;
break;
case 2:
$x += 10;
$y -= 10;
break;
case 3:
$x -= 10;
$y -= 10;
break;
case 4:
$x += 20;
$y += 20;
break;
case 5:
$x -= 20;
$y += 20;
break;
case 6:
$x += 30;
$y -= 20;
break;
case 7:
$x += 20;
$y -= 40;
break;
case 8:
$x -= 30;
$y -= 30;
break;
case 9:
$x += 40;
$y -= 20;
break;
default:
break;
}
$query = "insert into user_positions (coord_x, coord_y,ts, acc_id, location_id, zone_id) values (".$x.", ".$y.", '".date('Y-m-d H:i:s')."', 315 , 1, 1)";
$query1 = "insert into user_positions (coord_x, coord_y,ts, acc_id, location_id, zone_id) values (".($y+$rand).", ".($x-$rand).", '".date('Y-m-d H:i:s')."', 316 , 1, 1)";
mysqli_query($link, $query1);
mysqli_query($link, $query);
return $query;
}
if(isset($idLastMsg)){
$company = $_SESSION['company'];
$result = [];
if ( true === $idLastMsg ) {
$idMsg = 0;
} else {
$idMsg = explode('_',$idLastMsg)[0];
}
$query = "select ch.id,ch.msg,ch.acc_id,ch.date_massage,ch.company_id,ch.file,ch.file_name,ch.file_ext,acc.login from chat as ch left join accounts_internal as acc ON ch.acc_id = acc.id where ch.id > " . $idMsg ." and ch.company_id = " . $company . "";
$res_query = mysqli_query($link, $query);
$insertMass = '';
$plugFileImg = '';
while ($res = mysqli_fetch_assoc($res_query)) {
$plugFileImg = $res['file'];
if ( null != $res['file'] ){
$plugFileImg = '
' . $res['file_name'] . '
';
}
if ($res['acc_id'] == $_SESSION['id']) {
$insertMass .=''.$res['login'].''.$res['date_massage'].'
'. $plugFileImg. $res['msg'].'
';
} else {
$insertMass .= ''.$res['login'].''.$res['date_massage'].'
'.$plugFileImg . $res['msg'].'
';
}
//$result[] = $res;
}
echo json_encode($insertMass);
}
if(isset($addNewMsg))
{
$logPath = $_SERVER['DOCUMENT_ROOT'] . '/uploads/chat/' . 'log.txt';
$result = $addNewMsg;//'';
if ('' != $addNewMsg || !empty($_FILES['file_v']['tmp_name'])) {
$info = new SplFileInfo($_FILES['file_v']['name']);
$fileRandomName = strtotime(date("Y-m-d H:i:s")) . "." . $info->getExtension();
$path = $_SERVER['DOCUMENT_ROOT'] . '/uploads/chat/' . $fileRandomName;
$fileName = '';
if (copy($_FILES['file_v']['tmp_name'], $path)) {
$fileName = $_FILES['file_v']['name'];
}
$company = $_SESSION['company'];
$acc_id = $_SESSION['id'];
$pattern = "/((http|https):\/\/(\S*?\.\S*?))(\s|\;|\)|\]|\[|\{|\}|,|”|\"|'|:|\<|$|\.\s)/i";
$replacement = "$0";
$addNewMsg = preg_replace($pattern, $replacement, $addNewMsg);
if ('' != $fileName) {
$query = "insert into `chat` (`company_id`, `msg` ,`acc_id`,`file`,`file_name`,`file_ext`) values ($company,\"".$addNewMsg."\",$acc_id, '$fileRandomName', '$fileName','".$info->getExtension()."')";
//Добавление файла в файлотеку
//Получаем логин и имя пользователя
$q = 'select login, name from accounts_internal where id = ' . $acc_id;
$result = mysqli_query($link, $q);
$account = mysqli_fetch_array($result);
if ($account) {
$login = $account['login'];
$userName = $account['name'];
//Ищем папку с именем пользователя
$q = 'select id from subj where pId = 1 and name = "' . $login . '" and isFolder = 1';
$result = mysqli_query($link, $q);
$row = mysqli_fetch_array($result);
$subjId = $row['id'] ?? null;
//Если такой нет, то создаём
if (!$subjId) {
$now = (new DateTime())->format('Y-m-d H:i:s');
$q = 'insert into subj (pId, isFolder, name, note, date, acc_download) VALUES ' .
' (1, 1, "' . $login . '", "' . $userName . '", "' . $now . '", ' . $acc_id . ')';
if ($result = mysqli_query($link, $q)) {
$subjId = mysqli_insert_id($link);
} else {
file_put_contents($logPath, mysqli_error($link), FILE_APPEND);
}
}
//Добавляем в неё файл
$q = 'insert into subj (pId, isFolder, path, fname, name, size, date, acc_download) VALUES ' .
' (' . $subjId . ', 0, "/uploadfiles/", "' . $fileRandomName . '", "' . $fileName . '", ' . filesize($path) . ', "' . $now . '", ' . $acc_id . ')';
$result = mysqli_query($link, $q);
//Копируем файл в файлотеку
if (copy($_FILES['file_v']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . '/filelib/uploadfiles/' . $fileRandomName)) {
file_put_contents($logPath, 'Файл сохранён под именем: ' . $fileRandomName, FILE_APPEND);
}
if (!$result) {
file_put_contents($logPath, 'second: ' . mysqli_error($link), FILE_APPEND);
file_put_contents($logPath, $q, FILE_APPEND);
}
}
} else {
$query = "insert into `chat` (`company_id`, `msg` ,`acc_id`) values ($company,\"".$addNewMsg."\",$acc_id)";
}
$result = mysqli_query($link, $query);
}
echo json_encode($result);
}
if (isset($del_loc))
{
Location::Delete($del_loc);
}
if (isset($load_locs))
{
Location::EchoLocations();
}
if (isset($add_loc))
{
Location::Add($add_loc, $desc);
}
if (isset($delete_cpt))
{
CheckPointType::Delete($delete_cpt);
}
if (isset($add_to_task))
{
global $link;
$taskType = mysqli_query($link, "insert into checkpoint_types_for_tasks (tasktype_id, cp_type_id) values ($taskType, $add_to_task)");
//add_to_task - id of cpt to add
}
if (isset($addcpt))
{
CheckPointType::CreateFromScratch($addcpt, $name);
}
if (isset($toggletwx))
{
$cp = CheckPointType::CreateFromID($toggletwx);
$newtwx = abs($cp->getWriteToTWX()-1);
$cp->setWriteToTWX($newtwx);
$writeTWX = "нет";
if ($cp->getWriteToTWX())
$writeTWX = "да";
echo "Запись в АСУ СГ: ";
}
if (isset($showcheckbox))
{
$cp = CheckPointType::CreateFromID($showcheckbox);
$writeTWX = "нет";
if ($cp->getWriteToTWX())
$writeTWX = "да";
echo "Запись в АСУ СГ: ";
}
if (isset($show))
{
EchoTypesOfClass($show);
}
if (isset($show_cb_list))
{
EchoCheckBoxTemplate();
}
if (isset($add_cb))
{
$parent = CheckPointType::CreateFromID($parent_id);
if ($parent->class != "MultiSelect" && $parent->class != "DropList" ) {
echo "Не для этого типа чекпойнтов! $parent_id $parent->class";
return;
}
CheckPointType::AddChildToDB($add_cb, $parent_id);
}
if (isset($remove_cb, $parent_id))
{
CheckPointType::CreateFromID($parent_id)->RemoveChildFromDB($remove_cb);
}
if (isset($id))
{
$cpt = CheckPointType::CreateFromID($id);
EchoContents($cpt);
}
if (isset($jobtype) && isset($acc))
{
global $link;
$userId = $_SESSION['id'];
$task = mysqli_query($link, "CALL change_jobtype_priority($acc, $jobtype, $userId)");
}
if (isset($asusg_id) && isset($project_type) )
{
global $link;
$resultArray = [];
//$userId = $_SESSION['id'];
$task = mysqli_query($link, "CALL asusg_bind_projecttype($asusg_id, $project_type)");
}
if (isset($asusg_id) && isset($user_id) )
{
global $link;
//var_dump($user_id, $asusg_id);
$task = mysqli_query($link, "CALL asusg_start_projects($user_id, $asusg_id)");
}
if (isset($asutask_id) && isset($projecttype_id) )
{
global $link;
//var_dump($user_id, $asusg_id);
$task = mysqli_query($link, "CALL asusg_bind_jt2task($asutask_id, $projecttype_id)");
echo json_encode([$asutask_id, $projecttype_id, $task ]);
}
if (isset($employee_uuid) && isset($employee_id) )
{
global $link;
$task = mysqli_query($link, "CALL asusg_bind_employee('$employee_uuid', $employee_id)");
echo json_encode(["CALL asusg_bind_employee(".$employee_uuid.", ".$employee_id.")" ]);
}
if (isset($listItems))
{
global $link;
$listItems = explode(',',$listItems);
$result = false;
if ( 0 < count($listItems)) {
$params = [];
$i = 0;
$asusg_job_id = 0;
$paramsString = "INSERT INTO asusg_job2command (`asusg_job_id`,`smopp_cmd_id`,`jobtype_id`,`asusg_projecttype_id`,`cmd_order`) values";
foreach($listItems as $item){
$tempArray = explode('_',$item);
$params[] = ['asusg_job_id' =>$tempArray[0],'smopp_cmd_id' =>$tempArray[1],'cmd_order' => $i];
$paramsString .= "($tempArray[0],$tempArray[1],$tempArray[3],$tempArray[4],$i),";
$asusg_job_id = $tempArray[0];
$i++;
}
$paramsString = substr($paramsString,0,-1);
$resDelete = mysqli_query($link,"delete from asusg_job2command where asusg_job_id = $asusg_job_id and smopp_cmd_id >= 0 and cmd_order >= 0");
$resInsert = mysqli_query($link,$paramsString);
//if ($res) {
$result = $res;
//}
}
echo json_encode('Удаление =>'.$resDelete . " вставка =>" . json_encode($paramsString) );//mysqli_error($link));
}
if (isset($loco_series) and isset($typefix)) {
global $link;
$paramsString = "INSERT INTO asusg_projecttype (`repair_type`,`loco_serie_id`) values ( $typefix, $loco_series )";
$res = mysqli_query($link,$paramsString);
echo json_encode($res);
}
if (isset($loco_seria) and isset($typefix)) {
global $link;
$paramsString = "SELECT * FROM asusg_projecttype WHERE `repair_type` = $typefix and `loco_serie_id` = $loco_seria";
$res = mysqli_query($link,$paramsString);
echo json_encode($res);
}
if (isset($removeProjectTypeAsusg)) {
global $link;
$queryParams = explode('@',$removeProjectTypeAsusg);
$paramsString = "DELETE FROM asusg_projecttype WHERE `loco_serie_id` = " . $queryParams[0] . " and `repair_type`=" . $queryParams[1];
$res = mysqli_query($link,$paramsString);
echo json_encode($res);
}
if (isset($listItemsAsusg)) {
global $link;
$listItems = explode(',',$listItemsAsusg);
$result = false;
if ( 0 < count($listItems)) {
$params = [];
$i = 0;
$asusg_job_id = 0;
$paramsString = "INSERT INTO asusg_job2project (`asusg_projecttype_id`,`asusg_jobplan_id`,`job_order`) values";
foreach($listItems as $item){
$tempArray = explode('_',$item);
$asusg_job_id = $tempArray[0];
$params[] = ['asusg_projecttype_id'=> $job_id,'asusg_jobplan_id' =>$item,'job_order' => $i];
$paramsString .= "($job_id,$asusg_job_id,$i),";
$i++;
}
$paramsString = substr($paramsString,0,-1);
$resDelete = mysqli_query($link,"delete from asusg_job2project where asusg_projecttype_id = $job_id and asusg_jobplan_id >= 0 and job_order >= 0");
$resInsert = mysqli_query($link,$paramsString);
//if ($res) {
$result = $res;
//}
}
echo json_encode('Удаление =>'.$resDelete . " вставка =>" . $paramsString );//mysqli_error($link));
}
if (isset($taskName)) {
global $link;
$paramsString = "INSERT INTO asusg_jobplan (`name`) values ( '$taskName' )";
$res = mysqli_query($link,$paramsString);
echo json_encode("вставка =>" + $res );
}
if (isset($moveToPlan))
{
global $link;
$id_user = $_SESSION['id'];
$query = "CALL asusg_build_project( $id_user, 194, 734, '$loco', $loco_number, $id_asusg_job)";
$res = mysqli_query($link,$query);
echo json_encode($res);//mysqli_error($link));
}
function EchoTypesOfClass($show)
{
$classes = CheckPoint::GetClasses();
$search = array_search($show, $classes, true);
if ($search) {
$list = CheckPointType::GetCheckPointTypes($show);
EchoSelect($list, $show."s", $show."_list");
}
}
function EchoContents($cpt)
{
echo "Варианты для \"[$cpt->id] $cpt->name\":
";
foreach ($cpt->childrenCheckpointTypes as $child) {
echo '';
echo "
";
//echo "
";
echo "[$child->id]
$child->name";
echo "
";
}
echo "+
";
}
function EchoCheckBoxTemplate()
{
$typesCheckBox = CheckPointType::GetCheckPointTypes("CheckBox");
echo "Выберите чекпойнт для добавления:
";
EchoCheckPointType($typesCheckBox, 'cb_template');
echo "
";
}
function EchoCheckPointType($list, $id)
{
echo "";
}
function EchoSelect($list, $name, $id)
{
echo "";
echo "
";
EchoCheckPointType($list, $id);
echo "
";
echo "
-
";
echo "
+
";
echo "
";
}
function fromRGB($R, $G, $B)
{
$R = dechex($R);
if (strlen($R)<2)
$R = '0'.$R;
$G = dechex($G);
if (strlen($G)<2)
$G = '0'.$G;
$B = dechex($B);
if (strlen($B)<2)
$B = '0'.$B;
return '#' . $R . $G . $B;
}