/** * @todo rebuild with List and JS operations */ private static function detail_reponsible_persons() { $equipment_type = new EquipmentType($_GET['id']); $template = new HTMLTemplate("equipment/admin/equipment_type/detail_responsible_person.html"); $template->set_var("name", $equipment_type->get_name()); $paramquery = $_GET; $paramquery['action'] = "add_user"; $params = http_build_query($paramquery, '', '&'); $template->set_var("add_user_params", $params); $user_array = $equipment_type->list_users(); $user_content_array = array(); $counter = 0; if (is_array($user_array) and count($user_array) >= 1) { foreach ($user_array as $key => $value) { $user = new User($value); $paramquery = $_GET; $paramquery['action'] = "delete_user"; $paramquery['key'] = $value; $params = http_build_query($paramquery, '', '&'); $user_content_array[$counter]['username'] = $user->get_username(); $user_content_array[$counter]['fullname'] = $user->get_full_name(false); $user_content_array[$counter]['delete_params'] = $params; $counter++; } $template->set_var("no_user", false); } else { $template->set_var("no_user", true); } $template->set_var("user", $user_content_array); $template->output(); }
/** * @throws EquipmentTypeIDMissingException */ public static function type_detail($type_id, $owner_id) { if (is_numeric($type_id)) { $equipment_type = new EquipmentType($type_id); $equipment_owner = new User($owner_id); $template = new HTMLTemplate("equipment/detail.html"); $template->set_var("name", $equipment_type->get_name()); $template->set_var("category", $equipment_type->get_cat_name()); if ($equipment_type->get_location_id() == null) { $template->set_var("location", "<span class='italic'>none</span>"); } else { $location = new Location($equipment_type->get_location_id()); $template->set_var("location", $location->get_name(true)); } $template->set_var("owner", $equipment_owner->get_full_name(false)); if ($equipment_type->get_description()) { $template->set_var("description", $equipment_type->get_description()); } else { $template->set_var("description", "<span class='italic'>none</span>"); } $user_array = $equipment_type->list_users(); $user_content_array = array(); $counter = 0; if (is_array($user_array) and count($user_array) >= 1) { foreach ($user_array as $key => $value) { $user = new User($value); $user_content_array[$counter]['username'] = $user->get_username(); $user_content_array[$counter]['fullname'] = $user->get_full_name(false); $counter++; } $template->set_var("no_user", false); } else { $template->set_var("no_user", true); } $template->set_var("user", $user_content_array); $ou_array = $equipment_type->list_organisation_units(); $ou_content_array = array(); $counter = 0; if (is_array($ou_array) and count($ou_array) >= 1) { foreach ($ou_array as $key => $value) { $organisation_unit = new OrganisationUnit($value); $ou_content_array[$counter]['name'] = $organisation_unit->get_name(); $counter++; } $template->set_var("no_ou", false); } else { $template->set_var("no_ou", true); } $template->set_var("ou", $ou_content_array); $template->output(); } else { throw new EquipmentTypeIDMissingException(); } }