"tagname"); } else { $title="Tag Types for " . $_GET['type'] . "s"; $pattern=$_GET['type'] . '*'; $tag_type_filter=array("category"=>$pattern,"-SORT"=>"tagname"); } // Print header require_once 'plc_drupal.php'; drupal_set_title($title); include 'plc_header.php'; // Common functions require_once 'plc_functions.php'; require_once 'plc_sorts.php'; // find person roles $_person= $plc->person; $_roles= $_person['role_ids']; //print_r( $_person ); // if no id, display list of tag types if( !$_GET['id'] && !$_GET['add'] && !$_GET['add_type'] && !$_GET['edit_type'] ) { // get types $tag_types= $api->GetTagTypes($tag_type_filter, array( "tag_type_id", "tagname", "category", "description", "min_role_id" ) ); // get role names for the min role_ids foreach( $tag_types as $tag_type ) { $roles= $api->GetRoles(); foreach( $roles as $role ) { if( $tag_type['min_role_id'] == $role['role_id'] ) $role_name= $role['name']; } $tag_type_info[]= array( "tag_type_id" => $tag_type['tag_type_id'], "tagname" => $tag_type['tagname'], "description" => $tag_type['description'], "min_role" => $role_name, "category" => $tag_type['category']); } // list them echo "

Tag Types

\n"; echo ""; // if admin we need to more cells if( in_array( "10", $_person['role_ids'] ) ) echo ""; echo ""; foreach( $tag_type_info as $type ) { echo ""; echo ""; echo ""; echo ""; echo ""; // if admin display edit/delet links if( in_array( "10", $_person['role_ids'] ) ) { echo ""; echo ""; } echo "\n"; } echo "
NameCategory>Min RoleDescription
". $type['tagname'] ."". $type['category'] ."". $type['min_role'] ."". $type['description'] ."Edit"; echo plc_delete_link_button ('tag_action.php?del_type='. $type['tag_type_id'], $type['tagname']); echo "
\n"; if( in_array( "10", $_person['role_ids'] ) ) echo "

Add a Tag Type"; } elseif( $_GET['add_type'] || $_GET['edit_type'] ) { // if its edit get the tag info if( $_GET['edit_type'] ) { $type_id= intval( $_GET['edit_type'] ); $type_info= $api->GetTagTypes( array( $type_id ) ); $tagname= $type_info[0]['tagname']; $min_role_id= $type_info[0]['min_role_id']; $description= $type_info[0]['description']; $category=$type_info[0]['category']; } // display form for tag types echo "

\n"; echo "

Add Tag Type

\n"; echo "

Name: \n"; echo "

Category: \n"; echo "

Min Role: \n"; echo "

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

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

\n"; } elseif( $_GET['add'] ) { // get slice id from GET $slice_id= intval( $_GET['add'] ); // get all tag types $tag_types= $api->GetTagTypes( $tag_type_filter , array( "tag_type_id", "tagname" ) ); foreach( $tag_types as $tag_type ) { $all_tags[$tag_type['tag_type_id']]= $tag_type['tagname']; } // get slice's tag types $slice_info= $api->GetSlices( array( $slice_id ), array( "slice_tag_ids" ) ); $tag_info= $api->GetSliceTags( $slice_info[0]['slice_tag_ids'], array( "tag_type_id", "tagname" ) ); foreach( $tag_info as $info ) { $slice_tag_types[$info['tag_type_id']]= $info['tagname']; } $tag_types= $all_tags; // start form echo "
\n"; echo "

Edit ". $slice_info[0]['name'] ." tag: ". $tag_type[0]['tagname'] ."

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

Value: \n"; echo "

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

\n"; } else { $tag_id= intval( $_GET['id'] ); // get tag $slice_tag= $api->GetSliceTags( array( $tag_id ), array( "slice_id", "slice_tag_id", "tag_type_id", "value", "description", "min_role_id" ) ); // get type info $tag_type= $api->GetTagTypes( array( $slice_tag[0]['tag_type_id'] ), array( "tag_type_id", "tagname", "description" ) ); // slice info $slice_info= $api->GetSlices( array( $slice_tag[0]['slice_id'] ), array( "name" ) ); // start form and put values in to be edited. echo "
\n"; echo "

Edit ". $slice_info[0]['name'] ." tag: ". $tag_type[0]['tagname'] ."

\n"; echo $slice_tag[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'; ?>