Esempio n. 1
0
 public function actionContact()
 {
     $this->layout = "main-web";
     $model = new \app\models\Contact();
     if (Yii::$app->request->post()) {
         $post = Yii::$app->request->post();
         if ($model->load($post) && $model->validate()) {
             if ($model->save()) {
                 Yii::$app->session->setFlash('success', 'El Contacto ha sido guardado.');
                 $model->refresh();
             } else {
                 Yii::$app->session->setFlash('error', 'Error al guardar el Contacto.');
             }
         }
     }
     return $this->render('contact', ['model' => $model]);
 }
 public function actionContact()
 {
     $user = User::findOne(Yii::$app->user->id);
     $contact = new \app\models\Contact();
     $model = new ContactForm();
     if ($model->email == null) {
         $model->email = $user->parent->identity;
     }
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
         $contact->user_id = $user->id;
         $contact->email = $model->email;
         $contact->subject = $model->subject;
         $contact->body = $model->body;
         $contact->date = date('Y-m-d h:i:s');
         $contact->status = 0;
         $contact->save();
         return $this->refresh();
     }
     return $this->render('contact', ['model' => $model, 'user' => $user]);
 }
Esempio n. 3
0
<?php

use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\helpers\Url;
use app\models\Notification;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
$events = Notification::getUserNotifications('event');
$journals = Notification::getUserNotifications('journal');
$messages = app\models\Contact::getMessages();
$global = Notification::getGlobalNotifications();
//var_dump($journals); die();
$number_new_events = count($events);
$number_new_journals = count($journals);
$number_messages = count($messages);
$number_global = Notification::notificationCount($global, true);
?>
<!-- Main Header -->
<header class="main-header">

    <!-- Header Navbar -->
    <nav class="navbar navbar-static-top" role="navigation">
        <!-- Logo -->
        <a href="<?php 
echo Yii::$app->homeUrl;
?>
" class="logo">
            <!-- mini logo for sidebar mini 50x50 pixels -->
            <span class="logo-mini"><b>K</b>C</span>
            <!-- logo for regular state and mobile devices -->