Finish detsta_part
This commit is contained in:
@@ -36,6 +36,8 @@ class DetStaDBSave extends Object
|
||||
/**messagedetsta lab*/
|
||||
public $messageLab;
|
||||
|
||||
public $path;
|
||||
|
||||
/**messagedetsta tetelek*/
|
||||
public $messageTetelek = [];
|
||||
|
||||
@@ -56,6 +58,7 @@ class DetStaDBSave extends Object
|
||||
protected function saveMessageDetsta( ) {
|
||||
$this->message = new MessageDetsta();
|
||||
$this->message->id_user = $this->idUser;
|
||||
$this->message->path = $this->path;
|
||||
if ( isset( $this->koteg ) ){
|
||||
$this->message->id_ugiro = $this->koteg->id_ugiro;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ class DetStatProcessor extends Object{
|
||||
|
||||
/**aktuális koteg, config paraméterként kapju*/
|
||||
public $koteg;
|
||||
public $path;
|
||||
|
||||
public $idKoteg;
|
||||
public $detstatUzenet;
|
||||
public $megbizasok;
|
||||
@@ -44,6 +46,7 @@ class DetStatProcessor extends Object{
|
||||
$saver = new DetStaDBSave(
|
||||
[
|
||||
'giroDETSTA' => $this->detstatUzenet,
|
||||
'path' => $this->path,
|
||||
'koteg' => $this->koteg,
|
||||
'idUser' =>\Yii::$app->user->id
|
||||
]);
|
||||
@@ -71,7 +74,7 @@ class DetStatProcessor extends Object{
|
||||
|
||||
public function readDetstaUzenet(){
|
||||
|
||||
$filename = \Yii::getAlias("@webroot") ."/" .$this->koteg->desta_path;
|
||||
$filename = \Yii::getAlias("@webroot") ."/" .$this->path;
|
||||
$content = file_get_contents($filename);
|
||||
$this->detstatUzenet = GiroDETSTA::parse($content);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\helpers\VarDumper;
|
||||
|
||||
/**
|
||||
* Login form
|
||||
@@ -68,6 +69,8 @@ class LoginForm extends Model
|
||||
if ($this->validate()) {
|
||||
return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
|
||||
} else {
|
||||
\Yii::error("Belépés - validáció sikertelen");
|
||||
\Yii::error( $this->getErrors());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -80,10 +83,12 @@ class LoginForm extends Model
|
||||
protected function getUser()
|
||||
{
|
||||
if ($this->_user === null) {
|
||||
\Yii::info("admin login - find user by name...");
|
||||
$this->_user = User::findByUsername($this->username);
|
||||
}
|
||||
|
||||
if ( $this->_user != null ){
|
||||
\Yii::info("Felhasználónév rendben...");
|
||||
if ( $this->roles != null ){
|
||||
$canLogin = false;
|
||||
foreach ($this->roles as $role){
|
||||
@@ -91,10 +96,14 @@ class LoginForm extends Model
|
||||
}
|
||||
|
||||
if ( !$canLogin ){
|
||||
\Yii::info("user ".$this->_user->username." has no permission to login to administration area!");
|
||||
\Yii::error("user ".$this->_user->username." has no permission to login to administration area!");
|
||||
$this->_user = null;
|
||||
}else{
|
||||
\Yii::info("user ".$this->_user->username." has permission to login to administration area!");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
\Yii::error("Felhasználó nem található: " .$this->username);
|
||||
}
|
||||
|
||||
return $this->_user;
|
||||
|
||||
@@ -59,4 +59,6 @@ class MessageDetsta extends BaseFitnessActiveRecord
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -93,6 +93,11 @@ class Ugiro extends \yii\db\ActiveRecord
|
||||
->viaTable('ugiro_request_assignment', ['id_ugiro' => 'id_ugiro']);
|
||||
}
|
||||
|
||||
public function getDetstaUzenetek()
|
||||
{
|
||||
return $this->hasMany(MessageDetsta::className(), ['id_ugiro' => 'id_ugiro']);
|
||||
}
|
||||
|
||||
|
||||
public static function statuses() {
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user