function get_user_links() { $condition = array('user_id' => $this->uid, 'is_active' => 1); $Links = new Links(); $category_list = $Links->load_category($condition); if (count($category_list) > 0) { $links_data_array = array(); for ($counter = 0; $counter < count($category_list); $counter++) { $links_data_array[$counter]['category_id'] = $category_list[$counter]->category_id; $links_data_array[$counter]['category_name'] = $category_list[$counter]->category_name; $Links->user_id = $this->uid; $condition = array('category_id' => $category_list[$counter]->category_id, 'is_active' => 1); $links_array = $Links->load_link($condition); $links_data_array[$counter]['links'] = $links_array; } return $links_data_array; } }
<h4><label>List name</label></h4> <input type="text" name="updated_category_name" class="text longer" value="' . $category[0]->category_name . '" id="updated_category_name" /> </div> <div class="button_position"> <input type="hidden" name="category_id" value="' . $category[0]->category_id . '" /> <input type="button" name="edit_category" value="Save" class="buttonbar" onclick="javascript: list.update(true)" /> </div> </fieldset>'; print $edit_form; } else { if (!empty($_GET['category_id'])) { $condition = array('category_id' => $_GET['category_id'], 'is_active' => 1); $params_array = array('user_id' => $_SESSION['user']['id']); $Links = new Links(); $Links->set_params($params_array); $result_array = $Links->load_link($condition); $return_string = ''; if (count($result_array) > 0) { for ($counter = 0; $counter < count($result_array); $counter++) { $return_string .= '<div class="field"><h4><label><input type="checkbox" name="link_id[]" id="link_id_' . $result_array[$counter]->link_id . '" value="' . $result_array[$counter]->link_id . '" /></label><a href="' . $result_array[$counter]->url . '" target="_blank">' . $result_array[$counter]->title . '</a></h4><span style="font-size:12px;">' . $result_array[$counter]->url . '</span></div>'; } $return_string .= '<div class="button_position"> <input type="button" name="btn_new_list" class="buttonbar" value="Create new" onclick="javascript: list_links.create();" /> <input type="button" name="btn_edit_list" value="Edit selected links" onclick="javascript: list_links.edit();" class="buttonbar" /> <input type="button" name="btn_delete_list" value="Delete selected links" onclick="javascript: list_links.remove()" class="buttonbar" /> </div>'; } else { $return_string = "<center>There are no links under this list. Click <a href=\"javascript: list_links.create();\">here</a> to add</center> "; } print $return_string; }