public function getDescription($db) { if (count($this->services) != 0) { foreach ($this->services as $serviceId) { $serviceItem = new ChiconService($db, $serviceId); $jsonArray[] = $serviceItem->getServiceDescription(); unset($serviceItem); } $returnArray = array("cart" => $jsonArray); return $returnArray; } return $returnArray = array("cart" => null); }
switch ($cmd) { case "getLedDescription": if (isset($_GET['srvId'])) { require '../class/ChiconService.class.php'; $srvId = $_GET['srvId']; $service = new ChiconService($db, $srvId); $result = array("result" => array("code" => 200, "data" => $service->getLedDescription())); } else { $result = array("result" => array("code" => 400, "data" => array("error" => "Bad command"))); } echo json_encode($result); break; case "getAllServices": require '../class/ChiconServiceFabric.class.php'; $serviceFabric = new ChiconServiceFabric($db); $result = array("result" => array("code" => 200, "data" => $serviceFabric->getAllServices())); echo json_encode($result); break; case "getServiceDescription": if (isset($_GET['srvId'])) { require '../class/ChiconService.class.php'; $srvId = $_GET['srvId']; $service = new ChiconService($db, $srvId); $result = array("result" => array("code" => 200, "data" => $service->getServiceDescription())); } else { $result = array("result" => array("code" => 400, "data" => array("error" => "Bad command"))); } echo json_encode($result); break; } }