|
| 1 | +<?php |
| 2 | +namespace Learning; |
| 3 | +use Bitrix\Main\Entity; |
| 4 | + |
| 5 | +class GradebookTable extends Entity\DataManager |
| 6 | +{ |
| 7 | + /** |
| 8 | + * Returns DB table name for entity. |
| 9 | + * |
| 10 | + * @return string |
| 11 | + */ |
| 12 | + public static function getTableName() |
| 13 | + { |
| 14 | + return 'b_learn_gradebook'; |
| 15 | + } |
| 16 | + |
| 17 | + /** |
| 18 | + * Returns User Fields ID. |
| 19 | + * |
| 20 | + * @return array |
| 21 | + */ |
| 22 | + public static function getUfId() |
| 23 | + { |
| 24 | + return 'LEARNING_GRADEBOOK'; |
| 25 | + } |
| 26 | + |
| 27 | + /** |
| 28 | + * Returns entity map definition. |
| 29 | + * |
| 30 | + * @return array |
| 31 | + */ |
| 32 | + public static function getMap() |
| 33 | + { |
| 34 | + return array( |
| 35 | + new Entity\IntegerField('ID', array( |
| 36 | + 'primary' => true, |
| 37 | + 'autocomplete' => true |
| 38 | + )), |
| 39 | + new Entity\IntegerField('STUDENT_ID', array( |
| 40 | + 'required' => true |
| 41 | + )), |
| 42 | + new Entity\ReferenceField( |
| 43 | + 'STUDENT', |
| 44 | + '\Bitrix\Main\User', |
| 45 | + array('=this.STUDENT_ID' => 'ref.ID'), |
| 46 | + array('join_type' => 'LEFT') |
| 47 | + ), |
| 48 | + new Entity\IntegerField('TEST_ID', array( |
| 49 | + 'required' => true |
| 50 | + )), |
| 51 | + new Entity\ReferenceField( |
| 52 | + 'TEST', |
| 53 | + '\Learning\TestTable', |
| 54 | + array('=this.TEST_ID' => 'ref.ID'), |
| 55 | + array('join_type' => 'LEFT') |
| 56 | + ), |
| 57 | + new Entity\IntegerField('RESULT', array( |
| 58 | + 'required' => true |
| 59 | + )), |
| 60 | + new Entity\IntegerField('MAX_RESULT', array( |
| 61 | + 'required' => true |
| 62 | + )), |
| 63 | + new Entity\IntegerField('ATTEMPTS', array( |
| 64 | + 'required' => true |
| 65 | + )), |
| 66 | + new Entity\BooleanField('COMPLETED', array( |
| 67 | + 'values' => array('N', 'Y') |
| 68 | + )), |
| 69 | + new Entity\IntegerField('EXTRA_ATTEMPTS', array( |
| 70 | + 'required' => true |
| 71 | + )) |
| 72 | + ); |
| 73 | + } |
| 74 | +} |
| 75 | + |
0 commit comments