From dc44aee53418d646a144061224b4f08a8ea38373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=9D=CE=AF=CE=BA=CE=BF=CF=82=20=CE=9A=CE=B1=CF=84=CF=83?= =?UTF-8?q?=CE=B1=CE=BF=CF=8D=CE=BD=CE=BF=CF=82?= Date: Wed, 18 Jan 2017 22:42:07 +0200 Subject: [PATCH] update epal module with new entities --- drupal/modules/epal/epal.info.yml | 2 +- drupal/modules/epal/epal.links.action.yml | 15 + drupal/modules/epal/epal.links.menu.yml | 42 ++ drupal/modules/epal/epal.links.task.yml | 66 +++ drupal/modules/epal/epal.permissions.yml | 66 +++ .../epal/epal_student_course_field.page.inc | 30 ++ .../epal/epal_student_epal_chosen.page.inc | 30 ++ drupal/modules/epal/epal_users.page.inc | 30 ++ .../modules/epal/src/Entity/EpalStudent.php | 291 +++++++++-- .../src/Entity/EpalStudentCourseField.php | 264 ++++++++++ .../EpalStudentCourseFieldInterface.php | 77 +++ .../EpalStudentCourseFieldViewsData.php | 24 + .../epal/src/Entity/EpalStudentEpalChosen.php | 393 ++++++++++++++ .../Entity/EpalStudentEpalChosenInterface.php | 77 +++ .../Entity/EpalStudentEpalChosenViewsData.php | 24 + drupal/modules/epal/src/Entity/EpalUsers.php | 490 ++++++++++++++++++ .../epal/src/Entity/EpalUsersInterface.php | 77 +++ .../epal/src/Entity/EpalUsersViewsData.php | 24 + ...StudentCourseFieldAccessControlHandler.php | 47 ++ ...palStudentCourseFieldHtmlRouteProvider.php | 85 +++ .../src/EpalStudentCourseFieldListBuilder.php | 45 ++ ...alStudentCourseFieldTranslationHandler.php | 14 + ...lStudentEpalChosenAccessControlHandler.php | 47 ++ ...EpalStudentEpalChosenHtmlRouteProvider.php | 85 +++ .../src/EpalStudentEpalChosenListBuilder.php | 45 ++ ...palStudentEpalChosenTranslationHandler.php | 14 + .../src/EpalUsersAccessControlHandler.php | 47 ++ .../epal/src/EpalUsersHtmlRouteProvider.php | 85 +++ .../modules/epal/src/EpalUsersListBuilder.php | 45 ++ .../epal/src/EpalUsersTranslationHandler.php | 14 + .../Form/EpalStudentCourseFieldDeleteForm.php | 15 + .../src/Form/EpalStudentCourseFieldForm.php | 50 ++ .../EpalStudentCourseFieldSettingsForm.php | 55 ++ .../Form/EpalStudentEpalChosenDeleteForm.php | 15 + .../src/Form/EpalStudentEpalChosenForm.php | 50 ++ .../EpalStudentEpalChosenSettingsForm.php | 55 ++ .../epal/src/Form/EpalUsersDeleteForm.php | 15 + .../modules/epal/src/Form/EpalUsersForm.php | 50 ++ .../epal/src/Form/EpalUsersSettingsForm.php | 55 ++ .../epal_student_course_field.html.twig | 22 + .../epal_student_epal_chosen.html.twig | 22 + .../epal/templates/epal_users.html.twig | 22 + 42 files changed, 2983 insertions(+), 38 deletions(-) create mode 100644 drupal/modules/epal/epal_student_course_field.page.inc create mode 100644 drupal/modules/epal/epal_student_epal_chosen.page.inc create mode 100644 drupal/modules/epal/epal_users.page.inc create mode 100644 drupal/modules/epal/src/Entity/EpalStudentCourseField.php create mode 100644 drupal/modules/epal/src/Entity/EpalStudentCourseFieldInterface.php create mode 100644 drupal/modules/epal/src/Entity/EpalStudentCourseFieldViewsData.php create mode 100644 drupal/modules/epal/src/Entity/EpalStudentEpalChosen.php create mode 100644 drupal/modules/epal/src/Entity/EpalStudentEpalChosenInterface.php create mode 100644 drupal/modules/epal/src/Entity/EpalStudentEpalChosenViewsData.php create mode 100644 drupal/modules/epal/src/Entity/EpalUsers.php create mode 100644 drupal/modules/epal/src/Entity/EpalUsersInterface.php create mode 100644 drupal/modules/epal/src/Entity/EpalUsersViewsData.php create mode 100644 drupal/modules/epal/src/EpalStudentCourseFieldAccessControlHandler.php create mode 100644 drupal/modules/epal/src/EpalStudentCourseFieldHtmlRouteProvider.php create mode 100644 drupal/modules/epal/src/EpalStudentCourseFieldListBuilder.php create mode 100644 drupal/modules/epal/src/EpalStudentCourseFieldTranslationHandler.php create mode 100644 drupal/modules/epal/src/EpalStudentEpalChosenAccessControlHandler.php create mode 100644 drupal/modules/epal/src/EpalStudentEpalChosenHtmlRouteProvider.php create mode 100644 drupal/modules/epal/src/EpalStudentEpalChosenListBuilder.php create mode 100644 drupal/modules/epal/src/EpalStudentEpalChosenTranslationHandler.php create mode 100644 drupal/modules/epal/src/EpalUsersAccessControlHandler.php create mode 100644 drupal/modules/epal/src/EpalUsersHtmlRouteProvider.php create mode 100644 drupal/modules/epal/src/EpalUsersListBuilder.php create mode 100644 drupal/modules/epal/src/EpalUsersTranslationHandler.php create mode 100644 drupal/modules/epal/src/Form/EpalStudentCourseFieldDeleteForm.php create mode 100644 drupal/modules/epal/src/Form/EpalStudentCourseFieldForm.php create mode 100644 drupal/modules/epal/src/Form/EpalStudentCourseFieldSettingsForm.php create mode 100644 drupal/modules/epal/src/Form/EpalStudentEpalChosenDeleteForm.php create mode 100644 drupal/modules/epal/src/Form/EpalStudentEpalChosenForm.php create mode 100644 drupal/modules/epal/src/Form/EpalStudentEpalChosenSettingsForm.php create mode 100644 drupal/modules/epal/src/Form/EpalUsersDeleteForm.php create mode 100644 drupal/modules/epal/src/Form/EpalUsersForm.php create mode 100644 drupal/modules/epal/src/Form/EpalUsersSettingsForm.php create mode 100644 drupal/modules/epal/templates/epal_student_course_field.html.twig create mode 100644 drupal/modules/epal/templates/epal_student_epal_chosen.html.twig create mode 100644 drupal/modules/epal/templates/epal_users.html.twig diff --git a/drupal/modules/epal/epal.info.yml b/drupal/modules/epal/epal.info.yml index 54f0a60..8234186 100644 --- a/drupal/modules/epal/epal.info.yml +++ b/drupal/modules/epal/epal.info.yml @@ -2,4 +2,4 @@ name: epal type: module description: EPAL Registration core: 8.x -package: epal +package: EPAL diff --git a/drupal/modules/epal/epal.links.action.yml b/drupal/modules/epal/epal.links.action.yml index eb1e76f..85ed609 100644 --- a/drupal/modules/epal/epal.links.action.yml +++ b/drupal/modules/epal/epal.links.action.yml @@ -8,3 +8,18 @@ entity.epal_student_class.add_form: title: 'Add EPAL Student Class' appears_on: - entity.epal_student_class.collection +entity.epal_student_epal_chosen.add_form: + route_name: entity.epal_student_epal_chosen.add_form + title: 'Add Epal student epal chosen' + appears_on: + - entity.epal_student_epal_chosen.collection +entity.epal_student_course_field.add_form: + route_name: entity.epal_student_course_field.add_form + title: 'Add Epal student course field' + appears_on: + - entity.epal_student_course_field.collection +entity.epal_users.add_form: + route_name: entity.epal_users.add_form + title: 'Add Epal users' + appears_on: + - entity.epal_users.collection diff --git a/drupal/modules/epal/epal.links.menu.yml b/drupal/modules/epal/epal.links.menu.yml index d6b1e05..ca0a2fb 100644 --- a/drupal/modules/epal/epal.links.menu.yml +++ b/drupal/modules/epal/epal.links.menu.yml @@ -26,3 +26,45 @@ epal_student_class.admin.structure.settings: description: 'Configure EPAL Student Class entities' route_name: epal_student_class.settings parent: system.admin_structure + +# Epal student epal chosen menu items definition +entity.epal_student_epal_chosen.collection: + title: 'Epal student epal chosen list' + route_name: entity.epal_student_epal_chosen.collection + description: 'List Epal student epal chosen entities' + parent: system.admin_structure + weight: 100 + +epal_student_epal_chosen.admin.structure.settings: + title: Epal student epal chosen settings + description: 'Configure Epal student epal chosen entities' + route_name: epal_student_epal_chosen.settings + parent: system.admin_structure + +# Epal student course field menu items definition +entity.epal_student_course_field.collection: + title: 'Epal student course field list' + route_name: entity.epal_student_course_field.collection + description: 'List Epal student course field entities' + parent: system.admin_structure + weight: 100 + +epal_student_course_field.admin.structure.settings: + title: Epal student course field settings + description: 'Configure Epal student course field entities' + route_name: epal_student_course_field.settings + parent: system.admin_structure + +# Epal users menu items definition +entity.epal_users.collection: + title: 'Epal users list' + route_name: entity.epal_users.collection + description: 'List Epal users entities' + parent: system.admin_structure + weight: 100 + +epal_users.admin.structure.settings: + title: Epal users settings + description: 'Configure Epal users entities' + route_name: epal_users.settings + parent: system.admin_structure diff --git a/drupal/modules/epal/epal.links.task.yml b/drupal/modules/epal/epal.links.task.yml index 6c1e124..5331102 100644 --- a/drupal/modules/epal/epal.links.task.yml +++ b/drupal/modules/epal/epal.links.task.yml @@ -42,3 +42,69 @@ entity.epal_student_class.delete_form: title: Delete weight: 10 +# Epal student epal chosen routing definition +epal_student_epal_chosen.settings_tab: + route_name: epal_student_epal_chosen.settings + title: 'Settings' + base_route: epal_student_epal_chosen.settings + +entity.epal_student_epal_chosen.canonical: + route_name: entity.epal_student_epal_chosen.canonical + base_route: entity.epal_student_epal_chosen.canonical + title: 'View' + +entity.epal_student_epal_chosen.edit_form: + route_name: entity.epal_student_epal_chosen.edit_form + base_route: entity.epal_student_epal_chosen.canonical + title: 'Edit' + +entity.epal_student_epal_chosen.delete_form: + route_name: entity.epal_student_epal_chosen.delete_form + base_route: entity.epal_student_epal_chosen.canonical + title: Delete + weight: 10 + +# Epal student course field routing definition +epal_student_course_field.settings_tab: + route_name: epal_student_course_field.settings + title: 'Settings' + base_route: epal_student_course_field.settings + +entity.epal_student_course_field.canonical: + route_name: entity.epal_student_course_field.canonical + base_route: entity.epal_student_course_field.canonical + title: 'View' + +entity.epal_student_course_field.edit_form: + route_name: entity.epal_student_course_field.edit_form + base_route: entity.epal_student_course_field.canonical + title: 'Edit' + +entity.epal_student_course_field.delete_form: + route_name: entity.epal_student_course_field.delete_form + base_route: entity.epal_student_course_field.canonical + title: Delete + weight: 10 + +# Epal users routing definition +epal_users.settings_tab: + route_name: epal_users.settings + title: 'Settings' + base_route: epal_users.settings + +entity.epal_users.canonical: + route_name: entity.epal_users.canonical + base_route: entity.epal_users.canonical + title: 'View' + +entity.epal_users.edit_form: + route_name: entity.epal_users.edit_form + base_route: entity.epal_users.canonical + title: 'Edit' + +entity.epal_users.delete_form: + route_name: entity.epal_users.delete_form + base_route: entity.epal_users.canonical + title: Delete + weight: 10 + diff --git a/drupal/modules/epal/epal.permissions.yml b/drupal/modules/epal/epal.permissions.yml index c796e25..8a43f07 100644 --- a/drupal/modules/epal/epal.permissions.yml +++ b/drupal/modules/epal/epal.permissions.yml @@ -42,3 +42,69 @@ view published epal student class entities: view unpublished epal student class entities: title: 'View unpublished EPAL Student Class entities' +add epal student epal chosen entities: + title: 'Create new Epal student epal chosen entities' + +administer epal student epal chosen entities: + title: 'Administer Epal student epal chosen entities' + description: 'Allow to access the administration form to configure Epal student epal chosen entities.' + restrict access: true + +delete epal student epal chosen entities: + title: 'Delete Epal student epal chosen entities' + +edit epal student epal chosen entities: + title: 'Edit Epal student epal chosen entities' + +access epal student epal chosen overview: + title: 'Access the Epal student epal chosen overview page' + +view published epal student epal chosen entities: + title: 'View published Epal student epal chosen entities' + +view unpublished epal student epal chosen entities: + title: 'View unpublished Epal student epal chosen entities' +add epal student course field entities: + title: 'Create new Epal student course field entities' + +administer epal student course field entities: + title: 'Administer Epal student course field entities' + description: 'Allow to access the administration form to configure Epal student course field entities.' + restrict access: true + +delete epal student course field entities: + title: 'Delete Epal student course field entities' + +edit epal student course field entities: + title: 'Edit Epal student course field entities' + +access epal student course field overview: + title: 'Access the Epal student course field overview page' + +view published epal student course field entities: + title: 'View published Epal student course field entities' + +view unpublished epal student course field entities: + title: 'View unpublished Epal student course field entities' +add epal users entities: + title: 'Create new Epal users entities' + +administer epal users entities: + title: 'Administer Epal users entities' + description: 'Allow to access the administration form to configure Epal users entities.' + restrict access: true + +delete epal users entities: + title: 'Delete Epal users entities' + +edit epal users entities: + title: 'Edit Epal users entities' + +access epal users overview: + title: 'Access the Epal users overview page' + +view published epal users entities: + title: 'View published Epal users entities' + +view unpublished epal users entities: + title: 'View unpublished Epal users entities' diff --git a/drupal/modules/epal/epal_student_course_field.page.inc b/drupal/modules/epal/epal_student_course_field.page.inc new file mode 100644 index 0000000..6be4226 --- /dev/null +++ b/drupal/modules/epal/epal_student_course_field.page.inc @@ -0,0 +1,30 @@ +setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); - $fields['name'] = BaseFieldDefinition::create('string') - ->setLabel(t('Name')) - ->setDescription(t('The name of the EPAL Student entity.')) - ->setSettings(array( - 'max_length' => 50, - 'text_processing' => 0, - )) - ->setDefaultValue('') + $fields['name'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('EpalUsers id')) + ->setDescription(t('Δώσε το id του EpalUsers.')) + ->setSetting('target_type', 'epal_users') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) ->setDisplayOptions('view', array( - 'label' => 'above', - 'type' => 'string', - 'weight' => -4, - )) + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + )) ->setDisplayOptions('form', array( - 'type' => 'string_textfield', - 'weight' => -4, - )) + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => array( + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ), + )) ->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.')); + + /* $fields['surname'] = BaseFieldDefinition::create('string') ->setLabel(t('Surname')) ->setDescription(t('The surname of the Student entity.')) @@ -310,13 +304,34 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface { )) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); + */ + + $fields['studentFirstname'] = 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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); - - $fields['address'] = BaseFieldDefinition::create('string') - ->setLabel(t('Address')) - ->setDescription(t('The address of the Student entity.')) + + $fields['studentSurname'] = BaseFieldDefinition::create('string') + ->setLabel(t('Επώνυμο μαθητή')) + ->setDescription(t('Δώσε το επώνυμο μαθητή.')) ->setSettings(array( - 'max_length' => 255, + 'max_length' => 50, 'text_processing' => 0, )) ->setDefaultValue('') @@ -331,12 +346,13 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface { )) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); - - $fields['birthdate'] = BaseFieldDefinition::create('datetime') - ->setLabel(t('Birth date')) - ->setDescription(t('The birth date')) + + /* + $fields['birthdate'] = BaseFieldDefinition::create('datetime') + ->setLabel(t('Ημερομηνία γέννησης μαθητή')) + ->setDescription(t('Δώσε την Ημερομηνία γέννησης μαθητή.')) ->setSetting('datetime_type', 'date') - ->setRequired(true) + ->setRequired(false) ->setDisplayOptions('view', array( 'label' => 'above', 'type' => 'string', @@ -347,7 +363,207 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface { )) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); + */ + + $fields['guardianSurname'] = 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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['guardianFirstname'] = 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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + /* + $fields['guardianADT'] = 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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + */ + + $fields['studentAmka'] = BaseFieldDefinition::create('string') + ->setLabel(t('ΑΜΚΑ μαθητή')) + ->setDescription(t('Δώσε το ΑΜΚΑ μαθητή.')) + ->setSettings(array( + 'max_length' => 20, + 'text_processing' => 0, + )) + ->setDefaultValue('') + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => -4, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['regionAddress'] = BaseFieldDefinition::create('string') + ->setLabel(t('Διεύθνση κηδεμόνα')) + ->setDescription(t('Δώσε τη διεύθυνση κηδεμόνα.')) + ->setSettings(array( + 'max_length' => 100, + 'text_processing' => 0, + )) + ->setDefaultValue('') + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => -4, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['regionTK'] = BaseFieldDefinition::create('string') + ->setLabel(t('ΤΚ περιοχής')) + ->setDescription(t('Δώσε τον ΤΚ της διεύθυνσης κατοικίας.')) + ->setSettings(array( + 'max_length' => 10, + 'text_processing' => 0, + )) + ->setDefaultValue('') + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => -4, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['regionArea'] = BaseFieldDefinition::create('string') + ->setLabel(t('Πόλη-Κοινότητα')) + ->setDescription(t('Δώσε την πόλη ή κοινότητα που διαμένεις.')) + ->setSettings(array( + 'max_length' => 100, + 'text_processing' => 0, + )) + ->setDefaultValue('') + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => -4, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + + $fields['certificateType'] = 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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['relationToStudent'] = 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, + )) + ->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.')); + + + /* $fields['epalstudentclass_id'] = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Student Class')) ->setDescription(t('The Students class.')) @@ -371,6 +587,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface { )) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); + */ return $fields; } diff --git a/drupal/modules/epal/src/Entity/EpalStudentCourseField.php b/drupal/modules/epal/src/Entity/EpalStudentCourseField.php new file mode 100644 index 0000000..bbb7dfc --- /dev/null +++ b/drupal/modules/epal/src/Entity/EpalStudentCourseField.php @@ -0,0 +1,264 @@ + \Drupal::currentUser()->id(), + ); + } + + /** + * {@inheritdoc} + */ + public function getName() { + return $this->get('name')->value; + } + + /** + * {@inheritdoc} + */ + public function setName($name) { + $this->set('name', $name); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCreatedTime() { + return $this->get('created')->value; + } + + /** + * {@inheritdoc} + */ + public function setCreatedTime($timestamp) { + $this->set('created', $timestamp); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOwner() { + return $this->get('user_id')->entity; + } + + /** + * {@inheritdoc} + */ + public function getOwnerId() { + return $this->get('user_id')->target_id; + } + + /** + * {@inheritdoc} + */ + public function setOwnerId($uid) { + $this->set('user_id', $uid); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setOwner(UserInterface $account) { + $this->set('user_id', $account->id()); + return $this; + } + + /** + * {@inheritdoc} + */ + public function isPublished() { + return (bool) $this->getEntityKey('status'); + } + + /** + * {@inheritdoc} + */ + public function setPublished($published) { + $this->set('status', $published ? TRUE : FALSE); + return $this; + } + + /** + * {@inheritdoc} + */ + public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { + $fields = parent::baseFieldDefinitions($entity_type); + + $fields['user_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Authored by')) + ->setDescription(t('The user ID of author of the Epal student course field entity.')) + ->setRevisionable(TRUE) + ->setSetting('target_type', 'user') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + )) + ->setDisplayOptions('form', array( + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => array( + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ), + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['name'] = BaseFieldDefinition::create('string') + ->setLabel(t('Name')) + ->setDescription(t('The name of the Epal student course field entity.')) + ->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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['student_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Student id')) + ->setDescription(t('Δώσε το id μαθητή.')) + ->setSetting('target_type', 'epal_student') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + )) + ->setDisplayOptions('form', array( + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => array( + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ), + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + + $fields['courseField_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Specialty id')) + ->setDescription(t('Δώσε το id ειδικότητας που επέλεξε ο μαθητής.')) + ->setSetting('target_type', 'eepal_specialty') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + )) + ->setDisplayOptions('form', array( + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => array( + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ), + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['status'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Publishing status')) + ->setDescription(t('A boolean indicating whether the Epal student course field 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; + } + +} diff --git a/drupal/modules/epal/src/Entity/EpalStudentCourseFieldInterface.php b/drupal/modules/epal/src/Entity/EpalStudentCourseFieldInterface.php new file mode 100644 index 0000000..e4813a7 --- /dev/null +++ b/drupal/modules/epal/src/Entity/EpalStudentCourseFieldInterface.php @@ -0,0 +1,77 @@ + \Drupal::currentUser()->id(), + ); + } + + /** + * {@inheritdoc} + */ + public function getName() { + return $this->get('name')->value; + } + + /** + * {@inheritdoc} + */ + public function setName($name) { + $this->set('name', $name); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCreatedTime() { + return $this->get('created')->value; + } + + /** + * {@inheritdoc} + */ + public function setCreatedTime($timestamp) { + $this->set('created', $timestamp); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOwner() { + return $this->get('user_id')->entity; + } + + /** + * {@inheritdoc} + */ + public function getOwnerId() { + return $this->get('user_id')->target_id; + } + + /** + * {@inheritdoc} + */ + public function setOwnerId($uid) { + $this->set('user_id', $uid); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setOwner(UserInterface $account) { + $this->set('user_id', $account->id()); + return $this; + } + + /** + * {@inheritdoc} + */ + public function isPublished() { + return (bool) $this->getEntityKey('status'); + } + + /** + * {@inheritdoc} + */ + public function setPublished($published) { + $this->set('status', $published ? TRUE : FALSE); + return $this; + } + + /** + * {@inheritdoc} + */ + public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { + $fields = parent::baseFieldDefinitions($entity_type); + + $fields['user_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Authored by')) + ->setDescription(t('The user ID of author of the Epal student epal chosen entity.')) + ->setRevisionable(TRUE) + ->setSetting('target_type', 'user') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + )) + ->setDisplayOptions('form', array( + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => array( + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ), + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + /* + $fields['name'] = BaseFieldDefinition::create('string') + ->setLabel(t('Name')) + ->setDescription(t('The name of the Epal student epal chosen entity.')) + ->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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + */ + + $fields['name'] = BaseFieldDefinition::create('string') + ->setLabel(t('Name')) + ->setDescription(t('The name of the EpalStudentEpalChosen entity.')) + ->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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + /* + $fields['student_id'] = BaseFieldDefinition::create('string') + ->setLabel(t('Student id')) + ->setDescription(t('ώσε το id μαθητή.')) + ->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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + */ + + + $fields['student_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Student id')) + ->setDescription(t('Δώσε το id μαθητή.')) + ->setSetting('target_type', 'epal_student') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + )) + ->setDisplayOptions('form', array( + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => array( + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ), + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + + $fields['epal_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Epal id')) + ->setDescription(t('Δώσε το όνομα - id σχολείου που επέλεξε ο μαθητής.')) + ->setSetting('target_type', 'eepal_school') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + )) + ->setDisplayOptions('form', array( + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => array( + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ), + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + + $fields['choice_no'] = BaseFieldDefinition::create('integer') + ->setLabel(t('Max Number of Students')) + ->setDescription(t('The maximum number of students in class.')) + ->setSettings(array( + 'max_length' => 2, + 'text_processing' => 0, + )) + ->setDefaultValue(25) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'integer', + 'weight' => -4, + )) + ->setDisplayOptions('form', array( + 'type' => 'integer', + 'weight' => -4, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + + $fields['points_for_order'] = BaseFieldDefinition::create('integer') + ->setLabel(t('Μόρια για σειρά προτίμησης')) + ->setDescription(t('Μόρια για σειρά προτίμησης.')) + ->setSettings(array( + 'max_length' => 2, + 'text_processing' => 0, + )) + //->setDefaultValue(25) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'integer', + //'weight' => -4, + )) + ->setDisplayOptions('form', array( + 'type' => 'integer', + //'weight' => -4, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['distance_from_epal'] = BaseFieldDefinition::create('float') + ->setLabel(t('Απόσταση από ΕΠΑΛ')) + ->setDescription(t('Απόσταση από ΕΠΑΛ.')) + ->setSettings(array( + //'max_length' => 2, + 'text_processing' => 0, + )) + //->setDefaultValue(25) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'float', + //'weight' => -4, + )) + ->setDisplayOptions('form', array( + 'type' => 'float', + //'weight' => -4, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['points_for_distance'] = BaseFieldDefinition::create('integer') + ->setLabel(t('Μόρια για απόσταση')) + ->setDescription(t('Μόρια για απόσταση.')) + ->setSettings(array( + 'max_length' => 2, + 'text_processing' => 0, + )) + //->setDefaultValue(25) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'integer', + //'weight' => -4, + )) + ->setDisplayOptions('form', array( + 'type' => 'integer', + //'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 epal chosen 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; + } + +} diff --git a/drupal/modules/epal/src/Entity/EpalStudentEpalChosenInterface.php b/drupal/modules/epal/src/Entity/EpalStudentEpalChosenInterface.php new file mode 100644 index 0000000..74a5773 --- /dev/null +++ b/drupal/modules/epal/src/Entity/EpalStudentEpalChosenInterface.php @@ -0,0 +1,77 @@ + \Drupal::currentUser()->id(), + ); + } + + /** + * {@inheritdoc} + */ + public function getName() { + return $this->get('name')->value; + } + + /** + * {@inheritdoc} + */ + public function setName($name) { + $this->set('name', $name); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getCreatedTime() { + return $this->get('created')->value; + } + + /** + * {@inheritdoc} + */ + public function setCreatedTime($timestamp) { + $this->set('created', $timestamp); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getOwner() { + return $this->get('user_id')->entity; + } + + /** + * {@inheritdoc} + */ + public function getOwnerId() { + return $this->get('user_id')->target_id; + } + + /** + * {@inheritdoc} + */ + public function setOwnerId($uid) { + $this->set('user_id', $uid); + return $this; + } + + /** + * {@inheritdoc} + */ + public function setOwner(UserInterface $account) { + $this->set('user_id', $account->id()); + return $this; + } + + /** + * {@inheritdoc} + */ + public function isPublished() { + return (bool) $this->getEntityKey('status'); + } + + /** + * {@inheritdoc} + */ + public function setPublished($published) { + $this->set('status', $published ? TRUE : FALSE); + return $this; + } + + /** + * {@inheritdoc} + */ + public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { + $fields = parent::baseFieldDefinitions($entity_type); + + $fields['user_id'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Authored by')) + ->setDescription(t('The user ID of author of the Epal users entity.')) + ->setRevisionable(TRUE) + ->setSetting('target_type', 'user') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + )) + ->setDisplayOptions('form', array( + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => array( + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ), + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + + + $fields['name'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('User Id από Drupal Users ')) + ->setDescription(t('Δώσε το id του user από τον Drupal Users πίνακα')) + ->setSetting('target_type', 'user') + ->setSetting('handler', 'default') + ->setTranslatable(TRUE) + ->setDisplayOptions('view', array( + 'label' => 'hidden', + 'type' => 'author', + 'weight' => 0, + )) + ->setDisplayOptions('form', array( + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => array( + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ), + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['userId'] = BaseFieldDefinition::create('string') + ->setLabel(t('User id χρήστη από taxis')) + ->setDescription(t('Δώσε το user id του χρήστη από taxis.')) + ->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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['userTaxId'] = BaseFieldDefinition::create('string') + ->setLabel(t('Tax id χρήστη')) + ->setDescription(t('Δώσε το tax id / ΑΦΜ του χρήστη.')) + ->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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['userFirstname'] = 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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['userSurname'] = 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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['userFatherName'] = 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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['userMothername'] = 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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + + + $fields['userAddress'] = 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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['userAddressTK'] = BaseFieldDefinition::create('string') + ->setLabel(t('ΤΚ')) + ->setDescription(t('Δώσε τον ΤΚ κατοικίας.')) + ->setSettings(array( + 'max_length' => 20, + 'text_processing' => 0, + )) + ->setDefaultValue('') + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => -4, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['userAddressArea'] = 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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['accessToken'] = BaseFieldDefinition::create('string') + ->setLabel(t('Access-Token από taxis')) + ->setDescription(t('Access-Token από taxis.')) + ->setSettings(array( + 'max_length' => 300, + 'text_processing' => 0, + )) + ->setDefaultValue('') + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => -4, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['offToken'] = BaseFieldDefinition::create('string') + ->setLabel(t('Off-Token')) + ->setDescription(t('Off-Token που δημιουργείται από εμάς.')) + ->setSettings(array( + 'max_length' => 300, + 'text_processing' => 0, + )) + ->setDefaultValue('') + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'string', + 'weight' => -4, + )) + ->setDisplayOptions('form', array( + 'type' => 'string_textfield', + 'weight' => -4, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['timeLogin'] = BaseFieldDefinition::create('timestamp') + ->setLabel(t('timeLogin')) + ->setDescription(t('timeLogin.')) + ; + + $fields['timeRegistration'] = BaseFieldDefinition::create('timestamp') + ->setLabel(t('timeRegistration')) + ->setDescription(t('timeRegistration.')) + ; + + $fields['timeTokenInvalid'] = BaseFieldDefinition::create('integer') + ->setLabel(t('Χρόνος σε min')) + ->setDescription(t('Χρόνος σε min μετά τον οποίο γίνεται το token ανενεργό.')) + ->setSettings(array( + //'max_length' => 2, + 'text_processing' => 0, + )) + ->setDisplayOptions('view', array( + 'label' => 'above', + 'type' => 'integer', + )) + ->setDisplayOptions('form', array( + 'type' => 'integer', + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['userIP'] = BaseFieldDefinition::create('string') + ->setLabel(t('userIP')) + ->setDescription(t('userIP.')) + ->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, + )) + ->setDisplayConfigurable('form', TRUE) + ->setDisplayConfigurable('view', TRUE); + + $fields['status'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Publishing status')) + ->setDescription(t('A boolean indicating whether the Epal users 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; + } + +} diff --git a/drupal/modules/epal/src/Entity/EpalUsersInterface.php b/drupal/modules/epal/src/Entity/EpalUsersInterface.php new file mode 100644 index 0000000..7bc087f --- /dev/null +++ b/drupal/modules/epal/src/Entity/EpalUsersInterface.php @@ -0,0 +1,77 @@ +isPublished()) { + return AccessResult::allowedIfHasPermission($account, 'view unpublished epal student course field entities'); + } + return AccessResult::allowedIfHasPermission($account, 'view published epal student course field entities'); + + case 'update': + return AccessResult::allowedIfHasPermission($account, 'edit epal student course field entities'); + + case 'delete': + return AccessResult::allowedIfHasPermission($account, 'delete epal student course field entities'); + } + + // Unknown operation, no opinion. + return AccessResult::neutral(); + } + + /** + * {@inheritdoc} + */ + protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { + return AccessResult::allowedIfHasPermission($account, 'add epal student course field entities'); + } + +} diff --git a/drupal/modules/epal/src/EpalStudentCourseFieldHtmlRouteProvider.php b/drupal/modules/epal/src/EpalStudentCourseFieldHtmlRouteProvider.php new file mode 100644 index 0000000..7b93e77 --- /dev/null +++ b/drupal/modules/epal/src/EpalStudentCourseFieldHtmlRouteProvider.php @@ -0,0 +1,85 @@ +id(); + + if ($collection_route = $this->getCollectionRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.collection", $collection_route); + } + + if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { + $collection->add("$entity_type_id.settings", $settings_form_route); + } + + return $collection; + } + + /** + * Gets the collection route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getCollectionRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('collection') && $entity_type->hasListBuilderClass()) { + $entity_type_id = $entity_type->id(); + $route = new Route($entity_type->getLinkTemplate('collection')); + $route + ->setDefaults([ + '_entity_list' => $entity_type_id, + '_title' => "{$entity_type->getLabel()} list", + ]) + ->setRequirement('_permission', 'access epal student course field overview') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the settings form route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { + if (!$entity_type->getBundleEntityType()) { + $route = new Route("/admin/structure/{$entity_type->id()}/settings"); + $route + ->setDefaults([ + '_form' => 'Drupal\epal\Form\EpalStudentCourseFieldSettingsForm', + '_title' => "{$entity_type->getLabel()} settings", + ]) + ->setRequirement('_permission', $entity_type->getAdminPermission()) + ->setOption('_admin_route', TRUE); + + return $route; + } + } + +} diff --git a/drupal/modules/epal/src/EpalStudentCourseFieldListBuilder.php b/drupal/modules/epal/src/EpalStudentCourseFieldListBuilder.php new file mode 100644 index 0000000..fb5b5f9 --- /dev/null +++ b/drupal/modules/epal/src/EpalStudentCourseFieldListBuilder.php @@ -0,0 +1,45 @@ +t('Epal student course field ID'); + $header['name'] = $this->t('Name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + /* @var $entity \Drupal\epal\Entity\EpalStudentCourseField */ + $row['id'] = $entity->id(); + $row['name'] = $this->l( + $entity->label(), + new Url( + 'entity.epal_student_course_field.edit_form', array( + 'epal_student_course_field' => $entity->id(), + ) + ) + ); + return $row + parent::buildRow($entity); + } + +} diff --git a/drupal/modules/epal/src/EpalStudentCourseFieldTranslationHandler.php b/drupal/modules/epal/src/EpalStudentCourseFieldTranslationHandler.php new file mode 100644 index 0000000..5e39922 --- /dev/null +++ b/drupal/modules/epal/src/EpalStudentCourseFieldTranslationHandler.php @@ -0,0 +1,14 @@ +isPublished()) { + return AccessResult::allowedIfHasPermission($account, 'view unpublished epal student epal chosen entities'); + } + return AccessResult::allowedIfHasPermission($account, 'view published epal student epal chosen entities'); + + case 'update': + return AccessResult::allowedIfHasPermission($account, 'edit epal student epal chosen entities'); + + case 'delete': + return AccessResult::allowedIfHasPermission($account, 'delete epal student epal chosen entities'); + } + + // Unknown operation, no opinion. + return AccessResult::neutral(); + } + + /** + * {@inheritdoc} + */ + protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { + return AccessResult::allowedIfHasPermission($account, 'add epal student epal chosen entities'); + } + +} diff --git a/drupal/modules/epal/src/EpalStudentEpalChosenHtmlRouteProvider.php b/drupal/modules/epal/src/EpalStudentEpalChosenHtmlRouteProvider.php new file mode 100644 index 0000000..a3484da --- /dev/null +++ b/drupal/modules/epal/src/EpalStudentEpalChosenHtmlRouteProvider.php @@ -0,0 +1,85 @@ +id(); + + if ($collection_route = $this->getCollectionRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.collection", $collection_route); + } + + if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { + $collection->add("$entity_type_id.settings", $settings_form_route); + } + + return $collection; + } + + /** + * Gets the collection route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getCollectionRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('collection') && $entity_type->hasListBuilderClass()) { + $entity_type_id = $entity_type->id(); + $route = new Route($entity_type->getLinkTemplate('collection')); + $route + ->setDefaults([ + '_entity_list' => $entity_type_id, + '_title' => "{$entity_type->getLabel()} list", + ]) + ->setRequirement('_permission', 'access epal student epal chosen overview') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the settings form route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { + if (!$entity_type->getBundleEntityType()) { + $route = new Route("/admin/structure/{$entity_type->id()}/settings"); + $route + ->setDefaults([ + '_form' => 'Drupal\epal\Form\EpalStudentEpalChosenSettingsForm', + '_title' => "{$entity_type->getLabel()} settings", + ]) + ->setRequirement('_permission', $entity_type->getAdminPermission()) + ->setOption('_admin_route', TRUE); + + return $route; + } + } + +} diff --git a/drupal/modules/epal/src/EpalStudentEpalChosenListBuilder.php b/drupal/modules/epal/src/EpalStudentEpalChosenListBuilder.php new file mode 100644 index 0000000..11ccaa5 --- /dev/null +++ b/drupal/modules/epal/src/EpalStudentEpalChosenListBuilder.php @@ -0,0 +1,45 @@ +t('Epal student epal chosen ID'); + $header['name'] = $this->t('Name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + /* @var $entity \Drupal\epal\Entity\EpalStudentEpalChosen */ + $row['id'] = $entity->id(); + $row['name'] = $this->l( + $entity->label(), + new Url( + 'entity.epal_student_epal_chosen.edit_form', array( + 'epal_student_epal_chosen' => $entity->id(), + ) + ) + ); + return $row + parent::buildRow($entity); + } + +} diff --git a/drupal/modules/epal/src/EpalStudentEpalChosenTranslationHandler.php b/drupal/modules/epal/src/EpalStudentEpalChosenTranslationHandler.php new file mode 100644 index 0000000..30fb1c5 --- /dev/null +++ b/drupal/modules/epal/src/EpalStudentEpalChosenTranslationHandler.php @@ -0,0 +1,14 @@ +isPublished()) { + return AccessResult::allowedIfHasPermission($account, 'view unpublished epal users entities'); + } + return AccessResult::allowedIfHasPermission($account, 'view published epal users entities'); + + case 'update': + return AccessResult::allowedIfHasPermission($account, 'edit epal users entities'); + + case 'delete': + return AccessResult::allowedIfHasPermission($account, 'delete epal users entities'); + } + + // Unknown operation, no opinion. + return AccessResult::neutral(); + } + + /** + * {@inheritdoc} + */ + protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) { + return AccessResult::allowedIfHasPermission($account, 'add epal users entities'); + } + +} diff --git a/drupal/modules/epal/src/EpalUsersHtmlRouteProvider.php b/drupal/modules/epal/src/EpalUsersHtmlRouteProvider.php new file mode 100644 index 0000000..611d16a --- /dev/null +++ b/drupal/modules/epal/src/EpalUsersHtmlRouteProvider.php @@ -0,0 +1,85 @@ +id(); + + if ($collection_route = $this->getCollectionRoute($entity_type)) { + $collection->add("entity.{$entity_type_id}.collection", $collection_route); + } + + if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) { + $collection->add("$entity_type_id.settings", $settings_form_route); + } + + return $collection; + } + + /** + * Gets the collection route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getCollectionRoute(EntityTypeInterface $entity_type) { + if ($entity_type->hasLinkTemplate('collection') && $entity_type->hasListBuilderClass()) { + $entity_type_id = $entity_type->id(); + $route = new Route($entity_type->getLinkTemplate('collection')); + $route + ->setDefaults([ + '_entity_list' => $entity_type_id, + '_title' => "{$entity_type->getLabel()} list", + ]) + ->setRequirement('_permission', 'access epal users overview') + ->setOption('_admin_route', TRUE); + + return $route; + } + } + + /** + * Gets the settings form route. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type. + * + * @return \Symfony\Component\Routing\Route|null + * The generated route, if available. + */ + protected function getSettingsFormRoute(EntityTypeInterface $entity_type) { + if (!$entity_type->getBundleEntityType()) { + $route = new Route("/admin/structure/{$entity_type->id()}/settings"); + $route + ->setDefaults([ + '_form' => 'Drupal\epal\Form\EpalUsersSettingsForm', + '_title' => "{$entity_type->getLabel()} settings", + ]) + ->setRequirement('_permission', $entity_type->getAdminPermission()) + ->setOption('_admin_route', TRUE); + + return $route; + } + } + +} diff --git a/drupal/modules/epal/src/EpalUsersListBuilder.php b/drupal/modules/epal/src/EpalUsersListBuilder.php new file mode 100644 index 0000000..f624e9b --- /dev/null +++ b/drupal/modules/epal/src/EpalUsersListBuilder.php @@ -0,0 +1,45 @@ +t('Epal users ID'); + $header['name'] = $this->t('Name'); + return $header + parent::buildHeader(); + } + + /** + * {@inheritdoc} + */ + public function buildRow(EntityInterface $entity) { + /* @var $entity \Drupal\epal\Entity\EpalUsers */ + $row['id'] = $entity->id(); + $row['name'] = $this->l( + $entity->label(), + new Url( + 'entity.epal_users.edit_form', array( + 'epal_users' => $entity->id(), + ) + ) + ); + return $row + parent::buildRow($entity); + } + +} diff --git a/drupal/modules/epal/src/EpalUsersTranslationHandler.php b/drupal/modules/epal/src/EpalUsersTranslationHandler.php new file mode 100644 index 0000000..b180d12 --- /dev/null +++ b/drupal/modules/epal/src/EpalUsersTranslationHandler.php @@ -0,0 +1,14 @@ +entity; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $entity = &$this->entity; + + $status = parent::save($form, $form_state); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Epal student course field.', [ + '%label' => $entity->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Epal student course field.', [ + '%label' => $entity->label(), + ])); + } + $form_state->setRedirect('entity.epal_student_course_field.canonical', ['epal_student_course_field' => $entity->id()]); + } + +} diff --git a/drupal/modules/epal/src/Form/EpalStudentCourseFieldSettingsForm.php b/drupal/modules/epal/src/Form/EpalStudentCourseFieldSettingsForm.php new file mode 100644 index 0000000..1486e54 --- /dev/null +++ b/drupal/modules/epal/src/Form/EpalStudentCourseFieldSettingsForm.php @@ -0,0 +1,55 @@ +entity; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $entity = &$this->entity; + + $status = parent::save($form, $form_state); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Epal student epal chosen.', [ + '%label' => $entity->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Epal student epal chosen.', [ + '%label' => $entity->label(), + ])); + } + $form_state->setRedirect('entity.epal_student_epal_chosen.canonical', ['epal_student_epal_chosen' => $entity->id()]); + } + +} diff --git a/drupal/modules/epal/src/Form/EpalStudentEpalChosenSettingsForm.php b/drupal/modules/epal/src/Form/EpalStudentEpalChosenSettingsForm.php new file mode 100644 index 0000000..76aee8f --- /dev/null +++ b/drupal/modules/epal/src/Form/EpalStudentEpalChosenSettingsForm.php @@ -0,0 +1,55 @@ +entity; + + return $form; + } + + /** + * {@inheritdoc} + */ + public function save(array $form, FormStateInterface $form_state) { + $entity = &$this->entity; + + $status = parent::save($form, $form_state); + + switch ($status) { + case SAVED_NEW: + drupal_set_message($this->t('Created the %label Epal users.', [ + '%label' => $entity->label(), + ])); + break; + + default: + drupal_set_message($this->t('Saved the %label Epal users.', [ + '%label' => $entity->label(), + ])); + } + $form_state->setRedirect('entity.epal_users.canonical', ['epal_users' => $entity->id()]); + } + +} diff --git a/drupal/modules/epal/src/Form/EpalUsersSettingsForm.php b/drupal/modules/epal/src/Form/EpalUsersSettingsForm.php new file mode 100644 index 0000000..0bced43 --- /dev/null +++ b/drupal/modules/epal/src/Form/EpalUsersSettingsForm.php @@ -0,0 +1,55 @@ + + {% if content %} + {{- content -}} + {% endif %} + diff --git a/drupal/modules/epal/templates/epal_student_epal_chosen.html.twig b/drupal/modules/epal/templates/epal_student_epal_chosen.html.twig new file mode 100644 index 0000000..63a6b30 --- /dev/null +++ b/drupal/modules/epal/templates/epal_student_epal_chosen.html.twig @@ -0,0 +1,22 @@ +{# +/** + * @file epal_student_epal_chosen.html.twig + * Default theme implementation to present Epal student epal chosen data. + * + * This template is used when viewing Epal student epal chosen pages. + * + * + * Available variables: + * - content: A list of content items. Use 'content' to print all content, or + * - attributes: HTML attributes for the container element. + * + * @see template_preprocess_epal_student_epal_chosen() + * + * @ingroup themeable + */ +#} + + {% if content %} + {{- content -}} + {% endif %} + diff --git a/drupal/modules/epal/templates/epal_users.html.twig b/drupal/modules/epal/templates/epal_users.html.twig new file mode 100644 index 0000000..f5e2067 --- /dev/null +++ b/drupal/modules/epal/templates/epal_users.html.twig @@ -0,0 +1,22 @@ +{# +/** + * @file epal_users.html.twig + * Default theme implementation to present Epal users data. + * + * This template is used when viewing Epal users pages. + * + * + * Available variables: + * - content: A list of content items. Use 'content' to print all content, or + * - attributes: HTML attributes for the container element. + * + * @see template_preprocess_epal_users() + * + * @ingroup themeable + */ +#} + + {% if content %} + {{- content -}} + {% endif %} + -- GitLab