add unsibscribe newsletter
This commit is contained in:
parent
e51f4a5934
commit
85047ec900
@ -146,6 +146,20 @@ class AdminMenuStructure{
|
||||
'items' => $items
|
||||
];
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// Hírlevelek
|
||||
/////////////////////////////
|
||||
$items = [];
|
||||
$items[] = ['label' => 'Hírlevelek', 'url' => ['/newsletter/index' , 'NewsletterSearch[start]' =>$todayDatetime,'NewsletterSearch[end]' => $tomorrowDatetime ] ];
|
||||
// $items[] = ['label' => 'Részletek aktiválása', 'url' => ['/ugiro/parts' ] ];
|
||||
// $items[] = ['label' => 'Bevétel', 'url' => ['/transfer/summary' , 'TransferSummarySearch[start]' =>$today,'TransferSummarySearch[end]' => $tomorrow ] ];
|
||||
// $items[] = ['label' => 'Napi bevételek', 'url' => ['/transfer/list', 'TransferListSearch[start]' =>$todayDatetime,'TransferListSearch[end]' => $tomorrowDatetime ] ];
|
||||
// $items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
|
||||
$this->menuItems[] = ['label' => 'Hírlevél', 'url' => $this->emptyUrl,
|
||||
'items' => $items
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -15,19 +15,33 @@ use common\components\Helper;
|
||||
/**
|
||||
* NewsletterController implements the CRUD actions for Newsletter model.
|
||||
*/
|
||||
class NewsletterController extends Controller
|
||||
class NewsletterController extends \backend\controllers\BackendController
|
||||
{
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['post'],
|
||||
],
|
||||
],
|
||||
];
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['post'],
|
||||
],
|
||||
],
|
||||
'access' => [
|
||||
'class' => \yii\filters\AccessControl::className(),
|
||||
'rules' => [
|
||||
// allow authenticated users
|
||||
[
|
||||
'actions' => ['create','index','view','update','delete'],
|
||||
'allow' => true,
|
||||
'roles' => ['admin','employee','reception'],
|
||||
],
|
||||
// everything else is denied
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lists all Newsletter models.
|
||||
|
||||
@ -108,6 +108,10 @@ class TicketController extends Controller {
|
||||
public function actionDaily(){
|
||||
set_time_limit(0);
|
||||
$this->actionWarnExpire();
|
||||
}
|
||||
|
||||
public function actionWeekly(){
|
||||
set_time_limit(0);
|
||||
$this->actionNewsletter();
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m160523_053901_alter_customer_set_default_newsletter_false extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->execute("update customer set newsletter = 0");
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m160523_053901_alter_customer_set_default_newsletter_false cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use yii\db\Schema;
|
||||
use yii\db\Migration;
|
||||
use common\models\Customer;
|
||||
|
||||
class m160523_055217_add_customer_newsletter_token extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->addColumn("customer", "newsletter_token", "string" );
|
||||
|
||||
$customers = Customer::find()->all();
|
||||
|
||||
foreach ($customers as $customer ){
|
||||
$customer->newsletter_token = Yii::$app->security->generateRandomString() . '_' . time();
|
||||
$customer->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
echo "m160523_055217_add_customer_newsletter_token cannot be reverted.\n";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
// Use safeUp/safeDown to run migration code within a transaction
|
||||
public function safeUp()
|
||||
{
|
||||
}
|
||||
|
||||
public function safeDown()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -218,10 +218,6 @@ class CustomerController extends Controller
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// s
|
||||
|
||||
/**
|
||||
|
||||
@ -15,6 +15,8 @@ use yii\filters\AccessControl;
|
||||
use common\models\User;
|
||||
use common\components\Helper;
|
||||
use common\models\Log;
|
||||
use common\models\Customer;
|
||||
use yii\web\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* Site controller
|
||||
@ -176,6 +178,26 @@ class SiteController extends Controller
|
||||
{
|
||||
return $this->render('about');
|
||||
}
|
||||
|
||||
public function actionNewsletterUnsubscribe($id,$token)
|
||||
{
|
||||
|
||||
$customer = Customer::find()
|
||||
->andWhere(['id_customer' => $id ])
|
||||
->andWhere(['newsletter_token' => $token])
|
||||
->one();
|
||||
|
||||
|
||||
if ( !isset($customer)){
|
||||
throw new NotFoundHttpException("Az oldal nem található");
|
||||
}
|
||||
|
||||
$customer->newsletter = 0;
|
||||
$customer->newsletter_token = Yii::$app->security->generateRandomString() . '_' . time();
|
||||
$customer->save();
|
||||
|
||||
return $this->render("unsubscribe");
|
||||
}
|
||||
|
||||
/**
|
||||
* Signs user up.
|
||||
|
||||
1
frontend/views/site/unsubscribe.php
Normal file
1
frontend/views/site/unsubscribe.php
Normal file
@ -0,0 +1 @@
|
||||
Ön sikeresen leiratkozott a hírlevelünkről!
|
||||
Loading…
Reference in New Issue
Block a user