示例#1
0
 function do_edit()
 {
     global $ttH;
     $err = "";
     $menu_id = $ttH->input["id"];
     if (isset($ttH->post['do_submit'])) {
         /*print_arr($ttH->post);
         		die();*/
         $name_action = $ttH->func->get_friendly_link($ttH->post["name_action"]);
         if (empty($err) && empty($ttH->post["title"])) {
             $err = $ttH->html->html_alert($ttH->lang["global"]["err_invalid_title"], "error");
         }
         if (empty($err)) {
             $col = array();
             $col["menu_nav"] = get_menu_nav($ttH->post["parent_id"], $menu_id);
             $col["menu_level"] = substr_count($col['menu_nav'], ',') + 1;
             $col["parent_id"] = $ttH->post["parent_id"];
             $col["name_action"] = $name_action;
             $col["target"] = $ttH->post["target"];
             $col["show_mod"] = isset($ttH->post["show_mod"]) ? get_input_show($ttH->post["show_mod"]) : "";
             $col["show_act"] = isset($ttH->post["show_act"]) ? get_input_show($ttH->post["show_act"]) : "";
             $col["date_update"] = time();
             $ok = $ttH->db->do_update("menu", $col, " menu_id='" . $menu_id . "'");
             if ($ok) {
                 $col_l = array();
                 $col_l["menu_id"] = $menu_id;
                 $col_l["title"] = $ttH->post["title"];
                 $col_l["link_type"] = $ttH->post["link_type"];
                 $col_l["link"] = $ttH->post["link"];
                 $ttH->db->do_update("menu_lang", $col_l, " menu_id='" . $menu_id . "' and lang='" . $ttH->conf["lang_cur"] . "'");
                 built_menu_nav_sub($menu_id, $col["menu_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 menu a, menu_lang al \n\t\t\t\t\t\twhere a.menu_id=al.menu_id \n\t\t\t\t\t\tand lang='" . $ttH->conf['lang_cur'] . "' \n\t\t\t\t\t\tand a.menu_id=" . $menu_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" => $menu_id));
     $data["list_group"] = list_group("group_id", $data["group_id"], " class=\"form-control\" onchange=\"window.location.href='" . $data["link_action"] . "&group_id='+this.value;\"");
     //$data['group_name'] = $ttH->data["menu_group"][$this->cur_group];
     $data["list_menu"] = list_menu($this->cur_group, "parent_id", $data["parent_id"], " class=\"form-control\"", array("title" => $ttH->lang['global']['select_title'], 'disabled' => $data["menu_id"]));
     $data["list_link_type"] = $ttH->admin->list_link_type("link_type", $data["link_type"], " class=\"form-control\"");
     $data["list_target"] = $ttH->admin->list_target("target", $data["target"], " class=\"form-control\"");
     $data["list_module"] = list_module("show_mod[]", $data["show_mod"], " class=\"form-control\"", array('title' => $ttH->lang["global"]["select_all"]));
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("edit");
     return $ttH->temp_act->text("edit");
 }
示例#2
0
 function do_edit()
 {
     global $ttH;
     $err = "";
     $banner_id = $ttH->input["id"];
     if (isset($ttH->post['do_submit'])) {
         /*print_arr($ttH->post);
         		die();*/
         if (empty($err) && empty($ttH->post["group_id"])) {
             $err = $ttH->html->html_alert($ttH->lang["banner"]["err_invalid_group"], "error");
         }
         $content = '';
         $type = $ttH->post["type"];
         if ($type == 'image') {
             $content = $ttH->func->get_input_pic($ttH->post["picture"]);
         } else {
             $content = $ttH->post["content"];
         }
         $date_begin = '';
         $date_end = '';
         if ($ttH->post["date_begin"]) {
             $tmp = explode(' ', $ttH->post["date_begin"]);
             $tmp[0] = explode('/', $tmp[0]);
             $tmp[1] = explode(':', $tmp[1]);
             $date_begin = mktime($tmp[1][0], $tmp[1][1], 0, $tmp[0][1], $tmp[0][0], $tmp[0][2]);
         }
         if ($ttH->post["date_end"]) {
             $tmp = explode(' ', $ttH->post["date_end"]);
             $tmp[0] = explode('/', $tmp[0]);
             $tmp[1] = explode(':', $tmp[1]);
             $date_end = mktime($tmp[1][0], $tmp[1][1], 0, $tmp[0][1], $tmp[0][0], $tmp[0][2]);
         }
         if (empty($err)) {
             $col = array();
             $col["group_id"] = $ttH->post["group_id"];
             $col["type"] = $ttH->post["type"];
             $col["title"] = $ttH->post["title"];
             $col["link_type"] = $ttH->post["link_type"];
             $col["link"] = $ttH->post["link"];
             $col["target"] = $ttH->post["target"];
             $col["content"] = $content;
             $col["show_mod"] = isset($ttH->post["show_mod"]) ? get_input_show($ttH->post["show_mod"]) : "";
             $col["show_act"] = isset($ttH->post["show_act"]) ? get_input_show($ttH->post["show_act"]) : "";
             $col["date_begin"] = $date_begin;
             $col["date_end"] = $date_end;
             $col["date_update"] = time();
             $ok = $ttH->db->do_update("banner", $col, " lang='" . $ttH->conf['lang_cur'] . "' and banner_id='" . $banner_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");
             }
         }
     }
     $sql = "select * from banner where lang='" . $ttH->conf['lang_cur'] . "' and banner_id=" . $banner_id;
     $result = $ttH->db->query($sql);
     if ($data = $ttH->db->fetch_row($result)) {
         if ($data['type'] == 'image') {
             $data['picture'] = $ttH->admin->get_form_pic('picture', $data['content'], $this->folder_upload, $this->dir);
             $data['content'] = '';
         }
     } else {
         $ttH->html->alert($ttH->lang["global"]["not_found_page"], $ttH->admin->get_link_admin($this->modules, $this->action));
     }
     $data["err"] = $err;
     $data["link_action"] = $ttH->admin->get_link_admin($this->modules, $this->action, $this->sub, array("id" => $banner_id));
     $data["list_group"] = list_group("group_id", $data["group_id"], " class=\"form-control\"");
     $data["list_link_type"] = $ttH->admin->list_link_type("link_type", $data["link_type"], " class=\"form-control\"");
     $data["list_target"] = $ttH->admin->list_target("target", $data["target"], " class=\"form-control\"");
     $data["html_content"] = $ttH->editor->load_editor("content", "content", $data["content"], "", "full", array("folder_up" => $this->folder_upload, "fldr" => $this->dir));
     $data["list_module"] = list_module("show_mod[]", $data["show_mod"], " class=\"form-control\"", array('title' => $ttH->lang["global"]["select_all"]));
     $data['type_check_' . $data['type']] = ' checked="checked"';
     $data["date_begin"] = $data["date_begin"] == 0 ? '' : $data["date_begin"];
     $data["date_end"] = $data["date_end"] == 0 ? '' : $data["date_end"];
     if ($data["date_begin"] && is_numeric($data["date_begin"])) {
         $data["date_begin"] = date('d/m/Y H:i', $data["date_begin"]);
     }
     if ($data["date_end"]) {
         $data["date_end"] = date('d/m/Y H:i', $data["date_end"]);
     }
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("edit");
     return $ttH->temp_act->text("edit");
 }
示例#3
0
 function do_add_menu()
 {
     global $ttH;
     $cur_group = isset($ttH->input['group_id']) ? $ttH->input['group_id'] : 'menu_header';
     $temp = 'menu_add';
     $name_action = isset($ttH->get['name_action']) ? $ttH->get['name_action'] : '';
     $link_action = $ttH->admin->get_link_admin_popup('layout', 'menu', 'add_menu', array("name_action" => $name_action));
     $tmp = explode('-', $name_action);
     $table = $tmp[1] != 'item' ? $tmp[0] . '_' . $tmp[1] : $tmp[0];
     $table_key = $tmp[1] . '_id';
     $table_id = $tmp[2];
     $sql = "select * from " . $table . " a, " . $table . "_lang al \r\r\n\t\t\t\t\t\twhere a." . $table_key . "=al." . $table_key . " \r\r\n\t\t\t\t\t\tand lang='" . $ttH->conf['lang_cur'] . "' \r\r\n\t\t\t\t\t\tand a." . $table_key . "='" . $table_id . "'";
     $result = $ttH->db->query($sql);
     if ($table_info = $ttH->db->fetch_row($result)) {
     }
     $data = array();
     $err = "";
     if (isset($ttH->post['do_submit'])) {
         /*print_arr($ttH->post);
         		die();*/
         $name_action = $ttH->func->get_friendly_link($ttH->post["name_action"]);
         if (empty($ttH->post["title"])) {
             $err = $ttH->html->html_alert($ttH->lang["global"]["err_invalid_title"], "error");
         }
         if (empty($err)) {
             $col = array();
             $col["group_id"] = $cur_group;
             $col["parent_id"] = $ttH->post["parent_id"];
             $col["name_action"] = $name_action;
             $col["target"] = $ttH->post["target"];
             $col["show_mod"] = isset($ttH->post["show_mod"]) ? get_input_show($ttH->post["show_mod"]) : "";
             $col["show_act"] = isset($ttH->post["show_act"]) ? get_input_show($ttH->post["show_act"]) : "";
             $col["show_order"] = 0;
             $col["is_show"] = 1;
             $col["date_create"] = time();
             $col["date_update"] = time();
             $ok = $ttH->db->do_insert("menu", $col);
             if ($ok) {
                 $menu_id = $ttH->db->insertid();
                 $col_l = array();
                 $col_l["menu_id"] = $menu_id;
                 $col_l["title"] = $ttH->post["title"];
                 $col_l["link_type"] = $ttH->post["link_type"];
                 $col_l["link"] = $ttH->post["link"];
                 foreach ($ttH->data["lang"] as $lang_id => $lang_row) {
                     $col_l["lang"] = $lang_row["name"];
                     $ttH->db->do_insert("menu_lang", $col_l);
                 }
                 //update group_nav
                 $col = array();
                 $col["menu_nav"] = get_menu_nav($ttH->post["parent_id"], $menu_id);
                 $col["menu_level"] = substr_count($col['menu_nav'], ',') + 1;
                 $ok = $ttH->db->do_update("menu", $col, " menu_id='" . $menu_id . "'");
                 if ($ok) {
                     built_menu_nav_sub($menu_id, $col["menu_nav"]);
                 }
                 $data = array();
                 $err = $ttH->html->html_alert($ttH->lang["global"]["add_success"], "success");
             } else {
                 $data = $ttH->post;
                 $err = $ttH->html->html_alert($ttH->lang["global"]["add_false"], "error");
             }
         } else {
             $data = $ttH->post;
         }
     }
     $data["err"] = $err;
     $arr_isset = array('group_id', 'parent_id', 'link_type', 'target');
     foreach ($arr_isset as $tmp) {
         $data[$tmp] = isset($data[$tmp]) ? $data[$tmp] : '';
     }
     $data['show_mod'] = isset($data['show_mod']) ? @implode(',', $data['show_mod']) : '';
     $data['name_action'] = $name_action;
     $data['title'] = isset($data['title']) ? $data['title'] : $table_info['title'];
     $data['link'] = isset($data['link']) ? $data['link'] : $table_info['friendly_link'];
     $data["link_action"] = $link_action;
     $data["list_group"] = list_group("group_id", $cur_group, " class=\"form-control\" onchange=\"window.location.href='" . $data["link_action"] . "&group_id='+this.value;\"");
     //$data['group_name'] = $ttH->data["menu_group"][$cur_group];
     $data["list_menu"] = list_menu($cur_group, "parent_id", $data['parent_id'], " class=\"form-control\"", array("title" => $ttH->lang['global']['select_title']));
     $data["list_link_type"] = $ttH->admin->list_link_type("link_type", $data['link_type'], " class=\"form-control\"");
     $data["list_target"] = $ttH->admin->list_target("target", $data['target'], " class=\"form-control\"");
     $data["list_module"] = list_module("show_mod[]", $data['show_mod'], " class=\"form-control\"", array('title' => $ttH->lang["global"]["select_all"]));
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse($temp);
     return $ttH->temp_act->text($temp);
 }
示例#4
0
 function do_edit()
 {
     global $ttH;
     $err = "";
     $menu_id = $ttH->input["id"];
     if (isset($ttH->post['do_submit'])) {
         /*print_arr($ttH->post);
         		die();*/
         $name_action = $ttH->func->fix_name_action($ttH->post["name_action"]);
         if (empty($err) && empty($ttH->post["title"])) {
             $err = $ttH->html->html_alert($ttH->lang["global"]["err_invalid_title"], "error");
         }
         if (empty($err)) {
             $col = array();
             $col["menu_nav"] = get_menu_nav($ttH->post["parent_id"], $menu_id);
             $col["menu_level"] = substr_count($col['menu_nav'], ',') + 1;
             $col["parent_id"] = $ttH->post["parent_id"];
             $col["name_action"] = $name_action;
             $col["target"] = $ttH->post["target"];
             //$col["picture"] = (isset($ttH->post['picture'])) ? $ttH->func->get_input_pic ($ttH->post['picture']) : '';
             $col["group_id"] = isset($ttH->post['group_id']) ? $ttH->post['group_id'] : '';
             $col["show_mod"] = isset($ttH->post["show_mod"]) ? get_input_show($ttH->post["show_mod"]) : "";
             $col["show_act"] = isset($ttH->post["show_act"]) ? get_input_show($ttH->post["show_act"]) : "";
             $col["date_update"] = time();
             //print_arr($col);die;
             $ok = $ttH->db->do_update("menu", $col, " menu_id='" . $menu_id . "'");
             if ($ok) {
                 $col_l = array();
                 $col_l["title"] = $ttH->post["title"];
                 //$col_l["short"] = $ttH->func->input_editor($ttH->post["short"]);
                 $col_l["link_type"] = $ttH->post["link_type"];
                 $col_l["link"] = $ttH->post["link"];
                 $ttH->db->do_update("menu", $col_l, " menu_id='" . $menu_id . "' and lang='" . $ttH->conf["lang_cur"] . "'");
                 built_menu_nav_sub($menu_id, $col["menu_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 menu \r\r\n\t\t\t\t\t\twhere lang='" . $ttH->conf['lang_cur'] . "' \r\r\n\t\t\t\t\t\tand menu_id=" . $menu_id;
     $result = $ttH->db->query($sql);
     if ($data = $ttH->db->fetch_row($result)) {
     } else {
         $ttH->html->alert($ttH->lang["global"]["not_found_page"], $ttH->admin->get_link_admin($this->modules, $this->action));
     }
     $data["err"] = $err;
     $data["link_action"] = $ttH->admin->get_link_admin($this->modules, $this->action, $this->sub, array("id" => $menu_id));
     return $this->_form_input($data);
 }