You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
3.3 KiB
PHTML
92 lines
3.3 KiB
PHTML
8 years ago
|
<?php
|
||
|
|
||
|
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||
|
|
||
|
class Template extends CI_Controller {
|
||
|
|
||
|
private $data = array();
|
||
|
|
||
|
public function __construct() {
|
||
|
parent::__construct();
|
||
|
$this->load->model('Templates_model');
|
||
|
$this->load->model('Mails_model');
|
||
|
$this->data['nav'] = 'mail';
|
||
|
$this->data['unseen_num'] = $this->Mails_model->unseen_list();
|
||
|
$this->data['nav_header'] = $this->load->view('mail/mail_header', $this->data, true);
|
||
|
}
|
||
|
|
||
|
public function index() {
|
||
|
$this->edit();
|
||
|
}
|
||
|
|
||
|
public function add() {
|
||
|
$this->Templates_model->add(-1, '新的模板', '');
|
||
|
redirect(site_url('template/edit/' . $this->Templates_model->insert_id));
|
||
|
}
|
||
|
|
||
|
public function edit($tp_sn = -1) {
|
||
|
$this->data['template_list'] = $this->Templates_model->get_list();
|
||
|
$tp_sn =$tp_sn == -1?isset($this->data['template_list'][0]->tp_sn)?$this->data['template_list'][0]->tp_sn:$tp_sn:$tp_sn;
|
||
|
$this->data['template'] = $this->Templates_model->detail($tp_sn);
|
||
|
$this->load->view('header', $this->data);
|
||
|
$this->load->view('mail/tempalte');
|
||
|
$this->load->view('footer');
|
||
|
}
|
||
|
|
||
|
public function edit_submit() {
|
||
|
$tp_sn = $this->input->post('tp_sn');
|
||
|
$tp_title = $this->input->post('tp_title');
|
||
|
$tp_content = $this->input->post('tp_content');
|
||
|
$this->Templates_model->update($tp_sn, -1, $tp_title, $tp_content);
|
||
|
echo json_encode(array('status' => 'ok_go', 'msg' => '保存成功!', 'url' => site_url('template/edit/' . $tp_sn)));
|
||
|
}
|
||
|
|
||
|
//获取模板列表
|
||
|
public function get($need_html=0) {
|
||
|
$this->data['template_list'] = $this->Templates_model->get_list();
|
||
|
if ($need_html!=0) {
|
||
|
$htmls='';
|
||
|
foreach ($this->data['template_list'] as $item_tpl) {
|
||
|
$htmls.='<li><a class="ke-plugin-mailtemplate-link" href="javascript:void(0);" data-href="'.site_url('template/detail/' . $item_tpl->tp_sn).'" class="list-group-item">'.$item_tpl->tp_title.'</a></li>';
|
||
|
}
|
||
|
echo $htmls;
|
||
|
}else{
|
||
|
echo json_encode($this->data);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public function detail($tp_sn=-1)
|
||
|
{
|
||
|
$template=$this->Templates_model->detail($tp_sn);
|
||
|
echo $template->tp_content;
|
||
|
}
|
||
|
|
||
|
public function payment($insert=0)
|
||
|
{
|
||
|
$data=array();
|
||
|
if ($this->input->post('price')) {
|
||
|
$data['payurl']='
|
||
|
<a href="https://www.chinahighlightstravel.com/payment/payment-center.asp?'.
|
||
|
'Site_Language=en_us&'.
|
||
|
'Site_CurrencyType=USD&'.
|
||
|
'Site_ACD=100-200-300&'.
|
||
|
'Site_OnlyPaymentType=0-1&'.
|
||
|
'Order_ID=&'.
|
||
|
'Order_TotalCost='.trim($this->input->post('price')).'&'.
|
||
|
'Order_Name='.urlencode($this->input->post('description')).'&'.
|
||
|
'Order_PaymentType=Motopay&'.
|
||
|
'ToEmail=davidyang@chinahighlights.net">'.
|
||
|
'<img border="0" alt="Pay now" src="http://www.chinahighlights.com/pic/pay-button.png" width="354" height="85" />'.
|
||
|
'</a>';
|
||
|
echo $data['payurl'];
|
||
|
return false;
|
||
|
}elseif ($insert==1) {
|
||
|
echo '';
|
||
|
return false;
|
||
|
}else{
|
||
|
$this->load->view('mail/payment',$data);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|