initial import from onelab svn codebase
[plewww.git] / planetlab / slices / delete_slice.php
1 <?php
2
3 // Require login
4 require_once 'plc_login.php';
5
6 // Get session and API handles
7 require_once 'plc_session.php';
8 global $plc, $api;
9
10 // Common functions
11 require_once 'plc_functions.php';
12 require_once 'plc_sorts.php';
13   
14 // find person roles
15 $_person= $plc->person;
16 $_roles= $_person['role_ids'];
17
18 //print_r( $_person );
19
20 // if no id then go back to slice index
21 if( !$_GET['id'] )
22   header( "index.php" );
23
24 // get slice id from get
25 $slice_id= $_GET['id'];
26
27 // delete it!
28 if( $_POST['delete'] ) {
29   $api->DeleteSlice( intval( $slice_id ) );
30   
31   header( "location: index.php" );
32   exit();
33 }
34
35 // Print header
36 require_once 'plc_drupal.php';
37 drupal_set_title('Slices');
38 include 'plc_header.php';
39
40
41 // get slice info from API call
42 $slice_info= $api->GetSlices( array( intval( $slice_id ) ), array( "name", "expires", "description" ) );
43
44 // start form
45 echo "<form action='delete_slice.php?id=$slice_id' method=post>\n";
46
47 // show delete confirmation
48 echo "<h2>Delete slice ". $slice_info[0]['name'] ."</h2>\n";
49 echo "<p>Are you sure you want to delete this slice?\n";
50
51 echo "<table><tbody>\n";
52 echo "<tr><th>Name: </th><td> ". $slice_info[0]['name'] ."</td></tr>\n";
53 echo "<tr><th>Description: </th><td> ". $slice_info[0]['description'] ."</td></tr>\n";
54 echo "<tr><th>Expiration: </th><td> ". gmstrftime( "%A %b-%d-%y %T %Z", $slice_info[0]['expires'] ) ."</td></tr>\n";
55 echo "</tbody></table>\n";
56 echo "<input type=submit value='Delete Slice' name='delete'>\n";
57 echo "</form\n";
58
59 // Print footer
60 include 'plc_footer.php';
61
62 ?>