예제 #1
0
파일: cpu.php 프로젝트: hughnguy/php
} elseif ($_GET['page'] === 'check-ip') {
    $result = $equip->doesIPAddressExist($_POST['cpu_ip_addr']);
    echo $result[0]["count"];
} elseif ($_GET['page'] === 'csv') {
    require_once FS_PHP . '/csv.php';
    if (!isset($_GET['status'])) {
        $_GET["status"] = 0;
    }
    $data = $equip->listItems($SESSION->department, $_GET["status"]);
    if (count($data) != 0) {
        $output = new CSV($data);
        $output->generate();
    }
} elseif ($_GET['page'] === 'export-selected') {
    require_once FS_PHP . '/csv.php';
    $data = $equip->listItemscsv(explode(',', $_GET['ids']));
    $output = new CSV($data);
    $output->generate();
} elseif ($_GET['page'] === 'scanlabel' && !empty($_GET['no'])) {
    header("Location: cpu.php?focus=" . $_GET['no']);
    exit;
} elseif ($_GET['page'] === 'getroom') {
    $data = $equip->listAllRooms($_POST['building_id']);
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($data);
    exit;
} elseif ($_GET['page'] === 'insertroom') {
    $data = $equip->insertRoom($_POST);
    header('Content-Type: application/json; charset=utf-8');
    echo json_encode($data);
    exit;