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 | 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 | 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 | 299 | public function eventMailerAction() |
| ... | ... | @@ -300,7 +320,7 @@ class EventsController extends \Phalcon\Mvc\Controller |
| 300 | 320 | if(isset($this->post['event_type'])){ |
| 301 | 321 | switch ($this->post['event_type']) { |
| 302 | 322 | case 'add_subscribe': |
| 303 | - $this->subscribeNewCustomer($this->project_model->getProjectId($this->host)); | |
| 323 | + $this->subscribeNewCustomer(); | |
| 304 | 324 | |
| 305 | 325 | |
| 306 | 326 | break; | ... | ... |
src/app/frontend/controllers/StandardEmailController.php
| ... | ... | @@ -249,4 +249,9 @@ class StandardEmailController extends \Phalcon\Mvc\Controller |
| 249 | 249 | $this->view->disableLevel(\Phalcon\Mvc\View::LEVEL_MAIN_LAYOUT); |
| 250 | 250 | echo $result; |
| 251 | 251 | } |
| 252 | + | |
| 253 | + | |
| 254 | + public function seriesOfLettersAction(){ | |
| 255 | + die('here'); | |
| 256 | + } | |
| 252 | 257 | } |
| 253 | 258 | \ No newline at end of file | ... | ... |
src/app/frontend/views/layouts/common.php
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | <li><a href="<?= $this->url->get([ 'for' => 'event_email_index', 'type' => 'online' ]) ?>" title="Event письма">Event online письма</a></li> |
| 13 | 13 | <li><a href="<?= $this->url->get([ 'for' => 'event_email_index', 'type' => 'offline' ]) ?>" title="Event письма">Event offline письма</a></li> |
| 14 | 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 | 16 | <li><a href="#" title="Обратная связь">Обратная связь</a></li> |
| 16 | 17 | <li><a href="<?= $this->url->get([ 'for' => 'delivery_index' ]) ?>" title="Статистика">Статистика</a></li> |
| 17 | 18 | </ul> | ... | ... |
src/app/tasks/EventMailTask.php
| ... | ... | @@ -31,6 +31,7 @@ class EventMailTask extends \Phalcon\CLI\Task |
| 31 | 31 | public function startEventsAction(){ |
| 32 | 32 | $this->actionEventAction(); |
| 33 | 33 | $this->orderTimeAfterAction(); |
| 34 | + $this->seriesOfLettersAction(); | |
| 34 | 35 | } |
| 35 | 36 | |
| 36 | 37 | public function actionEventAction(){ |
| ... | ... | @@ -119,7 +120,7 @@ class EventMailTask extends \Phalcon\CLI\Task |
| 119 | 120 | private function prepareEventData($item_data, $template){ |
| 120 | 121 | |
| 121 | 122 | if($template['text_type']=='static' ){ |
| 122 | - /*Ïðîâåðÿåì òèï øàáëîíà íà äèíàìè÷åñêèé èëè ñòàòè÷åñêèé*/ | |
| 123 | + | |
| 123 | 124 | |
| 124 | 125 | if( $item_data ){ |
| 125 | 126 | $template['text'] = $this->MyMailer->OnlineEvent->itemSet( $template, $item_data ); | ... | ... |
www/index.php
| ... | ... | @@ -403,6 +403,16 @@ try |
| 403 | 403 | ] |
| 404 | 404 | ) |
| 405 | 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 | ... | ... |