function editMetaDataTable_User(User $eUser) { $types = getTypes_User($eUser); $categories = getCategories($types); if (count($categories) == 0) { return errNoCats_MetaDataTable(); } ob_start(); if ($categories) { foreach ($categories as $category) { $values = getUserCategoryValues($eUser, $category); //var_dump($values); $descendant_type_sets = getDescendentTypesArray($types, $category); $label = html_encode($category->getLabel()); ?> <tbody id="cat_<?php echo $category->getID(); ?> "> <tr class="cat_head" id="cat_head_<?php echo $category->getID(); ?> "> <td></td> <th colspan="2"><?php echo $label; ?> </th> <td class="control" colspan="3"><ul class="page-action"><li class="last"><a href="#" class="add_btn" id="add_btn_<?php echo $category->getID(); ?> ">Add <?php echo $label; ?> </a></li></ul></td> </tr> <?php if ($values) { foreach ($values as $value) { echo editMetaDataRow($value, $category, $descendant_type_sets); } } ?> </tbody> <?php } } return editMetaDataTable(ob_get_clean()); }
echo "<div class=\"content-small\">for " . $organisation->getTitle() . " > " . ucwords($group) . " > " . ucwords($opts["associated_role"]) . "</div><br />"; echo editMetaDataTable_Category($organisation_id, $group, $role, null, $category); } else { //if there were any errors, return a 500 and display errors header("HTTP/1.0 500 Internal Error"); echo display_status_messages(false); } break; case 'new_value': $cat_id = filter_input(INPUT_POST, "type", FILTER_SANITIZE_NUMBER_INT); $proxy_id = filter_input(INPUT_POST, "proxy_id", FILTER_SANITIZE_NUMBER_INT); $type = MetaDataType::get($cat_id); if ($type) { $user = User::get($proxy_id); $org_id = $user->getOrganisationId(); $group = $user->getGroup(); $role = $user->getRole(); $types = MetaDataTypes::get($org_id, $group, $role, $proxy_id); $value_id = MetaDataValue::create($cat_id, $proxy_id); $value = MetaDataValue::get($value_id); $descendant_type_sets = getDescendentTypesArray($types, $type); header("Content-Type: application/xml"); echo editMetaDataRow($value, $type, $descendant_type_sets); } else { header("HTTP/1.0 500 Internal Error"); echo display_error("Invalid type. Please try again."); } } } exit; }