From 3baffed23eb562b638e9571457cdedd7b5f3485f Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 3 Oct 2021 20:06:08 +0200 Subject: [PATCH] [Advanced search] Edit of stored query description can now be done. Formatted code a bit. --- application/controllers/Search.php | 9 +- .../migrations/079_add_queries_table.php | 2 +- application/views/interface_assets/footer.php | 581 +++++++++--------- application/views/search/stored_queries.php | 20 +- 4 files changed, 321 insertions(+), 291 deletions(-) diff --git a/application/controllers/Search.php b/application/controllers/Search.php index b7d1b0d3..6ee1a4d5 100644 --- a/application/controllers/Search.php +++ b/application/controllers/Search.php @@ -120,15 +120,14 @@ class Search extends CI_Controller { $this->search_filter->delete_query($id); } - function edit_query() { + function save_edited_query() { $data = array( - 'cat' => xss_clean($this->input->post('category')), - 'title' => xss_clean($this->input->post('title')), - 'note' => xss_clean($this->input->post('content')) + 'description' => xss_clean($this->input->post('description')), ); $this->db->where('id', xss_clean($this->input->post('id'))); - $this->db->update('notes', $data); + $this->db->where('userid', $this->session->userdata['user_id']); + $this->db->update('queries', $data); } function fetchQueryResult($json, $returnquery) { diff --git a/application/migrations/079_add_queries_table.php b/application/migrations/079_add_queries_table.php index 8403f0eb..a1f90889 100644 --- a/application/migrations/079_add_queries_table.php +++ b/application/migrations/079_add_queries_table.php @@ -4,7 +4,7 @@ class Migration_add_queries_table extends CI_Migration { public function up() { - $this->db->query("create table queries (id integer not null auto_increment, query text, description text, userid integer not null, primary key (id)) ENGINE=myisam DEFAULT CHARSET=utf8;"); + $this->db->query("create table if not exists queries (id integer not null auto_increment, query text, description text, userid integer not null, primary key (id)) ENGINE=myisam DEFAULT CHARSET=utf8;"); } public function down() diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 476fab7e..fdf77110 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -52,289 +52,320 @@ function load_was_map() { uri->segment(1) == "search" && $this->uri->segment(2) == "filter") { ?> - + diff --git a/application/views/search/stored_queries.php b/application/views/search/stored_queries.php index a0de4018..5f1e9494 100644 --- a/application/views/search/stored_queries.php +++ b/application/views/search/stored_queries.php @@ -13,15 +13,15 @@ $i = 1;
id . '">'; - echo '