4 require_once 'plc_login.php';
6 // Get session and API handles
7 require_once 'plc_session.php';
12 require_once 'plc_drupal.php';
13 drupal_set_title('Slices');
14 include 'plc_header.php';
18 require_once 'plc_functions.php';
19 require_once 'plc_sorts.php';
22 $_person= $plc->person;
23 $_roles= $_person['role_ids'];
26 // TAGS -------------------------------------------------
29 if( $_GET['rem_id'] ) {
30 // get the id of the tag to remove from GET
31 $tag_id= intval( $_GET['rem_id'] );
34 $tag_info= $api->GetSliceTags( array( $tag_id ), array( "slice_id" ) );
35 $slice_id= $tag_info[0]['slice_id'];
38 $api->DeleteSliceTag( $tag_id );
41 header( "location: index.php?id=$slice_id" );
47 if( $_POST['edit_tag'] ) {
48 // get the id of the tag to update and the value from POST
49 $tag_id= intval( $_POST['tag_id'] );
50 $value= $_POST['value'];
51 $slice_id= $_POST['slice_id'];
54 $api->UpdateSliceTag( $tag_id, $value );
56 header( "location: index.php?id=$slice_id" );
62 if( $_POST['add_tag'] ) {
63 // get the slice_id, tag_type_id, and value from POST
64 $slice_id= intval( $_POST['slice_id'] );
65 $tag_type_id= intval( $_POST['tag_type_id'] );
66 $value= $_POST['value'];
69 $api->AddSliceTag( $slice_id, $tag_type_id, $value );
71 header( "location: index.php?id=$slice_id" );
75 // TAG TYPES ---------------------------------------------------
78 if( $_POST['add_type'] ) {
80 $name= $_POST['name'];
81 $min_role_id= intval( $_POST['min_role_id'] );
82 $description= $_POST['description'];
84 // make the tag_type_fields dict
85 // xxx misses category
86 $tag_type_fields= array( "min_role_id" => $min_role_id,
88 "description" => $description );
91 $api->AddTagType( $tag_type_fields );
93 header( "location: tags.php?type=slice" );
99 if( $_POST['edit_type'] ) {
101 $name= $_POST['name'];
102 $min_role_id= intval( $_POST['min_role_id'] );
103 $description= $_POST['description'];
104 $tag_type_id= intval( $_POST['tag_type_id'] );
106 // make tag_type_fields dict
107 $tag_type_fields= array( "min_role_id" => $min_role_id, "tagname" => $name, "description" => $description );
110 $api->UpdateTagType( $tag_type_id, $tag_type_fields );
112 header( "location: tags.php?type=slice" );
118 if( $_GET['del_type'] ) {
120 $type_id= intval( $_GET['del_type'] );
123 $api->DeleteTagType( $type_id );
125 header( "location: tags.php?type=slice" );
133 include 'plc_footer.php';