Commit e91b656d97ab84164fde4a78604a8f4b79024ebc
1 parent
54402351
change request to massage
Showing
5 changed files
with
41 additions
and
4 deletions
Show diff stats
src/app/frontend/controllers/EventsController.php
@@ -271,9 +271,29 @@ class EventsController extends \Phalcon\Mvc\Controller | @@ -271,9 +271,29 @@ class EventsController extends \Phalcon\Mvc\Controller | ||
271 | 271 | ||
272 | } | 272 | } |
273 | 273 | ||
274 | - | 274 | + private function getEventDate($time){ |
275 | + $now = date("Y-m-d H:i:s"); | ||
276 | + $EmailDate = new \DateTime($now); | ||
277 | + $EmailDate->modify($time); | ||
278 | + return $EmailDate->format('Y-m-d H:i:s'); | ||
279 | + } | ||
275 | private function subscribeNewCustomer(){ | 280 | private function subscribeNewCustomer(){ |
276 | - print_r($this->post); | 281 | + $user['email'] = $this->post['email']; |
282 | + $user['name'] = isset($this->post['name']) ? $this->post['name']:''; | ||
283 | + $user['project_id'] = $this->post['project_id']; | ||
284 | + $customer = $this->customers_model->findFirst("email = '{$this->post['email']}'"); | ||
285 | + if($customer instanceof \customersEmailList){ | ||
286 | + | ||
287 | + } else { | ||
288 | + $this->customers_model->save($user); | ||
289 | + $days = 10; | ||
290 | + for($i=1; $i<$days; $i++){ | ||
291 | + $date = $this->getEventDate("+". $i*7 ." days"); | ||
292 | + } | ||
293 | + | ||
294 | + | ||
295 | + } | ||
296 | + | ||
277 | } | 297 | } |
278 | 298 | ||
279 | public function eventMailerAction() | 299 | public function eventMailerAction() |
@@ -300,7 +320,7 @@ class EventsController extends \Phalcon\Mvc\Controller | @@ -300,7 +320,7 @@ class EventsController extends \Phalcon\Mvc\Controller | ||
300 | if(isset($this->post['event_type'])){ | 320 | if(isset($this->post['event_type'])){ |
301 | switch ($this->post['event_type']) { | 321 | switch ($this->post['event_type']) { |
302 | case 'add_subscribe': | 322 | case 'add_subscribe': |
303 | - $this->subscribeNewCustomer($this->project_model->getProjectId($this->host)); | 323 | + $this->subscribeNewCustomer(); |
304 | 324 | ||
305 | 325 | ||
306 | break; | 326 | break; |
src/app/frontend/controllers/StandardEmailController.php
@@ -249,4 +249,9 @@ class StandardEmailController extends \Phalcon\Mvc\Controller | @@ -249,4 +249,9 @@ class StandardEmailController extends \Phalcon\Mvc\Controller | ||
249 | $this->view->disableLevel(\Phalcon\Mvc\View::LEVEL_MAIN_LAYOUT); | 249 | $this->view->disableLevel(\Phalcon\Mvc\View::LEVEL_MAIN_LAYOUT); |
250 | echo $result; | 250 | echo $result; |
251 | } | 251 | } |
252 | + | ||
253 | + | ||
254 | + public function seriesOfLettersAction(){ | ||
255 | + die('here'); | ||
256 | + } | ||
252 | } | 257 | } |
253 | \ No newline at end of file | 258 | \ No newline at end of file |
src/app/frontend/views/layouts/common.php
@@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
12 | <li><a href="<?= $this->url->get([ 'for' => 'event_email_index', 'type' => 'online' ]) ?>" title="Event письма">Event online письма</a></li> | 12 | <li><a href="<?= $this->url->get([ 'for' => 'event_email_index', 'type' => 'online' ]) ?>" title="Event письма">Event online письма</a></li> |
13 | <li><a href="<?= $this->url->get([ 'for' => 'event_email_index', 'type' => 'offline' ]) ?>" title="Event письма">Event offline письма</a></li> | 13 | <li><a href="<?= $this->url->get([ 'for' => 'event_email_index', 'type' => 'offline' ]) ?>" title="Event письма">Event offline письма</a></li> |
14 | <li><a href="<?= $this->url->get([ 'for' => 'standard_email_index' ]) ?>" title="Информационная рассылка">Информационная рассылка</a></li> | 14 | <li><a href="<?= $this->url->get([ 'for' => 'standard_email_index' ]) ?>" title="Информационная рассылка">Информационная рассылка</a></li> |
15 | + <li><a href="<?= $this->url->get([ 'for' => 'series_of_letters' ]) ?>" title="Серии писем">Серии писем</a></li> | ||
15 | <li><a href="#" title="Обратная связь">Обратная связь</a></li> | 16 | <li><a href="#" title="Обратная связь">Обратная связь</a></li> |
16 | <li><a href="<?= $this->url->get([ 'for' => 'delivery_index' ]) ?>" title="Статистика">Статистика</a></li> | 17 | <li><a href="<?= $this->url->get([ 'for' => 'delivery_index' ]) ?>" title="Статистика">Статистика</a></li> |
17 | </ul> | 18 | </ul> |
src/app/tasks/EventMailTask.php
@@ -31,6 +31,7 @@ class EventMailTask extends \Phalcon\CLI\Task | @@ -31,6 +31,7 @@ class EventMailTask extends \Phalcon\CLI\Task | ||
31 | public function startEventsAction(){ | 31 | public function startEventsAction(){ |
32 | $this->actionEventAction(); | 32 | $this->actionEventAction(); |
33 | $this->orderTimeAfterAction(); | 33 | $this->orderTimeAfterAction(); |
34 | + $this->seriesOfLettersAction(); | ||
34 | } | 35 | } |
35 | 36 | ||
36 | public function actionEventAction(){ | 37 | public function actionEventAction(){ |
@@ -119,7 +120,7 @@ class EventMailTask extends \Phalcon\CLI\Task | @@ -119,7 +120,7 @@ class EventMailTask extends \Phalcon\CLI\Task | ||
119 | private function prepareEventData($item_data, $template){ | 120 | private function prepareEventData($item_data, $template){ |
120 | 121 | ||
121 | if($template['text_type']=='static' ){ | 122 | if($template['text_type']=='static' ){ |
122 | - /*Ïðîâåðÿåì òèï øàáëîíà íà äèíàìè÷åñêèé èëè ñòàòè÷åñêèé*/ | 123 | + |
123 | 124 | ||
124 | if( $item_data ){ | 125 | if( $item_data ){ |
125 | $template['text'] = $this->MyMailer->OnlineEvent->itemSet( $template, $item_data ); | 126 | $template['text'] = $this->MyMailer->OnlineEvent->itemSet( $template, $item_data ); |
www/index.php
@@ -403,6 +403,16 @@ try | @@ -403,6 +403,16 @@ try | ||
403 | ] | 403 | ] |
404 | ) | 404 | ) |
405 | ->setName( 'standard_email_getuserslike' ); | 405 | ->setName( 'standard_email_getuserslike' ); |
406 | + | ||
407 | + $router->add | ||
408 | + ( | ||
409 | + '/series_of_letters', | ||
410 | + [ | ||
411 | + 'controller' => 'standard_email', | ||
412 | + 'action' => 'seriesOfLetters', | ||
413 | + ] | ||
414 | + ) | ||
415 | + ->setName( 'series_of_letters' ); | ||
406 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////// | 416 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
407 | 417 | ||
408 | 418 |