1ea3b987
Administrator
maby first commit
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<?php
namespace controllers;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class SeoController extends \Phalcon\Mvc\Controller
{
function indexAction()
{
if( !$this->session->get('isAdminAuth') )
{
return $this->response->redirect([ 'for' => 'admin_login' ]);
}
$seo = $this->seoUrl->getSeoData($this->models->getSeoInfo());
$info = $this->models->getSeoInfo()->getAllSeo();
$this->view->setVars([
'info' => $info
]);
}
|
8799ab32
Administrator
090316
|
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
function setPdfFileAction()
{
if( !$this->session->get('isAdminAuth') )
{
return $this->response->redirect([ 'for' => 'admin_login' ]);
}
if ($this->request->hasFiles() == true) {
foreach ($this->request->getUploadedFiles() as $file){
//Move the file into the application
$route = STORAGE_PATH.'temp/catalog.pdf';
$file->moveTo($route);
}
}
}
|
1ea3b987
Administrator
maby first commit
|
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
function deleteAction()
{
$id = $this->request->get('id');
$this->models->getSeoInfo()->deleteSeo($id);
return $this->response->redirect([ 'for' => 'seo_info_index' ]);
}
function addAction()
{
if( !$this->session->get('isAdminAuth') )
{
return $this->response->redirect([ 'for' => 'admin_login' ]);
}
if( $this->request->isPost() ){
$data = $this->request->getPost('data');
$this->models->getSeoInfo()->addSeoData($data);
return $this->response->redirect([ 'for' => 'seo_info_index' ]);
}
$this->view->setVars([
]);
}
function updateAction()
{
if( !$this->session->get('isAdminAuth') )
{
return $this->response->redirect([ 'for' => 'admin_login' ]);
}
if( $this->request->isPost() ){
$data = $this->request->getPost('data');
$this->models->getSeoInfo()->UpdateSeo($data);
return $this->response->redirect([ 'for' => 'seo_info_index' ]);
}
$id = $this->request->get('id');
$data = $this->models->getSeoInfo()->getOneSeo($id);
$this->view->pick( 'seo/addEdit' );
$this->view->setVars([
'page' => $data
]);
}
function getPriceListAction(){
$list_ru = $this->models->getItems()->getItemsList(2);
$list_ua = $this->models->getItems()->getItemsList(1);
$filename = 'products_seo.csv';
$fp = fopen(STORAGE_PATH.'temp/'.$filename, 'w');
foreach ($list_ru as $fields) {
foreach ($fields as $k => $v) {
if ($k == 'image_url') {
$fields[$k] = $this->storage->getPhotoUrl($v, 'group', '800x');
}
}
fputcsv($fp, $fields, ",");
}
foreach ($list_ua as $fields) {
foreach ($fields as $k => $v) {
if ($k == 'image_url') {
$fields[$k] = $this->storage->getPhotoUrl($v, 'group', '800x');
}
}
fputcsv($fp, $fields, ",");
}
fclose($fp);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . $filename);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
// читаем файл и отправляем его пользователю
readfile(STORAGE_PATH.'temp/'.$filename);
unlink(STORAGE_PATH.'temp/'.$filename);
exit;
}
function getUsersListAction(){
$list = $this->models->getCustomers()->getAllUsersD();
$filename = 'users_list.csv';
$fp = fopen(STORAGE_PATH.'temp/'.$filename, 'w');
foreach ($list as $fields) {
$fields['key'] ="http://semena.in.ua/cabinet/email-cancel/".md5( $fields['email'].'just_sum_text' );
$fields['key_two'] ="http://semena.in.ua/cabinet/email-settings-key/".md5( $fields['email'].'just_sum_text' );
$fields['key_three'] ="http://semena.in.ua/cabinet/key/".md5( $fields['email'].'just_sum_text' );
fputcsv($fp, $fields, ",");
}
fclose($fp);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . $filename);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
// читаем файл и отправляем его пользователю
readfile(STORAGE_PATH.'temp/'.$filename);
unlink(STORAGE_PATH.'temp/'.$filename);
exit;
}
|
acd509a2
Administrator
090316
|
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
function setReconciliationAction(){
if( !$this->session->get('isAdminAuth') )
{
return $this->response->redirect([ 'for' => 'admin_login' ]);
}
$post['text'] = $this->request->getPost('text', 'string', NULL );
if(!(empty($post['text']))){
$this->models->getManagerMail()->UpdateData($post);
$data = $this->models->getManagerMail()->getData();
return $this->response->redirect([ 'for' => 'set_reconciliation','page' => $data[0] ]);
} else {
$data = $this->models->getManagerMail()->getData();
$this->view->setVars([
'page' => $data[0]
]);
}
}
|