//if we are removing a given category from DB: $removal_category = $_GET['remove_category']; $multiple_choice = $_GET['multiple_choice']; $pool = new Pool(); $pool->RemoveCategory($removal_category); if (isset($_GET['template_id'])) { //if we are removing a template category: $template_id = $_GET['template_id']; $pool_categories = $pool->GetTemplateCategories($template_id); } else { //if we are removing a non template category: $pool_categories = $pool->GetPoolCategoryData($pool_id); } $number_of_saved_categories = count($pool_categories); if ($number_of_saved_categories > 0) { $return_value = Update_Category_List($pool_categories, $multiple_choice); echo $return_value; } } if (isset($_GET['remove_category_choice'])) { //if we are removing a given category choice from DB: $category_id = $_GET['category_id']; $removal_choice = $_GET['remove_category_choice']; $pool = new Pool(); $pool->RemoveCategoryChoice($removal_choice); $category_choices = $pool->GetCategoryChoices($category_id); $number_categories_choices = count($category_choices); if ($number_categories_choices > 0) { $return_value = Update_Category_Choice_List($category_choices, $category_id); echo $return_value; }
<?php if ($number_of_saved_categories > 0) { //if saved categories exist in given pool: include_once 'inc/update_categories_list.php'; ?> <p style="font-style:italic">Click on a category name or its point value to edit it</p> <br> <div id="saved_category_space"> <?php $category_list = Update_Category_List($pool_categories, 1); echo $category_list; /* 3/26/14 - I COMMENTED OUT THE BELOW CODE - WE CAN CURRENTLY FETCH ALL OF IT USING THE UPDATE_CATEGORY_LIST FUNCTION ABOVE (FOUND IN THE SEND_POOL_DATA.PHP FILE) $category_counter = 1; //create list of saved pool categories for given pool by walking through pool_categories array: foreach($pool_categories as $category_id => $category_info){ $category_choices = $pool->GetCategoryChoices($category_id); ?> <div id="category_<?php echo $category_counter; ?>"> <div style="margin-left:50px; width:100%;" class="well well-sm"> <div class="row"> <div class="col-md-2"> <h4> Category name: </h4> </div> <div class="col-md-6"> <h2> <span class="label label-info"><span class="edit_pool_field" id="category_n_span<?php echo $category_info['Category ID']; ?>" style="margin-left:0px; white-space:normal;"><?php echo $category_info['Category Name']; ?></span></span> </h2> </div> <div class="col-md-2"> <h4>