Merge branch 'epalmodule' into 'develop'

Epalmodule

See merge request !8
parents 79ab1c50 a8cfdd7c
...@@ -3,3 +3,5 @@ type: module ...@@ -3,3 +3,5 @@ type: module
description: EPAL Registration description: EPAL Registration
core: 8.x core: 8.x
package: EPAL package: EPAL
dependencies:
- epalreadydata
\ No newline at end of file
This diff is collapsed.
...@@ -45,6 +45,8 @@ use Drupal\user\UserInterface; ...@@ -45,6 +45,8 @@ use Drupal\user\UserInterface;
* "uid" = "user_id", * "uid" = "user_id",
* "langcode" = "langcode", * "langcode" = "langcode",
* "status" = "status", * "status" = "status",
* "student_id" = "student_id",
* "courseField_id" = "courseField_id",
* }, * },
* links = { * links = {
* "canonical" = "/admin/structure/epal_student_course_field/{epal_student_course_field}", * "canonical" = "/admin/structure/epal_student_course_field/{epal_student_course_field}",
...@@ -84,8 +86,8 @@ class EpalStudentCourseField extends ContentEntityBase implements EpalStudentCou ...@@ -84,8 +86,8 @@ class EpalStudentCourseField extends ContentEntityBase implements EpalStudentCou
$this->set('name', $name); $this->set('name', $name);
return $this; return $this;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function getCreatedTime() { public function getCreatedTime() {
...@@ -145,6 +147,38 @@ class EpalStudentCourseField extends ContentEntityBase implements EpalStudentCou ...@@ -145,6 +147,38 @@ class EpalStudentCourseField extends ContentEntityBase implements EpalStudentCou
return $this; return $this;
} }
/**
* {@inheritdoc}
*/
public function getCourseField_id() {
return $this->get('courseField_id')->getString();
}
/**
* {@inheritdoc}
*/
public function setCourseField_id($name) {
$this->set('courseField_id', $name);
return $this;
}
/**
* {@inheritdoc}
*/
public function getStudent_id() {
return $this->get('student_id')->getString();
}
/**
* {@inheritdoc}
*/
public function setStudent_id($name) {
$this->set('student_id', $name);
return $this;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -152,14 +186,14 @@ class EpalStudentCourseField extends ContentEntityBase implements EpalStudentCou ...@@ -152,14 +186,14 @@ class EpalStudentCourseField extends ContentEntityBase implements EpalStudentCou
$fields = parent::baseFieldDefinitions($entity_type); $fields = parent::baseFieldDefinitions($entity_type);
$fields['user_id'] = BaseFieldDefinition::create('entity_reference') $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Authored by')) ->setLabel(t('Δημιουργός'))
->setDescription(t('The user ID of author of the Epal student course field entity.')) ->setDescription(t('Δημιουργός.'))
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setSetting('target_type', 'user') ->setSetting('target_type', 'user')
->setSetting('handler', 'default') ->setSetting('handler', 'default')
->setTranslatable(TRUE) ->setTranslatable(TRUE)
->setDisplayOptions('view', array( ->setDisplayOptions('view', array(
'label' => 'hidden', 'label' => 'above',
'type' => 'author', 'type' => 'author',
'weight' => 0, 'weight' => 0,
)) ))
...@@ -177,8 +211,8 @@ class EpalStudentCourseField extends ContentEntityBase implements EpalStudentCou ...@@ -177,8 +211,8 @@ class EpalStudentCourseField extends ContentEntityBase implements EpalStudentCou
->setDisplayConfigurable('view', TRUE); ->setDisplayConfigurable('view', TRUE);
$fields['name'] = BaseFieldDefinition::create('string') $fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name')) ->setLabel(t('Όνομα'))
->setDescription(t('The name of the Epal student course field entity.')) ->setDescription(t('Όνομα.'))
->setSettings(array( ->setSettings(array(
'max_length' => 50, 'max_length' => 50,
'text_processing' => 0, 'text_processing' => 0,
...@@ -197,19 +231,20 @@ class EpalStudentCourseField extends ContentEntityBase implements EpalStudentCou ...@@ -197,19 +231,20 @@ class EpalStudentCourseField extends ContentEntityBase implements EpalStudentCou
->setDisplayConfigurable('view', TRUE); ->setDisplayConfigurable('view', TRUE);
$fields['student_id'] = BaseFieldDefinition::create('entity_reference') $fields['student_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Student id')) ->setLabel(t('ID Μαθητή'))
->setDescription(t('Δώσε το id μαθητή.')) ->setDescription(t('Δώσε το id μαθητή.'))
->setSetting('target_type', 'epal_student') ->setSetting('target_type', 'epal_student')
->setSetting('handler', 'default') ->setSetting('handler', 'default')
->setTranslatable(TRUE) ->setTranslatable(TRUE)
->setDisplayOptions('view', array( ->setDisplayOptions('view', array(
'label' => 'hidden', 'label' => 'above',
'type' => 'author', 'type' => 'author',
'weight' => 0, 'weight' => -4,
)) ))
->setDisplayOptions('form', array( ->setRequired(true)
->setDisplayOptions('form', array(
'type' => 'entity_reference_autocomplete', 'type' => 'entity_reference_autocomplete',
'weight' => 5, 'weight' => -4,
'settings' => array( 'settings' => array(
'match_operator' => 'CONTAINS', 'match_operator' => 'CONTAINS',
'size' => '60', 'size' => '60',
...@@ -217,24 +252,25 @@ class EpalStudentCourseField extends ContentEntityBase implements EpalStudentCou ...@@ -217,24 +252,25 @@ class EpalStudentCourseField extends ContentEntityBase implements EpalStudentCou
'placeholder' => '', 'placeholder' => '',
), ),
)) ))
->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE); ->setDisplayConfigurable('view', TRUE);
$fields['courseField_id'] = BaseFieldDefinition::create('entity_reference') $fields['courseField_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Specialty id')) ->setLabel(t('ID ειδικότητας'))
->setDescription(t('Δώσε το id ειδικότητας που επέλεξε ο μαθητής.')) ->setDescription(t('Δώσε το id ειδικότητας που επέλεξε ο μαθητής.'))
->setSetting('target_type', 'eepal_specialty') ->setSetting('target_type', 'eepal_specialty')
->setSetting('handler', 'default') ->setSetting('handler', 'default')
->setRequired(true)
->setTranslatable(TRUE) ->setTranslatable(TRUE)
->setDisplayOptions('view', array( ->setDisplayOptions('view', array(
'label' => 'hidden', 'label' => 'above',
'type' => 'author', 'type' => 'author',
'weight' => 0, 'weight' => -4,
)) ))
->setDisplayOptions('form', array( ->setDisplayOptions('form', array(
'type' => 'entity_reference_autocomplete', 'type' => 'entity_reference_autocomplete',
'weight' => 5, 'weight' => -4,
'settings' => array( 'settings' => array(
'match_operator' => 'CONTAINS', 'match_operator' => 'CONTAINS',
'size' => '60', 'size' => '60',
......
...@@ -73,5 +73,11 @@ interface EpalStudentCourseFieldInterface extends ContentEntityInterface, Entit ...@@ -73,5 +73,11 @@ interface EpalStudentCourseFieldInterface extends ContentEntityInterface, Entit
* The called Epal student course field entity. * The called Epal student course field entity.
*/ */
public function setPublished($published); public function setPublished($published);
//get/set methods for additional fields for configuration properties.
public function getCourseField_id();
public function setCourseField_id($val);
public function getStudent_id();
public function setStudent_id($val);
} }
...@@ -39,12 +39,19 @@ use Drupal\user\UserInterface; ...@@ -39,12 +39,19 @@ use Drupal\user\UserInterface;
* translatable = TRUE, * translatable = TRUE,
* admin_permission = "administer epal student epal chosen entities", * admin_permission = "administer epal student epal chosen entities",
* entity_keys = { * entity_keys = {
* "id" = "id", * "id" = "id",
* "label" = "name", * "label" = "name",
* "uuid" = "uuid", * "uuid" = "uuid",
* "uid" = "user_id", * "uid" = "user_id",
* "langcode" = "langcode", * "langcode" = "langcode",
* "status" = "status", * "status" = "status",
* "student_id" = "student_id",
* "epal_id" = "epal_id",
* "choice_no" = "choice_no",
* "status" = "status",
* "created" = "created",
* "changed" = "changed",
* "default_langcode" = "default_langcode",
* }, * },
* links = { * links = {
* "canonical" = "/admin/structure/epal_student_epal_chosen/{epal_student_epal_chosen}", * "canonical" = "/admin/structure/epal_student_epal_chosen/{epal_student_epal_chosen}",
...@@ -144,7 +151,63 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal ...@@ -144,7 +151,63 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal
$this->set('status', $published ? TRUE : FALSE); $this->set('status', $published ? TRUE : FALSE);
return $this; return $this;
} }
//get / set methods for additional fields
public function getStudent_id() {
return $this->get('student_id')->getString();
}
public function setStudent_id($name) {
$this->set('student_id', $name);
return $this;
}
public function getEpal_id() {
//return $this->get('epal_id')->getString();
return $this->get('epal_id')->target_id;
}
public function setEpal_id($name) {
$this->set('epal_id', $name);
return $this;
}
public function getChoice_no() {
return $this->get('choice_no')->value;
}
public function setChoice_no($name) {
$this->set('choice_no', $name);
return $this;
}
public function getPoints_for_order() {
return $this->get('points_for_order')->value;
}
public function setPoints_for_order($name) {
$this->set('points_for_order', $name);
return $this;
}
public function getDistance_from_epal() {
return $this->get('distance_from_epal')->value;
}
public function setDistance_from_epal($name) {
$this->set('distance_from_epal', $name);
return $this;
}
public function getPoints_for_distance() {
return $this->get('points_for_distance')->value;
}
public function setPoints_for_distance($name) {
$this->set('points_for_distance', $name);
return $this;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -152,20 +215,20 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal ...@@ -152,20 +215,20 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal
$fields = parent::baseFieldDefinitions($entity_type); $fields = parent::baseFieldDefinitions($entity_type);
$fields['user_id'] = BaseFieldDefinition::create('entity_reference') $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Authored by')) ->setLabel(t('Δημιουργός'))
->setDescription(t('The user ID of author of the Epal student epal chosen entity.')) ->setDescription(t('Δημιουργός.'))
->setRevisionable(TRUE) ->setRevisionable(TRUE)
->setSetting('target_type', 'user') ->setSetting('target_type', 'user')
->setSetting('handler', 'default') ->setSetting('handler', 'default')
->setTranslatable(TRUE) ->setTranslatable(TRUE)
->setDisplayOptions('view', array( ->setDisplayOptions('view', array(
'label' => 'hidden', 'label' => 'above',
'type' => 'author', 'type' => 'author',
'weight' => 0, 'weight' => -6,
)) ))
->setDisplayOptions('form', array( ->setDisplayOptions('form', array(
'type' => 'entity_reference_autocomplete', 'type' => 'entity_reference_autocomplete',
'weight' => 5, 'weight' => -6,
'settings' => array( 'settings' => array(
'match_operator' => 'CONTAINS', 'match_operator' => 'CONTAINS',
'size' => '60', 'size' => '60',
...@@ -175,32 +238,10 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal ...@@ -175,32 +238,10 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal
)) ))
->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', 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') $fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name')) ->setLabel(t('Όνομα'))
->setDescription(t('The name of the EpalStudentEpalChosen entity.')) ->setDescription(t('Ονομασία του EpalStudentEpalChosen entity.'))
->setSettings(array( ->setSettings(array(
'max_length' => 50, 'max_length' => 50,
'text_processing' => 0, 'text_processing' => 0,
...@@ -217,69 +258,47 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal ...@@ -217,69 +258,47 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal
)) ))
->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', 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') $fields['student_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Student id')) ->setLabel(t('Id Μαθητή'))
->setDescription(t('Δώσε το id μαθητή.')) ->setDescription(t('Δώσε το id μαθητή.'))
->setSetting('target_type', 'epal_student') ->setSetting('target_type', 'epal_student')
->setSetting('handler', 'default') ->setSetting('handler', 'default')
->setRequired(true)
->setTranslatable(TRUE) ->setTranslatable(TRUE)
->setDisplayOptions('view', array( ->setDisplayOptions('view', array(
'label' => 'hidden', 'label' => 'above',
'type' => 'author', 'type' => 'author',
'weight' => 0, 'weight' => -4,
)) ))
->setDisplayOptions('form', array( ->setDisplayOptions('form', array(
'type' => 'entity_reference_autocomplete', 'type' => 'entity_reference_autocomplete',
'weight' => 5, 'weight' => -4,
'settings' => array( 'settings' => array(
'match_operator' => 'CONTAINS', 'match_operator' => 'CONTAINS',
'size' => '60', 'size' => '60',
'autocomplete_type' => 'tags', 'autocomplete_type' => 'tags',
'placeholder' => '', 'placeholder' => '',
), ),
)) ))
->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE); ->setDisplayConfigurable('view', TRUE);
$fields['epal_id'] = BaseFieldDefinition::create('entity_reference') $fields['epal_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Epal id')) ->setLabel(t('Id ΕΠΑΛ'))
->setDescription(t('Δώσε το όνομα - id σχολείου που επέλεξε ο μαθητής.')) ->setDescription(t('Δώσε το όνομα - id σχολείου που επέλεξε ο μαθητής.'))
->setSetting('target_type', 'eepal_school') ->setSetting('target_type', 'eepal_school')
->setSetting('handler', 'default') ->setSetting('handler', 'default')
->setRequired(true)
->setTranslatable(TRUE) ->setTranslatable(TRUE)
->setDisplayOptions('view', array( ->setDisplayOptions('view', array(
'label' => 'hidden', 'label' => 'above',
'type' => 'author', 'type' => 'author',
'weight' => 0, 'weight' => -4,
)) ))
->setDisplayOptions('form', array( ->setDisplayOptions('form', array(
'type' => 'entity_reference_autocomplete', 'type' => 'entity_reference_autocomplete',
'weight' => 5, 'weight' => -4,
'settings' => array( 'settings' => array(
'match_operator' => 'CONTAINS', 'match_operator' => 'CONTAINS',
'size' => '60', 'size' => '60',
...@@ -288,17 +307,16 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal ...@@ -288,17 +307,16 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal
), ),
)) ))
->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE); ->setDisplayConfigurable('view', TRUE);
$fields['choice_no'] = BaseFieldDefinition::create('integer') $fields['choice_no'] = BaseFieldDefinition::create('integer')
->setLabel(t('Max Number of Students')) ->setLabel(t('Σειρά προτίμησης'))
->setDescription(t('The maximum number of students in class.')) ->setDescription(t('Δώσε τη σειρά προτίμησης.'))
->setSettings(array( ->setSettings(array(
'max_length' => 2, 'max_length' => 2,
'text_processing' => 0, 'text_processing' => 0,
)) ))
->setDefaultValue(25) ->setRequired(true)
->setDisplayOptions('view', array( ->setDisplayOptions('view', array(
'label' => 'above', 'label' => 'above',
'type' => 'integer', 'type' => 'integer',
...@@ -310,7 +328,6 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal ...@@ -310,7 +328,6 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal
)) ))
->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE); ->setDisplayConfigurable('view', TRUE);
$fields['points_for_order'] = BaseFieldDefinition::create('integer') $fields['points_for_order'] = BaseFieldDefinition::create('integer')
->setLabel(t('Μόρια για σειρά προτίμησης')) ->setLabel(t('Μόρια για σειρά προτίμησης'))
...@@ -319,15 +336,14 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal ...@@ -319,15 +336,14 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal
'max_length' => 2, 'max_length' => 2,
'text_processing' => 0, 'text_processing' => 0,
)) ))
//->setDefaultValue(25)
->setDisplayOptions('view', array( ->setDisplayOptions('view', array(
'label' => 'above', 'label' => 'above',
'type' => 'integer', 'type' => 'integer',
//'weight' => -4, 'weight' => -4,
)) ))
->setDisplayOptions('form', array( ->setDisplayOptions('form', array(
'type' => 'integer', 'type' => 'integer',
//'weight' => -4, 'weight' => -4,
)) ))
->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE); ->setDisplayConfigurable('view', TRUE);
...@@ -336,18 +352,16 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal ...@@ -336,18 +352,16 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal
->setLabel(t('Απόσταση από ΕΠΑΛ')) ->setLabel(t('Απόσταση από ΕΠΑΛ'))
->setDescription(t('Απόσταση από ΕΠΑΛ.')) ->setDescription(t('Απόσταση από ΕΠΑΛ.'))
->setSettings(array( ->setSettings(array(
//'max_length' => 2,
'text_processing' => 0, 'text_processing' => 0,
)) ))
//->setDefaultValue(25)
->setDisplayOptions('view', array( ->setDisplayOptions('view', array(
'label' => 'above', 'label' => 'above',
'type' => 'float', 'type' => 'float',
//'weight' => -4, 'weight' => -4,
)) ))
->setDisplayOptions('form', array( ->setDisplayOptions('form', array(
'type' => 'float', 'type' => 'float',
//'weight' => -4, 'weight' => -4,
)) ))
->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE); ->setDisplayConfigurable('view', TRUE);
...@@ -359,21 +373,19 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal ...@@ -359,21 +373,19 @@ class EpalStudentEpalChosen extends ContentEntityBase implements EpalStudentEpal
'max_length' => 2, 'max_length' => 2,
'text_processing' => 0, 'text_processing' => 0,
))