function do_edit() { global $ttH; $err = ""; $group_id = $ttH->input["id"]; $sql = "select * from banner_group where group_id='" . $group_id . "'"; $result = $ttH->db->query($sql); if ($data = $ttH->db->fetch_row($result)) { $data["arr_title"] = unserialize($data["arr_title"]); } if (isset($ttH->post['do_submit'])) { /*print_arr($ttH->post); die();*/ $group_id = $ttH->func->get_friendly_link($ttH->post["group_id"]); if (empty($err) && empty($ttH->post["group_id"])) { $err = $ttH->html->html_alert($ttH->lang["banner"]["err_invalid_group"], "error"); } if (empty($err) && empty($ttH->post["title"])) { $err = $ttH->html->html_alert($ttH->lang["global"]["err_invalid_title"], "error"); } if (empty($err)) { $col = array(); $data["arr_title"][$ttH->conf["lang_cur"]] = $ttH->post["title"]; $col["group_id"] = $group_id; $col["arr_title"] = serialize($data["arr_title"]); $data["width"] = $col["width"] = $ttH->post["width"]; $data["height"] = $col["height"] = $ttH->post["height"]; $data["type_show"] = $col["type_show"] = $ttH->post["type_show"]; $col["date_update"] = time(); $ok = $ttH->db->do_update("banner_group", $col, " group_id='" . $group_id . "'"); if ($ok) { $err = $ttH->html->html_alert($ttH->lang["global"]["edit_success"], "success"); } else { $err = $ttH->html->html_alert($ttH->lang["global"]["edit_false"], "error"); } } } $data["err"] = $err; $data["link_action"] = $ttH->admin->get_link_admin($this->modules, $this->action, $this->sub, array("id" => $group_id)); $data["title"] = $data["arr_title"][$ttH->conf["lang_cur"]]; $data["list_type_show"] = list_type_show("type_show", $data['type_show'], " class='form-control'"); $ttH->temp_act->assign('data', $data); $ttH->temp_act->parse("edit"); return $ttH->temp_act->text("edit"); }
function do_edit() { global $ttH; $err = ""; $group_id = $ttH->input["id"]; if (isset($ttH->post['do_submit'])) { /*print_arr($ttH->post); die();*/ $parent_id = isset($ttH->post["parent_id"]) ? (double) $ttH->post["parent_id"] : 0; if (empty($ttH->post["title"])) { $err = $ttH->html->html_alert($ttH->lang["global"]["err_invalid_title"], "error"); } if (empty($err)) { $col = array(); $col["group_nav"] = get_group_nav($parent_id, $group_id); $col["group_level"] = substr_count($col['group_nav'], ',') + 1; $col["parent_id"] = $parent_id; $col["picture"] = $ttH->func->get_input_pic($ttH->post["picture"]); $col["group_related"] = isset($ttH->post["group_related"]) ? implode(',', $ttH->post["group_related"]) : ''; $col["pic_show"] = isset($ttH->post["pic_show"]) ? $ttH->post["pic_show"] : 'slide'; $col["type_show"] = isset($ttH->post["type_show"]) ? $ttH->post["type_show"] : 'list_item'; $col["num_show"] = isset($ttH->post["num_show"]) ? $ttH->post["num_show"] : 0; $col["date_update"] = time(); $ok = $ttH->db->do_update("page_group", $col, " group_id='" . $group_id . "'"); if ($ok) { $col_l = array(); $col_l["title"] = $ttH->post["title"]; $col_l["short"] = $ttH->func->input_editor($ttH->post["short"]); $col_l["content"] = $ttH->func->input_editor($ttH->post["content"]); $friendly_link = $ttH->post["friendly_link"] ? $ttH->post["friendly_link"] : $ttH->post["title"]; $col_l["friendly_link"] = $ttH->func->get_friendly_link_db($friendly_link, 'page_group_lang', 'group_id', $group_id, $ttH->conf['lang_cur']); $col_l["meta_title"] = $ttH->post["meta_title"] ? $ttH->post["meta_title"] : $ttH->func->meta_title($ttH->post["title"]); $col_l["meta_key"] = $ttH->post["meta_key"] ? $ttH->post["meta_key"] : $ttH->func->meta_key($ttH->post["title"]); $col_l["meta_desc"] = $ttH->post["meta_desc"] ? $ttH->func->meta_desc($ttH->post["meta_desc"]) : $ttH->func->meta_desc($ttH->post["content"]); $ttH->db->do_update("page_group_lang", $col_l, " group_id='" . $group_id . "' and lang='" . $ttH->conf["lang_cur"] . "'"); built_group_nav_sub($group_id, $col["group_nav"]); $err = $ttH->html->html_alert($ttH->lang["global"]["edit_success"], "success"); } else { $err = $ttH->html->html_alert($ttH->lang["global"]["edit_false"], "error"); } } } $sql = "select * from page_group a, page_group_lang al \r\r\n\t\t\t\t\t\twhere a.group_id=al.group_id \r\r\n\t\t\t\t\t\tand lang='" . $ttH->conf['lang_cur'] . "' \r\r\n\t\t\t\t\t\tand a.group_id=" . $group_id; $result = $ttH->db->query($sql); if ($data = $ttH->db->fetch_row($result)) { } $data["err"] = $err; $data["link_action"] = $ttH->admin->get_link_admin($this->modules, $this->action, $this->sub, array("id" => $group_id)); $data["list_group"] = list_group("parent_id", $data['parent_id'], " class=\"form-control\"", array("title" => $ttH->lang['global']['select_title'], 'disabled' => $data["group_id"])); $data['picture'] = $ttH->admin->get_form_pic('picture', $data['picture'], $this->folder_upload, $this->dir); $data["html_short"] = $ttH->editor->load_editor("short", "short", $data['short'], "", "mini", array("folder_up" => $this->folder_upload, "fldr" => $this->dir)); $data["html_content"] = $ttH->editor->load_editor("content", "content", $data['content'], "", "full", array("folder_up" => $this->folder_upload, "fldr" => $this->dir)); $data["group_related"] = is_array($data["group_related"]) ? $data["group_related"] : explode(',', $data["group_related"]); //$data["list_group_related"] = list_group ("group_related[]", $data["group_related"], " class=\"form-control\"", array('select_muti' => 1)); $data["list_pic_show"] = list_pic_show("pic_show", $data["pic_show"], " class=\"form-control\""); $data["list_type_show"] = list_type_show("type_show", $data["type_show"], " class=\"form-control\""); $data["list_num_show"] = $ttH->admin->list_number("num_show", 1, 50, $data['num_show'], " class=\"form-control\"", array('title' => 'Tự động ---')); $ttH->temp_act->assign('data', $data); $ttH->temp_act->parse("edit"); return $ttH->temp_act->text("edit"); }