function index() { $page = $this->_get_page(10); $this->_user_mod =& m('member'); $this->_store_mod =& m('store'); $this->_coupon_mod =& m('coupon'); $msg = $this->_user_mod->findAll(array('conditions' => 'user_id = ' . $this->visitor->get('user_id'), 'count' => true, 'limit' => $page['limit'], 'include' => array('bind_couponsn' => array()))); $page['item_count'] = $this->_user_mod->getCount(); $coupon = array(); $coupon_ids = array(); $msg = current($msg); if (!empty($msg['coupon_sn'])) { foreach ($msg['coupon_sn'] as $key => $val) { $coupon_tmp = $this->_coupon_mod->get(array('fields' => "this.*,store.store_name,store.store_id", 'conditions' => 'coupon_id = ' . $val['coupon_id'], 'join' => 'belong_to_store')); $coupon_tmp['valid'] = 0; $time = gmtime(); if ($val['remain_times'] > 0 && ($coupon_tmp['end_time'] == 0 || $coupon_tmp['end_time'] > $time)) { $coupon_tmp['valid'] = 1; } $coupon[$key] = array_merge($val, $coupon_tmp); } } $this->import_resource(array('script' => array(array('path' => 'dialog/dialog.js', 'attr' => 'id="dialog_js"'), array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_coupon'), 'index.php?app=my_coupon', LANG::get('coupon_list')); $this->_curitem('my_coupon'); $this->_curmenu('coupon_list'); $this->assign('page_info', $page); //将分页信息传递给视图,用于形成分页条 $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('coupon_list')); $this->_format_page($page); $this->assign('coupons', $coupon); $this->display('my_coupon.index.html'); }
function index() { $conditions = ''; $conditions = $this->_get_query_conditions(array(array('field' => 'title', 'equal' => 'LIKE'))); /* 取得列表数据 */ $conditions .= ' and store_id =' . $this->_store_id; $page = $this->_get_page(10); //获取分页信息 $trans_list = $this->_trans_mod->find(array('conditions' => '1=1 ' . $conditions, 'limit' => $page['limit'], 'count' => true)); $page['item_count'] = $this->_trans_mod->getCount(); $this->_format_page($page); $this->assign('page_info', $page); $this->assign('trans_list', $trans_list); /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), url('app=member'), LANG::get('trans'), url('app=trans'), LANG::get('trans_list')); $this->_curitem('trans'); $this->_curmenu('trans_list'); $this->import_resource(array('script' => array(array('path' => 'dialog/dialog.js', 'attr' => 'id="dialog_js"'), array('path' => 'mlselection.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => ''), array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => ''), array('path' => 'utils.js', 'attr' => ''), array('path' => 'inline_edit.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); $this->assign('filtered', $conditions ? 1 : 0); //是否有查询条件 //将分页信息传递给视图,用于形成分页条 $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('trans')); header("Content-Type:text/html;charset=" . CHARSET); $this->display('trans.index.html'); }
function index() { /* 获取订单列表 */ $this->_get_orders(); /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_order'), 'index.php?app=buyer_order', LANG::get('order_list')); /* 当前用户中心菜单 */ $this->_curitem('my_order'); $this->_curmenu('order_list'); $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('my_order')); $this->import_resource(array('script' => array(array('path' => 'dialog/dialog.js', 'attr' => 'id="dialog_js"'), array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); /* 显示订单列表 */ $this->display('buyer_order.index.html'); }
function index() { /* 获取订单列表 */ $this->_get_orders(); /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('order_manage'), 'index.php?app=seller_order', LANG::get('order_list')); /* 当前用户中心菜单 */ $type = isset($_GET['type']) && $_GET['type'] != '' ? trim($_GET['type']) : 'all_orders'; $this->_curitem('order_manage'); $this->_curmenu($type); $this->assign('page_title', Lang::get('member_center') . ' - ' . Lang::get('order_manage')); $this->import_resource(array('script' => array(array('path' => 'dialog/dialog.js', 'attr' => 'id="dialog_js"'), array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); /* 显示订单列表 */ $this->display('seller_order.index.html'); }
function index() { $page = $this->_get_page(10); $coupon = $this->_coupon_mod->find(array('conditions' => 'store_id = ' . $this->_store_id, 'limit' => $page['limit'], 'count' => true)); $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('coupon'), 'index.php?app=coupon', LANG::get('coupons_list')); $page['item_count'] = $this->_coupon_mod->getCount(); $this->_format_page($page); $this->assign('page_info', $page); $this->_curitem('coupon'); $this->_curmenu('coupons_list'); $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('coupon')); $this->assign('coupons', $coupon); $this->import_resource(array('script' => array(array('path' => 'dialog/dialog.js', 'attr' => 'id="dialog_js"'), array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); $this->assign('time', gmtime()); $this->display('coupon.index.html'); }
function index() { extract($this->_get_themes()); if (empty($themes)) { $this->show_warning('no_themes'); return; } /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('theme_list')); /* 当前用户中心菜单 */ $this->_curitem('my_theme'); $this->_curmenu('theme_config'); $this->assign('themes', $themes); $this->assign('curr_template_name', $curr_template_name); $this->assign('curr_style_name', $curr_style_name); $this->assign('manage_store', $this->visitor->get('manage_store')); $this->assign('id', $this->visitor->get('user_id')); $this->import_resource(array('script' => array(array('path' => 'dialog/dialog.js', 'attr' => 'id="dialog_js"'), array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); $this->assign('page_title', Lang::get('member_center') . ' - ' . Lang::get('my_theme')); $this->display('my_theme.index.html'); }
/** * 管理 * * @author Garbin * @param none * @return void */ function index() { $search_options = array('seller_name' => Lang::get('store_name'), 'buyer_name' => Lang::get('buyer_name'), 'payment_name' => Lang::get('payment_name'), 'order_sn' => Lang::get('order_sn')); /* 默认搜索的字段是店铺名 */ $field = 'seller_name'; $_GET['status'] = 20; array_key_exists($_GET['field'], $search_options) && ($field = $_GET['field']); $conditions = $this->_get_query_conditions(array(array('field' => $field, 'equal' => 'LIKE', 'name' => 'search_name'), array('field' => 'status', 'equal' => '=', 'type' => 'numeric'), array('field' => 'add_time', 'name' => 'add_time_from', 'equal' => '>=', 'handler' => 'gmstr2time'), array('field' => 'add_time', 'name' => 'add_time_to', 'equal' => '<=', 'handler' => 'gmstr2time_end'), array('field' => 'order_amount', 'name' => 'order_amount_from', 'equal' => '>=', 'type' => 'numeric'), array('field' => 'order_amount', 'name' => 'order_amount_to', 'equal' => '<=', 'type' => 'numeric'))); $model_order =& m('order'); $page = $this->_get_page(10); //获取分页信息 //更新排序 if (isset($_GET['sort']) && isset($_GET['order'])) { $sort = strtolower(trim($_GET['sort'])); $order = strtolower(trim($_GET['order'])); if (!in_array($order, array('asc', 'desc'))) { $sort = 'add_time'; $order = 'desc'; } } else { $sort = 'add_time'; $order = 'desc'; } $orders = $model_order->find(array('conditions' => '1=1 ' . $conditions, 'limit' => $page['limit'], 'order' => "{$sort} {$order}", 'count' => true)); //找出所有商城的合作伙伴 $page['item_count'] = $model_order->getCount(); //获取统计的数据 $this->_format_page($page); $this->assign('filtered', $conditions ? 1 : 0); //是否有查询条件 $this->assign('order_status_list', array(ORDER_PENDING => Lang::get('order_pending'), ORDER_SUBMITTED => Lang::get('order_submitted'), ORDER_ACCEPTED => Lang::get('order_accepted'), ORDER_SHIPPED => Lang::get('order_shipped'), ORDER_FINISHED => Lang::get('order_finished'), ORDER_CANCELED => Lang::get('order_canceled'))); $this->assign('search_options', $search_options); $this->assign('page_info', $page); //将分页信息传递给视图,用于形成分页条 $this->assign('orders', $orders); $this->import_resource(array('script' => array(array('path' => 'dialog/dialog.js', 'attr' => 'id="dialog_js"'), array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); $this->display('fahuo.index.html'); }
function edit() { $coupon_id = isset($_GET['id']) ? intval($_GET['id']) : 0; $current_coupon = $this->_coupon_mod->get_info($coupon_id); if (empty($coupon_id)) { echo Lang::get("no_coupon"); } if (!IS_POST) { $this->import_resource(array('script' => array(array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); header("Content-Type:text/html;charset=" . CHARSET); $gcategory_mod =& bm('gcategory', array('store_id' => 0)); $this->assign('scategories', $this->_get_scategories()); $this->assign('sgrades', $this->_get_sgrade()); $this->assign('gcategories', $gcategory_mod->get_options(0)); $current_coupon['selected'] = array(); $current_coupon['selected'][$current_coupon['type']] = $current_coupon['type_content']; if ($current_coupon['coupon_image']) { $current_coupon['coupon_image'] = dirname(site_url()) . "/" . $current_coupon['coupon_image']; } $store_mod =& m('store'); $store = $store_mod->find(array('conditions' => 'state=1', 'fields' => 'store_name,store_id')); if ($current_coupon['type'] == 4) { $type_content = unserialize($current_coupon['type_content']); if (!empty($type_content)) { foreach ($type_content as $key => $val) { $store[$val]['selected'] = 1; } } } $this->assign('build_editor', $this->_build_editor(array('name' => 'tip', 'content_css' => SITE_URL . "/themes/mall/{$template_name}/styles/{$style_name}/css/ecmall.css"))); $this->assign('build_upload', $this->_build_upload(array('belong' => BELONG_ARTICLE, 'item_id' => 0))); // 构建swfupload上传组件 $this->assign('store', $store); $this->assign('coupon', $current_coupon); $this->display('coupon.form.html'); } else { if (!$current_coupon['if_issue']) { $coupon_value = floatval(trim($_POST['coupon_value'])); $use_times = intval(trim($_POST['use_times'])); $min_amount = floatval(trim($_POST['min_amount'])); if (empty($coupon_value) || $coupon_value < 0) { $this->show_warning('coupon_value_not'); exit; } if (empty($use_times)) { $this->show_warning('use_times_not_zero'); exit; } if ($min_amount < 0) { $this->show_warning("min_amount_gt_zero"); exit; } $start_time = gmstr2time(trim($_POST['start_time'])); $end_time = gmstr2time_end(trim($_POST['end_time'])) - 1; //echo gmstr2time_end(trim($_POST['end_time'])) . '-------' .$end_time;exit; if ($end_time < $start_time) { $this->show_warning('end_gt_start'); exit; } $coupon = array('coupon_name' => trim($_POST['coupon_name']), 'coupon_value' => $coupon_value, 'store_id' => 0, 'use_times' => $use_times, 'start_time' => $start_time, 'end_time' => $end_time, 'min_amount' => $min_amount, 'if_issue' => trim($_POST['if_issue']) == 1 ? 1 : 0, 'tip' => $_POST['tip'], 'open_agree_item' => $_POST['open_agree_item'], 'show_in_list' => $_POST['show_in_list']); if ($_POST['open_agree_item']) { $coupon['type_content'] = $_POST['type'] == 4 ? serialize($_POST['type_content'][$_POST['type']]) : $_POST['type_content'][$_POST['type']]; $coupon['type'] = $_POST['type']; } else { $coupon['type_content'] = ''; $coupon['type'] = ''; } /* 处理上传的图片 */ $coupon_image = $this->_upload_image($coupon_id); if ($coupon_image) { $coupon['coupon_image'] = $coupon_image; } if ($_POST['open_agree_item']) { $store_ids = $this->_save_store_coupon($_POST['type'], $_POST['type_content'][$_POST['type']], $coupon_id); if (trim($_POST['if_issue']) == 1) { if ($store_ids) { foreach ($store_ids as $key => $val) { $ms =& ms(); $content = get_msg(Lang::get('to_store_owner_who_can_use_coupon'), array('coupon_name' => $_POST['coupon_name'])); $ms->pm->send(MSG_SYSTEM, $val, '', $content); } } } } else { $store_coupon_mod =& m('store_coupon'); $store_coupon_mod->drop('coupon_id=' . $coupon_id); } } else { $coupon['if_issue'] = trim($_POST['if_issue']) == 1 ? 1 : 0; $coupon['tip'] = $_POST['tip']; } $this->_coupon_mod->edit($coupon_id, $coupon); if ($this->_coupon_mod->has_error()) { $this->show_warning($this->_coupon_mod->get_error()); exit; } $this->show_message('edit_coupon_success', 'back_list', 'index.php?app=coupon'); } }
function _import_resource() { if (in_array(ACT, array('index', 'add', 'edit'))) { $resource['script'][] = array('path' => 'jquery.ui/jquery.ui.js'); } if (in_array(ACT, array('index', 'add', 'edit'))) { $resource['script'][] = array('attr' => 'id="dialog_js"', 'path' => 'dialog/dialog.js'); } if (in_array(ACT, array('add', 'edit'))) { $resource['script'][] = array('path' => 'jquery.plugins/jquery.validate.js'); } if (in_array(ACT, array('add', 'edit'))) { $resource['script'][] = array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js'); $resource['style'] .= 'jquery.ui/themes/ui-lightness/jquery.ui.css'; } $this->import_resource($resource); }
/** * 列表收藏的店铺 * * @author Garbin * @return void */ function _list_collect_store() { $conditions = $this->_get_query_conditions(array(array('field' => 'store_name', 'equal' => 'LIKE'))); $model_store =& m('store'); $page = $this->_get_page(); //获取分页信息 $collect_store = $model_store->find(array('join' => 'be_collect,belongs_to_user', 'fields' => 'this.*,member.user_name,collect.add_time', 'conditions' => 'collect.user_id = ' . $this->visitor->get('user_id') . $conditions, 'count' => true, 'order' => 'collect.add_time DESC', 'limit' => $page['limit'])); $page['item_count'] = $model_store->getCount(); //获取统计的数据 $this->_format_page($page); $step = intval(Conf::get('upgrade_required')); $step < 1 && ($step = 5); foreach ($collect_store as $key => $store) { empty($store['store_logo']) && ($collect_store[$key]['store_logo'] = Conf::get('default_store_logo')); $collect_store[$key]['credit_image'] = $this->_view->res_base . '/images/' . $model_store->compute_credit($store['credit_value'], $step); } $this->assign('collect_store', $collect_store); /* 当前位置 */ $this->_curlocal(LANG::get('member_center'), 'index.php?app=member', LANG::get('my_favorite'), 'index.php?app=my_favorite', LANG::get('collect_store')); $this->import_resource(array('script' => array(array('path' => 'dialog/dialog.js', 'attr' => 'id="dialog_js"'), array('path' => 'jquery.ui/jquery.ui.js', 'attr' => ''), array('path' => 'jquery.ui/i18n/' . i18n_code() . '.js', 'attr' => ''), array('path' => 'jquery.plugins/jquery.validate.js', 'attr' => '')), 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); //当前用户中心菜单项 $this->_curitem('my_favorite'); $this->_curmenu('collect_store'); $this->assign('page_info', $page); //将分页信息传递给视图,用于形成分页条 $this->assign('filtered', $conditions ? 1 : 0); //是否有查询条件 $this->_config_seo('title', Lang::get('member_center') . ' - ' . Lang::get('collect_store')); $this->display('my_favorite.store.index.html'); }
/** * 让页面具有编辑功能 * * @author Garbin * @param string $html * @return string */ function _make_editable($page, $html) { $editmode = '<base href="' . dirname(site_url()) . '/" /><script type="text/javascript">__PAGE__ = "' . $page . '";</script><script type="text/javascript" src="' . SITE_URL . '/includes/libraries/javascript/jquery.ui/jquery.ui.js"></script><script type="text/javascript" charset="utf-8" src="' . SITE_URL . '/includes/libraries/javascript/jquery.ui/i18n/' . i18n_code() . '.js"></script><script id="dialog_js" type="text/javascript" src="' . SITE_URL . '/includes/libraries/javascript/dialog/dialog.js"></script><script id="template_editor_js" type="text/javascript" src="' . SITE_URL . '/admin/includes/javascript/template_panel.js"></script><link id="template_editor_css" href="' . SITE_URL . '/admin/templates/style/template_panel.css" rel="stylesheet" type="text/css" /><link rel="stylesheet" href="' . SITE_URL . '/includes/libraries/javascript/jquery.ui/themes/ui-lightness/jquery.ui.css" type="text/css" media="screen" />'; return str_replace('<!--<editmode></editmode>-->', $editmode, $html); }
/** * 让页面具有编辑功能 * * @author Garbin * @param string $html * @return string */ function _make_editable($page, $html) { $real_backend_url = site_url(); $editmode = '<script type="text/javascript" src="' . $real_backend_url . '/index.php?act=jslang"></script><script type="text/javascript">__PAGE__ = "' . $page . '"; REAL_BACKEND_URL = "' . $real_backend_url . '";</script><script type="text/javascript" src="' . SITE_URL . '/includes/libraries/javascript/jquery.ui/jquery.ui.js"></script><script type="text/javascript" charset="utf-8" src="' . SITE_URL . '/includes/libraries/javascript/jquery.ui/i18n/' . i18n_code() . '.js"></script><script id="dialog_js" type="text/javascript" src="' . SITE_URL . '/includes/libraries/javascript/dialog/dialog.js"></script><script id="template_editor_js" type="text/javascript" src="' . $real_backend_url . '/includes/javascript/template_panel.js"></script><link id="template_editor_css" href="' . $real_backend_url . '/templates/style/template_panel.css" rel="stylesheet" type="text/css" /><link rel="stylesheet" href="' . SITE_URL . '/includes/libraries/javascript/jquery.ui/themes/ui-lightness/jquery.ui.css" type="text/css" media="screen" /><link rel="stylesheet" href="' . SITE_URL . '/includes/libraries/javascript/hack.css" type="text/css" media="screen" />'; return str_replace('<!--<editmode></editmode>-->', $editmode, $html); }
/** * 编辑商品品牌 * * @author Hyber * @return void */ function edit() { $brand_id = isset($_GET['id']) ? intval($_GET['id']) : 0; if (!$brand_id) { $this->show_warning('no_such_brand'); return; } if (!IS_POST) { $find_data = $this->_brand_mod->find($brand_id); if (empty($find_data)) { $this->show_warning('no_such_brand'); return; } $brand = current($find_data); if ($brand['brand_logo']) { $brand['brand_logo'] = dirname(site_url()) . "/" . $brand['brand_logo']; } if ($brand['brand_recommend']) { $brand['brand_recommend'] = dirname(site_url()) . "/" . $brand['brand_recommend']; } if ($brand['discount_time']) { $brand['discount_time'] = date('Y-m-d', $brand['discount_time']); } /* 显示新增表单 */ $yes_or_no = array(1 => Lang::get('yes'), 0 => Lang::get('no')); $this->import_resource(array('script' => 'jquery.plugins/jquery.validate.js,jquery.ui/jquery.ui.js,jquery.ui/i18n/' . i18n_code() . '.js', 'style' => 'jquery.ui/themes/ui-lightness/jquery.ui.css')); $this->assign('yes_or_no', $yes_or_no); $this->assign('brand', $brand); $this->display('brand.form.html'); } else { $data = array(); $data['brand_name'] = $_POST['brand_name']; $data['brand_link'] = $_POST['brand_link']; $data['sort_order'] = $_POST['sort_order']; $data['recommended'] = $_POST['recommended']; $data['discount'] = $_POST['discount']; $data['discount_time'] = strtotime($_POST['discount_time']); $data['age'] = $_POST['age']; $data['tag'] = $_POST['tag']; $logo = $this->_upload_logo($brand_id); $logo && ($data['brand_logo'] = $logo); if ($logo === false) { return; } $rec_img_url = $this->_upload_recommend($brand_id); $rec_img_url && ($data['brand_recommend'] = $rec_img_url); if ($rec_img_url === false) { return; } /* 检查名称是否已存在 */ if (!$this->_brand_mod->unique(trim($data['brand_name']), $brand_id)) { $this->show_warning('name_exist'); return; } $rows = $this->_brand_mod->edit($brand_id, $data); if ($this->_brand_mod->has_error()) { $this->show_warning($this->_brand_mod->get_error()); return; } $this->show_message('edit_brand_successed', 'back_list', 'index.php?app=brand', 'edit_again', 'index.php?app=brand&act=edit&id=' . $brand_id); } }