| @@ 14-62 (lines=49) @@ | ||
| 11 | ||
| 12 | namespace Migrations\Migration; |
|
| 13 | ||
| 14 | class Map extends \Model |
|
| 15 | { |
|
| 16 | public static $objectName = 'Карта миграции данных'; |
|
| 17 | public static $labels = [ |
|
| 18 | 'name' => 'Название', |
|
| 19 | 'migration_id' => 'Миграция данных' |
|
| 20 | ]; |
|
| 21 | public static $cols = [ |
|
| 22 | 'name' => ['type' => 'text'], |
|
| 23 | 'migration_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'migration'], |
|
| 24 | ]; |
|
| 25 | public static $dataManagers = [ |
|
| 26 | 'manager' => [ |
|
| 27 | 'name' => 'Карты миграции данных', |
|
| 28 | 'cols' => ['name', 'migration_id'], |
|
| 29 | 'actions' => [ |
|
| 30 | 'mapEdit' => [ |
|
| 31 | 'className' => 'Href', |
|
| 32 | 'href' => '/admin/migrations/map', |
|
| 33 | 'text' => '<i class = "glyphicon glyphicon-cog"></i>' |
|
| 34 | ], |
|
| 35 | 'Edit', 'Delete' |
|
| 36 | ], |
|
| 37 | ] |
|
| 38 | ]; |
|
| 39 | public static $forms = [ |
|
| 40 | 'manager' => [ |
|
| 41 | 'map' => [ |
|
| 42 | ['name', 'migration_id'] |
|
| 43 | ] |
|
| 44 | ] |
|
| 45 | ]; |
|
| 46 | ||
| 47 | public static function relations() |
|
| 48 | { |
|
| 49 | return [ |
|
| 50 | 'migration' => [ |
|
| 51 | 'model' => 'Migrations\Migration', |
|
| 52 | 'col' => 'migration_id' |
|
| 53 | ], |
|
| 54 | 'paths' => [ |
|
| 55 | 'type' => 'many', |
|
| 56 | 'model' => 'Migrations\Migration\Map\Path', |
|
| 57 | 'col' => 'migration_map_id' |
|
| 58 | ] |
|
| 59 | ]; |
|
| 60 | } |
|
| 61 | ||
| 62 | } |
|
| 63 | ||
| @@ 12-57 (lines=46) @@ | ||
| 9 | */ |
|
| 10 | namespace Users; |
|
| 11 | ||
| 12 | class Group extends \Model |
|
| 13 | { |
|
| 14 | public static $objectName = 'Группа пользователей'; |
|
| 15 | public static $labels = [ |
|
| 16 | 'name' => 'Название', |
|
| 17 | 'user' => 'Пользователи', |
|
| 18 | 'role' => 'Роли' |
|
| 19 | ]; |
|
| 20 | public static $cols = [ |
|
| 21 | 'name' => ['type' => 'text'], |
|
| 22 | 'user' => ['type' => 'select', 'source' => 'relation', 'relation' => 'users'], |
|
| 23 | 'role' => ['type' => 'select', 'source' => 'relation', 'relation' => 'roles'], |
|
| 24 | ]; |
|
| 25 | public static $dataManagers = [ |
|
| 26 | 'manager' => [ |
|
| 27 | 'name' => 'Группы пользователей', |
|
| 28 | 'cols' => [ |
|
| 29 | 'name', 'role', 'user' |
|
| 30 | ] |
|
| 31 | ] |
|
| 32 | ]; |
|
| 33 | public static $forms = [ |
|
| 34 | 'manager' => [ |
|
| 35 | 'map' => [ |
|
| 36 | ['name'] |
|
| 37 | ] |
|
| 38 | ] |
|
| 39 | ]; |
|
| 40 | ||
| 41 | public static function relations() |
|
| 42 | { |
|
| 43 | return [ |
|
| 44 | 'roles' => [ |
|
| 45 | 'type' => 'many', |
|
| 46 | 'model' => 'Users\Role', |
|
| 47 | 'col' => 'group_id' |
|
| 48 | ], |
|
| 49 | 'users' => [ |
|
| 50 | 'type' => 'many', |
|
| 51 | 'model' => 'Users\User', |
|
| 52 | 'col' => 'group_id' |
|
| 53 | ] |
|
| 54 | ]; |
|
| 55 | } |
|
| 56 | ||
| 57 | } |
|
| 58 | ||
| @@ 14-58 (lines=45) @@ | ||
| 11 | ||
| 12 | namespace Users; |
|
| 13 | ||
| 14 | class Activity extends \Model |
|
| 15 | { |
|
| 16 | public static $objectName = 'Activity'; |
|
| 17 | public static $labels = [ |
|
| 18 | 'text' => 'Текст', |
|
| 19 | 'user_id' => 'Пользователь', |
|
| 20 | 'category_id' => 'Категория', |
|
| 21 | ]; |
|
| 22 | public static $cols = [ |
|
| 23 | 'text' => ['type' => 'text'], |
|
| 24 | 'user_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'user'], |
|
| 25 | 'category_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'category'], |
|
| 26 | ]; |
|
| 27 | public static $dataManagers = [ |
|
| 28 | 'manager' => [ |
|
| 29 | 'name' => 'Activity', |
|
| 30 | 'cols' => [ |
|
| 31 | 'text', 'user_id', 'category_id', 'date_create', |
|
| 32 | ] |
|
| 33 | ] |
|
| 34 | ]; |
|
| 35 | public static $forms = [ |
|
| 36 | 'manager' => [ |
|
| 37 | 'map' => [ |
|
| 38 | ['text'], |
|
| 39 | ['user_id', 'category_id'] |
|
| 40 | ] |
|
| 41 | ] |
|
| 42 | ]; |
|
| 43 | ||
| 44 | public static function relations() |
|
| 45 | { |
|
| 46 | return [ |
|
| 47 | 'user' => [ |
|
| 48 | 'model' => 'Users\User', |
|
| 49 | 'col' => 'user_id' |
|
| 50 | ], |
|
| 51 | 'category' => [ |
|
| 52 | 'model' => 'Users\Activity\Category', |
|
| 53 | 'col' => 'category_id' |
|
| 54 | ], |
|
| 55 | ]; |
|
| 56 | } |
|
| 57 | ||
| 58 | } |
|
| 59 | ||