| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace app\models;
- use yii\base\Model;
- class OrganizerForm extends Model
- {
- public $id;
- public $user_id;
- public $fio;
- public $at_org;
- public $org_type;
- public $phone;
- public $fax;
- public $firma_full;
- public $inn;
- public $zkpo;
- public $u_address;
- public $f_address;
- public $member;
- public $member_phone;
- public $member_email;
- public $site;
- public $files;
-
- public function rules()
- {
- return [
- [['user_id', 'fio', 'at_org', 'org_type'], 'required'],
- [['user_id', 'org_type', 'inn', 'zkpo', 'files'], 'integer', 'min' => 6, 'max' => 25],
- [['fio', 'at_org', 'phone', 'fax', 'firma_full', 'u_address', 'f_address', 'member', 'member_phone', 'member_email', 'site'], 'string', 'max' => 255],
- [['fio', 'at_org', 'phone', 'fax', 'firma_full', 'u_address', 'f_address', 'member', 'member_phone', 'member_email'], 'safe'],
- ['fax', 'match', 'pattern' => '/\(?([0-9]{3})\)?([ .-]?)([0-9]{3})\2([0-9]{4})/'],
- ];
- }
- public function init(){
- $profile = new Profile;
- }
- public function register(){
- if (!$this->validate()) {
- return false;
- }
- $this->clients->setAttributes(
- [
- 'id' => $this->id,
- 'user_id' => $this->user_id,
- 'fio' => $this->fio,
- 'at_org' => $this->at_org,
- 'org_type' => $this->org_type,
- 'phone' => $this->phone,
- 'fax' => $this->fax,
- 'firma_full' => $this->firma_full,
- 'inn' => $this->inn,
- 'zkpo' => $this->zkpo,
- 'u_address' => $this->u_address,
- 'f_address' => $this->f_address,
- 'member' => $this->member,
- 'member_phone' => $this->member_phone,
- 'member_email' => $this->member_email,
- 'site' => $this->site,
- 'files' => $this->files,
- ]
- );
- return $this->profile->save();
- }
- }
|