/
pages.php
90 lines (77 loc) · 2.56 KB
/
pages.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
class Pages extends Public_Controller
{
function __construct()
{
parent::__construct();
}
function index($slug)
{
if($_POST&&($slug=='contactus'))
{
$this->load->library('email');
$data['contact'] = new Contact;
$data['contact']->from_array($_POST);
$data['contact']->save();
$group = new Group($_POST['group_id']);
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from($_POST['email'], $_POST['name']);
$email = 'jakepong@hotmail.com';
$this->email->to($email);
//$this->email->to($group->email);
$this->email->subject($_POST['title']);
$this->email->message($this->load->view('view',$data,TRUE));
$this->email->send();
//echo $this->email->print_debugger();
set_notify('success','ระบบได้ทำการบันทึกข้อมูลเรียบร้อยแล้วค่ะ');
redirect($_SERVER['HTTP_REFERER']);
}
$data['page'] = new Page();
$data['page']->get_by_slug($slug);
$this->template->build('page_index',$data);
}
function view($id)
{
if($_POST&&($slug=='contactus'))
{
$this->load->library('email');
$contact = new Contact;
$contact->from_array($_POST);
$contact->save();
$group = new Group($_POST['group_id']);
$config['mailtype'] = 'html';
$this->email->initialize($config);
$this->email->from($_POST['email'], $_POST['name']);
$this->email->to($group->email);
$this->email->subject($_POST['title']);
$this->email->message($_POST['detail']);
$this->email->send();
set_notify('success','ระบบได้ทำการบันทึกข้อมูลเรียบร้อยแล้วค่ะ');
redirect($_SERVER['HTTP_REFERER']);
}
$data['page'] = new Page($id);
$category_type = "pages";$category_id = $id;
// auth_access($category_type,$category_id);
$data['page']->counter();
$this->template->build('page_index',$data);
}
function txtslide($id=66){
$data['page'] = new Page($id);
$this->load->view('txtslide',$data);
// echo'<div id="marquee">
// <marquee align="middle" scrollamount="5" scrolldelay="91" onmouseover="this.stop();" onmouseout="this.start();">'.lang_decode($page->detail).'</marquee>
// </div>';
}
function save(){
if($_POST)
{
$data['contact'] = new Contact;
$data['contact']->from_array($_POST);
$data['contact']->save();
set_notify('success', 'ติดต่อสอบถามค่ะ');
}
redirect($_SERVER['HTTP_REFERER']);
}
}
?>