Example #1
0
 /**
  * Sends an email to the specified email address using the information collected by this model.
  * @param  string  $email the target email address
  * @return boolean whether the model passes validation
  */
 public function contact($email)
 {
     if ($this->validate()) {
         Yii::$app->mailer->compose()->setTo($email)->setFrom([Yii::$app->params['adminEmail'] => Yii::$app->name . ' - ' . Module::t('module', 'TITLE_CONTACT')])->setReplyTo([$this->email => $this->name])->setSubject($this->subject)->setTextBody($this->body)->send();
         return true;
     } else {
         return false;
     }
 }
Example #2
0
 public function actionIndex()
 {
     $model = new ContactForm();
     if (Yii::$app->user->isGuest) {
         $model->scenario = ContactForm::SCENARIO_GUEST;
     }
     if ($user = Yii::$app->user->identity) {
         /** @var \app\modules\user\models\User $user */
         $model->name = $user->username;
         $model->email = $user->email;
     }
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['supportEmail'])) {
         Yii::$app->session->setFlash('success', Module::t('module', 'FLASH_CONTACT_FORM_SEND_SUCCESS'));
         return $this->refresh();
     } else {
         return $this->render('index', ['model' => $model]);
     }
 }
Example #3
0
 public function getArticlesStatusArray()
 {
     return [self::ARTICLE_INACTIVE => Module::t('app', 'ARTICLE_STATUS_INACTIVE'), self::ARTICLE_ACTIVE => Module::t('app', 'ARTICLE_STATUS_ACTIVE')];
 }
Example #4
0
<?php

use app\modules\main\Module;
/* @var $this yii\web\View */
/* @var $user app\modules\user\models\User */
$resetLink = Yii::$app->urlManager->createAbsoluteUrl(['user/default/password-reset', 'token' => $user->password_reset_token]);
?>

<?php 
echo Module::t('module', 'HELLO {username}', ['username' => $user->username]);
?>

<?php 
echo Module::t('module', 'FOLLOW_TO_RESET_PASSWORD');
?>

<?php 
echo $resetLink;
Example #5
0
                <?php 
    echo $form->field($model, 'name');
    ?>
                <?php 
    echo $form->field($model, 'email');
    ?>
                <?php 
    echo $form->field($model, 'subject');
    ?>
                <?php 
    echo $form->field($model, 'body')->textArea(['rows' => 6]);
    ?>
                <?php 
    echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['captchaAction' => '/main/contact/captcha', 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>']);
    ?>
                <div class="form-group">
                    <?php 
    echo Html::submitButton(Module::t('module', 'BUTTON_SEND'), ['class' => 'btn btn-primary', 'name' => 'contact-button']);
    ?>
                </div>
                <?php 
    ActiveForm::end();
    ?>
            </div>
        </div>

    <?php 
}
?>
</div>
Example #6
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => 'ID', 'created_at' => Module::t('module', 'LOG_CREATED_AT'), 'ip' => Module::t('module', 'LOG_IP'), 'user_id' => Module::t('module', 'LOG_USER')];
 }
Example #7
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['name' => Module::t('module', 'CONTACT_NAME'), 'email' => Module::t('module', 'CONTACT_EMAIL'), 'subject' => Module::t('module', 'CONTACT_SUBJECT'), 'body' => Module::t('module', 'CONTACT_MESSAGE'), 'verifyCode' => Module::t('module', 'CONTACT_VERIFY_CODE')];
 }
Example #8
0
<?php

use yii\helpers\Html;
use yii\grid\GridView;
use app\modules\main\Module;
$this->title = Module::t('module', 'LOG');
$this->params['breadcrumbs'][] = $this->title;
?>
<h1><?php 
echo Html::encode($this->title);
?>
</h1>
<p id="total_logs">
<?php 
echo Module::t('module', 'LOG USER TOTAL: {count}', array('count' => $count));
?>
</p>
<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'ip', ['attribute' => 'user.login', 'label' => Module::t('module', 'LOG_USER_LOGIN')], ['attribute' => 'user.username', 'label' => Module::t('module', 'LOG_USER_NAME')], 'created_at']]);