for ($i = 0; $i < count($data); $i++) { $z = $equip->countItems($data[$i]['group_id']); $data[$i]['noi'] = $z[0]['count']; } $employees = $equip->listEmployees(); $allCpu = $equip->listcpuUG(); $allMon = $equip->listmonUG(); $allPer = $equip->listperUG(); $allKey = $equip->listkeyUG(); $allFurn = $equip->listfurnUG(); $listStatus = $equip->listStatus(); //Shared tags $allTags = $cpu->listAllTags(); $allConns = $cpu->listAllConn(); //For furniture edit dialog $furn_types = $furniture->listTypes(); $furn_departments = $furniture->listDepartments(); //For key edit dialog $key_makes = $key->listMakes(); $key_locktypes = $key->listLockTypes(); $key_empassign = $key->listEmployees(); //For cpu edit dialog $cpu_makes = $cpu->listMakes(); $cpu_assign = $cpu->listEmployees(); $cpu_departments = $cpu->listDepartments(); //For mon edit dialog $mon_makes = $mon->listMakes(); $mon_assign = $mon->listEmployees(); $mon_departments = $mon->listDepartments(); //For per edit dialog $per_types = $per->listTypes();
//============================================================================================ require 'models/furniture.php'; $equip = new Furniture(); //============================================================================================ // Load the page requested by the user //============================================================================================ if (!isset($_GET['page'])) { if (isset($_GET['discarded']) && $_GET['discarded'] === '1') { $equip->showDiscarded = true; } $data = $equip->listItems($SESSION->department); foreach ($data as $key => $d) { $data[$key]['tag'] = $equip->listTags($data[$key]['furn_id']); } $allTags = $equip->listAllTags(); $types = $equip->listTypes(); $departments = $equip->listDepartments(); $allBuildings = $equip->listAllBuildings(); $render = true; $l10nFile = 'l10n/furniture.php'; $viewFile = 'views/furniture.php'; } elseif ($_GET['page'] === "fetch") { //Fetch specific furniture information $editdata = $equip->fetchItem($_POST['furn_id']); header('Content-Type: application/json; charset=utf-8'); echo json_encode($editdata); exit; } elseif ($_GET['page'] === "add") { $data = $equip->addItem($_POST); header('Content-Type: application/json; charset=utf-8'); echo json_encode($data);