6 require_once 'plc_login.php';
8 // Get session and API handles
9 require_once 'plc_session.php';
13 require_once 'plc_functions.php';
14 require_once 'plc_sorts.php';
17 $_person= $plc->person;
18 $_roles= $_person['role_ids'];
20 //plc_debug('GET',$_GET);
21 //plc_debug('POST',$_POST);
24 if( $_POST['edit_type'] ) {
25 $setting_type_id= intval( $_POST['interface_tag_type_id'] );
26 $setting_type = array ('category' => $_POST['category'],
27 'name' => $_POST['name'],
28 'min_role_id' => intval( $_POST['min_role_id'] ),
29 'description' => $_POST['description']);
32 $api->UpdateTagType( $setting_type_id, $setting_type );
33 $api_error=$api->error();
34 if (!empty($api_error)) {
35 print "<div class='plc-error'>" . $api_error . "</div>";
38 // xxx check the destination page
39 header( "location: settings.php" );
44 if( $_POST['add_type'] ) {
45 $setting_type = array ('category' => $_POST['category'],
46 'name' => $_POST['name'],
47 'min_role_id' => intval( $_POST['min_role_id'] ),
48 'description' => $_POST['description']);
50 $api->AddTagType( $setting_type );
52 // xxx check the destination page
53 header( "location: settings.php" );
59 if( $_GET['rem_id'] ) {
60 // get the id of the tag to remove from GET
61 $setting_id= intval( $_GET['rem_id'] );
64 $setting= $api->GetInterfaceTags( array( $setting_id ), array( "interface_id" ) );
65 $interface_id= $setting[0]['interface_id'];
68 $api->DeleteInterfaceTag( $setting_id );
70 header( "location: interfaces.php?id=$interface_id" );
75 if( $_POST['add_setting'] ) {
76 // get the interface_id, tag_type_id, and value from POST
77 $interface_id= intval( $_POST['interface_id'] );
78 $interface_tag_type_id= intval( $_POST['interface_tag_type_id'] );
79 $value= $_POST['value'];
82 $api->AddInterfaceTag( $interface_id, $interface_tag_type_id, $value );
84 header( "location: interfaces.php?id=$interface_id" );
89 if( $_POST['edit_setting'] ) {
90 // get the id of the setting to update and the value from POST
91 $setting_id= intval( $_POST['setting_id'] );
92 $value= $_POST['value'];
93 $interface_id= $_POST['interface_id'];
96 $api->UpdateInterfaceTag($setting_id, $value );
98 header( "location: interfaces.php?id=$interface_id" );
102 // Settings -------------------------------------------------
104 // TAG TYPES ---------------------------------------------------
107 if( $_GET['del_type'] ) {
109 $type_id= intval( $_GET['del_type'] );
112 $api->DeleteTagType( $type_id );
114 // xxx check the destination page
115 header( "location: settings.php" );
121 include 'plc_footer.php';