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 plc_redirect ("settings.php");
43 if( $_POST['add_type'] ) {
44 $setting_type = array ('category' => $_POST['category'],
45 'name' => $_POST['name'],
46 'min_role_id' => intval( $_POST['min_role_id'] ),
47 'description' => $_POST['description']);
49 $api->AddTagType( $setting_type );
51 // xxx check the destination page
52 plc_redirect ("settings.php");
57 if( $_GET['rem_id'] ) {
58 // get the id of the tag to remove from GET
59 $setting_id= intval( $_GET['rem_id'] );
62 $setting= $api->GetInterfaceTags( array( $setting_id ), array( "interface_id" ) );
63 $interface_id= $setting[0]['interface_id'];
66 $api->DeleteInterfaceTag( $setting_id );
68 plc_redirect (l_interface($interface_id));
72 if( $_POST['add_setting'] ) {
73 // get the interface_id, tag_type_id, and value from POST
74 $interface_id= intval( $_POST['interface_id'] );
75 $interface_tag_type_id= intval( $_POST['interface_tag_type_id'] );
76 $value= $_POST['value'];
79 $api->AddInterfaceTag( $interface_id, $interface_tag_type_id, $value );
81 plc_redirect (l_interface($interface_id));
85 if( $_POST['edit_setting'] ) {
86 // get the id of the setting to update and the value from POST
87 $setting_id= intval( $_POST['setting_id'] );
88 $value= $_POST['value'];
89 $interface_id= $_POST['interface_id'];
92 $api->UpdateInterfaceTag($setting_id, $value );
94 plc_redirect (l_interface($interface_id));
97 // Settings -------------------------------------------------
99 // TAG TYPES ---------------------------------------------------
102 if( $_GET['del_type'] ) {
104 $type_id= intval( $_GET['del_type'] );
107 $api->DeleteTagType( $type_id );
109 // xxx check the destination page
110 plc_redirect ("settings.php" );
115 include 'plc_footer.php';