コード例 #1
0
    function do_edit()
    {
        global $ttH;
        $err = "";
        $item_id = $ttH->input["id"];
        if (isset($ttH->post['do_submit'])) {
            /*print_arr($ttH->post);
            		die();*/
            $group_id = isset($ttH->post['group_id']) ? $ttH->post['group_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($group_id, 0, 'item');
                $col["group_id"] = $group_id;
                $col["picture"] = $ttH->func->get_input_pic($ttH->post["picture"], $this->folder_upload);
                foreach ($this->arr_select as $k => $v) {
                    if (isset($v['muti']) && $v['muti'] == true) {
                        $col[$k] = isset($ttH->post[$k]) ? implode(',', $ttH->post[$k]) : '';
                    } else {
                        $col[$k] = isset($ttH->post[$k]) ? $ttH->post[$k] : '';
                    }
                }
                $col["date_update"] = time();
                $ok = $ttH->db->do_update($this->dbtable, $col, " " . $this->dbtable_id . "='" . $item_id . "'");
                if ($ok) {
                    $col_l = array();
                    $col_l["title"] = $ttH->post["title"];
                    foreach ($this->arr_editor as $k => $v) {
                        $col_l[$k] = $ttH->func->input_editor($ttH->post[$k]);
                    }
                    $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, $this->dbtable . '_lang', $this->dbtable_id, $item_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(isset($ttH->post["content"]) ? $ttH->post["content"] : '');
                    $ttH->db->do_update($this->dbtable . "_lang", $col_l, " " . $this->dbtable_id . "='" . $item_id . "' and lang='" . $ttH->conf["lang_cur"] . "'");
                    //Update menu link
                    $this->func->update_menu_link($this->modules . "-item-" . $item_id, $col_l);
                    //End
                    $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 " . $this->dbtable . " a, " . $this->dbtable . "_lang al \n\t\t\t\t\t\twhere a." . $this->dbtable_id . "=al." . $this->dbtable_id . " \n\t\t\t\t\t\tand lang='" . $ttH->conf['lang_cur'] . "' \n\t\t\t\t\t\tand a." . $this->dbtable_id . "='" . $item_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" => $item_id));
        $data["list_group"] = $this->func->list_group("group_id", $data["group_id"], " class=\"form-control\"", array('title' => $ttH->lang['global']['select_title']));
        $data['picture'] = $ttH->admin->get_form_pic('picture', $data['picture'], $this->folder_upload, $this->dir);
        foreach ($this->arr_editor as $k => $v) {
            $data["html_" . $k] = $ttH->editor->load_editor($k, $k, isset($data[$k]) ? $data[$k] : '', "", isset($v['editor']) ? $v['editor'] : "full", array("folder_up" => $this->folder_upload, "fldr" => $this->dir));
            $ttH->temp_act->assign('row', array('title' => isset($ttH->lang[$this->modules][$k]) ? $ttH->lang[$this->modules][$k] : $ttH->lang['global'][$k], 'html_editor' => $data["html_" . $k]));
            $ttH->temp_act->parse("edit.editor");
        }
        foreach ($this->arr_select as $k => $v) {
            $tmp = array();
            if (isset($v['muti']) && $v['muti'] == true) {
                $tmp["select_muti"] = 1;
            }
            eval('$data["list_' . $k . '"] = $this->func->list_' . $k . ' (
				"' . (isset($tmp["select_muti"]) ? $k . '[]' : $k) . '", 
				"' . (isset($data[$k]) ? $data[$k] : '') . '", 
				" class=\'form-control\'", 
				$tmp);');
            $ttH->temp_act->assign('row', array('title' => isset($ttH->lang[$this->modules][$k]) ? $ttH->lang[$this->modules][$k] : $ttH->lang['global'][$k], 'content' => $data["list_" . $k]));
            $ttH->temp_act->parse("edit.select");
        }
        $ttH->temp_act->assign('data', $data);
        if (!in_array('group_id', $this->arr_notuse)) {
            $ttH->temp_act->parse("edit.group_id");
        }
        $ttH->temp_act->parse("edit");
        return $ttH->temp_act->text("edit");
    }
コード例 #2
0
ファイル: group_.php プロジェクト: duonghoaikhanh/shophoa
 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;
             foreach ($this->arr_picture as $k => $v) {
                 $col[$k] = isset($ttH->post[$k]) ? $ttH->func->get_input_pic($ttH->post[$k]) : '';
             }
             foreach ($this->arr_select as $k => $v) {
                 if (isset($v['muti']) && $v['muti'] == true) {
                     $col[$k] = isset($ttH->post[$k]) ? implode(',', $ttH->post[$k]) : '';
                 } else {
                     $col[$k] = isset($ttH->post[$k]) ? $ttH->post[$k] : '';
                 }
             }
             foreach ($this->arr_checkbox as $k => $v) {
                 if (isset($v['muti']) && $v['muti'] == true) {
                     $col[$k] = isset($ttH->post[$k]) ? implode(',', $ttH->post[$k]) : '';
                 } else {
                     $col[$k] = isset($ttH->post[$k]) ? $ttH->post[$k] : '';
                 }
             }
             $col["date_update"] = time();
             $ok = $ttH->db->do_update($this->modules . "_group", $col, " group_id='" . $group_id . "'");
             if ($ok) {
                 $col_l = array();
                 $col_l["title"] = $ttH->post["title"];
                 foreach ($this->arr_editor as $k => $v) {
                     $col_l[$k] = $ttH->func->input_editor($ttH->post[$k]);
                 }
                 $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, $this->modules . '_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(isset($ttH->post["content"]) ? $ttH->post["content"] : '');
                 $ttH->db->do_update($this->modules . "_group_lang", $col_l, " group_id='" . $group_id . "' and lang='" . $ttH->conf["lang_cur"] . "'");
                 //Update menu link
                 $this->func->update_menu_link($this->modules . "-group-" . $group_id, $col_l);
                 //End
                 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 " . $this->modules . "_group a, " . $this->modules . "_group_lang al \n\t\t\t\t\t\twhere a.group_id=al.group_id \n\t\t\t\t\t\tand lang='" . $ttH->conf['lang_cur'] . "' \n\t\t\t\t\t\tand a.group_id=" . $group_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" => $group_id));
     return $this->_form_input($data);
 }
コード例 #3
0
 function do_edit()
 {
     global $ttH;
     $err = "";
     $item_id = $ttH->input["id"];
     if (isset($ttH->post['do_submit'])) {
         /*print_arr($ttH->post);
         		die();*/
         $group_id = isset($ttH->post['group_id']) ? $ttH->post['group_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($group_id, 0, 'item');
             $col["group_id"] = $group_id;
             $col["picture"] = $ttH->func->get_input_pic($ttH->post["picture"], $this->folder_upload);
             $col["date_update"] = time();
             $ok = $ttH->db->do_update("page", $col, " item_id='" . $item_id . "'");
             if ($ok) {
                 $col_l = array();
                 $col_l["title"] = $ttH->post["title"];
                 $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_lang', 'item_id', $item_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_lang", $col_l, " item_id='" . $item_id . "' and lang='" . $ttH->conf["lang_cur"] . "'");
                 $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 a, page_lang al \n\t\t\t\t\t\twhere a.item_id=al.item_id \n\t\t\t\t\t\tand lang='" . $ttH->conf['lang_cur'] . "' \n\t\t\t\t\t\tand a.item_id=" . $item_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" => $item_id));
     $data["list_group"] = list_group("group_id", $data["group_id"], " class=\"form-control\"", array('title' => $ttH->lang['global']['select_title']));
     $data['picture'] = $ttH->admin->get_form_pic('picture', $data['picture'], $this->folder_upload, $this->dir);
     $data["html_content"] = $ttH->editor->load_editor("content", "content", $data['content'], "", "full", array("folder_up" => $this->folder_upload, "fldr" => $this->dir));
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("edit");
     return $ttH->temp_act->text("edit");
 }
コード例 #4
0
ファイル: gallery.php プロジェクト: duonghoaikhanh/shophoa
 function iframe_upload()
 {
     global $ttH;
     flush();
     $data = array();
     $err = '';
     $ok = 0;
     if (isset($ttH->post['do_submit'])) {
         /*print_arr($ttH->post);
         		die();*/
         $group_id = isset($ttH->post['group_id']) ? $ttH->post['group_id'] : 0;
         if (empty($err)) {
             $num = isset($ttH->post['uploader_count']) ? $ttH->post['uploader_count'] : 0;
             for ($i = 0; $i < $num; $i++) {
                 $status = isset($ttH->post['uploader_' . $i . '_status']) ? $ttH->post['uploader_' . $i . '_status'] : '';
                 if ($status == 'done') {
                     $title = $ttH->post['uploader_' . $i . '_name'];
                     $col = array();
                     $col["group_nav"] = get_group_nav($group_id, 0, 'gallery');
                     $col["group_id"] = $group_id;
                     $col["picture"] = $this->folder_upload . '/' . $this->dir . '/' . $ttH->post['uploader_' . $i . '_name'];
                     $col["title"] = $title;
                     $col["show_order"] = 0;
                     $col["is_show"] = 1;
                     $col["date_create"] = time();
                     $col["date_update"] = time();
                     foreach ($ttH->data["lang"] as $lang_id => $lang_row) {
                         if (isset($item_id) && $item_id) {
                             $friendly_link = isset($ttH->post["friendly_link"]) && $ttH->post["friendly_link"] ? $ttH->post["friendly_link"] : $title;
                             $col["friendly_link"] = $ttH->func->get_friendly_link_db($friendly_link, $this->dbtable, $this->dbtable_id, $item_id, $lang_row["name"]);
                             $col["meta_title"] = isset($ttH->post["meta_title"]) && $ttH->post["meta_title"] ? $ttH->post["meta_title"] : $ttH->func->meta_title($title);
                             $col["meta_key"] = isset($ttH->post["meta_key"]) && $ttH->post["meta_key"] ? $ttH->post["meta_key"] : $ttH->func->meta_key($title);
                             $col["meta_desc"] = isset($ttH->post["meta_desc"]) && $ttH->post["meta_desc"] ? $ttH->func->meta_desc($ttH->post["meta_desc"]) : $ttH->func->meta_desc(isset($ttH->post["content"]) ? $ttH->post["content"] : '');
                         }
                         $col["lang"] = $lang_row["name"];
                         $ok = $ttH->db->do_insert('gallery', $col);
                         if ($ok && !isset($col['item_id'])) {
                             $item_id = $ttH->db->insertid();
                             $col['item_id'] = $item_id;
                             $col_l = array();
                             $col_l['item_id'] = $item_id;
                             $friendly_link = isset($ttH->post["friendly_link"]) && $ttH->post["friendly_link"] ? $ttH->post["friendly_link"] : $title;
                             $col_l["friendly_link"] = $ttH->func->get_friendly_link_db($friendly_link, $this->dbtable, $this->dbtable_id, $item_id, $lang_row["name"]);
                             $col_l["meta_title"] = isset($ttH->post["meta_title"]) && $ttH->post["meta_title"] ? $ttH->post["meta_title"] : $ttH->func->meta_title($title);
                             $col_l["meta_key"] = isset($ttH->post["meta_key"]) && $ttH->post["meta_key"] ? $ttH->post["meta_key"] : $ttH->func->meta_key($title);
                             $col_l["meta_desc"] = isset($ttH->post["meta_desc"]) && $ttH->post["meta_desc"] ? $ttH->func->meta_desc($ttH->post["meta_desc"]) : $ttH->func->meta_desc(isset($ttH->post["content"]) ? $ttH->post["content"] : '');
                             $ttH->db->do_update('gallery', $col_l, " id='" . $item_id . "'");
                             // update current
                         }
                     }
                 }
             }
             $link = $ttH->admin->get_link_admin($this->modules, $this->action, "iframe_upload");
             if ($ok) {
                 $ttH->html->alert($ttH->lang["global"]["add_success"], $link);
             } else {
                 $ttH->html->alert($ttH->lang["global"]["add_false"], $link);
             }
         }
     }
     $data['group_id'] = isset($ttH->input['group_id']) ? $ttH->input['group_id'] : 0;
     $data['link_action'] = $ttH->admin->get_link_admin($this->modules, $this->action, "iframe_upload");
     $data['url_upload'] = $ttH->admin->get_link_admin($this->modules, $this->action, "ajax_upload");
     //$data['url_upload'] = $ttH->conf['rooturl'].'admin/modules/gallery/ajax/upload.php';
     $ttH->temp_act->assign('data', $data);
     $ttH->temp_act->parse("muti_upload");
     echo $ttH->temp_act->text("muti_upload");
     exit;
 }
コード例 #5
0
 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");
 }