EpalStudent.php 36.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
<?php

namespace Drupal\epal\Entity;

use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityChangedTrait;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\user\UserInterface;

/**
 * Defines the EPAL Student entity.
 *
 * @ingroup epal
 *
 * @ContentEntityType(
 *   id = "epal_student",
 *   label = @Translation("EPAL Student"),
 *   handlers = {
 *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
 *     "list_builder" = "Drupal\epal\EpalStudentListBuilder",
 *     "views_data" = "Drupal\epal\Entity\EpalStudentViewsData",
 *
 *     "form" = {
 *       "default" = "Drupal\epal\Form\EpalStudentForm",
 *       "add" = "Drupal\epal\Form\EpalStudentForm",
 *       "edit" = "Drupal\epal\Form\EpalStudentForm",
 *       "delete" = "Drupal\epal\Form\EpalStudentDeleteForm",
 *     },
 *     "access" = "Drupal\epal\EpalStudentAccessControlHandler",
 *     "route_provider" = {
 *       "html" = "Drupal\epal\EpalStudentHtmlRouteProvider",
 *     },
 *   },
 *   base_table = "epal_student",
 *   admin_permission = "administer epal student entities",
 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "name",
 *     "uuid" = "uuid",
 *     "uid" = "user_id",
 *     "langcode" = "langcode",
 *     "status" = "status",
45 46 47
 *     "epaluser_id" = "epaluser_id",
 *     "name" = "name",
 *     "studentsurname" = "studentsurname",
48 49 50 51 52 53 54 55 56 57 58
 *   },
 *   links = {
 *     "canonical" = "/admin/epal/epal_student/{epal_student}",
 *     "add-form" = "/admin/epal/epal_student/add",
 *     "edit-form" = "/admin/epal/epal_student/{epal_student}/edit",
 *     "delete-form" = "/admin/epal/epal_student/{epal_student}/delete",
 *     "collection" = "/admin/epal/epal_student",
 *   },
 *   field_ui_base_route = "epal_student.settings"
 * )
 */
59 60 61
class EpalStudent extends ContentEntityBase implements EpalStudentInterface
{
    use EntityChangedTrait;
62 63 64 65

  /**
   * {@inheritdoc}
   */
66 67 68 69
  public static function preCreate(EntityStorageInterface $storage_controller, array &$values)
  {
      parent::preCreate($storage_controller, $values);
      $values += array(
70 71 72 73
      'user_id' => \Drupal::currentUser()->id(),
    );
  }

74 75 76 77
    public function getName()
    {
        return $this->get('name')->value;
    }
78 79 80 81

  /**
   * {@inheritdoc}
   */
82 83 84 85 86
  public function setName($name)
  {
      $this->set('name', $name);

      return $this;
87 88
  }

89
  /**
90 91
   * {@inheritdoc}
   */
92 93 94
  public function getUser_id()
  {
      return $this->get('user_id')->value;
95 96
  }

97 98 99
  /**
   * {@inheritdoc}
   */
100 101 102 103 104
  public function setUser_id($name)
  {
      $this->set('user_id', $name);

      return $this;
105
  }
106

107
  /**
108 109
   * {@inheritdoc}
   */
110 111 112
  public function getCreatedTime()
  {
      return $this->get('created')->value;
113 114 115 116 117
  }

  /**
   * {@inheritdoc}
   */
118 119 120 121 122
  public function setCreatedTime($timestamp)
  {
      $this->set('created', $timestamp);

      return $this;
123
  }
124

125 126 127
  /**
   * {@inheritdoc}
   */
128 129 130
  public function getStatus()
  {
      return $this->get('status')->value;
131 132 133 134 135
  }

  /**
   * {@inheritdoc}
   */
136 137 138 139 140
  public function setStatus($name)
  {
      $this->set('status', $name);

      return $this;
141
  }
142 143 144 145

  /**
   * {@inheritdoc}
   */
146 147 148
  public function getOwner()
  {
      return $this->get('user_id')->entity;
149
  }
150

151 152 153
  /**
   * {@inheritdoc}
   */
154 155 156 157 158
  public function setOwner(UserInterface $account)
  {
      $this->set('user_id', $account->id());

      return $this;
159
  }
160 161 162 163

  /**
   * {@inheritdoc}
   */
164 165 166
  public function getOwnerId()
  {
      return $this->get('user_id')->target_id;
167 168 169 170 171
  }

  /**
   * {@inheritdoc}
   */
172 173 174 175 176
  public function setOwnerId($uid)
  {
      $this->set('user_id', $uid);

      return $this;
177 178 179 180 181
  }

  /**
   * {@inheritdoc}
   */
182 183 184
  public function isPublished()
  {
      return (bool) $this->getEntityKey('status');
185 186 187 188 189
  }

  /**
   * {@inheritdoc}
   */
190 191 192 193 194
  public function setPublished($published)
  {
      $this->set('status', $published ? true : false);

      return $this;
195
  }
196

197 198 199
  /**
   * {@inheritdoc}
   */
200 201 202
  public function getEpaluser_id()
  {
      return $this->get('epaluser_id')->getString();
203
  }
204 205 206 207

  /**
   * {@inheritdoc}
   */
208 209 210 211 212
  public function setEpaluser_id($name)
  {
      $this->set('epaluser_id', $name);

      return $this;
213
  }
214

215
  /**
216 217
   * {@inheritdoc}
   */
218 219 220
  public function getStudentSurname()
  {
      return $this->get('studentsurname')->value;
221 222 223 224 225
  }

  /**
   * {@inheritdoc}
   */
226 227 228
  public function setStudentSurname($name)
  {
      $this->set('Studentsurname', $name);
229

230
      return $this;
231 232
  }

233 234 235 236
    public function getBirthdate()
    {
        return $this->get('birthdate')->value;
    }
237

238 239 240
    public function setBirthdate($name)
    {
        $this->set('birthdate', $name);
241

242 243
        return $this;
    }
244

245 246 247 248
    public function getFatherFirstname()
    {
        return $this->get('fatherfirstname')->value;
    }
249

250 251 252 253 254 255
    public function setFatherFirstname($name)
    {
        $this->set('fatherfirstname', $name);

        return $this;
    }
256

257 258 259 260 261 262 263 264 265 266 267 268 269
    public function getMotherSurname()
    {
        return $this->get('mothersurname')->value;
    }

    public function setMotherSurname($name)
    {
        $this->set('mothersurname', $name);

        return $this;
    }

  /**
270 271
   * {@inheritdoc}
   */
272 273 274
  public function getStudentAmka()
  {
      return $this->get('studentamka')->value;
275
  }
276 277 278 279

  /**
   * {@inheritdoc}
   */
280 281 282 283 284
  public function setStudentAmka($name)
  {
      $this->set('studentamka', $name);

      return $this;
285 286
  }

287
  /**
288 289
   * {@inheritdoc}
   */
290 291 292
  public function getRegionAddress()
  {
      return $this->get('regionaddress')->value;
293 294 295 296 297
  }

  /**
   * {@inheritdoc}
   */
298 299 300 301 302
  public function setRegionAddress($name)
  {
      $this->set('regionaddress', $name);

      return $this;
303 304
  }

305
  /**
306 307
   * {@inheritdoc}
   */
308 309 310
  public function getRegionTK()
  {
      return $this->get('regiontk')->value;
311 312 313 314 315
  }

  /**
   * {@inheritdoc}
   */
316 317 318 319 320
  public function setRegionTK($name)
  {
      $this->set('regiontk', $name);

      return $this;
321 322 323 324 325
  }

  /**
   * {@inheritdoc}
   */
326 327 328
  public function getRegionArea()
  {
      return $this->get('regionarea')->value;
329 330 331 332 333
  }

  /**
   * {@inheritdoc}
   */
334 335 336 337 338
  public function setRegionArea($name)
  {
      $this->set('regionarea', $name);

      return $this;
339 340 341 342 343
  }

  /**
   * {@inheritdoc}
   */
344 345 346
  public function getCertificateType()
  {
      return $this->get('certificatetype')->value;
347 348 349 350 351
  }

  /**
   * {@inheritdoc}
   */
352 353 354 355 356
  public function setCertificateType($name)
  {
      $this->set('certificatetype', $name);

      return $this;
357
  }
358

359 360 361
  /**
   * {@inheritdoc}
   */
362 363 364
  public function getCurrentclass()
  {
      return $this->get('currentclass')->value;
365 366 367 368 369
  }

  /**
   * {@inheritdoc}
   */
370 371 372 373 374
  public function setCurrentclass($name)
  {
      $this->set('currentclass', $name);

      return $this;
375
  }
376

377 378 379
  /**
   * {@inheritdoc}
   */
380 381 382
  public function getCurrentepal()
  {
      return $this->get('currentepal')->value;
383
  }
384 385 386 387

  /**
   * {@inheritdoc}
   */
388 389 390 391 392
  public function setCurrentepal($name)
  {
      $this->set('currentepal', $name);

      return $this;
393
  }
394

395 396 397
  /**
   * {@inheritdoc}
   */
398 399 400
  public function getCurrentsector()
  {
      return $this->get('currentsector')->value;
401 402 403 404 405
  }

  /**
   * {@inheritdoc}
   */
406 407 408 409 410
  public function setCurrentsector($name)
  {
      $this->set('currentsector', $name);

      return $this;
411
  }
412

413 414 415
  /**
   * {@inheritdoc}
   */
416 417 418
  public function getTelnum()
  {
      return $this->get('telnum')->value;
419 420 421 422 423
  }

  /**
   * {@inheritdoc}
   */
424 425 426 427 428
  public function setTelnum($name)
  {
      $this->set('telnum', $name);

      return $this;
429 430 431 432 433
  }

  /**
   * {@inheritdoc}
   */
434 435 436
  public function getRelationToStudent()
  {
      return $this->get('relationtostudent')->value;
437 438 439 440 441
  }

  /**
   * {@inheritdoc}
   */
442 443 444
  public function setRelationToStudent($name)
  {
      $this->set('relationtostudent', $name);
445

446 447
      return $this;
  }
448 449 450 451

  /**
   * {@inheritdoc}
   */
452 453 454
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type)
  {
      $fields = parent::baseFieldDefinitions($entity_type);
455

456
      $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
457 458
      ->setLabel(t('Δημιουργός'))
      ->setDescription(t('Δημιουργός.'))
459
      ->setRevisionable(true)
460 461
      ->setSetting('target_type', 'user')
      ->setSetting('handler', 'default')
462
      ->setTranslatable(true)
463
      ->setDisplayOptions('view', array(
464
        'label' => 'above',
465 466 467 468 469 470 471 472 473 474 475 476 477
        'type' => 'author',
        'weight' => 0,
      ))
      ->setDisplayOptions('form', array(
        'type' => 'entity_reference_autocomplete',
        'weight' => 5,
        'settings' => array(
          'match_operator' => 'CONTAINS',
          'size' => '60',
          'autocomplete_type' => 'tags',
          'placeholder' => '',
        ),
      ))
478 479
      ->setDisplayConfigurable('form', true)
      ->setDisplayConfigurable('view', true);
480

481
      $fields['epaluser_id'] = BaseFieldDefinition::create('entity_reference')
482 483
      ->setLabel(t('Id χρήστη ΕΠΑΛ'))
      ->setDescription(t('Δώσε το id του αντίστοιχου Epal User.'))
484 485
      ->setSetting('target_type', 'epal_users')
      ->setSetting('handler', 'default')
486
        ->setRequired(true)
Open Source Developer's avatar
Open Source Developer committed
487
 //     ->setTranslatable(TRUE)
488
      ->setDisplayOptions('view', array(
489
              'label' => 'above',
490 491 492
              'type' => 'author',
              'weight' => 0,
            ))
493
      ->setDisplayOptions('form', array(
494 495 496 497 498 499 500 501 502
              'type' => 'entity_reference_autocomplete',
              'weight' => 5,
              'settings' => array(
                'match_operator' => 'CONTAINS',
                'size' => '60',
                'autocomplete_type' => 'tags',
                'placeholder' => '',
              ),
            ))
503 504
      ->setDisplayConfigurable('form', true)
      ->setDisplayConfigurable('view', true);
505

506
      $fields['student_record_id'] = BaseFieldDefinition::create('string')
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
      ->setLabel(t('Id μαθητή από myschool'))
      ->setDescription(t('Δώσε το Id μαθητή από myschool.'))
      ->setSettings(array(
        'max_length' => 50,
        'text_processing' => 0,
      ))
      ->setDefaultValue('')
      ->setDisplayOptions('view', array(
        'label' => 'above',
        'type' => 'string',
        'weight' => -4,
      ))
      ->setDisplayOptions('form', array(
        'type' => 'string_textfield',
        'weight' => -4,
      ))
523 524
      ->setDisplayConfigurable('form', true)
      ->setDisplayConfigurable('view', true);
525

526
      $fields['name'] = BaseFieldDefinition::create('string')
527 528 529 530 531 532
      ->setLabel(t('Όνομα μαθητή'))
      ->setDescription(t('Δώσε το μικρό μαθητή.'))
      ->setSettings(array(
        'max_length' => 50,
        'text_processing' => 0,
      ))
533
      ->setRequired(true)
534 535 536 537 538 539 540 541 542 543
      ->setDefaultValue('')
      ->setDisplayOptions('view', array(
        'label' => 'above',
        'type' => 'string',
        'weight' => -4,
      ))
      ->setDisplayOptions('form', array(
        'type' => 'string_textfield',
        'weight' => -4,
      ))
544 545
      ->setDisplayConfigurable('form', true)
      ->setDisplayConfigurable('view', true);
546

547
      $fields['studentsurname'] = BaseFieldDefinition::create('string')
548 549
          ->setLabel(t('Επώνυμο μαθητή'))
          ->setDescription(t('Δώσε το επώνυμο μαθητή.'))
550
          ->setSettings(array(
551
            'max_length' => 50,
552 553
            'text_processing' => 0,
          ))
554
          ->setRequired(true)
555 556 557 558 559 560 561 562 563 564
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
565 566
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
567

568
      $fields['birthdate'] = BaseFieldDefinition::create('datetime')
569 570
        ->setLabel(t('Ημερομηνία γέννησης μαθητή'))
        ->setDescription(t('Δώσε την Ημερομηνία γέννησης μαθητή.'))
571
        ->setSetting('datetime_type', 'date')
572
        ->setRequired(true)
573 574 575 576 577 578 579 580
        ->setDisplayOptions('view', array(
          'label' => 'above',
          'type' => 'string',
          'weight' => -4,
        ))->setDisplayOptions('form', array(
          'type' => 'string_textfield',
          'weight' => -4,
        ))
581 582
        ->setDisplayConfigurable('form', true)
        ->setDisplayConfigurable('view', true);
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599

      $fields['sex'] = BaseFieldDefinition::create('boolean')
          ->setLabel(t('Φύλο'))
          ->setDescription(t('Φύλο.'))
          ->setSettings(array(
            'text_processing' => 0,
          ))
          ->setRequired(false)
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'boolean',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'boolean',
            'weight' => -4,
          ))
600 601
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
602

603
      $fields['fatherfirstname'] = BaseFieldDefinition::create('string')
604 605
          ->setLabel(t('Όνομα του πατέρα'))
          ->setDescription(t('Δώσε το όνομα του πατέρα.'))
606 607 608 609
          ->setSettings(array(
            'max_length' => 50,
            'text_processing' => 0,
          ))
610
          ->setRequired(true)
611 612 613 614 615 616 617 618 619 620
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
621 622
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
623

624
      $fields['fathersurname'] = BaseFieldDefinition::create('string')
625 626
          ->setLabel(t('Επώνυμο πατέρα'))
          ->setDescription(t('Δώσε το επώνυμο του πατέρα.'))
627 628 629 630
          ->setSettings(array(
            'max_length' => 50,
            'text_processing' => 0,
          ))
631
          ->setRequired(true)
632 633 634 635 636 637 638 639 640 641
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
642 643
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
644

645
      $fields['motherfirstname'] = BaseFieldDefinition::create('string')
646 647 648 649 650 651
          ->setLabel(t('Όνομα μητέρας'))
          ->setDescription(t('Δώσε το όνομα της μητέρας.'))
          ->setSettings(array(
            'max_length' => 50,
            'text_processing' => 0,
          ))
652
          ->setRequired(true)
653 654 655 656 657 658 659 660 661 662
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
663 664
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
665

666
      $fields['mothersurname'] = BaseFieldDefinition::create('string')
667 668 669 670 671 672
          ->setLabel(t('Επώνυμο μητέρας'))
          ->setDescription(t('Δώσε το επώνυμο της μητέρας.'))
          ->setSettings(array(
            'max_length' => 50,
            'text_processing' => 0,
          ))
673
          ->setRequired(true)
674 675 676 677 678 679 680 681 682 683
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
684 685
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
686

687
      $fields['studentamka'] = BaseFieldDefinition::create('string')
688 689 690 691 692 693
          ->setLabel(t('ΑΜΚΑ μαθητή'))
          ->setDescription(t('Δώσε το ΑΜΚΑ μαθητή.'))
          ->setSettings(array(
            'max_length' => 20,
            'text_processing' => 0,
          ))
694
          ->setRequired(false)
695 696 697 698 699 700 701 702 703 704
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
705 706
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
707

708
      $fields['regionaddress'] = BaseFieldDefinition::create('string')
709 710 711 712 713 714
          ->setLabel(t('Διεύθνση κηδεμόνα'))
          ->setDescription(t('Δώσε τη διεύθυνση κηδεμόνα.'))
          ->setSettings(array(
            'max_length' => 100,
            'text_processing' => 0,
          ))
715
          ->setRequired(true)
716 717 718 719 720 721 722 723 724 725
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
726 727
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
728

729
      $fields['regiontk'] = BaseFieldDefinition::create('string')
730 731 732 733 734 735
          ->setLabel(t('ΤΚ περιοχής'))
          ->setDescription(t('Δώσε τον ΤΚ της διεύθυνσης κατοικίας.'))
          ->setSettings(array(
            'max_length' => 10,
            'text_processing' => 0,
          ))
736
          ->setRequired(true)
737 738 739 740 741 742 743 744 745
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
746 747
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
748

749
      $fields['regionarea'] = BaseFieldDefinition::create('string')
750 751 752 753 754 755
          ->setLabel(t('Πόλη-Κοινότητα'))
          ->setDescription(t('Δώσε την πόλη ή κοινότητα που διαμένεις.'))
          ->setSettings(array(
            'max_length' => 100,
            'text_processing' => 0,
          ))
756
          ->setRequired(true)
757 758 759 760 761 762 763 764 765 766
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
767 768
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
769

770
      $fields['certificatetype'] = BaseFieldDefinition::create('string')
771 772 773 774 775 776
          ->setLabel(t('Τύπος απολυτηρίου'))
          ->setDescription(t('Δώσε τον τύπο απολυτηρίου, πχ Απολυτήριο Γυμνασίου'))
          ->setSettings(array(
            'max_length' => 50,
            'text_processing' => 0,
          ))
777
          ->setRequired(true)
778 779 780 781 782 783 784 785 786 787
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
788 789
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
790

791
      $fields['lastam'] = BaseFieldDefinition::create('string')
792 793 794 795 796 797
          ->setLabel(t('Αριθμός Μητρώου στο τελευταίο σχολείο φοίτησης'))
          ->setDescription(t('Αριθμός Μητρώου στο τελευταίο σχολείο φοίτησης'))
          ->setSettings(array(
            'max_length' => 10,
            'text_processing' => 0,
          ))
798
          ->setRequired(false)
799 800 801 802 803 804 805 806 807 808
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
809 810
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
811 812 813 814 815 816 817 818

      //entity_reference has to be changed to a reference to  new entity containing the whole schools
      $fields['graduate_school'] = BaseFieldDefinition::create('entity_reference')
          ->setLabel(t('Σχολείο αποφοίτησης'))
          ->setDescription(t('Δώσε το σχολείο αποφοίτησης.'))
          ->setSetting('target_type', 'eepal_school')
          ->setSetting('handler', 'default')
          //   ->setTranslatable(TRUE)
819
          ->setDisplayOptions('view', array(
820 821 822 823
                'label' => 'above',
                'type' => 'author',
                'weight' => -4,
              ))
824
          ->setDisplayOptions('form', array(
825 826 827 828 829 830 831 832 833
                'type' => 'entity_reference_autocomplete',
                'weight' => -4,
                'settings' => array(
                  'match_operator' => 'CONTAINS',
                  'size' => '60',
                  'autocomplete_type' => 'tags',
                  'placeholder' => '',
                ),
              ))
834 835
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
836

837
      $fields['apolytirio_id'] = BaseFieldDefinition::create('string')
838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853
            ->setLabel(t('Αριθμός απολυτηρίου'))
            ->setDescription(t('Δώσε τον αριθμό απολυτηρίου'))
            ->setSettings(array(
              'max_length' => 50,
              'text_processing' => 0,
            ))
            ->setDefaultValue('')
            ->setDisplayOptions('view', array(
              'label' => 'above',
              'type' => 'string',
              'weight' => -4,
            ))
            ->setDisplayOptions('form', array(
              'type' => 'string_textfield',
              'weight' => -4,
            ))
854 855 856 857 858 859 860 861 862 863
            ->setDisplayConfigurable('form', true)
            ->setDisplayConfigurable('view', true);

      $fields['graduation_year'] = BaseFieldDefinition::create('integer')
            ->setLabel(t('Έτος κτήσης απολυτηρίου'))
            ->setDescription(t('Δώσε το έτος κτήσης απολυτηρίου.'))
            ->setSettings(array(
              'text_processing' => 0,
            ))
            ->setRequired(true)
864 865 866 867 868 869 870 871
            ->setDisplayOptions('view', array(
              'label' => 'above',
              'type' => 'string',
              'weight' => -4,
            ))->setDisplayOptions('form', array(
              'type' => 'string_textfield',
              'weight' => -4,
            ))
872 873
            ->setDisplayConfigurable('form', true)
            ->setDisplayConfigurable('view', true);
874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891

      $fields['currentclass'] = BaseFieldDefinition::create('string')
            ->setLabel(t('Τάξη παρακολούθησης'))
            ->setDescription(t('Δώσε την τρέχουσα τάξη παρακολούθησης'))
            ->setSettings(array(
              'max_length' => 50,
              'text_processing' => 0,
            ))
            ->setDefaultValue('')
            ->setDisplayOptions('view', array(
              'label' => 'above',
              'type' => 'string',
              'weight' => -4,
            ))
            ->setDisplayOptions('form', array(
              'type' => 'string_textfield',
              'weight' => -4,
            ))
892 893
            ->setDisplayConfigurable('form', true)
            ->setDisplayConfigurable('view', true);
894

895
      $fields['currentepal'] = BaseFieldDefinition::create('entity_reference')
896 897 898
            ->setLabel(t('ΕΠΑΛ παρακολούθησης'))
            ->setDescription(t('Δώσε το τρέχον ΕΠΑΛ παρακολούθησης.'))
            ->setSetting('target_type', 'eepal_school')
899 900
            ->setSetting('handler', 'default')
            ->setDisplayOptions('view', array(
901
              'label' => 'above',
902
              'type' => 'author',
903
              'weight' => -4,
904 905 906
            ))
            ->setDisplayOptions('form', array(
              'type' => 'entity_reference_autocomplete',
907
              'weight' => -4,
908 909 910 911 912 913 914
              'settings' => array(
                'match_operator' => 'CONTAINS',
                'size' => '60',
                'autocomplete_type' => 'tags',
                'placeholder' => '',
              ),
            ))
915 916
            ->setDisplayConfigurable('form', true)
            ->setDisplayConfigurable('view', true);
917

918
      $fields['currentsector'] = BaseFieldDefinition::create('string')
919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934
          ->setLabel(t('Τομέας παρακολούθησης'))
          ->setDescription(t('Δώσε τον τομέα παρακολούθησης.'))
          ->setSettings(array(
            'max_length' => 50,
            'text_processing' => 0,
          ))
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
935 936
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
937

938
      $fields['currentcourse'] = BaseFieldDefinition::create('string')
939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954
            ->setLabel(t('Ειδικότητα παρακολούθησης'))
            ->setDescription(t('Δώσε την ειδικότητα παρακολούθησης.'))
            ->setSettings(array(
              'max_length' => 50,
              'text_processing' => 0,
            ))
            ->setDefaultValue('')
            ->setDisplayOptions('view', array(
              'label' => 'above',
              'type' => 'string',
              'weight' => -4,
            ))
            ->setDisplayOptions('form', array(
              'type' => 'string_textfield',
              'weight' => -4,
            ))
955 956
            ->setDisplayConfigurable('form', true)
            ->setDisplayConfigurable('view', true);
957

958
      $fields['relationtostudent'] = BaseFieldDefinition::create('string')
959 960 961 962 963 964
          ->setLabel(t('Σχέση αιτούντα με μαθητή'))
          ->setDescription(t('Δώσε τη σχέση αιτούντα με μαθητή, πχ  Γονέας - Κηδεμόνας - Μαθητής'))
          ->setSettings(array(
            'max_length' => 50,
            'text_processing' => 0,
          ))
965
          ->setRequired(true)
966 967 968 969 970 971 972 973 974 975
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
976 977
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
978

979
      $fields['telnum'] = BaseFieldDefinition::create('string')
980 981 982 983 984 985
          ->setLabel(t('Τηλέφωνο επικοινωνίας'))
          ->setDescription(t('Δώσε το τηλέφωνο επικοινωνίας'))
          ->setSettings(array(
            'max_length' => 50,
            'text_processing' => 0,
          ))
986
          ->setRequired(true)
987 988 989 990 991 992 993 994 995 996
          ->setDefaultValue('')
          ->setDisplayOptions('view', array(
            'label' => 'above',
            'type' => 'string',
            'weight' => -4,
          ))
          ->setDisplayOptions('form', array(
            'type' => 'string_textfield',
            'weight' => -4,
          ))
997 998
          ->setDisplayConfigurable('form', true)
          ->setDisplayConfigurable('view', true);
999

1000
      $fields['points'] = BaseFieldDefinition::create('float')
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014
        ->setLabel(t('Μόρια'))
        ->setDescription(t('Μόρια.'))
        ->setSettings(array(
          'text_processing' => 0,
        ))
        ->setDisplayOptions('view', array(
          'label' => 'above',
          'type' => 'float',
          'weight' => -4,
        ))
        ->setDisplayOptions('form', array(
          'type' => 'float',
          'weight' => -4,
        ))
1015 1016
        ->setDisplayConfigurable('form', true)
        ->setDisplayConfigurable('view', true);
1017

1018
      $fields['agreement'] = BaseFieldDefinition::create('boolean')
1019 1020 1021 1022 1023
        ->setLabel(t('Συμφωνία όρων συστήματος'))
        ->setDescription(t('Συμφωνία όρων συστήματος.'))
        ->setSettings(array(
          'text_processing' => 0,
        ))
1024
        ->setRequired(true)
1025 1026 1027 1028 1029 1030 1031 1032 1033
        ->setDisplayOptions('view', array(
          'label' => 'above',
          'type' => 'boolean',
          'weight' => -4,
        ))
        ->setDisplayOptions('form', array(
          'type' => 'boolean',
          'weight' => -4,
        ))
1034 1035
        ->setDisplayConfigurable('form', true)
        ->setDisplayConfigurable('view', true);
1036

1037
      $fields['guardian_name'] = BaseFieldDefinition::create('string')
1038 1039 1040 1041 1042 1043
            ->setLabel(t('Όνομα κηδεμόνα'))
            ->setDescription(t('Δώσε το όνομα κηδεμόνα.'))
            ->setSettings(array(
              'max_length' => 50,
              'text_processing' => 0,
            ))
1044
            ->setRequired(true)
1045 1046 1047 1048 1049 1050 1051 1052 1053 1054
            ->setDefaultValue('')
            ->setDisplayOptions('view', array(
              'label' => 'above',
              'type' => 'string',
              'weight' => -4,
            ))
            ->setDisplayOptions('form', array(
              'type' => 'string_textfield',
              'weight' => -4,
            ))
1055 1056
            ->setDisplayConfigurable('form', true)
            ->setDisplayConfigurable('view', true);
1057

1058
      $fields['guardian_surname'] = BaseFieldDefinition::create('string')
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075
                ->setLabel(t('Επώνυμο κηδεμόνα'))
                ->setDescription(t('Δώσε το επώνυμο κηδεμόνα.'))
                ->setSettings(array(
                  'max_length' => 50,
                  'text_processing' => 0,
                ))
              ->setRequired(true)
                ->setDefaultValue('')
                ->setDisplayOptions('view', array(
                  'label' => 'above',
                  'type' => 'string',
                  'weight' => -4,
                ))
                ->setDisplayOptions('form', array(
                  'type' => 'string_textfield',
                  'weight' => -4,
                ))
1076 1077
                ->setDisplayConfigurable('form', true)
                ->setDisplayConfigurable('view', true);
1078

1079
      $fields['guardian_fathername'] = BaseFieldDefinition::create('string')
1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096
                    ->setLabel(t('Όνομα πατέρα κηδεμόνα'))
                    ->setDescription(t('Δώσε το όνομα πατέρα του κηδεμόνα.'))
                    ->setSettings(array(
                      'max_length' => 50,
                      'text_processing' => 0,
                    ))
                  ->setRequired(true)
                    ->setDefaultValue('')
                    ->setDisplayOptions('view', array(
                      'label' => 'above',
                      'type' => 'string',
                      'weight' => -4,
                    ))
                    ->setDisplayOptions('form', array(
                      'type' => 'string_textfield',
                      'weight' => -4,
                    ))
1097 1098
                    ->setDisplayConfigurable('form', true)
                    ->setDisplayConfigurable('view', true);
1099

1100
      $fields['guardian_mothername'] = BaseFieldDefinition::create('string')
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117
                        ->setLabel(t('Όνομα μητέρας κηδεμόνα'))
                        ->setDescription(t('Δώσε το όνομα μητέρας του κηδεμόνα.'))
                        ->setSettings(array(
                          'max_length' => 50,
                          'text_processing' => 0,
                        ))
                      ->setRequired(true)
                        ->setDefaultValue('')
                        ->setDisplayOptions('view', array(
                          'label' => 'above',
                          'type' => 'string',
                          'weight' => -4,
                        ))
                        ->setDisplayOptions('form', array(
                          'type' => 'string_textfield',
                          'weight' => -4,
                        ))
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194
                        ->setDisplayConfigurable('form', true)
                        ->setDisplayConfigurable('view', true);

      $fields['lastschool_registrynumber'] = BaseFieldDefinition::create('string')
                            ->setLabel(t('Κωδικός τελευταίου σχολείου'))
                            ->setDescription(t('Κωδικός τελευταίου σχολείου'))
                            ->setSettings(array(
                              'max_length' => 20,
                              'text_processing' => 0,
                            ))
                          ->setRequired(true)
                            ->setDisplayOptions('view', array(
                              'label' => 'above',
                              'type' => 'string',
                              'weight' => -4,
                            ))
                            ->setDisplayOptions('form', array(
                              'type' => 'string_textfield',
                              'weight' => -4,
                            ))
                            ->setDisplayConfigurable('form', true)
                            ->setDisplayConfigurable('view', true);

      $fields['lastschool_schoolyear'] = BaseFieldDefinition::create('string')
                                ->setLabel(t('Σχολικό έτος φοίτησης τελευταίου σχολείου'))
                                ->setDescription(t('Σχολικό έτος φοίτησης τελευταίου σχολείου'))
                                ->setSettings(array(
                                  'max_length' => 10,
                                  'text_processing' => 0,
                                ))
                              ->setRequired(true)
                                ->setDisplayOptions('view', array(
                                  'label' => 'above',
                                  'type' => 'string',
                                  'weight' => -4,
                                ))
                                ->setDisplayOptions('form', array(
                                  'type' => 'string_textfield',
                                  'weight' => -4,
                                ))
                                ->setDisplayConfigurable('form', true)
                                ->setDisplayConfigurable('view', true);

      $fields['lastschool_class'] = BaseFieldDefinition::create('string')
                                    ->setLabel(t('Τάξη φοίτησης τελευταίου σχολείου'))
                                    ->setDescription(t('Τάξη φοίτησης τελευταίου σχολείου'))
                                    ->setSettings(array(
                                      'max_length' => 10,
                                      'text_processing' => 0,
                                    ))
                                  ->setRequired(true)
                                    ->setDisplayOptions('view', array(
                                      'label' => 'above',
                                      'type' => 'string',
                                      'weight' => -4,
                                    ))
                                    ->setDisplayOptions('form', array(
                                      'type' => 'string_textfield',
                                      'weight' => -4,
                                    ))
                                    ->setDisplayConfigurable('form', true)
                                    ->setDisplayConfigurable('view', true);

      $fields['status'] = BaseFieldDefinition::create('boolean')
          ->setLabel(t('Publishing status'))
          ->setDescription(t('A boolean indicating whether the EPAL Student is published.'))
            ->setDefaultValue(true);

      $fields['created'] = BaseFieldDefinition::create('created')
          ->setLabel(t('Created'))
          ->setDescription(t('The time that the entity was created.'));

      $fields['changed'] = BaseFieldDefinition::create('changed')
          ->setLabel(t('Changed'))
          ->setDescription(t('The time that the entity was last edited.'));

      return $fields;
1195 1196
  }
}