person; $_roles= $_person['role_ids']; //print_r( $_person ); // if no id, display list of attributes types if( !$_GET['id'] && !$_GET['add'] && !$_GET['add_type'] && !$_GET['edit_type'] ) { // get types $attrib_types= $api->GetSliceTagTypes( NULL, array( "attribute_type_id", "name", "description", "min_role_id" ) ); // get role names for the min role_ids foreach( $attrib_types as $attrib_type ) { $roles= $api->GetRoles(); foreach( $roles as $role ) { if( $attrib_type['min_role_id'] == $role['role_id'] ) $role_name= $role['name']; } $attrib_type_info[]= array( "attribute_type_id" => $attrib_type['attribute_type_id'], "name" => $attrib_type['name'], "description" => $attrib_type['description'], "min_role" => $role_name ); } // list them echo "

Slice Attribute Types

\n"; echo ""; // if admin we need to more cells if( in_array( "10", $_person['role_ids'] ) ) echo ""; echo ""; foreach( $attrib_type_info as $type ) { echo ""; // if admin display edit/delet links if( in_array( "10", $_person['role_ids'] ) ) { echo ""; echo ""; } echo "\n"; } echo "
NameMin RoleDescription
". $type['name'] ."". $type['min_role'] ."". $type['description'] ."Edit"; echo plc_delete_link_button ('attrib_action.php?del_type='. $type['attribute_type_id'], $type['name']); echo "
\n"; if( in_array( "10", $_person['role_ids'] ) ) echo "

Add an Attribute Type"; } elseif( $_GET['add_type'] || $_GET['edit_type'] ) { // if its edit get the attribute info if( $_GET['edit_type'] ) { $type_id= intval( $_GET['edit_type'] ); $type_info= $api->GetSliceTagTypes( array( $type_id ) ); $name= $type_info[0]['name']; $min_role_id= $type_info[0]['min_role_id']; $description= $type_info[0]['description']; } // display form for attribute types echo "

\n"; echo "

Add Attribute Type

\n"; echo "

Name: \n"; echo "

Min Role: \n"; echo "

Description:
\n"; echo "\n"; echo "

\n"; echo "\n"; } else echo "name='add_type' value='Add Attribute Type'>\n"; echo "

\n"; } elseif( $_GET['add'] ) { // get slice id from GET $slice_id= intval( $_GET['add'] ); // get all attribute types $attrib_types= $api->GetSliceTagTypes( NULL, array( "attribute_type_id", "name" ) ); foreach( $attrib_types as $attrib_type ) { $all_attribs[$attrib_type['attribute_type_id']]= $attrib_type['name']; } // get slice's attribute types $slice_info= $api->GetSlices( array( $slice_id ), array( "slice_tag_ids" ) ); $attrib_info= $api->GetSliceTags( $slice_info[0]['slice_tag_ids'], array( "attribute_type_id", "name" ) ); foreach( $attrib_info as $info ) { $slice_attrib_types[$info['attribute_type_id']]= $info['name']; } $attribute_types= $all_attribs; // start form echo "
\n"; echo "

Edit ". $slice_info[0]['name'] ." attribute: ". $attrib_type[0]['name'] ."

\n"; echo "\n"; echo "

Value: \n"; echo "

\n"; echo "\n"; echo "

\n"; } else { $attribute_id= intval( $_GET['id'] ); // get attribute info $slice_attib= $api->GetSliceTags( array( $attribute_id ), array( "slice_id", "slice_tag_id", "attribute_type_id", "value", "description", "min_role_id" ) ); // get type info $attrib_type= $api->GetSliceTagTypes( array( $slice_attib[0]['attribute_type_id'] ), array( "attribute_type_id", "name", "description" ) ); // slice info $slice_info= $api->GetSlices( array( $slice_attib[0]['slice_id'] ), array( "name" ) ); // start form and put values in to be edited. echo "
\n"; echo "

Edit ". $slice_info[0]['name'] ." attribute: ". $attrib_type[0]['name'] ."

\n"; echo $slice_attib[0]['description'] ."
\n"; echo "Value:

\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; } echo "

Back to Slices\n"; // Print footer include 'plc_footer.php'; ?>