"Info", Log::$TYPE_ERR => "Hiba", Log::$TYPE_TICKET_USAGE_FIRST => "Bérlet használat", Log::$TYPE_TICKET_USAGE_MULTIPLE => "Többszöri bérlet használat", Log::$TYPE_LOGIN => "Bejelentkezés", Log::$TYPE_DEFAULT_ACCOUNT => "Alapértelmezett kassza", Log::$TYPE_CREATE_CUSTOMER => "Új vendég", Log::$TYPE_PROCUREMENT_UPDATE => "Beszerzés módosítás", Log::$TYPE_TICKET_COUNT_MOVE_OUT => "Ki mozgás", Log::$TYPE_WASTE => "Selejt", Log::$TYPE_NEWSLETTER_SUBSCRIBE => "Feliratkozás hirlevélre", Log::$TYPE_NEWSLETTER_UNSUBSCRIBE => "Leiratkozás hírlevélről", Log::$TYPE_NEWSLETTER_SENT => "Hirlevél elküldve", Log::$TYPE_TICKET_EXPIRE_SENT => "Bérlet lejáart figyelmeztetés elküldve", Log::$TYPE_NEWSLETTER_SEND_START => "Hirlevél küldés start", Log::$TYPE_NEWSLETTER_SEND_END => "Hirlevél küldés vége", Log::$TYPE_KEY_ASSIGN => "Kulcs kiadás", Log::$TYPE_KEY_UNASSIGN => "Kulcs visszaadás", Log::$TYPE_TOWEL_IN => "Törölköző ki", Log::$TYPE_TOWEL_OUT => "Törölköző vissza", Log::$TYPE_CRUD => "CRUD", Log::$TYPE_TICKET_UPDATED_BY_ADMIN => "Bérlet módosítás", Log::$TYPE_MOBILE_DEVICE_STATUS => "Mobil eszköz státusz" ]; } public function getTypeName() { $types = Log::getTypes(); return Helper::getArrayValue($types, $this->type, null); } /** * @inheritdoc */ public static function tableName() { return 'log'; } /** * @inheritdoc */ public function rules() { return [ ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id_log' => Yii::t('common/log', 'Azonosító'), 'type' => Yii::t('common/log', 'Típus'), 'message' => Yii::t('common/log', 'Üzenet'), 'url' => Yii::t('common/log', 'Url'), 'app' => Yii::t('common/log', 'Alkalmazás'), 'id_user' => Yii::t('common/log', 'Felhasználó'), 'id_transfer' => Yii::t('common/log', 'Tranzakció'), 'id_money_movement' => Yii::t('common/log', 'Pénzmozgás'), 'id_ticket' => Yii::t('common/log', 'Bérlet'), 'id_sale' => Yii::t('common/log', 'Termékeladás'), 'id_customer' => Yii::t('common/log', 'Vendég'), 'id_account' => Yii::t('common/log', 'Kassza'), 'id_account_state' => Yii::t('common/log', 'Id Account State'), 'id_key' => Yii::t('common/log', 'Kulcs'), 'id_product' => Yii::t('common/log', 'Termék'), 'id_door_log' => Yii::t('common/log', 'Kapu log'), 'created_at' => Yii::t('common/log', 'Dátum idő'), 'updated_at' => Yii::t('common/log', 'Módosítás'), 'start' => 'Időszak kezdete', 'end' => 'Időszak vége' ]; } public static function info($message) { self::log(['type' => self::$TYPE_INFO, 'message' => $message]); } /** * example * Log::log([ * 'type' =>Log::$TYPE_LOGIN, * 'message' => $message * ]); * @param array $config */ public static function log($config) { $model = new Log($config); $model->app = \Yii::$app->name; $model->url = Url::canonical(); $model->id_user = \Yii::$app->user->id; $model->save(false); } /** * create a log from the console app * */ public static function logC($config) { $model = new Log($config); $model->app = "Fitness rendszer"; $model->url = "console"; $model->id_user = 1; $model->save(false); } public function getUser() { return $this->hasOne(User::className(), ["id" => "id_user"]); } public function getTicket() { return $this->hasOne(Ticket::className(), ["id_ticket" => "id_ticket"]); } public function getCustomer() { return $this->hasOne(Customer::className(), ["id_customer" => "id_customer"]); } public function getMoneyMovement() { return $this->hasOne(MoneyMovement::className(), ["id_money_movement" => "id_money_movement"]); } public function getUserName() { $user = $this->user; if (isset($user)) { return $user->username; } return null; } public function getCustomerName() { $customer = $this->customer; if (isset($customer)) { return $customer->name; } return null; } public function getTicketName() { $ticket = $this->ticket; if (isset($ticket)) { return $ticket->ticketTypeName; } return null; } }