You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
4.7 KiB
70 lines
4.7 KiB
<?php
|
|
require_once('../ajax_asm.php');
|
|
ob_start();
|
|
$UID = intval( $CUser->Data['id'] );
|
|
$ACCESS = intval( $CUser->Data['access'] );
|
|
if( $UID > 1 ){
|
|
$QS = "SELECT * FROM resources";// WHERE `node_id`=1";
|
|
$Result = $DATABASE->Query( $QS, false );
|
|
if( count( $Result ) ){
|
|
foreach( $Result as $R ){
|
|
switch( $R['type'] ){
|
|
case 1:
|
|
//Uart
|
|
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="UART_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('UART_LINE_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
|
|
break;
|
|
case 6:
|
|
//USB DC
|
|
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="USBDC_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('UART_LINE_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
|
|
break;
|
|
case 31:
|
|
//Video Grabber
|
|
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="VIDEO_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('FRAMEGRAB_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
|
|
break;
|
|
case 100:
|
|
//Loopback
|
|
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('LOOPBACK_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
|
|
break;
|
|
case 101:
|
|
//Ethernet Interface
|
|
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('ETHERNET_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
|
|
break;
|
|
case 102:
|
|
//WiFi Interface
|
|
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('WIFI_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
|
|
break;
|
|
case 103:
|
|
//Virtual IP Interface
|
|
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('VIRTUALIP_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
|
|
break;
|
|
case 104:
|
|
//VPN Interface
|
|
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('VPN_TUN_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
|
|
break;
|
|
case 105:
|
|
//WAN Interface
|
|
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="NET_'.(($R['active']==0)?'N':'O').'" onclick="editResource('.$R['id'].');">'.$Labels->GetLabel('WAN_LINE_PROP').' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
|
|
break;
|
|
//Media Encoder Sink
|
|
case 131: // Video Encoder Sink
|
|
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="MEDIA_'.(($R['active']==0)?'N':'O').'">'.'Video Sink'.' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
|
|
break;
|
|
case 132: // Audio Encoder Sink
|
|
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item" id="MEDIA_'.(($R['active']==0)?'N':'O').'">'.'Audio Sink'.' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
|
|
break;
|
|
default:
|
|
$SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a align="center" style="padding: 5px; color: black; background-color: grey;">'.$R['device'].' '.(($R['used']==0)?'':'<img title="used" src="/style/icons/icons/link.png">').'</a>\'}';
|
|
};
|
|
};
|
|
$Data['resources'] = '['.implode( ',', $SockDataParts ).']';
|
|
$Data['status']='ok';
|
|
} else {
|
|
$Data['status']='na';
|
|
$Data['resources'] = array();
|
|
};
|
|
$Data['messages'] = ob_get_clean();
|
|
echo json_encode( $Data );
|
|
} else {
|
|
header('location: /');
|
|
};
|
|
?>
|