3 // $Id: setting_action.php 1159 2008-01-24 18:51:36Z thierry $
6 require_once 'plc_login.php';
8 // Get session and API handles
9 require_once 'plc_session.php';
14 require_once 'plc_drupal.php';
15 drupal_set_title('Slices');
16 include 'plc_header.php';
20 require_once 'plc_functions.php';
21 require_once 'plc_sorts.php';
24 $_person= $plc->person;
25 $_roles= $_person['role_ids'];
27 //plc_debug('GET',$_GET);
28 //plc_debug('POST',$_POST);
31 if( $_POST['edit_type'] ) {
32 $setting_type_id= intval( $_POST['interface_tag_type_id'] );
33 $setting_type = array ('category' => $_POST['category'],
34 'name' => $_POST['name'],
35 'min_role_id' => intval( $_POST['min_role_id'] ),
36 'description' => $_POST['description']);
39 $api->UpdateTagType( $setting_type_id, $setting_type );
40 $api_error=$api->error();
41 if (!empty($api_error)) {
42 print "<div class='plc-error'>" . $api_error . "</div>";
45 header( "location: settings.php" );
50 if( $_POST['add_type'] ) {
51 $setting_type = array ('category' => $_POST['category'],
52 'name' => $_POST['name'],
53 'min_role_id' => intval( $_POST['min_role_id'] ),
54 'description' => $_POST['description']);
56 $api->AddTagType( $setting_type );
58 header( "location: settings.php" );
64 if( $_GET['rem_id'] ) {
65 // get the id of the tag to remove from GET
66 $setting_id= intval( $_GET['rem_id'] );
69 $setting= $api->GetInterfaceTags( array( $setting_id ), array( "interface_id" ) );
70 $interface_id= $setting[0]['interface_id'];
73 $api->DeleteInterfaceTag( $setting_id );
75 header( "location: interfaces.php?id=$interface_id" );
80 if( $_POST['add_setting'] ) {
81 // get the interface_id, tag_type_id, and value from POST
82 $interface_id= intval( $_POST['interface_id'] );
83 $interface_tag_type_id= intval( $_POST['interface_tag_type_id'] );
84 $value= $_POST['value'];
87 $api->AddInterfaceTag( $interface_id, $interface_tag_type_id, $value );
89 header( "location: interfaces.php?id=$interface_id" );
94 if( $_POST['edit_setting'] ) {
95 // get the id of the setting to update and the value from POST
96 $setting_id= intval( $_POST['setting_id'] );
97 $value= $_POST['value'];
98 $interface_id= $_POST['interface_id'];
101 $api->UpdateInterfaceTag($setting_id, $value );
103 header( "location: interfaces.php?id=$interface_id" );
107 // Settings -------------------------------------------------
109 // TAG TYPES ---------------------------------------------------
112 if( $_GET['del_type'] ) {
114 $type_id= intval( $_GET['del_type'] );
117 $api->DeleteTagType( $type_id );
119 header( "location: settings.php" );
125 include 'plc_footer.php';