Your IP : 216.73.216.48


Current Path : /hdd/hdd11/www/codedit/models/forms/
Upload File :
Current File : /hdd/hdd11/www/codedit/models/forms/AddFtpConnectionForm.php

<?php

namespace app\models\forms;

use Yii;
use yii\base\Model;
use app\models\FtpConnections;

class AddFtpConnectionForm extends Model {

    public $type;
    public $host;
    public $username;
    public $password;
    public $port;
    public $dir;

    public function rules() {
        return [
            [['type', 'host', 'port', 'username', 'password'], 'required'],
            [['type', 'host', 'username', 'dir'], 'safe'],
            [['port'], 'integer']
        ];
    }

    public function attributeLabels() {
        return [
            'type' => Yii::t('app', 'Вид'),
            'host' => Yii::t('app', 'Хост'),
            'username' => Yii::t('app', 'Потребител'),
            'password' => Yii::t('app', 'Парола'),
            'port' => Yii::t('app', 'Порт'),
            'dir' => Yii::t('app', 'Директория')
        ];
    }

    public function addConnection($memberID) {
        $ftpConnections = new FtpConnections();
        return $ftpConnections->addConnection($memberID, $this->type, $this->host, $this->username, $this->password, $this->port, $this->dir);
    }

}