Example #1
0
 public function action_contacts()
 {
     $this->title = "Контакты";
     $this->breadCrambsActive = $this->title;
     $user = $this->user;
     $this->messages = array();
     if ($this->isPost() && isset($_POST['sendEmail'])) {
         if (M_Helpers::sendEmail($_POST, $this->messages)) {
             $_SESSION['success_sent'] = true;
             $this->redirect(M_Link::ToPage('contacts'));
         }
         $this->fields = $_POST;
     } else {
         $this->fields['message'] = '';
         $this->fields['email'] = isset($user['login']) ? $user['login'] : '';
         $this->fields['name'] = isset($user['user_name']) ? $user['user_name'] : '';
         if (isset($_SESSION['success_sent'])) {
             $this->messages['success'] = 'Сообщение отправлено!';
             unset($_SESSION['success_sent']);
         }
     }
     // Получение пути к шаблону
     $templateName = $this->getTemplate('components/page/v_contacts.php');
     // Формирование контента страницы
     $this->blocks['_content_page'] = $this->Template($templateName, $this);
 }