Blame view

common/models/Brands.php 2.08 KB
0084d336   Administrator   Importers CRUD
1
2
3
4
  <?php
  
  namespace common\models;
  
13ffaf8e   Mihail   add error handler...
5
  use backend\components\base\BaseActiveRecord;
0084d336   Administrator   Importers CRUD
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  use Yii;
  
  /**
   * This is the model class for table "w_brands".
   *
   * @property integer $ID
   * @property string $BRAND
   * @property integer $if_tecdoc
   * @property string $tecdoc_logo
   * @property integer $if_oem
   * @property integer $if_checked
   * @property string $CONTENT
   * @property string $IMG
   * @property string $timestamp
   */
13ffaf8e   Mihail   add error handler...
21
  class Brands extends BaseActiveRecord
0084d336   Administrator   Importers CRUD
22
  {
13ffaf8e   Mihail   add error handler...
23
24
      // для валидации выбранного пользователем файла
      public $file;
5c35d76d   Mihail   add xls parser
25
26
      // флаг, нужно ли удалять изображение
      public $delete_img;
0084d336   Administrator   Importers CRUD
27
28
29
30
31
32
33
34
35
36
37
38
39
40
      /**
       * @inheritdoc
       */
      public static function tableName()
      {
          return 'w_brands';
      }
  
      /**
       * @inheritdoc
       */
      public function rules()
      {
          return [
5c35d76d   Mihail   add xls parser
41
              [['BRAND'], 'required'],
0084d336   Administrator   Importers CRUD
42
43
44
              [['if_tecdoc', 'if_oem', 'if_checked'], 'integer'],
              [['CONTENT'], 'string'],
              [['timestamp'], 'safe'],
5c35d76d   Mihail   add xls parser
45
              [['delete_img'], 'safe'],
0084d336   Administrator   Importers CRUD
46
47
              [['BRAND'], 'string', 'max' => 100],
              [['tecdoc_logo'], 'string', 'max' => 50],
13ffaf8e   Mihail   add error handler...
48
              ['IMG', 'string', 'max' => 255],
5c35d76d   Mihail   add xls parser
49
50
51
              ['IMG', 'match', 'pattern' => '/[a-zA-Z0-9]+\.[a-zA-Z]+/', 'message' => 'Имя файла изображения должно иметь только латинские символы и цифры'],
            //  [['file'], 'image' ]
              [['file'], 'file', 'extensions' => ['jpg','png','bmp'], 'checkExtensionByMimeType'=>false ]
0084d336   Administrator   Importers CRUD
52
53
54
55
56
57
58
59
60
          ];
      }
  
      /**
       * @inheritdoc
       */
      public function attributeLabels()
      {
          return [
5c35d76d   Mihail   add xls parser
61
62
              'ID' => 'НОМЕР',
              'BRAND' => 'БРЕНД',
4b12e92e   Mihail   work with margins...
63
              'if_tecdoc' => 'ТЕКДОК?',
0084d336   Administrator   Importers CRUD
64
              'tecdoc_logo' => 'Tecdoc Logo',
5c35d76d   Mihail   add xls parser
65
              'if_oem' => 'Оригинал',
0084d336   Administrator   Importers CRUD
66
              'if_checked' => 'If Checked',
4b12e92e   Mihail   work with margins...
67
68
              'CONTENT' => 'Описание',
              'IMG' => 'Изображение',
0084d336   Administrator   Importers CRUD
69
              'timestamp' => 'Timestamp',
5c35d76d   Mihail   add xls parser
70
              'delete_img' => 'Удалить',
0084d336   Administrator   Importers CRUD
71
72
73
          ];
      }
  }