Merge branch 'release/version/v0.1.26'
This commit is contained in:
commit
93c8750441
5
.gitignore
vendored
5
.gitignore
vendored
@ -49,9 +49,10 @@ phpunit.phar
|
|||||||
/rest/web/assets/**
|
/rest/web/assets/**
|
||||||
!/rest/web/assets/.gitkeep
|
!/rest/web/assets/.gitkeep
|
||||||
|
|
||||||
|
/customerapi/web/assets/**
|
||||||
|
!/customerapi/web/assets/.gitkeep
|
||||||
|
|
||||||
|
|
||||||
/customerapi/config/*-local.php
|
/customerapi/config/*-local.php
|
||||||
/customerapi/runtime/logs/**
|
/customerapi/runtime/logs/**
|
||||||
!/customerapi/runtime/.gitkeep
|
!/customerapi/runtime/.gitkeep
|
||||||
/customerapi/web/assets/**
|
|
||||||
!/customerapi/assets/.gitkeep
|
|
||||||
|
|||||||
@ -1,22 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace backend\components;
|
namespace backend\components;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use common\models\Order;
|
|
||||||
use yii\helpers\Html;
|
|
||||||
use common\components\RoleDefinition;
|
use common\components\RoleDefinition;
|
||||||
use common\components\Helper;
|
|
||||||
|
|
||||||
class AdminMenuStructure{
|
class AdminMenuStructure
|
||||||
|
{
|
||||||
|
|
||||||
public $menuItems;
|
public $menuItems;
|
||||||
public $emptyUrl = '#';//maybe null
|
public $emptyUrl = '#';//maybe null
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct()
|
||||||
|
{
|
||||||
$this->menuItems = [];
|
$this->menuItems = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function can($authItem){
|
protected function can($authItem)
|
||||||
|
{
|
||||||
$result = false;
|
$result = false;
|
||||||
if (\Yii::$app->user->can($authItem)) {
|
if (\Yii::$app->user->can($authItem)) {
|
||||||
$result = true;
|
$result = true;
|
||||||
@ -25,48 +26,51 @@ class AdminMenuStructure{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \yii\base\InvalidConfigException
|
||||||
|
*/
|
||||||
protected function addUserMainMenu(){
|
protected function addUserMainMenu()
|
||||||
|
{
|
||||||
|
|
||||||
$userMainMenu = null;
|
$userMainMenu = null;
|
||||||
$items = [];
|
$items = [];
|
||||||
if (!Yii::$app->user->isGuest) {
|
if (!Yii::$app->user->isGuest) {
|
||||||
|
|
||||||
//$today = \Yii::$app->formatter->asDate( time() );
|
//$today = \Yii::$app->formatter->asDate( time() );
|
||||||
$today = \Yii::$app->formatter->asDate( strtotime('today UTC') );
|
$today = \Yii::$app->formatter->asDate(strtotime('today UTC'));
|
||||||
$tomorrow = \Yii::$app->formatter->asDate( strtotime('tomorrow UTC') );
|
$tomorrow = \Yii::$app->formatter->asDate(strtotime('tomorrow UTC'));
|
||||||
|
|
||||||
$todayDatetime = \Yii::$app->formatter->asDatetime( strtotime('today UTC') );
|
$todayDatetime = \Yii::$app->formatter->asDatetime(strtotime('today UTC'));
|
||||||
$tomorrowDatetime = \Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
|
$tomorrowDatetime = \Yii::$app->formatter->asDatetime(strtotime('tomorrow UTC'));
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Beállítások
|
// Beállítások
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
if ( RoleDefinition::isAdmin()){
|
if (RoleDefinition::isAdmin()) {
|
||||||
$items[] = ['label' => 'Felhasználók', 'url' =>['/user/index']];
|
$items[] = ['label' => 'Felhasználók', 'url' => ['/user/index']];
|
||||||
$items[] = ['label' => 'Jogosultságok', 'url' =>['/user/role']];
|
$items[] = ['label' => 'Jogosultságok', 'url' => ['/user/role']];
|
||||||
$this->menuItems[] = ['label' => 'Beállítások', 'url' => $this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Beállítások', 'url' => $this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (RoleDefinition::isAdmin() || RoleDefinition::isEmployee()
|
||||||
|
|| RoleDefinition::isReception()) {
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Törszadatok
|
// Törszadatok
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
$items = [];
|
$items = [];
|
||||||
$items[] = ['label' => 'Raktárak', 'url' =>['/warehouse/index']];
|
$items[] = ['label' => 'Raktárak', 'url' => ['/warehouse/index']];
|
||||||
if ( RoleDefinition::isAdmin()){
|
if (RoleDefinition::isAdmin()) {
|
||||||
$items[] = ['label' => 'Kasszák', 'url' =>['/account/index']];
|
$items[] = ['label' => 'Kasszák', 'url' => ['/account/index']];
|
||||||
}
|
}
|
||||||
$items[] = ['label' => 'Kedvezmények', 'url' => ['/discount/index'] ];
|
$items[] = ['label' => 'Kedvezmények', 'url' => ['/discount/index']];
|
||||||
$items[] = ['label' => 'Termék kategóriák', 'url' => ['/product-category/index'] ];
|
$items[] = ['label' => 'Termék kategóriák', 'url' => ['/product-category/index']];
|
||||||
$items[] = ['label' => 'Bérlet típusok', 'url' => ['/ticket-type/index'] ];
|
$items[] = ['label' => 'Bérlet típusok', 'url' => ['/ticket-type/index']];
|
||||||
$items[] = ['label' => 'Kulcsok', 'url' =>['/key/index']];
|
$items[] = ['label' => 'Kulcsok', 'url' => ['/key/index']];
|
||||||
// $items[] = ['label' => 'Pénznem', 'url' => ['/currency/index'] ];
|
// $items[] = ['label' => 'Pénznem', 'url' => ['/currency/index'] ];
|
||||||
$this->menuItems[] = ['label' => 'Törzsadatok', 'url' =>$this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Törzsadatok', 'url' => $this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -74,13 +78,13 @@ class AdminMenuStructure{
|
|||||||
// BÉRLETEK
|
// BÉRLETEK
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
$items = [];
|
$items = [];
|
||||||
$items[] = ['label' => 'Vendégek', 'url' => ['/customer/index'] , 'target_url' => ['/customer/index' ,'/customer/view','/ticket/index-customer'] ];
|
$items[] = ['label' => 'Vendégek', 'url' => ['/customer/index'], 'target_url' => ['/customer/index', '/customer/view', '/ticket/index-customer']];
|
||||||
$items[] = ['label' => 'Bérletkártyák', 'url' => ['/card/index'] ];
|
$items[] = ['label' => 'Bérletkártyák', 'url' => ['/card/index']];
|
||||||
$items[] = ['label' => 'Bérletek', 'url' => ['/ticket/index' , 'TicketSearch[start]' =>$todayDatetime,'TicketSearch[end]' => $tomorrowDatetime ] ];
|
$items[] = ['label' => 'Bérletek', 'url' => ['/ticket/index', 'TicketSearch[start]' => $todayDatetime, 'TicketSearch[end]' => $tomorrowDatetime]];
|
||||||
$items[] = ['label' => 'Statisztika', 'url' => ['/ticket/statistics' , 'TicketSearchStatisitcs[start]' =>$today,'TicketSearchStatisitcs[end]' => $tomorrow ] ];
|
$items[] = ['label' => 'Statisztika', 'url' => ['/ticket/statistics', 'TicketSearchStatisitcs[start]' => $today, 'TicketSearchStatisitcs[end]' => $tomorrow]];
|
||||||
$items[] = ['label' => 'Kártya létrehozás', 'url' => ['/card-package/index' , ] ];
|
$items[] = ['label' => 'Kártya létrehozás', 'url' => ['/card-package/index',]];
|
||||||
$items[] = ['label' => 'Kártya csomag RFId hozzárendelés', 'url' => ['/card-package/import' , ] ];
|
$items[] = ['label' => 'Kártya csomag RFId hozzárendelés', 'url' => ['/card-package/import',]];
|
||||||
$items[] = ['label' => 'Érvényességek újraszámolása', 'url' => ['/card/recalculate' , ] ];
|
$items[] = ['label' => 'Érvényességek újraszámolása', 'url' => ['/card/recalculate',]];
|
||||||
$this->menuItems[] = ['label' => 'Bérletek/Vendégek', 'url' => $this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Bérletek/Vendégek', 'url' => $this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
];
|
];
|
||||||
@ -89,14 +93,14 @@ class AdminMenuStructure{
|
|||||||
// Termékek
|
// Termékek
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
$items = [];
|
$items = [];
|
||||||
$items[] = ['label' => 'Termékek', 'url' => ['/product/index'] ];
|
$items[] = ['label' => 'Termékek', 'url' => ['/product/index']];
|
||||||
$items[] = ['label' => 'Beszerzések', 'url' => ['/procurement/index'] ];
|
$items[] = ['label' => 'Beszerzések', 'url' => ['/procurement/index']];
|
||||||
$items[] = ['label' => 'Selejt', 'url' => ['/waste/index' ,'WasteSearch[date_start]' =>$today,'WasteSearch[date_end]' => $tomorrow ] ];
|
$items[] = ['label' => 'Selejt', 'url' => ['/waste/index', 'WasteSearch[date_start]' => $today, 'WasteSearch[date_end]' => $tomorrow]];
|
||||||
$items[] = ['label' => 'Leltár csoport', 'url' => ['/inventory-group/index'] ];
|
$items[] = ['label' => 'Leltár csoport', 'url' => ['/inventory-group/index']];
|
||||||
$items[] = ['label' => 'Leltár', 'url' => ['/inventory/index'] ];
|
$items[] = ['label' => 'Leltár', 'url' => ['/inventory/index']];
|
||||||
$items[] = ['label' => 'Részletes eladások', 'url' => ['/transfer/sale' ,'TransferSaleSearch[start]' =>$todayDatetime,'TransferSaleSearch[end]' => $tomorrowDatetime ] ];
|
$items[] = ['label' => 'Részletes eladások', 'url' => ['/transfer/sale', 'TransferSaleSearch[start]' => $todayDatetime, 'TransferSaleSearch[end]' => $tomorrowDatetime]];
|
||||||
$items[] = ['label' => 'Termék összesítő', 'url' => ['/product/statistics' ,'ProductStatisticsSearch[start]' =>$todayDatetime,'ProductStatisticsSearch[end]' => $tomorrowDatetime ] ];
|
$items[] = ['label' => 'Termék összesítő', 'url' => ['/product/statistics', 'ProductStatisticsSearch[start]' => $todayDatetime, 'ProductStatisticsSearch[end]' => $tomorrowDatetime]];
|
||||||
$items[] = ['label' => 'Leltár pillanat képek', 'url' => ['/inventory/daily' ] ];
|
$items[] = ['label' => 'Leltár pillanat képek', 'url' => ['/inventory/daily']];
|
||||||
$this->menuItems[] = ['label' => 'Termékek', 'url' => $this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Termékek', 'url' => $this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
];
|
];
|
||||||
@ -105,11 +109,11 @@ class AdminMenuStructure{
|
|||||||
// Pénzügy
|
// Pénzügy
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
$items = [];
|
$items = [];
|
||||||
$items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index' , 'TransferSearch[start]' =>$todayDatetime,'TransferSearch[end]' => $tomorrowDatetime ] ];
|
$items[] = ['label' => 'Tranzakciók', 'url' => ['/transfer/index', 'TransferSearch[start]' => $todayDatetime, 'TransferSearch[end]' => $tomorrowDatetime]];
|
||||||
// $items[] = ['label' => 'Bevétel', 'url' => ['/transfer/summary' , 'TransferSummarySearch[start]' =>$today,'TransferSummarySearch[end]' => $tomorrow ] ];
|
// $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' => 'Napi bevételek', 'url' => ['/transfer/list', 'TransferListSearch[start]' => $todayDatetime, 'TransferListSearch[end]' => $tomorrowDatetime]];
|
||||||
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
|
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index']];
|
||||||
$items[] = ['label' => 'Későbbi utalások', 'url' => ['/transfer/payment-later','TransferLaterSearch[start]' =>$todayDatetime,'TransferLaterSearch[end]' => $tomorrowDatetime ,'TransferLaterSearch[enterStart]' =>$todayDatetime,'TransferLaterSearch[enterEnd]' => $tomorrowDatetime ] ];
|
$items[] = ['label' => 'Későbbi utalások', 'url' => ['/transfer/payment-later', 'TransferLaterSearch[start]' => $todayDatetime, 'TransferLaterSearch[end]' => $tomorrowDatetime, 'TransferLaterSearch[enterStart]' => $todayDatetime, 'TransferLaterSearch[enterEnd]' => $tomorrowDatetime]];
|
||||||
//$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$todayDatetime,'CollectionSearch[end]' => $tomorrowDatetime ] ];
|
//$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$todayDatetime,'CollectionSearch[end]' => $tomorrowDatetime ] ];
|
||||||
$this->menuItems[] = ['label' => 'Pénzügy', 'url' => $this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Pénzügy', 'url' => $this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
@ -118,17 +122,17 @@ class AdminMenuStructure{
|
|||||||
// Tartós megbízások
|
// Tartós megbízások
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
$items = [];
|
$items = [];
|
||||||
$items[] = ['label' => 'Szerződések', 'url' => ['/contract/index' ] ];
|
$items[] = ['label' => 'Szerződések', 'url' => ['/contract/index']];
|
||||||
$items[] = ['label' => 'Megbízások', 'url' => ['/ticket-installment-request/index' , 'TicketInstallmentRequestSearch[start]' =>$today,'TicketInstallmentRequestSearch[end]' => $tomorrow ] ];
|
$items[] = ['label' => 'Megbízások', 'url' => ['/ticket-installment-request/index', 'TicketInstallmentRequestSearch[start]' => $today, 'TicketInstallmentRequestSearch[end]' => $tomorrow]];
|
||||||
$items[] = ['label' => 'Giro kötegbe jelölés', 'url' => ['/ticket-installment-request/pending' , 'TicketInstallmentRequestSearchPending[end]' => $tomorrow ] ];
|
$items[] = ['label' => 'Giro kötegbe jelölés', 'url' => ['/ticket-installment-request/pending', 'TicketInstallmentRequestSearchPending[end]' => $tomorrow]];
|
||||||
$items[] = ['label' => 'GIRO köteg létrehozás', 'url' => ['/ticket-installment-request/download-giro' ] ];
|
$items[] = ['label' => 'GIRO köteg létrehozás', 'url' => ['/ticket-installment-request/download-giro']];
|
||||||
$items[] = ['label' => 'GIRO kötegek', 'url' => ['/ugiro/index' ] ];
|
$items[] = ['label' => 'GIRO kötegek', 'url' => ['/ugiro/index']];
|
||||||
$items[] = ['label' => 'Detsta feltöltés', 'url' => ['/ugiro/upload' ] ];
|
$items[] = ['label' => 'Detsta feltöltés', 'url' => ['/ugiro/upload']];
|
||||||
// $items[] = ['label' => 'Részletek aktiválása', 'url' => ['/ugiro/parts' ] ];
|
// $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' => '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' => 'Napi bevételek', 'url' => ['/transfer/list', 'TransferListSearch[start]' =>$todayDatetime,'TransferListSearch[end]' => $tomorrowDatetime ] ];
|
||||||
// $items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
|
// $items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
|
||||||
if ( RoleDefinition::isAdmin() ){
|
if (RoleDefinition::isAdmin()) {
|
||||||
$this->menuItems[] = ['label' => 'Tartós megbízások', 'url' => $this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Tartós megbízások', 'url' => $this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
];
|
];
|
||||||
@ -137,8 +141,8 @@ class AdminMenuStructure{
|
|||||||
// Kap lug megbízások
|
// Kap lug megbízások
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
$items = [];
|
$items = [];
|
||||||
$items[] = ['label' => 'Kártya események', 'url' => ['/door-log/index' , 'DoorLogSearch[start]' =>$todayDatetime,'DoorLogSearch[end]' => $tomorrowDatetime ] ];
|
$items[] = ['label' => 'Kártya események', 'url' => ['/door-log/index', 'DoorLogSearch[start]' => $todayDatetime, 'DoorLogSearch[end]' => $tomorrowDatetime]];
|
||||||
$items[] = ['label' => 'Esemény napló', 'url' => ['/log/index' , 'LogSearch[start]' =>$todayDatetime,'LogSearch[end]' => $tomorrowDatetime ] ];
|
$items[] = ['label' => 'Esemény napló', 'url' => ['/log/index', 'LogSearch[start]' => $todayDatetime, 'LogSearch[end]' => $tomorrowDatetime]];
|
||||||
$this->menuItems[] = ['label' => 'Események', 'url' => $this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Események', 'url' => $this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
];
|
];
|
||||||
@ -148,7 +152,7 @@ class AdminMenuStructure{
|
|||||||
// Hírlevelek
|
// Hírlevelek
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
$items = [];
|
$items = [];
|
||||||
$items[] = ['label' => 'Hírlevelek', 'url' => ['/newsletter/index' , 'NewsletterSearch[start]' =>$todayDatetime,'NewsletterSearch[end]' => $tomorrowDatetime ] ];
|
$items[] = ['label' => 'Hírlevelek', 'url' => ['/newsletter/index', 'NewsletterSearch[start]' => $todayDatetime, 'NewsletterSearch[end]' => $tomorrowDatetime]];
|
||||||
$this->menuItems[] = ['label' => 'Hírlevél', 'url' => $this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Hírlevél', 'url' => $this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
];
|
];
|
||||||
@ -158,19 +162,37 @@ class AdminMenuStructure{
|
|||||||
// Korona vírus
|
// Korona vírus
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
$items = [];
|
$items = [];
|
||||||
$items[] = ['label' => 'Inaktiválás', 'url' => ['/customer/inactivate' ] ];
|
$items[] = ['label' => 'Inaktiválás', 'url' => ['/customer/inactivate']];
|
||||||
$items[] = ['label' => 'Aktiválás', 'url' => ['/customer/activate' ] ];
|
$items[] = ['label' => 'Aktiválás', 'url' => ['/customer/activate']];
|
||||||
$this->menuItems[] = ['label' => 'Koronavírus', 'url' => $this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Koronavírus', 'url' => $this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
// Group Training
|
||||||
|
/////////////////////////////
|
||||||
|
if (RoleDefinition::isLoggedUser()) {
|
||||||
|
$items = [];
|
||||||
|
$items[] = ['label' => 'Felszerelés', 'url' => ['/event-equipment-type']];
|
||||||
|
$items[] = ['label' => 'Edzők', 'url' => ['/trainer']];
|
||||||
|
$items[] = ['label' => 'Termek', 'url' => ['/room']];
|
||||||
|
$items[] = ['label' => 'Esemény típusok', 'url' => ['/event-type']];
|
||||||
|
$items[] = ['label' => 'Események', 'url' => ['/event/event/index']];
|
||||||
|
$items[] = ['label' => 'Órarend', 'url' => ['/event/event/timetable']];
|
||||||
|
$items[] = ['label' => 'Hét másolása', 'url' => ['/event/event/copy-week']];
|
||||||
|
$this->menuItems[] = ['label' => 'Csoportos edzés', 'url' => $this->emptyUrl,
|
||||||
|
'items' => $items
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// Development
|
// Development
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
if ( Yii::$app->user ){
|
if (RoleDefinition::isAdmin()) {
|
||||||
$items = [];
|
$items = [];
|
||||||
$items[] = ['label' => 'Kapu Ki', 'url' => ['/door-log/out' ] ];
|
$items[] = ['label' => 'Kapu Ki', 'url' => ['/door-log/out']];
|
||||||
$items[] = ['label' => 'Kapu Be', 'url' => ['/door-log/in' ] ];
|
$items[] = ['label' => 'Kapu Be', 'url' => ['/door-log/in']];
|
||||||
$this->menuItems[] = ['label' => 'Development', 'url' => $this->emptyUrl,
|
$this->menuItems[] = ['label' => 'Development', 'url' => $this->emptyUrl,
|
||||||
'items' => $items
|
'items' => $items
|
||||||
];
|
];
|
||||||
@ -180,12 +202,14 @@ class AdminMenuStructure{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addLoginMainMenu(){
|
protected function addLoginMainMenu()
|
||||||
|
{
|
||||||
if (Yii::$app->user->isGuest) {
|
if (Yii::$app->user->isGuest) {
|
||||||
$mainMenuItem= ['label' => Yii::t('common/site','Login'), 'url' => ['/site/login']];
|
$mainMenuItem = ['label' => Yii::t('common/site', 'Login'), 'url' => ['/site/login']];
|
||||||
} else {
|
} else {
|
||||||
$mainMenuItem= [
|
/** @noinspection PhpUndefinedFieldInspection */
|
||||||
'label' => Yii::t('common/site','Logout') . '(' . Yii::$app->user->identity->username . ')',
|
$mainMenuItem = [
|
||||||
|
'label' => Yii::t('common/site', 'Logout') . '(' . Yii::$app->user->identity->username . ')',
|
||||||
'url' => ['/site/logout'],
|
'url' => ['/site/logout'],
|
||||||
'linkOptions' => ['data-method' => 'post']
|
'linkOptions' => ['data-method' => 'post']
|
||||||
];
|
];
|
||||||
@ -194,7 +218,12 @@ class AdminMenuStructure{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function run(){
|
/**
|
||||||
|
* @return array
|
||||||
|
* @throws \yii\base\InvalidConfigException
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
$this->addUserMainMenu();
|
$this->addUserMainMenu();
|
||||||
// $this->addLoginMainMenu();
|
// $this->addLoginMainMenu();
|
||||||
return $this->menuItems;
|
return $this->menuItems;
|
||||||
|
|||||||
@ -12,7 +12,6 @@ return [
|
|||||||
'basePath' => dirname(__DIR__),
|
'basePath' => dirname(__DIR__),
|
||||||
'controllerNamespace' => 'backend\controllers',
|
'controllerNamespace' => 'backend\controllers',
|
||||||
'bootstrap' => ['log'],
|
'bootstrap' => ['log'],
|
||||||
'modules' => [],
|
|
||||||
'components' => [
|
'components' => [
|
||||||
'request' => [
|
'request' => [
|
||||||
'enableCsrfValidation'=>false,
|
'enableCsrfValidation'=>false,
|
||||||
@ -46,5 +45,11 @@ return [
|
|||||||
'errorAction' => 'site/error',
|
'errorAction' => 'site/error',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'modules' => [
|
||||||
|
'event' => [
|
||||||
|
'class' => 'common\modules\event\EventModule',
|
||||||
|
'mode' => 'backend'
|
||||||
|
],
|
||||||
|
],
|
||||||
'params' => $params,
|
'params' => $params,
|
||||||
];
|
];
|
||||||
|
|||||||
@ -269,7 +269,7 @@ class CardPackageController extends \backend\controllers\BackendController
|
|||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$tx->rollBack();
|
$tx->rollBack();
|
||||||
$model->failed = $model->failed + 1;
|
$model->failed = $model->failed + 1;
|
||||||
\Yii::error("Failed to import card rfid: " . print_r($row, true));
|
\Yii::error("Failed to import card rfid: " . print_r($row, true) . " ->" . $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -149,6 +149,8 @@ class CustomerController extends \backend\controllers\BackendController
|
|||||||
* If update is successful, the browser will be redirected to the 'view' page.
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
* @param integer $id
|
* @param integer $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException
|
||||||
|
* @throws \yii\base\InvalidConfigException
|
||||||
*/
|
*/
|
||||||
public function actionUpdate($id)
|
public function actionUpdate($id)
|
||||||
{
|
{
|
||||||
|
|||||||
109
backend/controllers/EventEquipmentTypeController.php
Normal file
109
backend/controllers/EventEquipmentTypeController.php
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\controllers;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use common\models\EventEquipmentType;
|
||||||
|
use backend\models\EventEquipmentTypeSearch;
|
||||||
|
use yii\web\Controller;
|
||||||
|
use yii\web\NotFoundHttpException;
|
||||||
|
use yii\filters\VerbFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EventEquipmentTypeController implements the CRUD actions for EventEquipmentType model.
|
||||||
|
*/
|
||||||
|
class EventEquipmentTypeController extends Controller
|
||||||
|
{
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'verbs' => [
|
||||||
|
'class' => VerbFilter::className(),
|
||||||
|
'actions' => [
|
||||||
|
'delete' => ['post'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all EventEquipmentType models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
$searchModel = new EventEquipmentTypeSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
return $this->render('index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a single EventEquipmentType model.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionView($id)
|
||||||
|
{
|
||||||
|
return $this->render('view', [
|
||||||
|
'model' => $this->findModel($id),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new EventEquipmentType model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreate()
|
||||||
|
{
|
||||||
|
$model = new EventEquipmentType();
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('create', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an existing EventEquipmentType model.
|
||||||
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionUpdate($id)
|
||||||
|
{
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('update', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the EventEquipmentType model based on its primary key value.
|
||||||
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
* @param integer $id
|
||||||
|
* @return EventEquipmentType the loaded model
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
protected function findModel($id)
|
||||||
|
{
|
||||||
|
if (($model = EventEquipmentType::findOne($id)) !== null) {
|
||||||
|
return $model;
|
||||||
|
} else {
|
||||||
|
throw new NotFoundHttpException('The requested page does not exist.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
152
backend/controllers/EventRegistrationController.php
Normal file
152
backend/controllers/EventRegistrationController.php
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\controllers;
|
||||||
|
|
||||||
|
use common\manager\EventRegistrationManager;
|
||||||
|
use common\models\CardEventRegistrationForm;
|
||||||
|
use Yii;
|
||||||
|
use common\models\EventRegistration;
|
||||||
|
use backend\models\EventRegistrationSearch;
|
||||||
|
use yii\web\BadRequestHttpException;
|
||||||
|
use yii\web\Controller;
|
||||||
|
use yii\web\HttpException;
|
||||||
|
use yii\web\NotFoundHttpException;
|
||||||
|
use yii\filters\VerbFilter;
|
||||||
|
use yii\web\ServerErrorHttpException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EventRegistrationController implements the CRUD actions for EventRegistration model.
|
||||||
|
*/
|
||||||
|
class EventRegistrationController extends Controller
|
||||||
|
{
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'verbs' => [
|
||||||
|
'class' => VerbFilter::className(),
|
||||||
|
'actions' => [
|
||||||
|
'delete' => ['post'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all EventRegistration models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
$searchModel = new EventRegistrationSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
return $this->render('index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a single EventRegistration model.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionView($id)
|
||||||
|
{
|
||||||
|
return $this->render('view', [
|
||||||
|
'model' => $this->findModel($id),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new EventRegistration model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreate()
|
||||||
|
{
|
||||||
|
$model = new EventRegistration();
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('create', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an existing EventRegistration model.
|
||||||
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException
|
||||||
|
*/
|
||||||
|
public function actionUpdate($id)
|
||||||
|
{
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('update', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an existing EventRegistration model.
|
||||||
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException
|
||||||
|
* @throws \yii\db\StaleObjectException
|
||||||
|
*/
|
||||||
|
public function actionDelete($id)
|
||||||
|
{
|
||||||
|
$this->findModel($id)->delete();
|
||||||
|
|
||||||
|
return $this->redirect(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function actionRegisterCard(){
|
||||||
|
$model = new CardEventRegistrationForm();
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->validate() ) {
|
||||||
|
$manager = new EventRegistrationManager();
|
||||||
|
try {
|
||||||
|
$manager->registerCard($model);
|
||||||
|
} catch (HttpException $e) {
|
||||||
|
if ( array_key_exists($e->getCode(),EventRegistrationManager::$STATES)) {
|
||||||
|
$model->addError("id_event", Yii::t('event-registration', EventRegistrationManager::$STATES[$e->getCode()]));
|
||||||
|
}else {
|
||||||
|
$model->addError("id_event", Yii::t('event-registration', "Unknown Error"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( $model->hasErrors() ){
|
||||||
|
return $this->redirect(['view', 'id' => $model->registration->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('register_card', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the EventRegistration model based on its primary key value.
|
||||||
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
* @param integer $id
|
||||||
|
* @return EventRegistration the loaded model
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
protected function findModel($id)
|
||||||
|
{
|
||||||
|
if (($model = EventRegistration::findOne($id)) !== null) {
|
||||||
|
return $model;
|
||||||
|
} else {
|
||||||
|
throw new NotFoundHttpException('The requested page does not exist.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
121
backend/controllers/EventTypeController.php
Normal file
121
backend/controllers/EventTypeController.php
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\controllers;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use common\models\EventType;
|
||||||
|
use backend\models\EventTypeSearch;
|
||||||
|
use yii\web\Controller;
|
||||||
|
use yii\web\NotFoundHttpException;
|
||||||
|
use yii\filters\VerbFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EventTypeController implements the CRUD actions for EventType model.
|
||||||
|
*/
|
||||||
|
class EventTypeController extends Controller
|
||||||
|
{
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'verbs' => [
|
||||||
|
'class' => VerbFilter::className(),
|
||||||
|
'actions' => [
|
||||||
|
'delete' => ['post'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all EventType models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
$searchModel = new EventTypeSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
return $this->render('index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a single EventType model.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionView($id)
|
||||||
|
{
|
||||||
|
return $this->render('view', [
|
||||||
|
'model' => $this->findModel($id),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new EventType model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreate()
|
||||||
|
{
|
||||||
|
$model = new EventType();
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('create', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an existing EventType model.
|
||||||
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionUpdate($id)
|
||||||
|
{
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('update', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an existing EventType model.
|
||||||
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionDelete($id)
|
||||||
|
{
|
||||||
|
$this->findModel($id)->delete();
|
||||||
|
|
||||||
|
return $this->redirect(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the EventType model based on its primary key value.
|
||||||
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
* @param integer $id
|
||||||
|
* @return EventType the loaded model
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
protected function findModel($id)
|
||||||
|
{
|
||||||
|
if (($model = EventType::findOne($id)) !== null) {
|
||||||
|
return $model;
|
||||||
|
} else {
|
||||||
|
throw new NotFoundHttpException('The requested page does not exist.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
121
backend/controllers/RoomController.php
Normal file
121
backend/controllers/RoomController.php
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\controllers;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use common\models\Room;
|
||||||
|
use backend\models\RoomSearch;
|
||||||
|
use yii\web\Controller;
|
||||||
|
use yii\web\NotFoundHttpException;
|
||||||
|
use yii\filters\VerbFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RoomController implements the CRUD actions for Room model.
|
||||||
|
*/
|
||||||
|
class RoomController extends Controller
|
||||||
|
{
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'verbs' => [
|
||||||
|
'class' => VerbFilter::className(),
|
||||||
|
'actions' => [
|
||||||
|
'delete' => ['post'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Room models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
$searchModel = new RoomSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
return $this->render('index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a single Room model.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionView($id)
|
||||||
|
{
|
||||||
|
return $this->render('view', [
|
||||||
|
'model' => $this->findModel($id),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Room model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreate()
|
||||||
|
{
|
||||||
|
$model = new Room();
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('create', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an existing Room model.
|
||||||
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionUpdate($id)
|
||||||
|
{
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('update', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an existing Room model.
|
||||||
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionDelete($id)
|
||||||
|
{
|
||||||
|
$this->findModel($id)->delete();
|
||||||
|
|
||||||
|
return $this->redirect(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the Room model based on its primary key value.
|
||||||
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
* @param integer $id
|
||||||
|
* @return Room the loaded model
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
protected function findModel($id)
|
||||||
|
{
|
||||||
|
if (($model = Room::findOne($id)) !== null) {
|
||||||
|
return $model;
|
||||||
|
} else {
|
||||||
|
throw new NotFoundHttpException('The requested page does not exist.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -71,7 +71,8 @@ class SiteController extends Controller
|
|||||||
$model = new LoginForm();
|
$model = new LoginForm();
|
||||||
$model->roles = [
|
$model->roles = [
|
||||||
'admin',
|
'admin',
|
||||||
'employee'
|
'employee',
|
||||||
|
'trainer',
|
||||||
];
|
];
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->login()) {
|
if ($model->load(Yii::$app->request->post()) && $model->login()) {
|
||||||
|
|
||||||
|
|||||||
@ -5,15 +5,13 @@ namespace backend\controllers;
|
|||||||
use Yii;
|
use Yii;
|
||||||
use common\models\TicketType;
|
use common\models\TicketType;
|
||||||
use backend\models\TicketTypeSearch;
|
use backend\models\TicketTypeSearch;
|
||||||
use yii\web\Controller;
|
|
||||||
use yii\web\NotFoundHttpException;
|
use yii\web\NotFoundHttpException;
|
||||||
use yii\filters\VerbFilter;
|
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TicketTypeController implements the CRUD actions for TicketType model.
|
* TicketTypeController implements the CRUD actions for TicketType model.
|
||||||
*/
|
*/
|
||||||
class TicketTypeController extends \backend\controllers\BackendController
|
class TicketTypeController extends BackendController
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -60,6 +58,7 @@ class TicketTypeController extends \backend\controllers\BackendController
|
|||||||
* Displays a single TicketType model.
|
* Displays a single TicketType model.
|
||||||
* @param integer $id
|
* @param integer $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException
|
||||||
*/
|
*/
|
||||||
public function actionView($id)
|
public function actionView($id)
|
||||||
{
|
{
|
||||||
@ -82,6 +81,7 @@ class TicketTypeController extends \backend\controllers\BackendController
|
|||||||
$model->time_unit_type = TicketType::TIME_UNIT_MONTH;
|
$model->time_unit_type = TicketType::TIME_UNIT_MONTH;
|
||||||
$model->time_unit_count = 1;
|
$model->time_unit_count = 1;
|
||||||
$model->max_usage_count = 0;
|
$model->max_usage_count = 0;
|
||||||
|
$model->max_reservation_count = 0;
|
||||||
$accounts = Account::find()->andWhere(['status' => Account::STATUS_ACTIVE])->all();
|
$accounts = Account::find()->andWhere(['status' => Account::STATUS_ACTIVE])->all();
|
||||||
|
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
@ -99,6 +99,7 @@ class TicketTypeController extends \backend\controllers\BackendController
|
|||||||
* If update is successful, the browser will be redirected to the 'view' page.
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
* @param integer $id
|
* @param integer $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException
|
||||||
*/
|
*/
|
||||||
public function actionUpdate($id)
|
public function actionUpdate($id)
|
||||||
{
|
{
|
||||||
|
|||||||
126
backend/controllers/TrainerController.php
Normal file
126
backend/controllers/TrainerController.php
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\controllers;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use common\models\Trainer;
|
||||||
|
use backend\models\TrainerSearch;
|
||||||
|
use yii\web\Controller;
|
||||||
|
use yii\web\NotFoundHttpException;
|
||||||
|
use yii\filters\VerbFilter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TrainerController implements the CRUD actions for Trainer model.
|
||||||
|
*/
|
||||||
|
class TrainerController extends Controller
|
||||||
|
{
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'verbs' => [
|
||||||
|
'class' => VerbFilter::className(),
|
||||||
|
'actions' => [
|
||||||
|
'delete' => ['post'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all Trainer models.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
$searchModel = new TrainerSearch();
|
||||||
|
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||||
|
|
||||||
|
return $this->render('index', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a single Trainer model.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionView($id)
|
||||||
|
{
|
||||||
|
return $this->render('view', [
|
||||||
|
'model' => $this->findModel($id),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new Trainer model.
|
||||||
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function actionCreate()
|
||||||
|
{
|
||||||
|
$model = new Trainer();
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('create', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates an existing Trainer model.
|
||||||
|
* If update is successful, the browser will be redirected to the 'view' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException
|
||||||
|
*/
|
||||||
|
public function actionUpdate($id)
|
||||||
|
{
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
|
return $this->redirect(['view', 'id' => $model->id]);
|
||||||
|
} else {
|
||||||
|
return $this->render('update', [
|
||||||
|
'model' => $model,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes an existing Trainer model.
|
||||||
|
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||||
|
* @param integer $id
|
||||||
|
* @return mixed
|
||||||
|
* @throws NotFoundHttpException
|
||||||
|
* @throws \yii\db\StaleObjectException
|
||||||
|
*/
|
||||||
|
public function actionDelete($id)
|
||||||
|
{
|
||||||
|
$trainer = $this->findModel($id);
|
||||||
|
$trainer->active = Trainer::ACTIVE_OFF;
|
||||||
|
$trainer->update( );
|
||||||
|
|
||||||
|
return $this->redirect(['index']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the Trainer model based on its primary key value.
|
||||||
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
* @param integer $id
|
||||||
|
* @return Trainer the loaded model
|
||||||
|
* @throws NotFoundHttpException if the model cannot be found
|
||||||
|
*/
|
||||||
|
protected function findModel($id)
|
||||||
|
{
|
||||||
|
if (($model = Trainer::findOne($id)) !== null) {
|
||||||
|
return $model;
|
||||||
|
} else {
|
||||||
|
throw new NotFoundHttpException('The requested page does not exist.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -33,12 +33,11 @@ use common\models\Customer;
|
|||||||
*/
|
*/
|
||||||
class CustomerUpdate extends \common\models\Customer
|
class CustomerUpdate extends \common\models\Customer
|
||||||
{
|
{
|
||||||
|
public $password_plain;
|
||||||
|
|
||||||
public $cardNumber;
|
public $cardNumber;
|
||||||
public $partnerCardNumber;
|
public $partnerCardNumber;
|
||||||
|
|
||||||
public $password_plain;
|
|
||||||
public $password_repeat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
@ -58,6 +57,8 @@ class CustomerUpdate extends \common\models\Customer
|
|||||||
// [['cardNumber'], 'string', 'max' => 10],
|
// [['cardNumber'], 'string', 'max' => 10],
|
||||||
// [['cardNumber'], 'validateCustomerCard' ],
|
// [['cardNumber'], 'validateCustomerCard' ],
|
||||||
|
|
||||||
|
[['password_plain' ] ,'string','min' =>6 ],
|
||||||
|
|
||||||
[['partnerCardNumber'], 'string', 'max' => 10],
|
[['partnerCardNumber'], 'string', 'max' => 10],
|
||||||
[['partnerCardNumber'], 'validatePartnerCard' ],
|
[['partnerCardNumber'], 'validatePartnerCard' ],
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ class CustomerUpdate extends \common\models\Customer
|
|||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
[['password_plain','password_repeat'], 'string', 'max' => 32],
|
[['password_plain' ], 'string', 'max' => 32],
|
||||||
|
|
||||||
[['sex'], 'integer'],
|
[['sex'], 'integer'],
|
||||||
|
|
||||||
@ -114,4 +115,21 @@ class CustomerUpdate extends \common\models\Customer
|
|||||||
// Customer::find()->andWhere( [$this->cardNumber )
|
// Customer::find()->andWhere( [$this->cardNumber )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $insert
|
||||||
|
* @return bool
|
||||||
|
* @throws \yii\base\Exception
|
||||||
|
* @throws \yii\base\InvalidConfigException
|
||||||
|
*/
|
||||||
|
public function beforeSave($insert)
|
||||||
|
{
|
||||||
|
$result = parent::beforeSave($insert);
|
||||||
|
if ($result && !empty($this->password_plain)) {
|
||||||
|
$this->setPassword($this->password_plain);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
67
backend/models/EventEquipmentTypeSearch.php
Normal file
67
backend/models/EventEquipmentTypeSearch.php
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\EventEquipmentType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EventEquipmentTypeSearch represents the model behind the search form about `common\models\EventEquipmentType`.
|
||||||
|
*/
|
||||||
|
class EventEquipmentTypeSearch extends EventEquipmentType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['name'], 'safe'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function scenarios()
|
||||||
|
{
|
||||||
|
// bypass scenarios() implementation in the parent class
|
||||||
|
return Model::scenarios();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = EventEquipmentType::find();
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||||
|
// $query->where('0=1');
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'id' => $this->id,
|
||||||
|
'created_at' => $this->created_at,
|
||||||
|
'updated_at' => $this->updated_at,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['like', 'name', $this->name]);
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
69
backend/models/EventRegistrationSearch.php
Normal file
69
backend/models/EventRegistrationSearch.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\EventRegistration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EventRegistrationSearch represents the model behind the search form about `common\models\EventRegistration`.
|
||||||
|
*/
|
||||||
|
class EventRegistrationSearch extends EventRegistration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id', 'id_event', 'id_customer'], 'integer'],
|
||||||
|
[['created_at', 'updated_at', 'canceled_at'], 'safe'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function scenarios()
|
||||||
|
{
|
||||||
|
// bypass scenarios() implementation in the parent class
|
||||||
|
return Model::scenarios();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = EventRegistration::find();
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||||
|
// $query->where('0=1');
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'id' => $this->id,
|
||||||
|
'id_event' => $this->id_event,
|
||||||
|
'id_customer' => $this->id_customer,
|
||||||
|
'created_at' => $this->created_at,
|
||||||
|
'updated_at' => $this->updated_at,
|
||||||
|
'canceled_at' => $this->canceled_at,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
68
backend/models/EventTypeSearch.php
Normal file
68
backend/models/EventTypeSearch.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\EventType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EventTypeSearch represents the model behind the search form about `common\models\EventType`.
|
||||||
|
*/
|
||||||
|
class EventTypeSearch extends EventType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id'], 'integer'],
|
||||||
|
[['name', 'created_at', 'updated_at'], 'safe'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function scenarios()
|
||||||
|
{
|
||||||
|
// bypass scenarios() implementation in the parent class
|
||||||
|
return Model::scenarios();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = EventType::find();
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||||
|
// $query->where('0=1');
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'id' => $this->id,
|
||||||
|
'created_at' => $this->created_at,
|
||||||
|
'updated_at' => $this->updated_at,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['like', 'name', $this->name]);
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
69
backend/models/RoomSearch.php
Normal file
69
backend/models/RoomSearch.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Room;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RoomSearch represents the model behind the search form about `common\models\Room`.
|
||||||
|
*/
|
||||||
|
class RoomSearch extends Room
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id', 'seat_count'], 'integer'],
|
||||||
|
[['name', 'created_at', 'updated_at'], 'safe'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function scenarios()
|
||||||
|
{
|
||||||
|
// bypass scenarios() implementation in the parent class
|
||||||
|
return Model::scenarios();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = Room::find();
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||||
|
// $query->where('0=1');
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'id' => $this->id,
|
||||||
|
'seat_count' => $this->seat_count,
|
||||||
|
'created_at' => $this->created_at,
|
||||||
|
'updated_at' => $this->updated_at,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['like', 'name', $this->name]);
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
72
backend/models/TrainerSearch.php
Normal file
72
backend/models/TrainerSearch.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace backend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\data\ActiveDataProvider;
|
||||||
|
use common\models\Trainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TrainerSearch represents the model behind the search form about `common\models\Trainer`.
|
||||||
|
*/
|
||||||
|
class TrainerSearch extends Trainer
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id', 'active'], 'integer'],
|
||||||
|
[['name', 'phone', 'email', 'password', 'created_at', 'updated_at'], 'safe'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function scenarios()
|
||||||
|
{
|
||||||
|
// bypass scenarios() implementation in the parent class
|
||||||
|
return Model::scenarios();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates data provider instance with search query applied
|
||||||
|
*
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return ActiveDataProvider
|
||||||
|
*/
|
||||||
|
public function search($params)
|
||||||
|
{
|
||||||
|
$query = Trainer::find();
|
||||||
|
|
||||||
|
$dataProvider = new ActiveDataProvider([
|
||||||
|
'query' => $query,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load($params);
|
||||||
|
|
||||||
|
if (!$this->validate()) {
|
||||||
|
// uncomment the following line if you do not want to return any records when validation fails
|
||||||
|
// $query->where('0=1');
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query->andFilterWhere([
|
||||||
|
'id' => $this->id,
|
||||||
|
'active' => $this->active,
|
||||||
|
'created_at' => $this->created_at,
|
||||||
|
'updated_at' => $this->updated_at,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$query->andFilterWhere(['like', 'name', $this->name])
|
||||||
|
->andFilterWhere(['like', 'phone', $this->phone])
|
||||||
|
->andFilterWhere(['like', 'email', $this->email])
|
||||||
|
->andFilterWhere(['like', 'password', $this->password]);
|
||||||
|
|
||||||
|
return $dataProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,7 +8,6 @@ use yii\data\ActiveDataProvider;
|
|||||||
use common\models\Transfer;
|
use common\models\Transfer;
|
||||||
use yii\db\Expression;
|
use yii\db\Expression;
|
||||||
use yii\db\Query;
|
use yii\db\Query;
|
||||||
use yii\helpers\ArrayHelper;
|
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
use common\components\Helper;
|
use common\components\Helper;
|
||||||
use common\components\RoleDefinition;
|
use common\components\RoleDefinition;
|
||||||
@ -278,11 +277,12 @@ class TransferSearch extends Transfer
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws \yii\db\Exception
|
||||||
|
*/
|
||||||
public function totalsTransfers()
|
public function totalsTransfers()
|
||||||
{
|
{
|
||||||
|
|
||||||
$accounts = Account::read();
|
$accounts = Account::read();
|
||||||
$accountMap = ArrayHelper::map($accounts, 'id_account', 'name');
|
|
||||||
$idUser = $this->id_user;
|
$idUser = $this->id_user;
|
||||||
|
|
||||||
/**mk totals need date time format*/
|
/**mk totals need date time format*/
|
||||||
@ -291,8 +291,7 @@ class TransferSearch extends Transfer
|
|||||||
$start .= ' 00:00';
|
$start .= ' 00:00';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->totals = Transfer::mkTotals($start, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts);
|
||||||
$this->totals = Transfer::mkTotals($start, $this->timestampEnd, $idUser, $this->types, $this->id_account, $accounts, $accountMap);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,6 +69,11 @@ use kartik\widgets\DatePicker;
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
|
<div class='col-md-6'>
|
||||||
|
<?= $form->field($model, 'password_plain')->textInput(['maxlength' => true]) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class='row'>
|
||||||
<div class='col-md-6'>
|
<div class='col-md-6'>
|
||||||
<?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
|
<?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
23
backend/views/event-equipment-type/_form.php
Normal file
23
backend/views/event-equipment-type/_form.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventEquipmentType */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event-equipment-type-form">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/event-equipment-type', 'Create') : Yii::t('common/event-equipment-type', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
26
backend/views/event-equipment-type/_search.php
Normal file
26
backend/views/event-equipment-type/_search.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model backend\models\EventEquipmentTypeSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event-equipment-type-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'name') ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton(Yii::t('common/event-equipment-type', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
21
backend/views/event-equipment-type/create.php
Normal file
21
backend/views/event-equipment-type/create.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventEquipmentType */
|
||||||
|
|
||||||
|
$this->title = Yii::t('common/event-equipment-type', 'Create Event Equipment Type');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/event-equipment-type', 'Event Equipment Types'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-equipment-type-create">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
34
backend/views/event-equipment-type/index.php
Normal file
34
backend/views/event-equipment-type/index.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel backend\models\EventEquipmentTypeSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t('common/event-equipment-type', 'Event Equipment Types');
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-equipment-type-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('common/event-equipment-type', 'Create Event Equipment Type'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
[
|
||||||
|
'class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{view} {update}'
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
23
backend/views/event-equipment-type/update.php
Normal file
23
backend/views/event-equipment-type/update.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventEquipmentType */
|
||||||
|
|
||||||
|
$this->title = Yii::t('common/event-equipment-type', 'Update {modelClass}: ', [
|
||||||
|
'modelClass' => 'Event Equipment Type',
|
||||||
|
]) . ' #' . $model->name;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/event-equipment-type', 'Event Equipment Types'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
|
||||||
|
$this->params['breadcrumbs'][] = Yii::t('common/event-equipment-type', 'Update');
|
||||||
|
?>
|
||||||
|
<div class="event-equipment-type-update">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
31
backend/views/event-equipment-type/view.php
Normal file
31
backend/views/event-equipment-type/view.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventEquipmentType */
|
||||||
|
|
||||||
|
$this->title = $model->name;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/event-equipment-type', 'Event Equipment Types'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-equipment-type-view">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('common/event-equipment-type', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
24
backend/views/event-registration/_form.php
Normal file
24
backend/views/event-registration/_form.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventRegistration */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event-registration-form">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id_event')->textInput() ?>
|
||||||
|
<?= $form->field($model, 'id_customer')->textInput() ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('event-registration', 'Create') : Yii::t('event-registration', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
24
backend/views/event-registration/_form_register_card.php
Normal file
24
backend/views/event-registration/_form_register_card.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\CardEventRegistrationForm */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event-registration-form">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'card_number')->textInput() ?>
|
||||||
|
<?= $form->field($model, 'event_id')->textInput() ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('event-registration', 'Create') : Yii::t('event-registration', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
51
backend/views/event-registration/_search.php
Normal file
51
backend/views/event-registration/_search.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model backend\models\EventRegistrationSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event-registration-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
Keresés
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'id') ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'id_event') ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'id_customer') ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php // echo $form->field($model, 'canceled_at') ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="panel-footer">
|
||||||
|
<?= Html::submitButton(Yii::t('event-registration', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
21
backend/views/event-registration/create.php
Normal file
21
backend/views/event-registration/create.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventRegistration */
|
||||||
|
|
||||||
|
$this->title = Yii::t('event-registration', 'Create Event Registration');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-registration-create">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
38
backend/views/event-registration/index.php
Normal file
38
backend/views/event-registration/index.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel backend\models\EventRegistrationSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t('event-registration', 'Event Registrations');
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-registration-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('event-registration', 'Create Event Registration'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
['class' => 'yii\grid\SerialColumn'],
|
||||||
|
|
||||||
|
'id',
|
||||||
|
'id_event',
|
||||||
|
'id_customer',
|
||||||
|
'created_at:datetime',
|
||||||
|
'updated_at:datetime',
|
||||||
|
'canceled_at:datetime',
|
||||||
|
|
||||||
|
['class' => 'yii\grid\ActionColumn'],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
21
backend/views/event-registration/register_card.php
Normal file
21
backend/views/event-registration/register_card.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\CardEventRegistrationForm */
|
||||||
|
|
||||||
|
$this->title = Yii::t('event-registration', 'Create Event Registration');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-registration-create">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form_register_card', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
23
backend/views/event-registration/update.php
Normal file
23
backend/views/event-registration/update.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventRegistration */
|
||||||
|
|
||||||
|
$this->title = Yii::t('event-registration', 'Update {modelClass}: ', [
|
||||||
|
'modelClass' => 'Event Registration',
|
||||||
|
]) . ' ' . $model->id;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
||||||
|
$this->params['breadcrumbs'][] = Yii::t('event-registration', 'Update');
|
||||||
|
?>
|
||||||
|
<div class="event-registration-update">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
40
backend/views/event-registration/view.php
Normal file
40
backend/views/event-registration/view.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventRegistration */
|
||||||
|
|
||||||
|
$this->title = $model->id;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-registration-view">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('event-registration', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?= Html::a(Yii::t('event-registration', 'Delete'), ['delete', 'id' => $model->id], [
|
||||||
|
'class' => 'btn btn-danger',
|
||||||
|
'data' => [
|
||||||
|
'confirm' => Yii::t('event-registration', 'Are you sure you want to delete this item?'),
|
||||||
|
'method' => 'post',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
'id',
|
||||||
|
'id_event',
|
||||||
|
'id_customer',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
'canceled_at',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
23
backend/views/event-type/_form.php
Normal file
23
backend/views/event-type/_form.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventType */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event-type-form">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('event-type', 'Create') : Yii::t('event-type', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
36
backend/views/event-type/_search.php
Normal file
36
backend/views/event-type/_search.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model backend\models\EventTypeSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event-type-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">Keresés</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'name') ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel-footer">
|
||||||
|
<?= Html::submitButton(Yii::t('event-type', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
21
backend/views/event-type/create.php
Normal file
21
backend/views/event-type/create.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventType */
|
||||||
|
|
||||||
|
$this->title = Yii::t('event-type', 'Create Event Type');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-type', 'Event Types'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-type-create">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
36
backend/views/event-type/index.php
Normal file
36
backend/views/event-type/index.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel backend\models\EventTypeSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t('event-type', 'Event Types');
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-type-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('event-type', 'Create Event Type'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'created_at:datetime',
|
||||||
|
'updated_at:datetime',
|
||||||
|
|
||||||
|
['class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{view} {update}'
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
21
backend/views/event-type/update.php
Normal file
21
backend/views/event-type/update.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventType */
|
||||||
|
|
||||||
|
$this->title = Yii::t('event-type', 'Update Event Type:') . ' ' . $model->name;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-type', 'Event Types'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
|
||||||
|
$this->params['breadcrumbs'][] = Yii::t('event-type', 'Update');
|
||||||
|
?>
|
||||||
|
<div class="event-type-update">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
38
backend/views/event-type/view.php
Normal file
38
backend/views/event-type/view.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\EventType */
|
||||||
|
|
||||||
|
$this->title = $model->name;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-type', 'Event Types'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-type-view">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('event-type', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?= Html::a(Yii::t('event-type', 'Delete'), ['delete', 'id' => $model->id], [
|
||||||
|
'class' => 'btn btn-danger',
|
||||||
|
'data' => [
|
||||||
|
'confirm' => Yii::t('event-type', 'Are you sure you want to delete this item?'),
|
||||||
|
'method' => 'post',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
54
backend/views/event/_form.php
Normal file
54
backend/views/event/_form.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Event */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event-form">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'startDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose' => true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
'autocomplete' => 'off'
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'endDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose' => true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
'autocomplete' => 'off'
|
||||||
|
]
|
||||||
|
])
|
||||||
|
?>
|
||||||
|
<?= $form->field($model, 'seat_count')->textInput() ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id_room')->dropDownList(\common\models\Room::roomOptions(false, true)) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id_trainer')->dropDownList(\common\models\Trainer::trainerOptions(false, true)) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'id_event_type')->dropDownList(\common\models\EventType::eventTypeOptions(false, true)) ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('event', 'Create') : Yii::t('event', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
23
backend/views/event/_form_register_card.php
Normal file
23
backend/views/event/_form_register_card.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\CardEventRegistrationForm */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event-registration-form">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'card_number')->textInput() ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('event-registration', 'Create') : Yii::t('event-registration', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
74
backend/views/event/_search.php
Normal file
74
backend/views/event/_search.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model backend\models\EventSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">Keresés</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'id') ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'startDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
'autocomplete' => 'off'
|
||||||
|
]
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'endDateString')->widget(\kartik\widgets\DateTimePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd hh:ii'
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
'autocomplete' => 'off'
|
||||||
|
]
|
||||||
|
])
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'roomName')->dropDownList(\common\models\Room::roomOptions(true)) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'trainerName')->dropDownList(\common\models\Trainer::trainerOptions(true)) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?php echo $form->field($model, 'eventTypeName')->dropDownList(\common\models\EventType::eventTypeOptions(true)) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel-footer">
|
||||||
|
<?= Html::submitButton(Yii::t('event', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
74
backend/views/event/_view.php
Normal file
74
backend/views/event/_view.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Event */
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">Esemény</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||||
|
<?php try {
|
||||||
|
echo DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
'id',
|
||||||
|
'created_at:datetime',
|
||||||
|
'updated_at:datetime',
|
||||||
|
'deleted_at:datetime',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo "failed to render event details ";
|
||||||
|
} ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||||
|
<?php try {
|
||||||
|
echo DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
[
|
||||||
|
'attribute' => 'eventType.name',
|
||||||
|
'label' => $model->getAttributeLabel('id_event_type')
|
||||||
|
],
|
||||||
|
'start:datetime',
|
||||||
|
'end:datetime',
|
||||||
|
[
|
||||||
|
'attribute' => 'room.name',
|
||||||
|
'label' => $model->getAttributeLabel('id_room')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'trainer.name',
|
||||||
|
'label' => $model->getAttributeLabel('id_trainer')
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo "Failed to render view";
|
||||||
|
} ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
|
||||||
|
<?php try {
|
||||||
|
echo DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
'seat_count',
|
||||||
|
'eventRegistrationCount',
|
||||||
|
'openSeatCount',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo "Failed to render view";
|
||||||
|
} ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
21
backend/views/event/create.php
Normal file
21
backend/views/event/create.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Event */
|
||||||
|
|
||||||
|
$this->title = Yii::t('event', 'Create Event');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('event', 'Events'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-create">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
123
backend/views/event/index.php
Normal file
123
backend/views/event/index.php
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel backend\models\EventSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t('event', 'Events');
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('event', 'Create Event'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
[
|
||||||
|
'attribute' => 'event_id',
|
||||||
|
'label' => \Yii::t('event', 'ID')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'event_type_name',
|
||||||
|
'label' => \Yii::t('event', 'Id Event Type')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'event_start',
|
||||||
|
'label' => \Yii::t('event', 'Start'),
|
||||||
|
'format' => 'datetime'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'event_end',
|
||||||
|
'label' => \Yii::t('event', 'End'),
|
||||||
|
'format' => 'time'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'event_seat_count',
|
||||||
|
'label' => \Yii::t('event', 'Seat Count')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'registration_count',
|
||||||
|
'label' => \Yii::t('event', 'Registration Count')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'room_name',
|
||||||
|
'label' => \Yii::t('event', 'Room Name')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'trainer_name',
|
||||||
|
'label' => \Yii::t('event', 'Trainer Name')
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'event_created_at',
|
||||||
|
'label' => \Yii::t('event', 'Created At'),
|
||||||
|
'format' => 'datetime'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'event_updated_at',
|
||||||
|
'label' => \Yii::t('event', 'Updated At'),
|
||||||
|
'format' => 'datetime'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'event_deleted_at',
|
||||||
|
'label' => \Yii::t('event', 'Deleted At'),
|
||||||
|
'format' => 'datetime'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{view} {update} {reserve-card}',
|
||||||
|
'urlCreator' => function ($action, $model, $key, $index) {
|
||||||
|
$params = ['id' => $model['event_id']];
|
||||||
|
$params[0] = "event" . '/' . $action;
|
||||||
|
return \yii\helpers\Url::toRoute($params);
|
||||||
|
},
|
||||||
|
'buttons' => [
|
||||||
|
'view' => function ($url, $model, $key) {
|
||||||
|
$options = [
|
||||||
|
'title' => Yii::t('yii', 'View'),
|
||||||
|
'aria-label' => Yii::t('yii', 'View'),
|
||||||
|
'data-pjax' => '0',
|
||||||
|
];
|
||||||
|
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, $options);
|
||||||
|
},
|
||||||
|
'update' => function ($url, $model, $key) {
|
||||||
|
$options = [
|
||||||
|
'title' => Yii::t('yii', 'Update'),
|
||||||
|
'aria-label' => Yii::t('yii', 'Update'),
|
||||||
|
'data-pjax' => '0',
|
||||||
|
];
|
||||||
|
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, $options);
|
||||||
|
},
|
||||||
|
'delete' => function ($url, $model, $key) {
|
||||||
|
$options = [
|
||||||
|
'title' => Yii::t('yii', 'Delete'),
|
||||||
|
'aria-label' => Yii::t('yii', 'Delete'),
|
||||||
|
'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'),
|
||||||
|
'data-method' => 'post',
|
||||||
|
'data-pjax' => '0',
|
||||||
|
];
|
||||||
|
return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, $options);
|
||||||
|
},
|
||||||
|
'reserve-card' => function ($url, $model, $key) {
|
||||||
|
$options = [
|
||||||
|
'title' => Yii::t('yii', 'Register'),
|
||||||
|
'aria-label' => Yii::t('yii', 'Register'),
|
||||||
|
'data-pjax' => '0',
|
||||||
|
];
|
||||||
|
return Html::a('<span class="glyphicon glyphicon-user"></span>', $url, $options);
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
23
backend/views/event/register_card.php
Normal file
23
backend/views/event/register_card.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\CardEventRegistrationForm */
|
||||||
|
|
||||||
|
$this->title = Yii::t('event-registration', 'Create Event Registration');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('event-registration', 'Event Registrations'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="event-registration-create">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?php echo $this->render('_view', ['model' => $event]); ?>
|
||||||
|
|
||||||
|
<?= $this->render('_form_register_card', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
20
backend/views/event/update.php
Normal file
20
backend/views/event/update.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Event */
|
||||||
|
|
||||||
|
$this->title = Yii::t('event', 'Update Event:') . ' ' . $model->id;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('event', 'Events'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
|
||||||
|
$this->params['breadcrumbs'][] = Yii::t('event', 'Update');
|
||||||
|
?>
|
||||||
|
<div class="event-update">
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
168
backend/views/event/view.php
Normal file
168
backend/views/event/view.php
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Event */
|
||||||
|
|
||||||
|
$this->title = \Yii::t('event', 'Event Details');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('event', 'Events'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
|
||||||
|
function isReservationOpen($model)
|
||||||
|
{
|
||||||
|
$canceled = isset($model['event_registration_canceled_at']);
|
||||||
|
$deleted = isset($model['event_registration_deleted_at']);
|
||||||
|
return !$canceled && !$deleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getCommonColumnsHtmlOptions($model)
|
||||||
|
{
|
||||||
|
$options = [];
|
||||||
|
if (!isReservationOpen($model)) {
|
||||||
|
$options['style'] = 'text-decoration: line-through;';
|
||||||
|
}
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="event-view">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('event', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?php
|
||||||
|
if ( $model->canReserve()){
|
||||||
|
echo Html::a(Yii::t('event', 'Reservation'), ['reserve-card', 'id' => $model->id], ['class' => 'btn btn-primary']);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
if ($model->canDelete()) {
|
||||||
|
echo Html::a(Yii::t('event', 'Delete'), ['delete', 'id' => $model->id], [
|
||||||
|
'class' => 'btn btn-danger pull-right',
|
||||||
|
'data' => [
|
||||||
|
'confirm' => Yii::t('event', 'Are you sure you want to delete this item?'),
|
||||||
|
'method' => 'post',
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?php echo $this->render('_view', ['model' => $model]); ?>
|
||||||
|
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">Foglalások</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<?php try {
|
||||||
|
echo \yii\grid\GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
[
|
||||||
|
'attribute' => 'card_number',
|
||||||
|
'label' => \Yii::t('event', 'Card Number'),
|
||||||
|
'contentOptions' => function ($model) {
|
||||||
|
return getCommonColumnsHtmlOptions($model);
|
||||||
|
},
|
||||||
|
'format' => 'raw',
|
||||||
|
'value' => function ($model, $key, $index, $column) {
|
||||||
|
return Html::a($model['card_number'], ['card/view', 'id' => $model['card_id_card']]);
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'customer_name',
|
||||||
|
'label' => \Yii::t('event', 'Customer Name'),
|
||||||
|
'contentOptions' => function ($model) {
|
||||||
|
return getCommonColumnsHtmlOptions($model);
|
||||||
|
},
|
||||||
|
'format' => 'raw',
|
||||||
|
'value' => function ($model, $key, $index, $column) {
|
||||||
|
return Html::a($model['customer_name'], ['customer/view', 'id' => $model['customer_id_customer']]);
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'customer_email',
|
||||||
|
'label' => \Yii::t('event', 'Customer Email'),
|
||||||
|
'contentOptions' => function ($model) {
|
||||||
|
return getCommonColumnsHtmlOptions($model);
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'event_registration_created_at',
|
||||||
|
'label' => \Yii::t('event', 'Event Registration Created At'),
|
||||||
|
'contentOptions' => function ($model) {
|
||||||
|
return getCommonColumnsHtmlOptions($model);
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'event_registration_canceled_at',
|
||||||
|
'format' => 'datetime',
|
||||||
|
'label' => \Yii::t('event', 'Canceled At'),
|
||||||
|
'contentOptions' => function () {
|
||||||
|
$options = [];
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'event_registration_deleted_at',
|
||||||
|
'format' => 'datetime',
|
||||||
|
'label' => \Yii::t('event', 'Deleted At'),
|
||||||
|
'contentOptions' => function () {
|
||||||
|
$options = [];
|
||||||
|
return $options;
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{cancel-registration} {delete-registration}',
|
||||||
|
'urlCreator' => function ($action, $model) {
|
||||||
|
$params = ['id' => $model['event_registration_id']];
|
||||||
|
$params[0] = "event" . '/' . $action;
|
||||||
|
return \yii\helpers\Url::toRoute($params);
|
||||||
|
},
|
||||||
|
'buttons' => [
|
||||||
|
'cancel-registration' => function ($url, $model) {
|
||||||
|
if (isset($model['event_registration_canceled_at'])) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
$options = [
|
||||||
|
'title' => Yii::t('event', 'Cancel'),
|
||||||
|
'aria-label' => Yii::t('event', 'Cancel'),
|
||||||
|
'data-confirm' => Yii::t('event', 'Are you sure you want to cancel this item? Usage count won\'t be restored!'),
|
||||||
|
'data-method' => 'post',
|
||||||
|
'data-pjax' => '0',
|
||||||
|
];
|
||||||
|
return Html::a('<span class="glyphicon glyphicon-ban-circle"></span>', $url, $options);
|
||||||
|
},
|
||||||
|
'delete-registration' => function ($url, $model) {
|
||||||
|
if (isset($model['event_registration_canceled_at'])) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
$options = [
|
||||||
|
'title' => Yii::t('yii', 'Delete'),
|
||||||
|
'aria-label' => Yii::t('yii', 'Delete'),
|
||||||
|
'data-confirm' => Yii::t('event', 'Are you sure you want to delete this item? Usage count will be restored!'),
|
||||||
|
'data-method' => 'post',
|
||||||
|
'data-pjax' => '0',
|
||||||
|
];
|
||||||
|
return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, $options);
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
],
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo "Failed to render registrations";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
25
backend/views/room/_form.php
Normal file
25
backend/views/room/_form.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Room */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="room-form">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'seat_count')->textInput(['type' => 'number']) ?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('room', 'Create') : Yii::t('room', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
48
backend/views/room/_search.php
Normal file
48
backend/views/room/_search.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model backend\models\RoomSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="room-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
<?php
|
||||||
|
// ///////////////////////////////////////
|
||||||
|
// Search Pane
|
||||||
|
// ///////////////////////////////////////
|
||||||
|
?>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">Keresés</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<?php
|
||||||
|
// ///////////////////////////////////////
|
||||||
|
// Search fields
|
||||||
|
// ///////////////////////////////////////
|
||||||
|
?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'name') ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel-footer">
|
||||||
|
<?php
|
||||||
|
// ///////////////////////////////////////
|
||||||
|
// Search button
|
||||||
|
// ///////////////////////////////////////
|
||||||
|
?>
|
||||||
|
<?= Html::submitButton(Yii::t('room', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
</div>
|
||||||
21
backend/views/room/create.php
Normal file
21
backend/views/room/create.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Room */
|
||||||
|
|
||||||
|
$this->title = Yii::t('room', 'Create Room');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('room', 'Rooms'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="room-create">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
37
backend/views/room/index.php
Normal file
37
backend/views/room/index.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel backend\models\RoomSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t('room', 'Rooms');
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="room-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('room', 'Create Room'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'seat_count',
|
||||||
|
'created_at:datetime',
|
||||||
|
'updated_at:datetime',
|
||||||
|
|
||||||
|
['class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' => '{view} {update}'
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
21
backend/views/room/update.php
Normal file
21
backend/views/room/update.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Room */
|
||||||
|
|
||||||
|
$this->title = Yii::t('room', 'Update Room: ') . $model->name;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('room', 'Rooms'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
|
||||||
|
$this->params['breadcrumbs'][] = Yii::t('room', 'Update');
|
||||||
|
?>
|
||||||
|
<div class="room-update">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
39
backend/views/room/view.php
Normal file
39
backend/views/room/view.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Room */
|
||||||
|
|
||||||
|
$this->title = $model->name;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('room', 'Rooms'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="room-view">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('room', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?= Html::a(Yii::t('room', 'Delete'), ['delete', 'id' => $model->id], [
|
||||||
|
'class' => 'btn btn-danger',
|
||||||
|
'data' => [
|
||||||
|
'confirm' => Yii::t('room', 'Are you sure you want to delete this item?'),
|
||||||
|
'method' => 'post',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'seat_count',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -33,6 +33,7 @@ use yii\helpers\ArrayHelper;
|
|||||||
|
|
||||||
<?= mkTitle("Alkalmak")?>
|
<?= mkTitle("Alkalmak")?>
|
||||||
<?= $form->field($model, 'max_usage_count')->textInput() ?>
|
<?= $form->field($model, 'max_usage_count')->textInput() ?>
|
||||||
|
<?= $form->field($model, 'max_reservation_count')->textInput() ?>
|
||||||
|
|
||||||
<?= mkTitle("Érvényességi idő belállítások")?>
|
<?= mkTitle("Érvényességi idő belállítások")?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@ -21,7 +21,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
</p>
|
</p>
|
||||||
<?php }?>
|
<?php }?>
|
||||||
|
|
||||||
<?= DetailView::widget([
|
<?php try {
|
||||||
|
echo DetailView::widget([
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'name',
|
'name',
|
||||||
@ -30,6 +31,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
'value' => $model->typeHuman
|
'value' => $model->typeHuman
|
||||||
],
|
],
|
||||||
'max_usage_count',
|
'max_usage_count',
|
||||||
|
'max_reservation_count',
|
||||||
[
|
[
|
||||||
'attribute' => 'time_unit_count',
|
'attribute' => 'time_unit_count',
|
||||||
],
|
],
|
||||||
@ -44,7 +46,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'flag_student',
|
'attribute' => 'flag_student',
|
||||||
'value' => ( $model->isStudent() ? Yii::t('common', 'Yes' ) : Yii::t('common', 'No' ) ),
|
'value' => ($model->isStudent() ? Yii::t('common', 'Yes') : Yii::t('common', 'No')),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'status',
|
'attribute' => 'status',
|
||||||
@ -52,18 +54,21 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'door_allowed',
|
'attribute' => 'door_allowed',
|
||||||
'value' => ( $model->isDoor() ? Yii::t('common', 'Yes' ) : Yii::t('common', 'No' ) ),
|
'value' => ($model->isDoor() ? Yii::t('common', 'Yes') : Yii::t('common', 'No')),
|
||||||
//'visible' => \common\components\Helper::isTicketTypeDoorAllowedCheckOn()
|
//'visible' => \common\components\Helper::isTicketTypeDoorAllowedCheckOn()
|
||||||
],
|
],
|
||||||
'created_at:datetime',
|
'created_at:datetime',
|
||||||
'updated_at:datetime',
|
'updated_at:datetime',
|
||||||
[
|
[
|
||||||
'attribute' => 'installment_enabled',
|
'attribute' => 'installment_enabled',
|
||||||
'value' => ( $model->isInstallment() ? Yii::t('common', 'Yes' ) : Yii::t('common', 'No' ) ),
|
'value' => ($model->isInstallment() ? Yii::t('common', 'Yes') : Yii::t('common', 'No')),
|
||||||
],
|
],
|
||||||
'installment_money',
|
'installment_money',
|
||||||
'installment_count',
|
'installment_count',
|
||||||
],
|
],
|
||||||
]) ?>
|
]);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
echo "Failed to render ticket type";
|
||||||
|
} ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
20
backend/views/trainer/_form.php
Normal file
20
backend/views/trainer/_form.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Trainer */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
<div class="trainer-form">
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
|
||||||
|
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
|
||||||
|
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
|
||||||
|
<?= $form->field($model, 'active')->checkbox() ?>
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton($model->isNewRecord ? Yii::t('trainer', 'Create') : Yii::t('trainer', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
</div>
|
||||||
49
backend/views/trainer/_search.php
Normal file
49
backend/views/trainer/_search.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model backend\models\TrainerSearch */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
?>
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">Keresés</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="trainer-search">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => ['index'],
|
||||||
|
'method' => 'get',
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'name') ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'phone') ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?= $form->field($model, 'email') ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
|
||||||
|
<?php echo $form->field($model, 'active')->dropDownList([
|
||||||
|
'' => \Yii::t("trainer","All"),
|
||||||
|
\common\models\Trainer::ACTIVE_OFF => \Yii::t("trainer","active_off"),
|
||||||
|
\common\models\Trainer::ACTIVE_ON => \Yii::t("trainer","active_on"),
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton(Yii::t('trainer', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
21
backend/views/trainer/create.php
Normal file
21
backend/views/trainer/create.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Trainer */
|
||||||
|
|
||||||
|
$this->title = Yii::t('trainer', 'Create Trainer');
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('trainer', 'Trainers'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="trainer-create">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
37
backend/views/trainer/index.php
Normal file
37
backend/views/trainer/index.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\grid\GridView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $searchModel backend\models\TrainerSearch */
|
||||||
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
|
||||||
|
$this->title = Yii::t('trainer', 'Trainers');
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="trainer-index">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('trainer', 'Create Trainer'), ['create'], ['class' => 'btn btn-success']) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= GridView::widget([
|
||||||
|
'dataProvider' => $dataProvider,
|
||||||
|
'columns' => [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'phone',
|
||||||
|
'email:email',
|
||||||
|
['attribute' => 'active' , 'value' => function ($model){ return \common\models\Trainer::prettyPrintActive($model->active) ;} ],
|
||||||
|
'created_at:datetime',
|
||||||
|
'updated_at:datetime',
|
||||||
|
|
||||||
|
['class' => 'yii\grid\ActionColumn'],
|
||||||
|
],
|
||||||
|
]); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
21
backend/views/trainer/update.php
Normal file
21
backend/views/trainer/update.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Trainer */
|
||||||
|
|
||||||
|
$this->title = Yii::t('trainer', 'Update Trainer:' ) . ' ' . $model->name;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('trainer', 'Trainers'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
|
||||||
|
$this->params['breadcrumbs'][] = Yii::t('trainer', 'Update');
|
||||||
|
?>
|
||||||
|
<div class="trainer-update">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<?= $this->render('_form', [
|
||||||
|
'model' => $model,
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
44
backend/views/trainer/view.php
Normal file
44
backend/views/trainer/view.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\DetailView;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Trainer */
|
||||||
|
|
||||||
|
$this->title = $model->name;
|
||||||
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('trainer', 'Trainers'), 'url' => ['index']];
|
||||||
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
?>
|
||||||
|
<div class="trainer-view">
|
||||||
|
|
||||||
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<?= Html::a(Yii::t('trainer', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||||
|
<?= Html::a(Yii::t('trainer', 'Delete'), ['delete', 'id' => $model->id], [
|
||||||
|
'class' => 'btn btn-danger',
|
||||||
|
'data' => [
|
||||||
|
'confirm' => Yii::t('trainer', 'Are you sure you want to delete this item?'),
|
||||||
|
'method' => 'post',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<?= DetailView::widget([
|
||||||
|
'model' => $model,
|
||||||
|
'attributes' => [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
'phone',
|
||||||
|
'email:email',
|
||||||
|
[
|
||||||
|
'attribute' => 'active',
|
||||||
|
'value' => \common\models\Trainer::prettyPrintActive($model->active)
|
||||||
|
],
|
||||||
|
'created_at:datetime',
|
||||||
|
'updated_at:datetime',
|
||||||
|
],
|
||||||
|
]) ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
php /home/fitnessa/public_html/fitness-web/yii ticket/index
|
php /home/fitnessa/public_html/fitness-web/yii ticket/index
|
||||||
#php /home/fitnessa/public_html/fitness-web/yii ticket/daily
|
php /home/fitnessa/public_html/fitness-web/yii ticket/daily
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
-0.1.26
|
||||||
|
- add group training
|
||||||
-0.1.25
|
-0.1.25
|
||||||
- fix update inactive card
|
- fix update inactive card
|
||||||
-0.1.24
|
-0.1.24
|
||||||
|
|||||||
@ -8,6 +8,12 @@
|
|||||||
|
|
||||||
namespace common\components;
|
namespace common\components;
|
||||||
|
|
||||||
|
use DateInterval;
|
||||||
|
use DateTime;
|
||||||
|
use DateTimeZone;
|
||||||
|
use Exception;
|
||||||
|
use Yii;
|
||||||
|
use yii\base\InvalidConfigException;
|
||||||
use yii\i18n\Formatter;
|
use yii\i18n\Formatter;
|
||||||
|
|
||||||
class DateUtil
|
class DateUtil
|
||||||
@ -16,12 +22,13 @@ class DateUtil
|
|||||||
* Get UTC today @00:00:00 .
|
* Get UTC today @00:00:00 .
|
||||||
* Helper method to generate date for mysql
|
* Helper method to generate date for mysql
|
||||||
*
|
*
|
||||||
* @return \DateTime
|
* @return DateTime
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function todayStart( ){
|
public static function todayStart( ){
|
||||||
$d2 = new \DateTime();
|
$d2 = new DateTime();
|
||||||
$d2->setTimezone( new \DateTimeZone( "UTC" ) );
|
$d2->setTimezone( new DateTimeZone('UTC') );
|
||||||
$d2->setTime(0, 0, 0);
|
$d2->setTime(0, 0);
|
||||||
return $d2;
|
return $d2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,13 +36,14 @@ class DateUtil
|
|||||||
* Get UTC t @00:00:00 .
|
* Get UTC t @00:00:00 .
|
||||||
* Helper method to generate date for mysql
|
* Helper method to generate date for mysql
|
||||||
*
|
*
|
||||||
* @return \DateTime
|
* @return DateTime
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function tomorrowStart( ){
|
public static function tomorrowStart( ){
|
||||||
$d2 = new \DateTime();
|
$d2 = new DateTime();
|
||||||
$d2->add(new \DateInterval('P1D'));
|
$d2->add(new DateInterval('P1D'));
|
||||||
$d2->setTimezone( new \DateTimeZone( "UTC" ) );
|
$d2->setTimezone( new DateTimeZone('UTC') );
|
||||||
$d2->setTime(0, 0, 0);
|
$d2->setTime(0, 0);
|
||||||
return $d2;
|
return $d2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,11 +52,11 @@ class DateUtil
|
|||||||
public static function addMonth($timestamp, $monthCount = 1)
|
public static function addMonth($timestamp, $monthCount = 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($timestamp instanceof \DateTime) {
|
if ($timestamp instanceof DateTime) {
|
||||||
$d1 = $timestamp;
|
$d1 = $timestamp;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$d1 = new \DateTime();
|
$d1 = new DateTime();
|
||||||
|
|
||||||
if (isset($timestamp)) {
|
if (isset($timestamp)) {
|
||||||
$d1->setTimestamp($timestamp);
|
$d1->setTimestamp($timestamp);
|
||||||
@ -63,28 +71,34 @@ class DateUtil
|
|||||||
$day = $d1->format('d');
|
$day = $d1->format('d');
|
||||||
|
|
||||||
$year += floor($monthToAdd / 12);
|
$year += floor($monthToAdd / 12);
|
||||||
$monthToAdd = $monthToAdd % 12;
|
$monthToAdd %= 12;
|
||||||
$month += $monthToAdd;
|
$month += $monthToAdd;
|
||||||
if ($month > 12) {
|
if ($month > 12) {
|
||||||
$year++;
|
$year++;
|
||||||
$month = $month % 12;
|
$month %= 12;
|
||||||
if ($month === 0)
|
if ($month === 0) {
|
||||||
$month = 12;
|
$month = 12;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!checkdate($month, $day, $year)) {
|
if (!checkdate($month, $day, $year)) {
|
||||||
$d2 = \DateTime::createFromFormat('Y-n-j', $year . '-' . $month . '-1');
|
$d2 = DateTime::createFromFormat('Y-n-j', $year . '-' . $month . '-1');
|
||||||
$d2->modify('last day of');
|
$d2->modify('last day of');
|
||||||
} else {
|
} else {
|
||||||
$d2 = \DateTime::createFromFormat('Y-n-d', $year . '-' . $month . '-' . $day);
|
$d2 = DateTime::createFromFormat('Y-n-d', $year . '-' . $month . '-' . $day);
|
||||||
}
|
}
|
||||||
$d2->setTime(0, 0, 0);
|
$d2->setTime(0, 0);
|
||||||
|
|
||||||
|
|
||||||
return $d2;
|
return $d2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $dateTimeObject
|
||||||
|
* @return string
|
||||||
|
* @throws InvalidConfigException
|
||||||
|
*/
|
||||||
public static function formatUtc($dateTimeObject)
|
public static function formatUtc($dateTimeObject)
|
||||||
{
|
{
|
||||||
$formatter = new Formatter;
|
$formatter = new Formatter;
|
||||||
@ -93,6 +107,11 @@ class DateUtil
|
|||||||
return $formatter->asDatetime($dateTimeObject);
|
return $formatter->asDatetime($dateTimeObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $dateTimeObject
|
||||||
|
* @return string
|
||||||
|
* @throws InvalidConfigException
|
||||||
|
*/
|
||||||
public static function formatDateUtc($dateTimeObject)
|
public static function formatDateUtc($dateTimeObject)
|
||||||
{
|
{
|
||||||
$formatter = new Formatter;
|
$formatter = new Formatter;
|
||||||
@ -103,9 +122,27 @@ class DateUtil
|
|||||||
|
|
||||||
public static function parseDate($dateString){
|
public static function parseDate($dateString){
|
||||||
|
|
||||||
$date = \DateTime::createFromFormat("Y.m.d", $dateString, new \DateTimeZone( 'UTC'));
|
$date = DateTime::createFromFormat('Y.m.d', $dateString, new DateTimeZone( 'UTC'));
|
||||||
$date->setTime(0, 0, 0);
|
$date->setTime(0, 0);
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param integer $weekDay Numeric representation of the day of the week. @See https://www.php.net/manual/en/function.date.php
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function getLocalDayName($weekDay){
|
||||||
|
$translations = [
|
||||||
|
0 => Yii::t('common', 'Sunday'),
|
||||||
|
1 => Yii::t('common', 'Monday'),
|
||||||
|
2 => Yii::t('common', 'Tuesday'),
|
||||||
|
3 => Yii::t('common', 'Wednesday'),
|
||||||
|
4 => Yii::t('common', 'Thursday'),
|
||||||
|
5 => Yii::t('common', 'Friday'),
|
||||||
|
6 => Yii::t('common', 'Saturday'),
|
||||||
|
7 => Yii::t('common', 'Sunday'),
|
||||||
|
];
|
||||||
|
return $translations[$weekDay];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
131
common/components/HttpStatus.php
Normal file
131
common/components/HttpStatus.php
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace common\components;
|
||||||
|
|
||||||
|
|
||||||
|
class HttpStatus
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
// const CONTINUE = 100;
|
||||||
|
|
||||||
|
const SWITCHING_PROTOCOLS = 101;
|
||||||
|
|
||||||
|
const PROCESSING = 102; // RFC2518
|
||||||
|
|
||||||
|
const OK = 200;
|
||||||
|
|
||||||
|
const CREATED = 201;
|
||||||
|
|
||||||
|
const ACCEPTED = 202;
|
||||||
|
|
||||||
|
const NON_AUTHORITATIVE_INFORMATION = 203;
|
||||||
|
|
||||||
|
const NO_CONTENT = 204;
|
||||||
|
|
||||||
|
const RESET_CONTENT = 205;
|
||||||
|
|
||||||
|
const PARTIAL_CONTENT = 206;
|
||||||
|
|
||||||
|
const MULTI_STATUS = 207; // RFC4918
|
||||||
|
|
||||||
|
const ALREADY_REPORTED = 208; // RFC5842
|
||||||
|
|
||||||
|
const IM_USED = 226; // RFC3229
|
||||||
|
|
||||||
|
const MULTIPLE_CHOICES = 300;
|
||||||
|
|
||||||
|
const MOVED_PERMANENTLY = 301;
|
||||||
|
|
||||||
|
const FOUND = 302;
|
||||||
|
|
||||||
|
const SEE_OTHER = 303;
|
||||||
|
|
||||||
|
const NOT_MODIFIED = 304;
|
||||||
|
|
||||||
|
const USE_PROXY = 305;
|
||||||
|
|
||||||
|
const RESERVED = 306;
|
||||||
|
|
||||||
|
const TEMPORARY_REDIRECT = 307;
|
||||||
|
|
||||||
|
const PERMANENTLY_REDIRECT = 308; // RFC7238
|
||||||
|
|
||||||
|
const BAD_REQUEST = 400;
|
||||||
|
|
||||||
|
const UNAUTHORIZED = 401;
|
||||||
|
|
||||||
|
const PAYMENT_REQUIRED = 402;
|
||||||
|
|
||||||
|
const FORBIDDEN = 403;
|
||||||
|
|
||||||
|
const NOT_FOUND = 404;
|
||||||
|
|
||||||
|
const METHOD_NOT_ALLOWED = 405;
|
||||||
|
|
||||||
|
const NOT_ACCEPTABLE = 406;
|
||||||
|
|
||||||
|
const PROXY_AUTHENTICATION_REQUIRED = 407;
|
||||||
|
|
||||||
|
const REQUEST_TIMEOUT = 408;
|
||||||
|
|
||||||
|
const CONFLICT = 409;
|
||||||
|
|
||||||
|
const GONE = 410;
|
||||||
|
|
||||||
|
const LENGTH_REQUIRED = 411;
|
||||||
|
|
||||||
|
const PRECONDITION_FAILED = 412;
|
||||||
|
|
||||||
|
const REQUEST_ENTITY_TOO_LARGE = 413;
|
||||||
|
|
||||||
|
const REQUEST_URI_TOO_LONG = 414;
|
||||||
|
|
||||||
|
const UNSUPPORTED_MEDIA_TYPE = 415;
|
||||||
|
|
||||||
|
const REQUESTED_RANGE_NOT_SATISFIABLE = 416;
|
||||||
|
|
||||||
|
const EXPECTATION_FAILED = 417;
|
||||||
|
|
||||||
|
const I_AM_A_TEAPOT = 418; // RFC2324
|
||||||
|
|
||||||
|
const UNPROCESSABLE_ENTITY = 422; // RFC4918
|
||||||
|
|
||||||
|
const LOCKED = 423; // RFC4918
|
||||||
|
|
||||||
|
const FAILED_DEPENDENCY = 424; // RFC4918
|
||||||
|
|
||||||
|
const RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817
|
||||||
|
|
||||||
|
const UPGRADE_REQUIRED = 426; // RFC2817
|
||||||
|
|
||||||
|
const PRECONDITION_REQUIRED = 428; // RFC6585
|
||||||
|
|
||||||
|
const TOO_MANY_REQUESTS = 429; // RFC6585
|
||||||
|
|
||||||
|
const REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585
|
||||||
|
|
||||||
|
const INTERNAL_SERVER_ERROR = 500;
|
||||||
|
|
||||||
|
const NOT_IMPLEMENTED = 501;
|
||||||
|
|
||||||
|
const BAD_GATEWAY = 502;
|
||||||
|
|
||||||
|
const SERVICE_UNAVAILABLE = 503;
|
||||||
|
|
||||||
|
const GATEWAY_TIMEOUT = 504;
|
||||||
|
|
||||||
|
const VERSION_NOT_SUPPORTED = 505;
|
||||||
|
|
||||||
|
const VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; // RFC2295
|
||||||
|
|
||||||
|
const INSUFFICIENT_STORAGE = 507; // RFC4918
|
||||||
|
|
||||||
|
const LOOP_DETECTED = 508; // RFC5842
|
||||||
|
|
||||||
|
const NOT_EXTENDED = 510; // RFC2774
|
||||||
|
|
||||||
|
const NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585
|
||||||
|
|
||||||
|
}
|
||||||
@ -12,6 +12,7 @@ class RoleDefinition{
|
|||||||
'reception' => Yii::t('common/role' ,'Reception'),
|
'reception' => Yii::t('common/role' ,'Reception'),
|
||||||
'admin' => Yii::t('common/role' ,'Administrator'),
|
'admin' => Yii::t('common/role' ,'Administrator'),
|
||||||
'employee' => Yii::t('common/role' ,'Employee'),
|
'employee' => Yii::t('common/role' ,'Employee'),
|
||||||
|
'Trainer' => Yii::t('common/role' ,'Edző'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +89,15 @@ class RoleDefinition{
|
|||||||
return self::can('employee');
|
return self::can('employee');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function isTrainer(){
|
||||||
|
return self::can('trainer');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function isLoggedUser(){
|
||||||
|
return self::isTrainer() || self::isAdmin() || self::isEmployee()
|
||||||
|
|| self::isReception();
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* [
|
* [
|
||||||
* 'role1' => 'template1',
|
* 'role1' => 'template1',
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -4,3 +4,4 @@ Yii::setAlias('frontend', dirname(dirname(__DIR__)) . '/frontend');
|
|||||||
Yii::setAlias('backend', dirname(dirname(__DIR__)) . '/backend');
|
Yii::setAlias('backend', dirname(dirname(__DIR__)) . '/backend');
|
||||||
Yii::setAlias('console', dirname(dirname(__DIR__)) . '/console');
|
Yii::setAlias('console', dirname(dirname(__DIR__)) . '/console');
|
||||||
Yii::setAlias('rest', dirname(dirname(__DIR__)) . '/rest');
|
Yii::setAlias('rest', dirname(dirname(__DIR__)) . '/rest');
|
||||||
|
Yii::setAlias('customerapi', dirname(dirname(__DIR__)) . '/customerapi');
|
||||||
|
|||||||
@ -5,7 +5,7 @@ return [
|
|||||||
'supportEmail' => 'rocho02@gmail.com',
|
'supportEmail' => 'rocho02@gmail.com',
|
||||||
'infoEmail' => 'info@rocho-net.hu',
|
'infoEmail' => 'info@rocho-net.hu',
|
||||||
'user.passwordResetTokenExpire' => 3600,
|
'user.passwordResetTokenExpire' => 3600,
|
||||||
'version' => 'v0.1.25',
|
'version' => 'v0.1.26',
|
||||||
'company' => 'movar',//gyor
|
'company' => 'movar',//gyor
|
||||||
'company_name' => "Freimann Kft.",
|
'company_name' => "Freimann Kft.",
|
||||||
'product_visiblity' => 'account',// on reception which products to display. account or global
|
'product_visiblity' => 'account',// on reception which products to display. account or global
|
||||||
|
|||||||
25
common/mail/customer_password_change.php
Normal file
25
common/mail/customer_password_change.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
use common\components\Helper;
|
||||||
|
?>
|
||||||
|
<h1 style="font-size: 12px;">Kedves <?php echo $model->customer->name?>!</h1>
|
||||||
|
<p style="font-size: 12px;">
|
||||||
|
Az Ön új jelszava:
|
||||||
|
</p>
|
||||||
|
<ul style="font-size: 12px;">
|
||||||
|
<li>
|
||||||
|
"<?php echo $model->plainPassword ?>"
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p style="font-size: 12px;">
|
||||||
|
Üdvözlettel:
|
||||||
|
</p>
|
||||||
|
<p style="font-size: 12px;">
|
||||||
|
<?php echo $model->companyName ?>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Ez egy automatikus e-mail üzenet, amelyre nem tud válaszolni.
|
||||||
|
</p>
|
||||||
|
<?php
|
||||||
|
?>
|
||||||
267
common/manager/EventRegistrationManager.php
Normal file
267
common/manager/EventRegistrationManager.php
Normal file
@ -0,0 +1,267 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\manager;
|
||||||
|
|
||||||
|
use common\models\Card;
|
||||||
|
use common\models\CardEventRegistrationForm;
|
||||||
|
use common\models\Customer;
|
||||||
|
use common\models\Event;
|
||||||
|
use common\models\EventRegistration;
|
||||||
|
use common\models\Ticket;
|
||||||
|
use customerapi\models\available\EventInterval;
|
||||||
|
use customerapi\models\registrations\EventRegistrationAvailable;
|
||||||
|
use customerapi\models\details\EventRegistrationView;
|
||||||
|
use Exception;
|
||||||
|
use Yii;
|
||||||
|
use yii\base\BaseObject;
|
||||||
|
use yii\db\ActiveRecord;
|
||||||
|
use yii\db\Query;
|
||||||
|
use yii\web\BadRequestHttpException;
|
||||||
|
use yii\web\NotFoundHttpException;
|
||||||
|
use yii\web\ServerErrorHttpException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by IntelliJ IDEA.
|
||||||
|
* User: rocho
|
||||||
|
* Date: 2018.12.17.
|
||||||
|
* Time: 6:12
|
||||||
|
*/
|
||||||
|
class EventRegistrationManager extends BaseObject
|
||||||
|
{
|
||||||
|
const CARD_NOT_FOUND = 1;
|
||||||
|
const CUSTOMER_NOT_FOUND = 2;
|
||||||
|
const TICKET_NOT_FOUND = 3;
|
||||||
|
const NO_FREE_SEATS = 4;
|
||||||
|
const EVENT_TYPE_NOT_FOUND = 5;
|
||||||
|
const TICKET_INSUFFICIENT = 6;
|
||||||
|
const UNKNOWN_ERROR = 7;
|
||||||
|
const MAX_SEAT_COUNT_EXCEEDED = 8;
|
||||||
|
const EVENT_UNAVAILABLE = 9;
|
||||||
|
const ALREADY_REGISTERED = 10;
|
||||||
|
|
||||||
|
public static $STATES = [
|
||||||
|
self::CARD_NOT_FOUND => 'CARD_NOT_FOUND',
|
||||||
|
self::CUSTOMER_NOT_FOUND => 'CUSTOMER_NOT_FOUND',
|
||||||
|
self::TICKET_NOT_FOUND => 'TICKET_NOT_FOUND',
|
||||||
|
self::NO_FREE_SEATS => 'NO_FREE_SEATS',
|
||||||
|
self::EVENT_TYPE_NOT_FOUND => 'EVENT_TYPE_NOT_FOUND',
|
||||||
|
self::TICKET_INSUFFICIENT => 'TICKET_INSUFFICIENT',
|
||||||
|
self::UNKNOWN_ERROR => 'UNKNOWN_ERROR',
|
||||||
|
self::MAX_SEAT_COUNT_EXCEEDED => 'MAX_SEAT_COUNT_EXCEEDED',
|
||||||
|
self::EVENT_UNAVAILABLE => 'EVENT_UNAVAILABLE',
|
||||||
|
self::ALREADY_REGISTERED => 'ALREADY_REGISTERED',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CardEventRegistrationForm $cardEventForm
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function registerCard($cardEventForm)
|
||||||
|
{
|
||||||
|
$db = Yii::$app->db;
|
||||||
|
$tx = $db->beginTransaction();
|
||||||
|
try {
|
||||||
|
if ($cardEventForm->validate()) {
|
||||||
|
|
||||||
|
$requiresTicket = false;
|
||||||
|
|
||||||
|
/** @var Card $card */
|
||||||
|
$card = Card::readCard($cardEventForm->card_number, false);
|
||||||
|
if (!isset($card)) {
|
||||||
|
throw new NotFoundHttpException('Card not found: ' . $cardEventForm->card_number, self::CARD_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($card->isFree()) {
|
||||||
|
throw new NotFoundHttpException('Customer not found', self::CUSTOMER_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
$activeTickets = $card->getActiveTickets();
|
||||||
|
if (count($activeTickets) === 0) {
|
||||||
|
throw new NotFoundHttpException('Ticket not found1', self::TICKET_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var Event $event */
|
||||||
|
$event = Event::find()->andWhere(['id' => $cardEventForm->event_id])->one();
|
||||||
|
if (!isset($event)) {
|
||||||
|
throw new NotFoundHttpException('Event not found: ' . $cardEventForm->event_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset($event->deleted_at)){
|
||||||
|
throw new BadRequestHttpException('Event deleted', self::EVENT_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$event->hasFreeSeats()) {
|
||||||
|
throw new BadRequestHttpException('No free seats', self::NO_FREE_SEATS);
|
||||||
|
}
|
||||||
|
|
||||||
|
$eventType = $event->eventType;
|
||||||
|
|
||||||
|
if (!isset($eventType)) {
|
||||||
|
throw new ServerErrorHttpException('Event type not found', self::EVENT_TYPE_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
//detect if customer is already registered to event
|
||||||
|
/** @var EventRegistration[] $registrations */
|
||||||
|
$registrations = $event->getActiveEventRegistrations()->all();
|
||||||
|
|
||||||
|
foreach ($registrations as $registration ){
|
||||||
|
if ($registration->id_customer == $card->customer->id_customer){
|
||||||
|
throw new BadRequestHttpException("Already registered", self::ALREADY_REGISTERED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$selectedTicket = $eventType->findTicketAllowingEventType($activeTickets);
|
||||||
|
|
||||||
|
if (!isset($selectedTicket)) {
|
||||||
|
throw new NotFoundHttpException('Ticket not found2', self::TICKET_INSUFFICIENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
$selectedTicket->consumeReservationCount(1);
|
||||||
|
|
||||||
|
$selectedTicket->save();
|
||||||
|
|
||||||
|
$registration = new EventRegistration();
|
||||||
|
$registration->id_event = $event->id;
|
||||||
|
$registration->id_card = $card->id_card;
|
||||||
|
$registration->id_ticket = $selectedTicket->id_ticket;
|
||||||
|
$registration->id_customer = $card->customer->id_customer;
|
||||||
|
try {
|
||||||
|
$registration->save(false);
|
||||||
|
} catch (\yii\db\Exception $exception) {
|
||||||
|
throw new ServerErrorHttpException('Failed to save', self::UNKNOWN_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$cardEventForm->registration = $registration;
|
||||||
|
}
|
||||||
|
$tx->commit();
|
||||||
|
} catch (Exception $exception) {
|
||||||
|
$tx->rollBack();
|
||||||
|
throw $exception;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createFindRegistrationsQuery($idEvent)
|
||||||
|
{
|
||||||
|
$query = new Query();
|
||||||
|
$query->select([
|
||||||
|
'event_registration.id as event_registration_id',
|
||||||
|
'event_registration.created_at as event_registration_created_at',
|
||||||
|
'event_registration.canceled_at as event_registration_canceled_at',
|
||||||
|
'event_registration.deleted_at as event_registration_deleted_at',
|
||||||
|
'card.id_card as card_id_card',
|
||||||
|
'card.number as card_number',
|
||||||
|
'customer.id_customer as customer_id_customer',
|
||||||
|
'customer.name as customer_name',
|
||||||
|
'customer.email as customer_email',
|
||||||
|
]);
|
||||||
|
$query->from(EventRegistration::tableName());
|
||||||
|
$query->innerJoin(Event::tableName(), 'event_registration.id_event = event.id');
|
||||||
|
$query->innerJoin(Card::tableName(), 'event_registration.id_card = card.id_card');
|
||||||
|
$query->innerJoin(Customer::tableName(), 'customer.id_customer_card = card.id_card');
|
||||||
|
$query->andWhere(['event_registration.id_event' => $idEvent]);
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $idRegistration
|
||||||
|
* @return array|EventRegistration|ActiveRecord|null
|
||||||
|
* @throws NotFoundHttpException
|
||||||
|
*/
|
||||||
|
public function loadRegistration($idRegistration)
|
||||||
|
{
|
||||||
|
|
||||||
|
$registration = EventRegistration::find()->andWhere(['id' => $idRegistration])->one();
|
||||||
|
if ( $registration === null) {
|
||||||
|
throw new NotFoundHttpException('The requested registration does not exist.');
|
||||||
|
}
|
||||||
|
return $registration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param EventRegistration $registration
|
||||||
|
* @throws ServerErrorHttpException
|
||||||
|
*/
|
||||||
|
public function cancelRegistration($registration)
|
||||||
|
{
|
||||||
|
if (isset($registration->canceled_at)) {
|
||||||
|
throw new ServerErrorHttpException('The registration is already canceled');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($registration->deleted_at)) {
|
||||||
|
throw new ServerErrorHttpException('The reservation is already deleted');
|
||||||
|
}
|
||||||
|
|
||||||
|
$registration->canceled_at = date('Y-m-d H:i:s');
|
||||||
|
$registration->save(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param EventRegistration $registration
|
||||||
|
* @return bool
|
||||||
|
* @throws \yii\base\Exception
|
||||||
|
*/
|
||||||
|
public function deleteRegistration($registration)
|
||||||
|
{
|
||||||
|
if (isset($registration->deleted_at)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// $ticket = Ticket::findOne(['id_ticket' => $registration->id_ticket]);
|
||||||
|
// if( !isset($ticket ) ) {
|
||||||
|
// throw new \yii\base\Exception('Ticket not found: ' . $registration->id_ticket);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// $ticket->restoreReservationCount(1);
|
||||||
|
// $ticket->save(false);
|
||||||
|
|
||||||
|
$registration->deleted_at = date('Y-m-d H:i:s');
|
||||||
|
return $registration->save(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an event
|
||||||
|
* @param Event $event
|
||||||
|
* @throws Exception
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
public function deleteEvent($event)
|
||||||
|
{
|
||||||
|
$db = Yii::$app->db;
|
||||||
|
$tx = $db->beginTransaction();
|
||||||
|
try {
|
||||||
|
|
||||||
|
$registrations = $event->getEventRegistrations()->all();
|
||||||
|
// ////////////////////////////////
|
||||||
|
// if event has no registrations
|
||||||
|
// we can simply delete it from db
|
||||||
|
// ////////////////////////////////
|
||||||
|
if ( count($registrations) === 0 ) {
|
||||||
|
$event->delete();
|
||||||
|
} else {
|
||||||
|
// /////////////////////////////
|
||||||
|
// otherwise we mark the event deleted
|
||||||
|
// and we have to delete the registrations
|
||||||
|
// /////////////////////////////
|
||||||
|
$event->deleted_at = date('Y-m-d H:i:s');
|
||||||
|
$event->save(false);
|
||||||
|
foreach ($registrations as $registration) {
|
||||||
|
if (!isset($registration->deleted_at)) {
|
||||||
|
/** @var EventRegistration $registration */
|
||||||
|
$this->deleteRegistration($registration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tx->commit();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$tx->rollBack();
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
14
common/messages/hu/common/event-equipment-type.php
Normal file
14
common/messages/hu/common/event-equipment-type.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
"Name" => "Megnevezés",
|
||||||
|
"Search" => "Keresés",
|
||||||
|
"Create" => "Mentés",
|
||||||
|
"Update" => "Módosít",
|
||||||
|
"Delete" => "Törlés",
|
||||||
|
"Created At" => "Létrehozás dátum, idő",
|
||||||
|
"Updated At" => "Módosítás dátum, idő",
|
||||||
|
"Event Equipment Types" => "Felszerelések",
|
||||||
|
"Create Event Equipment Type" => "Új felszerelés létrehozása",
|
||||||
|
"Update {modelClass}: " => "Felszerelés módosítása: ",
|
||||||
|
];
|
||||||
@ -29,7 +29,7 @@ return [
|
|||||||
'Inactive' => 'Inaktív',
|
'Inactive' => 'Inaktív',
|
||||||
'Invalid account (inactive)!' => 'Érvénytelen kassza (inaktív)!',
|
'Invalid account (inactive)!' => 'Érvénytelen kassza (inaktív)!',
|
||||||
'Invalid account!' => 'Érvénytelen kassza!',
|
'Invalid account!' => 'Érvénytelen kassza!',
|
||||||
'Max Usage Count' => 'Akalmak',
|
'Max Usage Count' => 'Belépések száma (f. villa)',
|
||||||
'Month' => 'Hónap',
|
'Month' => 'Hónap',
|
||||||
'Name' => 'Név',
|
'Name' => 'Név',
|
||||||
'Normal' => 'Normál',
|
'Normal' => 'Normál',
|
||||||
@ -45,4 +45,5 @@ return [
|
|||||||
'Type' => 'Típus',
|
'Type' => 'Típus',
|
||||||
'Update' => 'Módosítás',
|
'Update' => 'Módosítás',
|
||||||
'Updated At' => 'Módosítás ideje',
|
'Updated At' => 'Módosítás ideje',
|
||||||
|
'Max Reservation Count' => 'Foglalások száma (csop. edzés)',
|
||||||
];
|
];
|
||||||
|
|||||||
32
common/messages/hu/event-registration.php
Normal file
32
common/messages/hu/event-registration.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by IntelliJ IDEA.
|
||||||
|
* User: rocho
|
||||||
|
* Date: 2018.12.06.
|
||||||
|
* Time: 7:55
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'ID' => 'ID',
|
||||||
|
'Name' => 'Név',
|
||||||
|
'Seat Count' => 'Férőhelyek száma',
|
||||||
|
'Create Event Registration' => 'Új regisztráció',
|
||||||
|
'Update Event Registration:' => 'Regisztráció módosítása:',
|
||||||
|
|
||||||
|
'Event Registrations' => 'Regisztrációk',
|
||||||
|
'Created At' => 'Létrehozási dátum, idő',
|
||||||
|
'Updated At' => 'Módosítási dátum, idő',
|
||||||
|
'Search' => 'Keres',
|
||||||
|
'Create' => 'Mentés',
|
||||||
|
'Update' => 'Módosít',
|
||||||
|
'Delete' => 'Törlés',
|
||||||
|
'All' => 'Mind',
|
||||||
|
'Unknown Error' => "Ismeretlen Hiba",
|
||||||
|
'CARD_NOT_FOUND' => 'Kártya nem található',
|
||||||
|
'CUSTOMER_NOT_FOUND' => 'Vendég nem található',
|
||||||
|
'TICKET_NOT_FOUND' => 'Nincs aktív bérlet',
|
||||||
|
'NO_FREE_SEATS' => 'Nincs szabad hely',
|
||||||
|
'EVENT_TYPE_NOT_FOUND' => 'Az esemény típusa ismereten',
|
||||||
|
'TICKET_INSUFFICIENT' => 'Nem található az eseményre jogosító aktív bérlet',
|
||||||
|
];
|
||||||
24
common/messages/hu/event-type.php
Normal file
24
common/messages/hu/event-type.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by IntelliJ IDEA.
|
||||||
|
* User: rocho
|
||||||
|
* Date: 2018.12.06.
|
||||||
|
* Time: 7:55
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'ID' => 'ID',
|
||||||
|
'Name' => 'Név',
|
||||||
|
'Create Event Type' => 'Új esemény Típus',
|
||||||
|
'Update Event Type:' => 'Esemény Típus adatainak módosítása:',
|
||||||
|
|
||||||
|
'Event Types' => 'Esemény Típusok',
|
||||||
|
'Created At' => 'Létrehozási dátum, idő',
|
||||||
|
'Updated At' => 'Módosítási dátum, idő',
|
||||||
|
'Search' => 'Keres',
|
||||||
|
'Create' => 'Mentés',
|
||||||
|
'Update' => 'Módosít',
|
||||||
|
'Delete' => 'Törlés',
|
||||||
|
'All' => 'Mind',
|
||||||
|
];
|
||||||
50
common/messages/hu/event.php
Normal file
50
common/messages/hu/event.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by IntelliJ IDEA.
|
||||||
|
* User: rocho
|
||||||
|
* Date: 2018.12.06.
|
||||||
|
* Time: 7:55
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'ID' => 'ID',
|
||||||
|
'Name' => 'Név',
|
||||||
|
'Seat Count' => 'Férőhelyek száma',
|
||||||
|
'Create Event' => 'Új esemény',
|
||||||
|
'Update Event:' => 'Esemény adatainak módosítása:',
|
||||||
|
|
||||||
|
'Events' => 'Események',
|
||||||
|
'Created At' => 'Létrehozási dátum, idő',
|
||||||
|
'Updated At' => 'Módosítási dátum, idő',
|
||||||
|
'Search' => 'Keres',
|
||||||
|
'Create' => 'Mentés',
|
||||||
|
'Update' => 'Módosít',
|
||||||
|
'Delete' => 'Törlés',
|
||||||
|
'All' => 'Mind',
|
||||||
|
'Start' => 'Esemény kezdete',
|
||||||
|
'End' => 'Esemény vége',
|
||||||
|
'Room Name' => 'Terem',
|
||||||
|
'Trainer Name' => 'Edző',
|
||||||
|
|
||||||
|
'Event start' => 'Esemény Kezdete',
|
||||||
|
'Event end' => 'Esemény vége',
|
||||||
|
'Id Room' => 'Terem',
|
||||||
|
'Id Trainer' => 'Edző',
|
||||||
|
'Id Event Type' => 'Esemény Típus',
|
||||||
|
'Registration Count' => 'Résztvevők',
|
||||||
|
'Card Number' => 'Kártyaszám',
|
||||||
|
'Customer Name' => 'Vendég Neve',
|
||||||
|
'Customer Email' => 'Vendég E-Mail címe',
|
||||||
|
'Canceled At' => 'Sztornó dátum, idő',
|
||||||
|
'Register' => 'Regisztráció',
|
||||||
|
'Event Registration Created At' => 'Regisztráció dátum, idő',
|
||||||
|
'Event Registration Count' => 'Foglalások száma',
|
||||||
|
'Open Seat Count' => 'Szabad helyek száma',
|
||||||
|
'Cancel' => 'Lemond',
|
||||||
|
'Deleted At' => 'Törlés dátum, idő',
|
||||||
|
'Are you sure you want to cancel this item? Usage count won\'t be restored!' => 'Biztos benne, hogy lemondja ezt az foglalást? A foglalás nem kerül vissza a bérletre!',
|
||||||
|
'Are you sure you want to delete this item? Usage count will be restored!' => 'Biztos benne, hogy törli ezt az foglalást? A foglalás vissza fog kerülni a bérletre!',
|
||||||
|
'Reservation' => 'Foglalás',
|
||||||
|
'Event Details' => "Esemény részletei"
|
||||||
|
];
|
||||||
25
common/messages/hu/room.php
Normal file
25
common/messages/hu/room.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by IntelliJ IDEA.
|
||||||
|
* User: rocho
|
||||||
|
* Date: 2018.12.06.
|
||||||
|
* Time: 7:55
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'ID' => 'ID',
|
||||||
|
'Name' => 'Név',
|
||||||
|
'Seat Count' => 'Férőhelyek száma',
|
||||||
|
'Create Room' => 'Új terem',
|
||||||
|
'Update Room:' => 'Terem adatainak módosítása:',
|
||||||
|
|
||||||
|
'Rooms' => 'Termek',
|
||||||
|
'Created At' => 'Létrehozási dátum, idő',
|
||||||
|
'Updated At' => 'Módosítási dátum, idő',
|
||||||
|
'Search' => 'Keres',
|
||||||
|
'Create' => 'Mentés',
|
||||||
|
'Update' => 'Módosít',
|
||||||
|
'Delete' => 'Törlés',
|
||||||
|
'All' => 'Mind',
|
||||||
|
];
|
||||||
38
common/messages/hu/trainer.php
Normal file
38
common/messages/hu/trainer.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Message translations.
|
||||||
|
*
|
||||||
|
* This file is automatically generated by 'yii message' command.
|
||||||
|
* It contains the localizable messages extracted from source code.
|
||||||
|
* You may modify this file by translating the extracted messages.
|
||||||
|
*
|
||||||
|
* Each array element represents the translation (value) of a message (key).
|
||||||
|
* If the value is empty, the message is considered as not translated.
|
||||||
|
* Messages that no longer need translation will have their translations
|
||||||
|
* enclosed between a pair of '@@' marks.
|
||||||
|
*
|
||||||
|
* Message string can be used with plural forms format. Check i18n section
|
||||||
|
* of the guide for details.
|
||||||
|
*
|
||||||
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
'ID' => 'ID',
|
||||||
|
'Name' => 'Név',
|
||||||
|
'Phone' => 'Telefon',
|
||||||
|
'Email' => 'E-Mail',
|
||||||
|
'Password' => 'Jelszó',
|
||||||
|
'Active' => 'Aktív',
|
||||||
|
'Created At' => 'Létrehozási dátum, idő',
|
||||||
|
'Updated At' => 'Módosítási dátum, idő',
|
||||||
|
'Create Trainer' => 'Új edző',
|
||||||
|
'Trainers' => 'Edzők',
|
||||||
|
'Search' => 'Keres',
|
||||||
|
'Create' => 'Mentés',
|
||||||
|
'Update' => 'Módosít',
|
||||||
|
'Delete' => 'Törlés',
|
||||||
|
'active_on' => 'Aktív',
|
||||||
|
'active_off' => 'Inaktív',
|
||||||
|
'Update Trainer:' => 'Edző adatainak módosítása:',
|
||||||
|
'All' => 'Mind',
|
||||||
|
];
|
||||||
@ -180,15 +180,19 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
|||||||
return $this->status == self::STATUS_DELETED;
|
return $this->status == self::STATUS_DELETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load card from the DB , where the number equals with card number or RFID number
|
||||||
|
* @param number|string $number the card number or the RFID number
|
||||||
|
* @param null|boolean $free optional. if set, append free or not free condition.
|
||||||
|
* @return \common\models\Card|null the card or null, if not found with given conditions
|
||||||
|
*/
|
||||||
public static function readCard($number,$free = null){
|
public static function readCard($number,$free = null){
|
||||||
$card = null;
|
$card = null;
|
||||||
$query = Card::find()
|
$query = Card::find()
|
||||||
->leftJoin(Customer::tableName(), 'card.id_card = customer.id_customer_card ' );
|
->leftJoin(Customer::tableName(), 'card.id_card = customer.id_customer_card ' );
|
||||||
// ->andWhere(['number'=>$number ]);
|
|
||||||
|
|
||||||
Card::addCardNumberCondition($query, $number);
|
Card::addCardNumberCondition($query, $number);
|
||||||
|
|
||||||
|
|
||||||
if ( isset($free) ){
|
if ( isset($free) ){
|
||||||
if ( $free == true){
|
if ( $free == true){
|
||||||
$query->andWhere('customer.id_customer is null');
|
$query->andWhere('customer.id_customer is null');
|
||||||
@ -317,4 +321,12 @@ class Card extends \common\models\BaseFitnessActiveRecord
|
|||||||
\Yii::$app->db->createCommand(self::$SQL_UPDATE_FLAG_STATUS_ACTIVE)->execute();
|
\Yii::$app->db->createCommand(self::$SQL_UPDATE_FLAG_STATUS_ACTIVE)->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isFree(){
|
||||||
|
return !isset($this->customer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getActiveTickets(){
|
||||||
|
return Ticket::readActive($this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
45
common/models/CardEventRegistrationForm.php
Normal file
45
common/models/CardEventRegistrationForm.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\models;
|
||||||
|
use common\components\Helper;
|
||||||
|
use yii\base\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by IntelliJ IDEA.
|
||||||
|
* User: rocho
|
||||||
|
* Date: 2018.12.17.
|
||||||
|
* Time: 6:14
|
||||||
|
*/
|
||||||
|
|
||||||
|
class CardEventRegistrationForm extends Model
|
||||||
|
{
|
||||||
|
public $card_number;
|
||||||
|
public $event_id;
|
||||||
|
public $registration;
|
||||||
|
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['card_number'], 'required' ],
|
||||||
|
[['card_number'], 'validateFormat' ]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function validateFormat(){
|
||||||
|
$this->card_number = Helper::fixAsciiChars( $this->card_number );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getIsNewRecord(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'card_number' => \Yii::t('event', 'Card Number'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -127,7 +127,14 @@ class Collection extends \common\models\BaseFitnessActiveRecord
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* */
|
* @param string $mode
|
||||||
|
* @param $start
|
||||||
|
* @param $end
|
||||||
|
* @param $idUser
|
||||||
|
* @param $types
|
||||||
|
* @param $idAccount
|
||||||
|
* @return Query
|
||||||
|
*/
|
||||||
public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$types,$idAccount){
|
public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$types,$idAccount){
|
||||||
|
|
||||||
$query = new Query();
|
$query = new Query();
|
||||||
@ -168,7 +175,7 @@ public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$ty
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function mkTotalsResultWithAllAvailableAccount($queryResult,$accounts,$accountMap,$idAccount){
|
public static function mkTotalsResultWithAllAvailableAccount($queryResult,$accounts,$idAccount){
|
||||||
|
|
||||||
$totals = [];
|
$totals = [];
|
||||||
$totals['total'] = 0;
|
$totals['total'] = 0;
|
||||||
@ -228,7 +235,7 @@ public static function mkTotalQuery($mode = 'reception', $start,$end,$idUser,$ty
|
|||||||
public static function mkReceptionTotal( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap){
|
public static function mkReceptionTotal( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap){
|
||||||
$result = [];
|
$result = [];
|
||||||
$queryResult = self::exTotalQuery('reception', $start, $end, $idUser, $types, $idAccount );
|
$queryResult = self::exTotalQuery('reception', $start, $end, $idUser, $types, $idAccount );
|
||||||
$result = self::mkTotalsResultWithAllAvailableAccount($queryResult, $accounts, $accountMap, $idAccount);
|
$result = self::mkTotalsResultWithAllAvailableAccount($queryResult, $accounts, $idAccount);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class CollectionCreate extends \common\models\Collection
|
|||||||
if (parent::beforeSave($insert)) {
|
if (parent::beforeSave($insert)) {
|
||||||
$this->id_user = Yii::$app->user->id;
|
$this->id_user = Yii::$app->user->id;
|
||||||
$this->created_by = Yii::$app->user->id;
|
$this->created_by = Yii::$app->user->id;
|
||||||
$paidAt = Transfer::mkPaidAtTotals($this->timestampStart, $this->timestampEnd, $this->user->id, null, $this->account->id_account, $this->accounts, $this->accountMap);
|
$paidAt = Transfer::mkPaidAtTotals($this->timestampStart, $this->timestampEnd, $this->user->id, null, $this->account->id_account, $this->accounts );
|
||||||
$this->money = $paidAt['total'];
|
$this->money = $paidAt['total'];
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -19,6 +19,7 @@ use common\components\Helper;
|
|||||||
* @property integer $part_count
|
* @property integer $part_count
|
||||||
* @property integer $part_required
|
* @property integer $part_required
|
||||||
* @property integer $id_ticket_type
|
* @property integer $id_ticket_type
|
||||||
|
* @property integer $id_discount
|
||||||
* @property string $expired_at
|
* @property string $expired_at
|
||||||
* @property string $created_at
|
* @property string $created_at
|
||||||
* @property string $updated_at
|
* @property string $updated_at
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace common\models;
|
namespace common\models;
|
||||||
|
|
||||||
|
use common\components\Helper;
|
||||||
use Yii;
|
use Yii;
|
||||||
|
use yii\base\Exception;
|
||||||
|
use yii\base\InvalidConfigException;
|
||||||
|
use yii\base\NotSupportedException;
|
||||||
|
use yii\web\IdentityInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the model class for table "customer".
|
* This is the model class for table "customer".
|
||||||
@ -33,8 +38,11 @@ use Yii;
|
|||||||
* @property integer towel_count
|
* @property integer towel_count
|
||||||
* @property \common\models\User user
|
* @property \common\models\User user
|
||||||
* @property mixed bank_account
|
* @property mixed bank_account
|
||||||
|
* @property string password_plain
|
||||||
|
* @property string password_hash
|
||||||
|
* @property string auth_key
|
||||||
*/
|
*/
|
||||||
class Customer extends BaseFitnessActiveRecord
|
class Customer extends BaseFitnessActiveRecord implements IdentityInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
const STATUS_DELETED = 0;
|
const STATUS_DELETED = 0;
|
||||||
@ -200,5 +208,135 @@ class Customer extends BaseFitnessActiveRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds an identity by the given ID.
|
||||||
|
* @param string|integer $id the ID to be looked for
|
||||||
|
* @return Customer
|
||||||
|
* Null should be returned if such an identity cannot be found
|
||||||
|
* or the identity is not in an active state (disabled, deleted, etc.)
|
||||||
|
*/
|
||||||
|
public static function findIdentity($id)
|
||||||
|
{
|
||||||
|
return self::findOne(['email' => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds an identity by the given token.
|
||||||
|
* @param mixed $token the token to be looked for
|
||||||
|
* @param mixed $type the type of the token. The value of this parameter depends on the implementation.
|
||||||
|
* For example, [[\yii\filters\auth\HttpBearerAuth]] will set this parameter to be `yii\filters\auth\HttpBearerAuth`.
|
||||||
|
* @return void the identity object that matches the given token.
|
||||||
|
* Null should be returned if such an identity cannot be found
|
||||||
|
* or the identity is not in an active state (disabled, deleted, etc.)
|
||||||
|
* @throws NotSupportedException
|
||||||
|
*/
|
||||||
|
public static function findIdentityByAccessToken($token, $type = null)
|
||||||
|
{
|
||||||
|
throw new NotSupportedException('"findIdentityByAccessToken" is not implemented.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an ID that can uniquely identify a user identity.
|
||||||
|
* @return string|integer an ID that uniquely identifies a user identity.
|
||||||
|
*/
|
||||||
|
public function getId()
|
||||||
|
{
|
||||||
|
return $this->id_customer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a key that can be used to check the validity of a given identity ID.
|
||||||
|
*
|
||||||
|
* The key should be unique for each individual user, and should be persistent
|
||||||
|
* so that it can be used to check the validity of the user identity.
|
||||||
|
*
|
||||||
|
* The space of such keys should be big enough to defeat potential identity attacks.
|
||||||
|
*
|
||||||
|
* This is required if [[User::enableAutoLogin]] is enabled.
|
||||||
|
* @return string a key that is used to check the validity of a given identity ID.
|
||||||
|
* @see validateAuthKey()
|
||||||
|
*/
|
||||||
|
public function getAuthKey()
|
||||||
|
{
|
||||||
|
// todo: add authkey to customer
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates the given auth key.
|
||||||
|
*
|
||||||
|
* This is required if [[User::enableAutoLogin]] is enabled.
|
||||||
|
* @param string $authKey the given auth key
|
||||||
|
* @return boolean whether the given auth key is valid.
|
||||||
|
* @see getAuthKey()
|
||||||
|
*/
|
||||||
|
public function validateAuthKey($authKey)
|
||||||
|
{
|
||||||
|
return $this->getAuthKey() === $authKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $password
|
||||||
|
* @return bool
|
||||||
|
* @throws \yii\base\InvalidConfigException
|
||||||
|
*/
|
||||||
|
public function validatePassword($password)
|
||||||
|
{
|
||||||
|
return Yii::$app->security->validatePassword($password, $this->password_hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates password hash from password and sets it to the model
|
||||||
|
*
|
||||||
|
* @param string $password
|
||||||
|
* @throws Exception
|
||||||
|
* @throws \yii\base\InvalidConfigException
|
||||||
|
*/
|
||||||
|
public function setPassword($password)
|
||||||
|
{
|
||||||
|
$this->password_hash = Yii::$app->security->generatePasswordHash($password);
|
||||||
|
// \Yii::info("pwd", $this->password_hash);
|
||||||
|
// echo $this->password_hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates "remember me" authentication key
|
||||||
|
* @throws InvalidConfigException if OpenSSL extension is needed but not installed.*@throws \yii\base\Exception
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function generateAuthKey()
|
||||||
|
{
|
||||||
|
$this->auth_key = Yii::$app->security->generateRandomString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates new password reset token
|
||||||
|
*/
|
||||||
|
public function generatePasswordResetToken()
|
||||||
|
{
|
||||||
|
$this->password_reset_token = Yii::$app->security->generateRandomString() . '_' . time();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes password reset token
|
||||||
|
*/
|
||||||
|
public function removePasswordResetToken()
|
||||||
|
{
|
||||||
|
$this->password_reset_token = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws InvalidConfigException
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function setDefaultPassword(){
|
||||||
|
$hasEmail = isset($this->email) && $this->email !== '';
|
||||||
|
$hasBirthday = isset($this->birthdate) ;
|
||||||
|
if ( $hasEmail && $hasBirthday){
|
||||||
|
$customerBirthDate = new \DateTime($this->birthdate);
|
||||||
|
$this->setPassword($customerBirthDate->format('Ymd'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
242
common/models/Event.php
Normal file
242
common/models/Event.php
Normal file
@ -0,0 +1,242 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use customerapi\models\details\EventEquipmentTypeAssignmentView;
|
||||||
|
use DateTime;
|
||||||
|
use DateTimeZone;
|
||||||
|
use Exception;
|
||||||
|
use Yii;
|
||||||
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
use yii\db\ActiveQuery;
|
||||||
|
use yii\db\ActiveRecord;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "event".
|
||||||
|
*
|
||||||
|
* @property integer $id
|
||||||
|
* @property integer $start
|
||||||
|
* @property integer $end
|
||||||
|
* @property integer $id_room
|
||||||
|
* @property integer $id_trainer
|
||||||
|
* @property integer $id_event_type
|
||||||
|
* @property integer $seat_count
|
||||||
|
* @property string $created_at
|
||||||
|
* @property string $updated_at
|
||||||
|
* @property string $deleted_at
|
||||||
|
* @property integer $active
|
||||||
|
* @property EventType $eventType
|
||||||
|
* @property Trainer $trainer
|
||||||
|
* @property Room $room
|
||||||
|
* @property EventRegistration[] $eventRegistrations
|
||||||
|
*/
|
||||||
|
class Event extends ActiveRecord
|
||||||
|
{
|
||||||
|
|
||||||
|
public $startDateString;
|
||||||
|
public $endDateString;
|
||||||
|
|
||||||
|
public $timestampStart;
|
||||||
|
public $timestampEnd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'event';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['startDateString',], 'date', 'format' => Yii::$app->formatter->datetimeFormat, 'timestampAttribute' => 'start', 'timeZone' => 'UTC'],
|
||||||
|
[['endDateString',], 'date', 'format' => Yii::$app->formatter->datetimeFormat, 'timestampAttribute' => 'end' , 'timeZone' => 'UTC'],
|
||||||
|
[['id_trainer','id_room', 'id_event_type','seat_count'], 'required'],
|
||||||
|
[['id_trainer','id_room', 'id_event_type','seat_count'], 'integer'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => Yii::t('event', 'ID'),
|
||||||
|
'start' => Yii::t('event', 'Start'),
|
||||||
|
'end' => Yii::t('event', 'End'),
|
||||||
|
'id_room' => Yii::t('event', 'Id Room'),
|
||||||
|
'id_trainer' => Yii::t('event', 'Id Trainer'),
|
||||||
|
'id_event_type' => Yii::t('event', 'Id Event Type'),
|
||||||
|
'created_at' => Yii::t('event', 'Created At'),
|
||||||
|
'updated_at' => Yii::t('event', 'Updated At'),
|
||||||
|
'deleted_at' => Yii::t('event', 'Deleted At'),
|
||||||
|
'trainerName' => Yii::t('event', 'Trainer Name'),
|
||||||
|
'roomName' => Yii::t('event', 'Room Name'),
|
||||||
|
'eventTypeName' => Yii::t('event', 'Típus'),
|
||||||
|
|
||||||
|
'event_start' => Yii::t('event', 'Start'),
|
||||||
|
'event_end' => Yii::t('event', 'End'),
|
||||||
|
'startDateString' => Yii::t('event', 'Start'),
|
||||||
|
'endDateString' => Yii::t('event', 'End'),
|
||||||
|
'status' => Yii::t('event', 'Status'),
|
||||||
|
'seat_count' => Yii::t('event', 'Seat Count'),
|
||||||
|
'eventRegistrationCount' => Yii::t('event', 'Event Registration Count'),
|
||||||
|
'openSeatCount' => Yii::t('event', 'Open Seat Count'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function afterFind()
|
||||||
|
{
|
||||||
|
parent::afterFind(); // TODO: Change the autogenerated stub
|
||||||
|
$format = 'Y.m.d H:i';
|
||||||
|
$date = new DateTime();
|
||||||
|
$date->setTimestamp($this->start);
|
||||||
|
$date->setTimezone(new DateTimeZone('UTC'));
|
||||||
|
$this->startDateString = $date->format($format);
|
||||||
|
$date->setTimestamp($this->end);
|
||||||
|
$this->endDateString = $date->format($format);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return ArrayHelper::merge( [
|
||||||
|
[
|
||||||
|
'class' => TimestampBehavior::class,
|
||||||
|
'value' => static function(){ return date('Y-m-d H:i:s' ); }
|
||||||
|
]
|
||||||
|
],
|
||||||
|
parent::behaviors());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @noinspection PhpUnused */
|
||||||
|
public function getEventType(){
|
||||||
|
return $this->hasOne($this->getEventTypeClass(),['id' => 'id_event_type']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @noinspection PhpUnused */
|
||||||
|
public function getTrainer(){
|
||||||
|
return $this->hasOne($this->getTrainerClass(),['id' => 'id_trainer']);
|
||||||
|
}/** @noinspection PhpUnused */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Room|ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getRoom() {
|
||||||
|
return $this->hasOne($this->getRoomClass(),['id' => 'id_room']);
|
||||||
|
}/** @noinspection PhpUnused */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Card|ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getCard() {
|
||||||
|
return $this->hasOne(Card::class,['id_card' => 'id_card']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return EventRegistration[]|ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getEventRegistrations(){
|
||||||
|
return $this->hasMany(EventRegistration::class,['id_event' => 'id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return EventEquipmentTypeAssignment[]|ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getEquipmentTypeAssignments(){
|
||||||
|
return $this->hasMany($this->getEquipmentTypeAssignmentsClass(),['id_event' => 'id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return EventRegistration[]|ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getActiveEventRegistrations(){
|
||||||
|
return $this->hasMany(EventRegistration::class,['id_event' => 'id'])->andWhere(
|
||||||
|
[
|
||||||
|
'event_registration.canceled_at' => null,
|
||||||
|
'event_registration.deleted_at' => null,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return EventRegistration[]|ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getActiveEventRegistrationsForCustomer(){
|
||||||
|
return $this->hasMany(EventRegistration::class,['id_event' => 'id'])->andWhere(
|
||||||
|
[
|
||||||
|
'event_registration.canceled_at' => null,
|
||||||
|
'event_registration.deleted_at' => null,
|
||||||
|
'event_registration.id_customer' => \Yii::$app->user->id
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getEventRegistrationCount(){
|
||||||
|
return count($this->getActiveEventRegistrations()->all());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getEquipmentTypeAssignmentsClass()
|
||||||
|
{
|
||||||
|
return EventEquipmentTypeAssignment::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @noinspection PhpUnused */
|
||||||
|
public function getOpenSeatCount(){
|
||||||
|
return $this->seat_count - $this->getEventRegistrationCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasFreeSeats(){
|
||||||
|
$registrationCount = count($this->eventRegistrations) ;
|
||||||
|
|
||||||
|
$seatCount = $this->seat_count;
|
||||||
|
if ( !isset($seatCount ) || $seatCount === 0){
|
||||||
|
$seatCount = PHP_INT_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $registrationCount < $seatCount ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canReserve(){
|
||||||
|
if ( isset($this->deleted_at)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( !$this->hasFreeSeats()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canDelete(){
|
||||||
|
if ( isset($this->deleted_at)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function getTrainerClass(){
|
||||||
|
return Trainer::class;
|
||||||
|
}
|
||||||
|
protected function getEventTypeClass(){
|
||||||
|
return EventType::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getRoomClass(){
|
||||||
|
return Room::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
80
common/models/EventEquipmentType.php
Normal file
80
common/models/EventEquipmentType.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "event_equipment_type".
|
||||||
|
*
|
||||||
|
* @property integer $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $created_at
|
||||||
|
* @property string $updated_at
|
||||||
|
*
|
||||||
|
* @property EventEquipmentTypeAssignment[] $eventEquipmentTypeAssignments
|
||||||
|
* @property EventRegistrationEquipmentTypeAssignment[] $eventRegistrationEquipmentTypeAssignments
|
||||||
|
*/
|
||||||
|
class EventEquipmentType extends \yii\db\ActiveRecord
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'event_equipment_type';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['name'], 'required'],
|
||||||
|
[['name'], 'string', 'max' => 255]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return ArrayHelper::merge( [
|
||||||
|
[
|
||||||
|
'class' => TimestampBehavior::className(),
|
||||||
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
||||||
|
]
|
||||||
|
],
|
||||||
|
parent::behaviors());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => Yii::t('common/event-equipment-type', 'ID'),
|
||||||
|
'name' => Yii::t('common/event-equipment-type', 'Name'),
|
||||||
|
'created_at' => Yii::t('common/event-equipment-type', 'Created At'),
|
||||||
|
'updated_at' => Yii::t('common/event-equipment-type', 'Updated At'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \yii\db\ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getEventEquipmentTypeAssignments()
|
||||||
|
{
|
||||||
|
return $this->hasMany(EventEquipmentTypeAssignment::className(), ['id_event_equipment_type' => 'id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \yii\db\ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getEventRegistrationEquipmentTypeAssignments()
|
||||||
|
{
|
||||||
|
return $this->hasMany(EventRegistrationEquipmentTypeAssignment::className(), ['id_event_equipment_type' => 'id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
86
common/models/EventEquipmentTypeAssignment.php
Normal file
86
common/models/EventEquipmentTypeAssignment.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "event_equipment_type_assignment".
|
||||||
|
*
|
||||||
|
* @property integer $id
|
||||||
|
* @property integer $id_event
|
||||||
|
* @property integer $id_event_equipment_type
|
||||||
|
* @property integer $count
|
||||||
|
* @property string $created_at
|
||||||
|
* @property string $updated_at
|
||||||
|
*
|
||||||
|
* @property Event $idEvent
|
||||||
|
* @property EventEquipmentType $idEventEquipmentType
|
||||||
|
*/
|
||||||
|
class EventEquipmentTypeAssignment extends \yii\db\ActiveRecord
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'event_equipment_type_assignment';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id_event', 'id_event_equipment_type', 'count'], 'integer'],
|
||||||
|
[['created_at', 'updated_at'], 'required'],
|
||||||
|
[['created_at', 'updated_at'], 'safe']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return ArrayHelper::merge( [
|
||||||
|
[
|
||||||
|
'class' => TimestampBehavior::className(),
|
||||||
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
||||||
|
]
|
||||||
|
],
|
||||||
|
parent::behaviors());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => Yii::t('common/event', 'ID'),
|
||||||
|
'id_event' => Yii::t('common/event', 'Id Event'),
|
||||||
|
'id_event_equipment_type' => Yii::t('common/event', 'Id Event Equipment Type'),
|
||||||
|
'count' => Yii::t('common/event', 'Count'),
|
||||||
|
'created_at' => Yii::t('common/event', 'Created At'),
|
||||||
|
'updated_at' => Yii::t('common/event', 'Updated At'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \yii\db\ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getEvent()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Event::className(), ['id' => 'id_event']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \yii\db\ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getEventEquipmentType()
|
||||||
|
{
|
||||||
|
return $this->hasOne(EventEquipmentType::className(), ['id' => 'id_event_equipment_type']);
|
||||||
|
}
|
||||||
|
}
|
||||||
138
common/models/EventRegistration.php
Normal file
138
common/models/EventRegistration.php
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "event_registration".
|
||||||
|
*
|
||||||
|
* @property integer $id
|
||||||
|
* @property integer $id_event
|
||||||
|
* @property integer $id_customer
|
||||||
|
* @property integer $id_card
|
||||||
|
* @property integer $id_ticket
|
||||||
|
* @property string $created_at
|
||||||
|
* @property string $updated_at
|
||||||
|
* @property string $canceled_at
|
||||||
|
* @property string $deleted_at
|
||||||
|
*/
|
||||||
|
class EventRegistration extends \yii\db\ActiveRecord
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'event_registration';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdocd
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id_event', 'id_customer'], 'integer'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => Yii::t('event-registration', 'ID'),
|
||||||
|
'id_event' => Yii::t('event-registration', 'Id Event'),
|
||||||
|
'id_customer' => Yii::t('event-registration', 'Id Customer'),
|
||||||
|
'created_at' => Yii::t('event-registration', 'Created At'),
|
||||||
|
'updated_at' => Yii::t('event-registration', 'Updated At'),
|
||||||
|
'canceled_at' => Yii::t('event-registration', 'Canceled At'),
|
||||||
|
'deleted_at' => Yii::t('event-registration', 'Deleted At'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return ArrayHelper::merge( [
|
||||||
|
[
|
||||||
|
'class' => TimestampBehavior::className(),
|
||||||
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
||||||
|
]
|
||||||
|
],
|
||||||
|
parent::behaviors());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getEvent(){
|
||||||
|
return $this->hasOne($this->getEventClass(),['id' => 'id_event']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCustomer(){
|
||||||
|
return $this->hasOne($this->getCustomerClass(),['id' => 'id_customer']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getEventClass(){
|
||||||
|
return Event::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCustomerClass(){
|
||||||
|
return Customer::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param EventRegistration $eventRegistration
|
||||||
|
*/
|
||||||
|
public static function isActive($eventRegistration){
|
||||||
|
if ( !isset($eventRegistration ) ){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( isset($eventRegistration->canceled_at ) ){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isset($eventRegistration->deleted_at ) ){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param EventRegistration $eventRegistration
|
||||||
|
*/
|
||||||
|
public static function isForCustomer($eventRegistration,$idCustomer){
|
||||||
|
if ( !isset($eventRegistration ) ){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ( !isset($eventRegistration->id_customer ) ){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $eventRegistration->id_customer == $idCustomer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param EventRegistration[] $eventRegistrations
|
||||||
|
*/
|
||||||
|
public static function filterActive($eventRegistrations){
|
||||||
|
return array_filter($eventRegistrations, EventRegistration::class.'::isActive' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param EventRegistration[] $eventRegistrations
|
||||||
|
*/
|
||||||
|
public static function filterForCustomer($eventRegistrations,$idCustomer){
|
||||||
|
$result = [];
|
||||||
|
foreach ($eventRegistrations as $eventRegistration){
|
||||||
|
if ( EventRegistration::isForCustomer($eventRegistration,$idCustomer)){
|
||||||
|
$result[] = $eventRegistration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
70
common/models/EventRegistrationEquipmentTypeAssignment.php
Normal file
70
common/models/EventRegistrationEquipmentTypeAssignment.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "event_registration_equipment_type_assignment".
|
||||||
|
*
|
||||||
|
* @property integer $id
|
||||||
|
* @property integer $id_event_equipment_type
|
||||||
|
* @property integer $id_event_registration
|
||||||
|
* @property string $created_at
|
||||||
|
* @property string $updated_at
|
||||||
|
*
|
||||||
|
* @property EventRegistration $idEventRegistration
|
||||||
|
* @property EventEquipmentType $idEventEquipmentType
|
||||||
|
*/
|
||||||
|
class EventRegistrationEquipmentTypeAssignment extends \yii\db\ActiveRecord
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'event_registration_equipment_type_assignment';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['id_event_equipment_type', 'id_event_registration'], 'integer'],
|
||||||
|
[['created_at', 'updated_at'], 'required'],
|
||||||
|
[['created_at', 'updated_at'], 'safe']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => Yii::t('common/event', 'ID'),
|
||||||
|
'id_event_equipment_type' => Yii::t('common/event', 'Id Event Equipment Type'),
|
||||||
|
'id_event_registration' => Yii::t('common/event', 'Id Event Registration'),
|
||||||
|
'created_at' => Yii::t('common/event', 'Created At'),
|
||||||
|
'updated_at' => Yii::t('common/event', 'Updated At'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \yii\db\ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getIdEventRegistration()
|
||||||
|
{
|
||||||
|
return $this->hasOne(EventRegistration::className(), ['id' => 'id_event_registration']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \yii\db\ActiveQuery
|
||||||
|
*/
|
||||||
|
public function getIdEventEquipmentType()
|
||||||
|
{
|
||||||
|
return $this->hasOne(EventEquipmentType::className(), ['id' => 'id_event_equipment_type']);
|
||||||
|
}
|
||||||
|
}
|
||||||
107
common/models/EventType.php
Normal file
107
common/models/EventType.php
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "event_type".
|
||||||
|
*
|
||||||
|
* @property integer $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $created_at
|
||||||
|
* @property string $updated_at
|
||||||
|
*/
|
||||||
|
class EventType extends \yii\db\ActiveRecord
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'event_type';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['name'], 'required'],
|
||||||
|
[['name'], 'unique'],
|
||||||
|
[['name'], 'string', 'max' => 255]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => Yii::t('event-type', 'ID'),
|
||||||
|
'name' => Yii::t('event-type', 'Name'),
|
||||||
|
'created_at' => Yii::t('event-type', 'Created At'),
|
||||||
|
'updated_at' => Yii::t('event-type', 'Updated At'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return ArrayHelper::merge( [
|
||||||
|
[
|
||||||
|
'class' => TimestampBehavior::className(),
|
||||||
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
||||||
|
]
|
||||||
|
],
|
||||||
|
parent::behaviors());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asOptions(){
|
||||||
|
$items = ArrayHelper::map(EventType::find()->all(),'id','name');
|
||||||
|
return ArrayHelper::merge(['' => \Yii::t('event-type','All')],$items);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function eventTypeOptions($all = false, $emptyString = false){
|
||||||
|
$items = ArrayHelper::map(EventType::find()->all(),'id','name');
|
||||||
|
$extra = [];
|
||||||
|
if ( $all ) {
|
||||||
|
$extra = ['' => \Yii::t('event-type','All')];
|
||||||
|
}
|
||||||
|
if ( $emptyString ) {
|
||||||
|
$extra = ['' => '' ];
|
||||||
|
}
|
||||||
|
return ArrayHelper::merge($extra,$items);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find the first ticket, which allows this event type
|
||||||
|
* @param \common\models\Ticket[] $tickets the list of active tickets
|
||||||
|
* @return Ticket|null
|
||||||
|
*/
|
||||||
|
public function findTicketAllowingEventType($tickets){
|
||||||
|
if (!isset($tickets)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if ( sizeof($tickets) == 0 ){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$possibleTickets = [];
|
||||||
|
|
||||||
|
foreach ($tickets as $ticket ){
|
||||||
|
if ( $ticket->hasOpenReservationCount() ){
|
||||||
|
$possibleTickets[] = $ticket;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( sizeof($possibleTickets) == 0 ){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: implement bossiness logic to select ticket
|
||||||
|
return $possibleTickets[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
83
common/models/Room.php
Normal file
83
common/models/Room.php
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "room".
|
||||||
|
*
|
||||||
|
* @property integer $id
|
||||||
|
* @property string $name
|
||||||
|
* @property integer $seat_count
|
||||||
|
* @property string $created_at
|
||||||
|
* @property string $updated_at
|
||||||
|
*/
|
||||||
|
class Room extends \yii\db\ActiveRecord
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'room';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['name', 'seat_count'], 'required'],
|
||||||
|
[['seat_count'], 'integer'],
|
||||||
|
[['name'], 'unique'],
|
||||||
|
[['name'], 'string', 'max' => 255]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => Yii::t('room', 'ID'),
|
||||||
|
'name' => Yii::t('room', 'Name'),
|
||||||
|
'seat_count' => Yii::t('room', 'Seat Count'),
|
||||||
|
'created_at' => Yii::t('room', 'Created At'),
|
||||||
|
'updated_at' => Yii::t('room', 'Updated At'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return ArrayHelper::merge( [
|
||||||
|
[
|
||||||
|
'class' => TimestampBehavior::className(),
|
||||||
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
||||||
|
]
|
||||||
|
],
|
||||||
|
parent::behaviors());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function asOptions(){
|
||||||
|
$items = ArrayHelper::map(Room::find()->all(),'id','name');
|
||||||
|
return ArrayHelper::merge(['' => \Yii::t('event-type','All')],$items);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function roomOptions($all = false, $emtpyString = false){
|
||||||
|
$items = ArrayHelper::map(Room::find()->all(),'id','name');
|
||||||
|
$extra = [];
|
||||||
|
if ( $all ) {
|
||||||
|
$extra = ['' => \Yii::t('room','All')];
|
||||||
|
}
|
||||||
|
if ( $emtpyString ) {
|
||||||
|
$extra = ['' => '' ];
|
||||||
|
}
|
||||||
|
return ArrayHelper::merge($extra,$items);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
namespace common\models;
|
namespace common\models;
|
||||||
|
|
||||||
|
use common\manager\EventRegistrationManager;
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\db\Query;
|
use yii\db\Query;
|
||||||
use yii\db\Expression;
|
use yii\db\Expression;
|
||||||
use common\components\Helper;
|
use common\components\Helper;
|
||||||
|
use yii\web\HttpException;
|
||||||
|
|
||||||
/** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
|
/** @noinspection PhpUnnecessaryFullyQualifiedNameInspection */
|
||||||
|
|
||||||
@ -33,6 +35,8 @@ use common\components\Helper;
|
|||||||
* @property int id_contract
|
* @property int id_contract
|
||||||
* @property integer $original_price
|
* @property integer $original_price
|
||||||
* @property string $original_end;
|
* @property string $original_end;
|
||||||
|
* @property integer $reservation_count
|
||||||
|
* @property integer $max_reservation_count
|
||||||
*
|
*
|
||||||
* @property \common\models\Card card
|
* @property \common\models\Card card
|
||||||
* @property \common\models\Ticket transfer
|
* @property \common\models\Ticket transfer
|
||||||
@ -442,6 +446,30 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasOpenReservationCount(){
|
||||||
|
return $this->reservation_count < $this->max_reservation_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $count
|
||||||
|
* @throws HttpException
|
||||||
|
*/
|
||||||
|
public function consumeReservationCount($count){
|
||||||
|
$newReservationCount = $this->reservation_count + $count;
|
||||||
|
if ( $newReservationCount > $this->max_reservation_count ){
|
||||||
|
throw new HttpException(400, 'Max ticket seat count exceeded',EventRegistrationManager::MAX_SEAT_COUNT_EXCEEDED);
|
||||||
|
}
|
||||||
|
$this->reservation_count = $newReservationCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function restoreReservationCount($usagesToRestore){
|
||||||
|
$this->reservation_count -= $usagesToRestore;
|
||||||
|
if ( $this->reservation_count < 0 ){
|
||||||
|
$this->reservation_count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function afterSave($insert, $changedAttributes) {
|
public function afterSave($insert, $changedAttributes) {
|
||||||
Card::updateCardFlagTicket($this->id_card);;
|
Card::updateCardFlagTicket($this->id_card);;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,13 +24,22 @@ use yii\helpers\ArrayHelper;
|
|||||||
* @property integer door_allowed
|
* @property integer door_allowed
|
||||||
* @property string $created_at
|
* @property string $created_at
|
||||||
* @property string $updated_at
|
* @property string $updated_at
|
||||||
|
* @property integer $max_reservation_count
|
||||||
|
* @property \common\models\Account $account
|
||||||
|
* @property string $typeHuman
|
||||||
|
* @property string $timeUnitHuman
|
||||||
|
* @property string $accountName
|
||||||
*/
|
*/
|
||||||
class TicketType extends \common\models\BaseFitnessActiveRecord {
|
class TicketType extends BaseFitnessActiveRecord
|
||||||
|
{
|
||||||
const STATUS_DELETED = 0;
|
const STATUS_DELETED = 0;
|
||||||
const STATUS_ACTIVE = 10;
|
const STATUS_ACTIVE = 10;
|
||||||
CONST TIME_UNIT_DAY = 10;//nap
|
// day
|
||||||
CONST TIME_UNIT_MONTH = 20;//hónap
|
CONST TIME_UNIT_DAY = 10;
|
||||||
CONST TIME_UNIT_MONTH_REFERENCE = 30; //tárgy hónap
|
// month
|
||||||
|
CONST TIME_UNIT_MONTH = 20;
|
||||||
|
// subject month
|
||||||
|
CONST TIME_UNIT_MONTH_REFERENCE = 30;
|
||||||
const TYPE_NORMAL = 10;
|
const TYPE_NORMAL = 10;
|
||||||
const TYPE_DEFAULT = self::TYPE_NORMAL;
|
const TYPE_DEFAULT = self::TYPE_NORMAL;
|
||||||
|
|
||||||
@ -57,7 +66,7 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[['name', 'id_account','time_unit_count','type' ,'time_unit_type' ,'max_usage_count','price_brutto'], 'required'],
|
[['name', 'id_account','time_unit_count','type' ,'time_unit_type' ,'max_usage_count','max_reservation_count','price_brutto'], 'required'],
|
||||||
////////////////
|
////////////////
|
||||||
//price brutto
|
//price brutto
|
||||||
////////////////
|
////////////////
|
||||||
@ -76,6 +85,10 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
|
|||||||
////////////////
|
////////////////
|
||||||
[['max_usage_count',], 'integer','min' => 0 , 'max' => 10000],
|
[['max_usage_count',], 'integer','min' => 0 , 'max' => 10000],
|
||||||
////////////////
|
////////////////
|
||||||
|
//max_reservation_count
|
||||||
|
////////////////
|
||||||
|
[['max_reservation_count',], 'integer','min' => 0 , 'max' => 10000],
|
||||||
|
////////////////
|
||||||
//flag_student
|
//flag_student
|
||||||
////////////////
|
////////////////
|
||||||
[['flag_student',], 'integer'],
|
[['flag_student',], 'integer'],
|
||||||
@ -140,6 +153,7 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
|
|||||||
'installment_count' => Yii::t('common/ticket_type', 'Havi részletek száma'),
|
'installment_count' => Yii::t('common/ticket_type', 'Havi részletek száma'),
|
||||||
'installment_money' => Yii::t('common/ticket_type', 'Havi részlet összege'),
|
'installment_money' => Yii::t('common/ticket_type', 'Havi részlet összege'),
|
||||||
'door_allowed' => Yii::t('common/ticket_type', 'Forgóvilla'),
|
'door_allowed' => Yii::t('common/ticket_type', 'Forgóvilla'),
|
||||||
|
'max_reservation_count' => Yii::t('common/ticket_type', 'Max Reservation Count'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +183,7 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
|
|||||||
}
|
}
|
||||||
public function getTimeUnitHuman() {
|
public function getTimeUnitHuman() {
|
||||||
$result = null;
|
$result = null;
|
||||||
$s = self::timeUnitTypes ( $this->time_unit_type );
|
$s = self::timeUnitTypes( );
|
||||||
if (array_key_exists ( $this->time_unit_type, $s )) {
|
if (array_key_exists ( $this->time_unit_type, $s )) {
|
||||||
$result = $s [$this->time_unit_type];
|
$result = $s [$this->time_unit_type];
|
||||||
}
|
}
|
||||||
@ -210,7 +224,7 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function validateIdAccount($attribute,$params){
|
public function validateIdAccount($attribute){
|
||||||
$account = null;
|
$account = null;
|
||||||
if ( !$this->hasErrors("id_account")){
|
if ( !$this->hasErrors("id_account")){
|
||||||
$account = Account::findOne($this->$attribute);
|
$account = Account::findOne($this->$attribute);
|
||||||
@ -235,7 +249,10 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* $param int $forceIncludeAccount id account, that should be included in list, even if it is inactive
|
* $param int $forceIncludeAccount id account, that should be included in list, even if it is inactive
|
||||||
* */
|
* @param null $forceIncludeObjectWithId
|
||||||
|
* @param null $account
|
||||||
|
* @return array|\yii\db\ActiveRecord[]|null
|
||||||
|
*/
|
||||||
public static function read($forceIncludeObjectWithId = null, $account = null){
|
public static function read($forceIncludeObjectWithId = null, $account = null){
|
||||||
$ticketTypes = null;
|
$ticketTypes = null;
|
||||||
|
|
||||||
|
|||||||
94
common/models/Trainer.php
Normal file
94
common/models/Trainer.php
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\behaviors\TimestampBehavior;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "trainer".
|
||||||
|
*
|
||||||
|
* @property integer $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $phone
|
||||||
|
* @property string $email
|
||||||
|
* @property string $password
|
||||||
|
* @property integer $active
|
||||||
|
* @property string $created_at
|
||||||
|
* @property string $updated_at
|
||||||
|
*/
|
||||||
|
class Trainer extends \yii\db\ActiveRecord
|
||||||
|
{
|
||||||
|
const ACTIVE_ON = 1;
|
||||||
|
const ACTIVE_OFF = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public static function tableName()
|
||||||
|
{
|
||||||
|
return 'trainer';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
[['active'], 'integer'],
|
||||||
|
[['name', 'email'], 'string', 'max' => 255],
|
||||||
|
[['phone'], 'string', 'max' => 20],
|
||||||
|
[['name','phone','email'] , 'required'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'id' => Yii::t('trainer', 'ID'),
|
||||||
|
'name' => Yii::t('trainer', 'Name'),
|
||||||
|
'phone' => Yii::t('trainer', 'Phone'),
|
||||||
|
'email' => Yii::t('trainer', 'Email'),
|
||||||
|
'password' => Yii::t('trainer', 'Password'),
|
||||||
|
'active' => Yii::t('trainer', 'Active'),
|
||||||
|
'created_at' => Yii::t('trainer', 'Created At'),
|
||||||
|
'updated_at' => Yii::t('trainer', 'Updated At'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function behaviors()
|
||||||
|
{
|
||||||
|
return ArrayHelper::merge( [
|
||||||
|
[
|
||||||
|
'class' => TimestampBehavior::className(),
|
||||||
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
||||||
|
]
|
||||||
|
],
|
||||||
|
parent::behaviors());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function prettyPrintActive($active){
|
||||||
|
if ( $active == Trainer::ACTIVE_ON ){
|
||||||
|
return \Yii::t("trainer",'active_on');
|
||||||
|
}
|
||||||
|
return \Yii::t("trainer",'active_off');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function trainerOptions($all = false, $emptyString = false){
|
||||||
|
$items = ArrayHelper::map(Trainer::find()->all(),'id','name');
|
||||||
|
$extra = [];
|
||||||
|
if ( $all ) {
|
||||||
|
$extra = ['' => \Yii::t('trainer','All')];
|
||||||
|
}
|
||||||
|
if ( $emptyString ) {
|
||||||
|
$extra = ['' => '' ];
|
||||||
|
}
|
||||||
|
return ArrayHelper::merge($extra,$items);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -3,11 +3,8 @@
|
|||||||
namespace common\models;
|
namespace common\models;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\Object;
|
|
||||||
use yii\helpers\ArrayHelper;
|
use yii\helpers\ArrayHelper;
|
||||||
use yii\behaviors\TimestampBehavior;
|
use yii\behaviors\TimestampBehavior;
|
||||||
use common\components\AccountAwareBehavior;
|
|
||||||
use common\components\UserAwareBehavior;
|
|
||||||
use common\components\DiscountAwareBehavior;
|
use common\components\DiscountAwareBehavior;
|
||||||
use common\components\CustomerAwareBehavior;
|
use common\components\CustomerAwareBehavior;
|
||||||
use yii\db\Query;
|
use yii\db\Query;
|
||||||
@ -604,12 +601,17 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
|||||||
}
|
}
|
||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
* @throws \yii\db\StaleObjectException
|
||||||
|
*/
|
||||||
public function beforeDelete() {
|
public function beforeDelete() {
|
||||||
parent::beforeDelete ();
|
parent::beforeDelete ();
|
||||||
if ($this->type == Transfer::TYPE_TICKET) {
|
if ($this->type == Transfer::TYPE_TICKET) {
|
||||||
$ticket = $this->ticket;
|
$ticket = $this->ticket;
|
||||||
if ($ticket != null) {
|
if ($ticket != null) {
|
||||||
$ticket->delete ();
|
$ticket->delete();
|
||||||
}
|
}
|
||||||
} else if ($this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT) {
|
} else if ($this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT) {
|
||||||
/** @noinspection PhpUndefinedFieldInspection */
|
/** @noinspection PhpUndefinedFieldInspection */
|
||||||
@ -816,11 +818,10 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
|||||||
* an array, wchic contains items. each item has to key - value pairs: [ id_account => 0, money => 0 ]
|
* an array, wchic contains items. each item has to key - value pairs: [ id_account => 0, money => 0 ]
|
||||||
*
|
*
|
||||||
* @param $accounts
|
* @param $accounts
|
||||||
* @param $accountMap
|
|
||||||
* @param $idAccount
|
* @param $idAccount
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function mkTotalsResultWithAllAvailableAccount($queryResult, $accounts, $accountMap, $idAccount) {
|
public static function mkTotalsResultWithAllAvailableAccount($queryResult, $accounts, $idAccount) {
|
||||||
$totals = [ ];
|
$totals = [ ];
|
||||||
$totals ['total'] = 0;
|
$totals ['total'] = 0;
|
||||||
|
|
||||||
@ -867,6 +868,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
|||||||
* @param $types
|
* @param $types
|
||||||
* @param $idAccount
|
* @param $idAccount
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws \yii\db\Exception
|
||||||
*/
|
*/
|
||||||
public static function exTotalQuery($mode, $start, $end, $idUser, $types, $idAccount) {
|
public static function exTotalQuery($mode, $start, $end, $idUser, $types, $idAccount) {
|
||||||
$query = self::mkTotalQuery ( $mode, $start, $end, $idUser, $types, $idAccount );
|
$query = self::mkTotalQuery ( $mode, $start, $end, $idUser, $types, $idAccount );
|
||||||
@ -885,45 +887,56 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
|||||||
* @param $accounts
|
* @param $accounts
|
||||||
* @param $accountMap
|
* @param $accountMap
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws \yii\db\Exception
|
||||||
*/
|
*/
|
||||||
public static function mkPaidAtTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
|
public static function mkPaidAtTotals($start, $end, $idUser, $types, $idAccount, $accounts) {
|
||||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||||
$result = [ ];
|
$result = [ ];
|
||||||
$queryResult = self::exTotalQuery ( 'paid_at', $start, $end, $idUser, $types, $idAccount );
|
$queryResult = self::exTotalQuery ( 'paid_at', $start, $end, $idUser, $types, $idAccount );
|
||||||
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
|
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $idAccount );
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find all transfers in the period ( doesn't matter if paid or not )
|
* find all transfers in the period ( doesn't matter if paid or not )
|
||||||
|
* @throws \yii\db\Exception
|
||||||
*/
|
*/
|
||||||
public static function mkCreatedAtTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
|
public static function mkCreatedAtTotals($start, $end, $idUser, $types, $idAccount, $accounts) {
|
||||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||||
$result = [ ];
|
$result = [ ];
|
||||||
$queryResult = self::exTotalQuery ( 'created_at', $start, $end, $idUser, $types, $idAccount );
|
$queryResult = self::exTotalQuery ( 'created_at', $start, $end, $idUser, $types, $idAccount );
|
||||||
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
|
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $idAccount );
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find transfers which were created but not paid in the period
|
* find transfers which were created but not paid in the period
|
||||||
|
* @throws \yii\db\Exception
|
||||||
*/
|
*/
|
||||||
public static function mkCreatedAtNotPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
|
public static function mkCreatedAtNotPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts) {
|
||||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||||
$result = [ ];
|
$result = [ ];
|
||||||
$queryResult = self::exTotalQuery ( 'created_at_not_paid', $start, $end, $idUser, $types, $idAccount );
|
$queryResult = self::exTotalQuery ( 'created_at_not_paid', $start, $end, $idUser, $types, $idAccount );
|
||||||
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
|
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $idAccount );
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find transfers which were created and paid in the period
|
* find transfers which were created and paid in the period
|
||||||
|
* @param $start
|
||||||
|
* @param $end
|
||||||
|
* @param $idUser
|
||||||
|
* @param $types
|
||||||
|
* @param $idAccount
|
||||||
|
* @param $accounts
|
||||||
|
* @return array
|
||||||
|
* @throws \yii\db\Exception
|
||||||
*/
|
*/
|
||||||
public static function mkCreatedAtPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
|
public static function mkCreatedAtPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts) {
|
||||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||||
$result = [ ];
|
$result = [ ];
|
||||||
$queryResult = self::exTotalQuery ( 'created_at_paid', $start, $end, $idUser, $types, $idAccount );
|
$queryResult = self::exTotalQuery ( 'created_at_paid', $start, $end, $idUser, $types, $idAccount );
|
||||||
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
|
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $idAccount );
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -937,22 +950,35 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
|||||||
* @param $accounts
|
* @param $accounts
|
||||||
* @param $accountMap
|
* @param $accountMap
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws \yii\db\Exception
|
||||||
*/
|
*/
|
||||||
public static function mkPaidAtNotCreatedAtPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
|
public static function mkPaidAtNotCreatedAtPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts) {
|
||||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||||
$result = [ ];
|
$result = [ ];
|
||||||
$queryResult = self::exTotalQuery ( 'paid_at_not_created_at', $start, $end, $idUser, $types, $idAccount );
|
$queryResult = self::exTotalQuery ( 'paid_at_not_created_at', $start, $end, $idUser, $types, $idAccount );
|
||||||
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
|
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $idAccount );
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
public static function mkTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
|
|
||||||
|
/**
|
||||||
|
* @param $start
|
||||||
|
* @param $end
|
||||||
|
* @param $idUser
|
||||||
|
* @param $types
|
||||||
|
* @param $idAccount
|
||||||
|
* @param $accounts
|
||||||
|
* @param $accountMap
|
||||||
|
* @return array
|
||||||
|
* @throws \yii\db\Exception
|
||||||
|
*/
|
||||||
|
public static function mkTotals($start, $end, $idUser, $types, $idAccount, $accounts) {
|
||||||
$result = [ ];
|
$result = [ ];
|
||||||
|
|
||||||
$result ['paid_at'] = self::mkPaidAtTotals ( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap );
|
$result ['paid_at'] = self::mkPaidAtTotals ( $start, $end, $idUser, $types, $idAccount, $accounts );
|
||||||
$result ['created_at'] = self::mkCreatedAtTotals ( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap );
|
$result ['created_at'] = self::mkCreatedAtTotals ( $start, $end, $idUser, $types, $idAccount, $accounts );
|
||||||
$result ['created_at_not_paid'] = self::mkCreatedAtNotPaidTotals ( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap );
|
$result ['created_at_not_paid'] = self::mkCreatedAtNotPaidTotals ( $start, $end, $idUser, $types, $idAccount, $accounts );
|
||||||
$result ['created_at_paid'] = self::mkCreatedAtPaidTotals ( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap );
|
$result ['created_at_paid'] = self::mkCreatedAtPaidTotals ( $start, $end, $idUser, $types, $idAccount, $accounts );
|
||||||
$result ['paid_at_not_created_at'] = self::mkPaidAtNotCreatedAtPaidTotals ( $start, $end, $idUser, $types, $idAccount, $accounts, $accountMap );
|
$result ['paid_at_not_created_at'] = self::mkPaidAtNotCreatedAtPaidTotals ( $start, $end, $idUser, $types, $idAccount, $accounts );
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@ -1220,6 +1246,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
|||||||
$ticket->id_discount = null; // contract.id_discount
|
$ticket->id_discount = null; // contract.id_discount
|
||||||
$ticket->start = $request->request_target_time_at;
|
$ticket->start = $request->request_target_time_at;
|
||||||
$ticket->end = date ( 'Y-m-d', strtotime ( $request->request_target_time_at . " +1 month -1 day" ) );
|
$ticket->end = date ( 'Y-m-d', strtotime ( $request->request_target_time_at . " +1 month -1 day" ) );
|
||||||
|
$ticket->max_reservation_count = $ticketType->max_reservation_count;
|
||||||
$ticket->max_usage_count = $ticketType->max_usage_count;
|
$ticket->max_usage_count = $ticketType->max_usage_count;
|
||||||
$ticket->usage_count = 0;
|
$ticket->usage_count = 0;
|
||||||
$ticket->status = Ticket::STATUS_INACTIVE;
|
$ticket->status = Ticket::STATUS_INACTIVE;
|
||||||
|
|||||||
@ -161,6 +161,8 @@ class User extends ActiveRecord implements IdentityInterface
|
|||||||
* Generates password hash from password and sets it to the model
|
* Generates password hash from password and sets it to the model
|
||||||
*
|
*
|
||||||
* @param string $password
|
* @param string $password
|
||||||
|
* @throws \yii\base\Exception
|
||||||
|
* @throws \yii\base\InvalidConfigException
|
||||||
*/
|
*/
|
||||||
public function setPassword($password)
|
public function setPassword($password)
|
||||||
{
|
{
|
||||||
|
|||||||
16
common/modules/event/EventModule.php
Normal file
16
common/modules/event/EventModule.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\modules\event;
|
||||||
|
|
||||||
|
class EventModule extends \yii\base\Module
|
||||||
|
{
|
||||||
|
public $controllerNamespace = 'common\modules\event\controllers';
|
||||||
|
public $mode;
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
|
||||||
|
// custom initialization code goes here
|
||||||
|
}
|
||||||
|
}
|
||||||
13
common/modules/event/controllers/DefaultController.php
Normal file
13
common/modules/event/controllers/DefaultController.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace common\modules\event\controllers;
|
||||||
|
|
||||||
|
use yii\web\Controller;
|
||||||
|
|
||||||
|
class DefaultController extends Controller
|
||||||
|
{
|
||||||
|
public function actionIndex()
|
||||||
|
{
|
||||||
|
return $this->render('index');
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user