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 // ATTRIBUTES -------------------------------------------------
29 if( $_GET['rem_id'] ) {
30 // get the id of the attrib to remove from GET
31 $attribute_id= intval( $_GET['rem_id'] );
34 $attrib_info= $api->GetSliceTags( array( $attribute_id ), array( "slice_id" ) );
35 $slice_id= $attrib_info[0]['slice_id'];
37 // delete the attribute
38 $api->DeleteSliceTag( $attribute_id );
41 header( "location: index.php?id=$slice_id" );
47 if( $_POST['edit_attribute'] ) {
48 // get the id of the attrib to update and teh value from POST
49 $attribute_id= intval( $_POST['attribute_id'] );
50 $value= $_POST['value'];
51 $slice_id= $_POST['slice_id'];
54 $api->UpdateSliceTag( $attribute_id, $value );
56 header( "location: index.php?id=$slice_id" );
62 if( $_POST['add_attribute'] ) {
63 // get the slice_id, attribute_type_id, and value from POST
64 $slice_id= intval( $_POST['slice_id'] );
65 $attribute_type_id= intval( $_POST['attribute_type_id'] );
66 $value= $_POST['value'];
69 $api->AddSliceTag( $slice_id, $attribute_type_id, $value );
71 header( "location: index.php?id=$slice_id" );
75 // ATTRIBUTE TYPES ---------------------------------------------------
77 // attribute type adds
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 attribute_type_fields dict
85 $attribute_type_fields= array( "min_role_id" => $min_role_id, "name" => $name, "description" => $description );
88 $api->AddSliceTagType( $attribute_type_fields );
90 header( "location: attributes.php" );
95 // attribute type updates
96 if( $_POST['edit_type'] ) {
98 $name= $_POST['name'];
99 $min_role_id= intval( $_POST['min_role_id'] );
100 $description= $_POST['description'];
101 $attribute_type_id= intval( $_POST['attribute_type_id'] );
103 // make attribute_type_fields dict
104 $attribute_type_fields= array( "min_role_id" => $min_role_id, "name" => $name, "description" => $description );
107 $api->UpdateSliceTagType( $attribute_type_id, $attribute_type_fields );
109 header( "location: attributes.php" );
114 // delete attribute types
115 if( $_GET['del_type'] ) {
117 $type_id= intval( $_GET['del_type'] );
120 $api->DeleteSliceTagType( $type_id );
122 header( "location: attributes.php" );
130 include 'plc_footer.php';