Пример #1
0
function displayAllServiceTypes()
{
    //global the tool and make a tool bar for adding a service
    global $tool, $serviceForm;
    if ($_SESSION['access'] >= 50) {
        $toolNames = array("Add New Service Type", "All Services");
        $toolIcons = array("add", "service");
        $toolHandlers = array("handleEvent('services.php?action=addServiceType')", "handleEvent('services.php')");
    } else {
        $toolNames = array("All Services");
        $toolIcons = array("service");
        $toolHandlers = array("handleEvent('services.php?action=addServiceType')", "handleEvent('services.php')");
    }
    echo $tool->createNewTools($toolNames, $toolIcons, $toolHandlers);
    $headings = array("Service Type", "Description", "Layer");
    $title = array();
    $data = array();
    $handlers = array();
    $allServiceTypes = ServiceType::get_service_types();
    foreach ($allServiceTypes as $id => $value) {
        $curService = new ServiceType($id);
        array_push($data, $curService->get_name(), $curService->get_description(), $curService->get_service_layer());
        array_push($handlers, "handleEvent('services.php?action=showServiceType&ID=" . $id . "')");
    }
    $serviceForm->setCols(3);
    echo $serviceForm->showAll($headings, $title, $data, $handlers);
}