Exemple #1
0
/**
 * removes a given host
 *
 * @api
 *
 * @param   int $host_id host id
 *
 * @return  bool                    on success
 */
function ace_host_remove($host_id)
{
    #check for active labs on this host
    if (!ace_host_has_active_labs($host_id)) {
        #remove all host role mappings first, then remove the host
        if (ace_db_host_remove_all_roles($host_id)) {
            return ace_db_host_remove($host_id);
        } else {
            return FALSE;
        }
    } else {
        return FALSE;
    }
}
Exemple #2
0
										<input name="display" value="hosts" type="hidden" />
										<button name="operation" value="host_save" type="submit">Add</button>
										<button type="reset">Clear</button>
									</td>
								</tr>
							</table>
						</form>
					</div>
				</div>
			</div>';
        break;
    case 'host_edit_form':
        $host_id = $_POST['host_id'];
        $host_record = ace_host_get_info($host_id);
        $active = $host_record['state'] == 1 ? TRUE : FALSE;
        $has_labs = ace_host_has_active_labs($host_id);
        $host_roles = ace_host_get_roles($host_id);
        $html_host_role_radios = '';
        foreach ($host_roles as $role) {
            $html_host_role_radios .= '<tr><td><input name="radio_host_role_id" value="' . $role['host_role_id'] . '" type="radio">' . $role['host_role_name'] . '</td></tr>';
        }
        $all_host_roles = ace_get_host_roles();
        $html_select_host_roles = '';
        foreach ($all_host_roles as $role) {
            $html_select_host_roles .= '<option value="' . $role['id'] . '">' . $role['name'] . '</value>';
        }
        $html = '
			<div class="element_table">
				<div class="element_column">
					<div class="element">
						<form name="form_edit_host" action="' . _ADMIN_URL_ . '" method="post">