<?php /* --- CONTROL HEADER --- */ require_once __DIR__ . '/get.php'; require_once __DIR__ . '/update.php'; $_get = new Admin_Custom_Inspiration_Get(); $_update = new Admin_Custom_Inspiration_Update(); $equal_search = array('visibility'); $default_sort_by = "category_order"; $pgdata = page_init($equal_search, $default_sort_by); // static/general.php $page = $pgdata['page']; $query_per_page = $pgdata['query_per_page']; $sort_by = $pgdata['sort_by']; $first_record = $pgdata['first_record']; $search_parameter = $pgdata['search_parameter']; $search_value = $pgdata['search_value']; $search_query = $pgdata['search_query']; $search = $pgdata['search']; $full_order = $_get->count_listing_news_category($search_query, $sort_by, $query_per_page); $total_query = $full_order['total_query']; $total_page = $full_order['total_page']; // RESULT $all_news = $_get->get_listing_news_category($search_query, $sort_by, $first_record, $query_per_page); // STORED VALUE echo "<input type=\"hidden\" name=\"url\" id=\"url\" class=\"hidden\" value=\"" . BASE_URL . "project-category-view\">\n"; echo "<input type=\"hidden\" name=\"page\" id=\"page\" class=\"hidden\" value=\"" . $page . "\" /> \n"; echo "<input type=\"hidden\" name=\"query_per_page\" id=\"query_per_page\" class=\"hidden\" value=\"" . $query_per_page . "\" /> \n"; echo "<input type=\"hidden\" name=\"total_page\" id=\"total_page\" class=\"hidden\" value=\"" . $total_page . "\" /> \n"; echo "<input type=\"hidden\" name=\"sort_by\" id=\"sort_by\" class=\"hidden\" value=\"" . $sort_by . "\" /> \n"; echo "<input type=\"hidden\" name=\"search\" id=\"search\" class=\"hidden\" value=\"" . $search_parameter . "-" . $search_value . "\" /> \n";
<?php require_once __DIR__ . '/get.php'; require_once __DIR__ . '/update.php'; $_get = new Admin_Custom_Inspiration_Get(); $_update = new Admin_Custom_Inspiration_Update(); $category_id = $_REQUEST['ins_id']; $category = $_get->get_category($category_id); $detail_category = $_get->get_category($category_id); if (isset($_POST['btn_detail_project_category'])) { // DEFINED VARIABLE $category_id = $_POST['hidden_category_id']; $category_name = filter_var($_POST['category_name'], FILTER_SANITIZE_STRING); $visibility = $_POST['visibility_status']; $projectText = $_POST['projectText']; if ($_FILES['upload_news_1']['name'] != '') { $image = upload_file($_global_general->url, 'images', $_FILES['upload_news_1'], 'projects', 'files/uploads/projects/', $ini_max_upload); } else { $image = $detail_category['description']; } if ($_FILES['upload_news_2']['name'] != '') { $cover = upload_file($_global_general->url, 'images', $_FILES['upload_news_2'], 'projects', 'files/uploads/projects/', $ini_max_upload); } else { $cover = $detail_category['cover']; } $_update->update($category_name, $image, $cover, $visibility, $projectText, $category_id); $type = 'success'; $msg = 'Changes has been successfully saved'; set_alert($type, $msg); safe_redirect('project-category-detail/' . $category_id); }
<?php require_once __DIR__ . '/get.php'; require_once __DIR__ . '/update.php'; $_get = new Admin_Custom_Inspiration_Get(); $_update = new Admin_Custom_Inspiration_Update(); if (isset($_POST['btn_insert_inspiration_category'])) { // DEFINED VARIABLE $category_name = filter_var($_POST['category_name'], FILTER_SANITIZE_STRING); $visibility = $_POST['visibility_status']; // CALL FUNCTION $order = $_get->get_category_order(); if (empty($order['max_order'])) { $order = 1; } else { $order = $order['max_order'] + 1; } $_update->insert($category_name, '', $visibility, $order); $type = 'success'; $msg = 'Item has been successfully saved'; set_alert($type, $msg); safe_redirect('self'); } ?>