Commit 10958fb2 authored by Νίκος Κατσαούνος's avatar Νίκος Κατσαούνος

updated HelperServices

parents 27f8d1cd df04a646
......@@ -79,7 +79,7 @@ epal.allocation:
requirements:
_user_is_logged_in: 'TRUE'
sectorperschool:
path: '/epal/sectorperSchool/{epalId}'
path: '/epal/sectorperSchool'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -87,7 +87,7 @@ sectorperschool:
requirements:
_user_is_logged_in: 'TRUE'
specialityperschool:
path: '/epal/specialityperSchool/{epalId}/{sectorId}'
path: '/epal/specialityperSchool/{sectorId}'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -103,7 +103,7 @@ confirmstudents:
requirements:
_user_is_logged_in: 'TRUE'
studentperschool:
path: '/epal/studentperSchool/{epalId}/{selectId}/{classId}/{limitdown}/{limitup}'
path: '/epal/studentperSchool/{selectId}/{classId}/{limitdown}/{limitup}'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -111,7 +111,7 @@ studentperschool:
requirements:
_user_is_logged_in: 'TRUE'
savecapacity:
path: '/epal/savecapacity/{taxi}/{tomeas}/{specialit}/{schoolid}'
path: '/epal/savecapacity/{taxi}/{tomeas}/{specialit}'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -223,7 +223,7 @@ critirioschosen:
requirements:
_user_is_logged_in: 'TRUE'
findcapacity:
path: '/epal/findCapacity/{taxi}/{tomeas}/{specialit}/{schoolid}'
path: '/epal/findCapacity/{taxi}/{tomeas}/{specialit}'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -238,3 +238,13 @@ findschoolid:
_controller: '\Drupal\epal\Controller\DirectorView::getSchoolID'
requirements:
_user_is_logged_in: 'TRUE'
gettypeofschool:
path: '/epal/gettypeofschool'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::gettypeofschool'
requirements:
_user_is_logged_in: 'TRUE'
......@@ -83,6 +83,12 @@ class ApplicationSubmit extends ControllerBase {
'certificatetype' => $applicationForm[0][certificatetype],
//'lastam' => $applicationForm[0][lastam],
'currentclass' => $applicationForm[0][currentclass],
'guardian_name' => $applicationForm[0][cu_name],
'guardian_surname' => $applicationForm[0][cu_surname],
'guardian_fathername' => $applicationForm[0][cu_fathername],
'guardian_mothername' => $applicationForm[0][cu_mothername],
'agreement' => $applicationForm[0][disclaimer_checked],
//'currentepal' => $applicationForm[0][currentepal],
//'currentsector' => $applicationForm[0][currentsector],
'points' => $applicationForm[0][points],
......
......@@ -50,12 +50,30 @@ class CurrentUser extends ControllerBase
], Response::HTTP_FORBIDDEN);
}
$epalConfigs = $this->entityTypeManager->getStorage('epal_config')->loadByProperties(array('name' => 'epal_config'));
$epalConfig = reset($epalConfigs);
if (!$epalConfig) {
return $this->respondWithStatus([
'message' => t("Configuration not found"),
], Response::HTTP_FORBIDDEN);
}
$userRoles = $user->getRoles();
foreach ($userRoles as $userRole) {
if (($userRole === 'epal') || ($userRole === 'regioneduadmin') || ($userRole === 'eduadmin')) {
return $this->respondWithStatus([
'name' => $user->mail->value,
'title' => $user->init->value,
'cu_name' => $user->mail->value,
'cu_surname' => '',
'cu_fathername' => '',
'cu_mothername' => '',
'cu_email' => '',
'minedu_username' => '',
'minedu_userpassword' => '',
'lock_capacity' => $epalConfig->lock_school_capacity->value,
'lock_students' => $epalConfig->lock_school_students_view->value,
'lock_application' => $epalConfig->lock_application->value,
'disclaimer_checked' => "0",
'title' => $user->init->value
], Response::HTTP_OK);
} else if ($userRole === 'applicant') {
break;
......@@ -66,8 +84,24 @@ class CurrentUser extends ControllerBase
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userName = $epalUser->name->value;
$userSurname = $epalUser->surname->value;
$userFathername = $epalUser->fathername->value;
$userMothername = $epalUser->mothername->value;
$userEmail = $user->mail->value;
return $this->respondWithStatus([
'name' => $epalUser->name->value,
'cu_name' => mb_substr($epalUser->name->value,0,4,'UTF-8') !== "####" ? $epalUser->name->value : '',
'cu_surname' => mb_substr($epalUser->surname->value,0,4,'UTF-8') !== "####" ? $epalUser->surname->value : '',
'cu_fathername' => mb_substr($epalUser->fathername->value,0,4,'UTF-8') !== "####" ? $epalUser->fathername->value : '',
'cu_mothername' => mb_substr($epalUser->mothername->value,0,4,'UTF-8') !== "####" ? $epalUser->mothername->value : '',
'cu_email' => mb_substr($user->mail->value,0,4,'UTF-8') !== "####" ? $user->mail->value : '',
'minedu_username' => '',
'minedu_userpassword' => '',
'lock_capacity' => $epalConfig->lock_school_capacity->value,
'lock_students' => $epalConfig->lock_school_students_view->value,
'lock_application' => $epalConfig->lock_application->value,
'disclaimer_checked' => "0",
'verificationCodeVerified' => $epalUser->verificationcodeverified->value,
], Response::HTTP_OK);
} else {
return $this->respondWithStatus([
......
......@@ -15,7 +15,7 @@ class DirectorView extends ControllerBase
{
protected $entityTypeManager;
protected $logger;
protected $testSchoolId='0640050';
// protected $testSchoolId='0640050';
public function __construct(EntityTypeManagerInterface $entityTypeManager,
LoggerChannelFactoryInterface $loggerChannel)
......@@ -34,7 +34,7 @@ class DirectorView extends ControllerBase
public function getSectorsPerSchool(Request $request, $epalId)
public function getSectorsPerSchool(Request $request)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
......@@ -42,8 +42,10 @@ public function getSectorsPerSchool(Request $request, $epalId)
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
// $schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('registry_no' => $user->mail->value, 'id' => intval($epalId)));
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id' => intval($epalId)));
$epalId = $user -> init -> value;
$schools = $this->entityTypeManager->getStorage('eepal_school')->
loadByProperties(array('id' => $epalId));
$school = reset($schools);
if (!$school) {
$this->logger->warning("no access to this school=" . $user->id());
......@@ -56,8 +58,8 @@ public function getSectorsPerSchool(Request $request, $epalId)
$userid = $user -> id();
$epalIdNew = intval($epalId);
$sectorPerSchool = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id'=> $epalIdNew));
//$epalIdNew = intval($epalId);
$sectorPerSchool = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id'=> $epalId));
$i = 0;
if ($sectorPerSchool) {
......@@ -92,7 +94,7 @@ public function getSectorsPerSchool(Request $request, $epalId)
}
public function getSpecialPerSchool(Request $request, $epalId , $sectorId)
public function getSpecialPerSchool(Request $request , $sectorId)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
......@@ -100,8 +102,9 @@ public function getSpecialPerSchool(Request $request, $epalId , $sectorId)
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
// $schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('registry_no' => $user->mail->value, 'id' => intval($epalId)));
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array( 'id' => intval($epalId)));
$epalId = $user -> init -> value;
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array( 'id' => $epalId));
$school = reset($schools);
if (!$school) {
$this->logger->warning("no access to this school=" . $user->id());
......@@ -112,8 +115,8 @@ public function getSpecialPerSchool(Request $request, $epalId , $sectorId)
return $response;
}
$userid = $user -> id();
$epalIdNew = intval($epalId);
$specialityPerSchool = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id'=> $epalIdNew));
//$epalIdNew = intval($epalId);
$specialityPerSchool = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id'=> $epalId));
$i = 0;
if ($specialityPerSchool) {
......@@ -155,7 +158,7 @@ public function getSpecialPerSchool(Request $request, $epalId , $sectorId)
}
public function getStudentPerSchool(Request $request, $epalId , $selectId, $classId, $limitdown, $limitup)
public function getStudentPerSchool(Request $request , $selectId, $classId, $limitdown, $limitup)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
......@@ -163,8 +166,8 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
// $schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('registry_no' => $user->mail->value, 'id' => intval($epalId)));
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array( 'id' => intval($epalId)));
$epalId = $user -> init -> value;
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array( 'id' => $epalId));
$school = reset($schools);
if (!$school) {
$this->logger->warning("no access to this school=" . $user->id());
......@@ -176,17 +179,17 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
}
$userid = $user -> id();
$epalIdNew = intval($epalId);
//$epalIdNew = intval($epalId);
$selectIdNew = intval($selectId);
if ($classId == 1)
{
$selectIdNew = -1;
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('epal_id'=> $epalIdNew, 'specialization_id' => $selectIdNew, 'currentclass' => $classId ));
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('epal_id'=> $epalId, 'specialization_id' => $selectIdNew, 'currentclass' => $classId ));
}
else
{
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('epal_id'=> $epalIdNew, 'specialization_id' => $selectIdNew, 'currentclass' => $classId ));
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('epal_id'=> $epalId, 'specialization_id' => $selectIdNew, 'currentclass' => $classId ));
}
$i = 0;
......@@ -325,7 +328,7 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid)
public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit)
{
......@@ -340,8 +343,8 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
// $schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('registry_no' => $user->mail->value, 'id' => intval($epalId)));
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('registry_no' => $this->testSchoolId));
$schoolid = $user -> init -> value;
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id'=> $schoolid));
$school = reset($schools);
if (!$school) {
$this->logger->warning("no access to this school=" . $user->id());
......@@ -357,7 +360,7 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
{
$postData = json_decode($content);
$cap = $postData->capacity;
if (($tomeas == 0) || ($specialit == 0))
if (($tomeas == 0) && ($specialit == 0))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id' => $schoolid ));
$classcapacity = reset($CapacityPerClass);
......@@ -368,7 +371,7 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
}
if (($tomeas != 0) || ($specialit == 0))
if (($tomeas != 0) && ($specialit == 0))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'sector_id' => $tomeas ));
$classcapacity = reset($CapacityPerClass);
......@@ -379,7 +382,7 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
}
if (($tomeas != 0) || ($specialit != 0))
if (($tomeas != 0) && ($specialit != 0) && ($taxi == 3))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'specialty_id' => $specialit));
$classcapacity = reset($CapacityPerClass);
......@@ -390,7 +393,15 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
}
if (($tomeas != 0) && ($specialit != 0) && ($taxi == 4))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'specialty_id' => $specialit));
$classcapacity = reset($CapacityPerClass);
if ($classcapacity) {
$classcapacity->set('capacity_class_specialty_d', $cap);
$classcapacity->save();
}
}
......@@ -414,7 +425,7 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
public function getSchoolsPerPerfetcure(Request $request, $perfectureId)
public function getSchoolsPerPerfetcure(Request $request)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
......@@ -423,6 +434,7 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
$user = reset($users);
if ($user)
{
$perfectureId = $user -> init -> value;
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('region_edu_admin_id'=> $perfectureId ));
if ($schools)
{
......@@ -472,6 +484,7 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
$user = reset($users);
if ($user)
{
$list= array();
$SchoolCats = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id'=> $schoolid ));
......@@ -588,18 +601,18 @@ public function returnstatus($id)
public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid)
public function findCapacity(Request $request,$taxi,$tomeas,$specialit)
{
$tomeasnew = intval($tomeas);
$specialitnew = intval($specialitnew) ;
$specialitnew = intval($specialit) ;
$authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('registry_no' => $this->testSchoolId));
$schoolid = $user -> init -> value;
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id'=> $schoolid));
$school = reset($schools);
if (!$school) {
$this->logger->warning("no access to this school=" . $user->id());
......@@ -624,7 +637,7 @@ public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
$list[] = array(
'taxi' => $taxi,
'capacity' => $classcapacity -> capacity_class_a -> value ,
);
);
}
}
......@@ -639,12 +652,13 @@ public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
'tomeas' => $tomeasnew,
'special' =>$specialitnew,
'capacity' => $classcapacity -> capacity_class_sector -> value ,
'sector' =>$tomeasnew."lala".$specialitnew
);
}
}
if (($tomeasnew != 0) && ($specialitnew != 0))
if (($tomeasnew != 0) && ($specialitnew != 0) && ($taxi == 3))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'specialty_id' => $specialitnew));
$classcapacity = reset($CapacityPerClass);
......@@ -655,10 +669,26 @@ public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
'special' =>$specialitnew,
'tomeas' => $classcapacity -> specialty_id -> value,
'capacity' => $classcapacity -> capacity_class_specialty -> value ,
'specialty' =>"fromspeciality"
);
}
}
if (($tomeasnew != 0) && ($specialitnew != 0) && ($taxi == 4))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'specialty_id' => $specialitnew));
$classcapacity = reset($CapacityPerClass);
if ($classcapacity) {
$list[] = array(
'taxi' =>$taxi,
'tomeas' => $tomeasnew,
'special' =>$specialitnew,
'tomeas' => $classcapacity -> specialty_id -> value,
'capacity' => $classcapacity -> capacity_class_specialty_d -> value ,
'specialty' =>"fromspecialityd"
);
}
}
......@@ -712,11 +742,46 @@ public function getSchoolID(Request $request)
public function gettypeofschool(Request $request)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
$schid = intval($user -> init -> value );
$schools = $this->entityTypeManager->getStorage('eepal_school')->
loadByProperties(array('id' => $schid));
$school = reset($schools);
if (!$school) {
$this->logger->warning("no access to this school=" . $user->id());
$response = new Response();
$response->setContent('No access to this school');
$response->setStatusCode(Response::HTTP_FORBIDDEN);
$response->headers->set('Content-Type', 'application/json');
return $response;
}
else
{
$list = array();
$list[] = array(
'type' => $school -> operation_shift -> value,
);
return $this->respondWithStatus(
$list
, Response::HTTP_OK);
}
} else {
return $this->respondWithStatus([
'message' => t("User not found!"),
], Response::HTTP_FORBIDDEN);
}
}
private function respondWithStatus($arr, $s) {
......
......@@ -206,7 +206,7 @@ class EpalConfig extends ContentEntityBase implements EpalConfigInterface {
->setSettings(array(
'text_processing' => 0,
))
->setRequired(TRUE)
->setRequired(FALSE)
->setDefaultValue(FALSE)
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -226,7 +226,7 @@ class EpalConfig extends ContentEntityBase implements EpalConfigInterface {
->setSettings(array(
'text_processing' => 0,
))
->setRequired(TRUE)
->setRequired(FALSE)
->setDefaultValue(FALSE)
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -246,7 +246,7 @@ class EpalConfig extends ContentEntityBase implements EpalConfigInterface {
->setSettings(array(
'text_processing' => 0,
))
->setRequired(TRUE)
->setRequired(FALSE)
->setDefaultValue(FALSE)
->setDisplayOptions('view', array(
'label' => 'above',
......
......@@ -505,7 +505,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
->setLabel(t('Ημερομηνία γέννησης μαθητή'))
->setDescription(t('Δώσε την Ημερομηνία γέννησης μαθητή.'))
->setSetting('datetime_type', 'date')
->setRequired(false)
->setRequired(true)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
......@@ -543,7 +543,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(false)
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -564,7 +564,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(false)
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -585,7 +585,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(false)
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -606,7 +606,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(false)
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -627,6 +627,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 20,
'text_processing' => 0,
))
->setRequired(false)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -647,6 +648,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 100,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -667,27 +669,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'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('')
->setRequired(true)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
......@@ -707,6 +689,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 100,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -727,6 +710,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -747,6 +731,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 10,
'text_processing' => 0,
))
->setRequired(false)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -912,6 +897,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -932,6 +918,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -969,7 +956,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
->setSettings(array(
'text_processing' => 0,
))
->setRequired(false)
->setRequired(true)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'boolean',
......@@ -982,6 +969,90 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['guardian_name'] = BaseFieldDefinition::create('string')
->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,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['guardian_surname'] = BaseFieldDefinition::create('string')
->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,
))
->setDisplayConfigurable('form', TRUE)