...
 
Commits (2)
dist/*
source/app.settings.ts
node_modules/*
!node_modules/zone.js/
!drupal/
drupal/*
!drupal/modules/
......
......@@ -18,11 +18,6 @@ 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
entity.epal_student_sector_field.add_form:
route_name: entity.epal_student_sector_field.add_form
title: 'Add Epal student sector field'
......
......@@ -55,20 +55,6 @@ epal_student_course_field.admin.structure.settings:
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
# Epal student sector field menu items definition
entity.epal_student_sector_field.collection:
title: 'Epal student sector field list'
......
......@@ -86,28 +86,6 @@ entity.epal_student_course_field.delete_form:
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
# Epal student sector field routing definition
epal_student_sector_field.settings_tab:
route_name: epal_student_sector_field.settings
......@@ -216,4 +194,3 @@ entity.epal_config.delete_form:
base_route: entity.epal_config.canonical
title: Delete
weight: 10
......@@ -86,28 +86,7 @@ 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'
add epal student sector field entities:
title: 'Create new Epal student sector field entities'
......
......@@ -167,7 +167,7 @@ class ApplicationSubmit extends ControllerBase
try {
//insert records in entity: epal_student
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if (!$epalUser) {
return $this->respondWithStatus([
......@@ -179,17 +179,6 @@ class ApplicationSubmit extends ControllerBase
$student = array(
'langcode' => 'el',
'student_record_id' => 0,
'sex' => 0,
'fathersurname' => '',
'mothersurname' => '',
'studentamka' => '',
'lastam' => '',
'graduate_school' => 0,
'apolytirio_id' => '',
'currentsector' => '',
'currentcourse' => '',
'points' => 0,
'user_id' => $epalUser->user_id->target_id,
'epaluser_id' => $epalUser->id(),
'name' => $name_encoded,
......@@ -200,8 +189,6 @@ class ApplicationSubmit extends ControllerBase
'regionaddress' => $regionaddress_encoded,
'regionarea' => $regionarea_encoded,
'regiontk' => $regiontk_encoded,
// 'certificatetype' => $certificatetype_encoded,
// 'graduation_year' => $applicationForm[0]['graduation_year'],
'lastschool_registrynumber' => $applicationForm[0]['lastschool_registrynumber'],
'lastschool_unittypeid' => $applicationForm[0]['lastschool_unittypeid'],
'lastschool_schoolname' => $applicationForm[0]['lastschool_schoolname'],
......@@ -214,7 +201,6 @@ class ApplicationSubmit extends ControllerBase
'guardian_mothername' => $guardian_mothername_encoded,
'agreement' => $applicationForm[0]['disclaimer_checked'],
'hasright' => $applicationForm[0]['hasright'],
//'relationtostudent' => $relationtostudent_encoded,
'relationtostudent' => $relationtostudent,
'telnum' => $telnum_encoded,
'second_period' => $second_period,
......@@ -421,7 +407,7 @@ class ApplicationSubmit extends ControllerBase
try {
//insert records in entity: epal_student
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if (!$epalUser) {
return $this->respondWithStatus([
......@@ -432,17 +418,6 @@ class ApplicationSubmit extends ControllerBase
//$second_period = $epalConfig->activate_second_period->value;
$student = array(
'langcode' => 'el',
'student_record_id' => 0,
'sex' => 0,
'fathersurname' => '',
'mothersurname' => '',
'studentamka' => '',
'lastam' => '',
'graduate_school' => 0,
'apolytirio_id' => '',
'currentsector' => '',
'currentcourse' => '',
'points' => 0,
'user_id' => $epalUser->user_id->target_id,
'epaluser_id' => $epalUser->id(),
'name' => $name_encoded,
......@@ -453,8 +428,6 @@ class ApplicationSubmit extends ControllerBase
'regionaddress' => $regionaddress_encoded,
'regionarea' => $regionarea_encoded,
'regiontk' => $regiontk_encoded,
// 'certificatetype' => $certificatetype_encoded,
// 'graduation_year' => $applicationForm[0]['graduation_year'],
'lastschool_registrynumber' => $applicationForm[0]['lastschool_registrynumber'],
'lastschool_unittypeid' => $applicationForm[0]['lastschool_unittypeid'],
'lastschool_schoolname' => $applicationForm[0]['lastschool_schoolname'],
......@@ -466,7 +439,6 @@ class ApplicationSubmit extends ControllerBase
'guardian_fathername' => $guardian_fathername_encoded,
'guardian_mothername' => $guardian_mothername_encoded,
'agreement' => $applicationForm[0]['disclaimer_checked'],
//'relationtostudent' => $relationtostudent_encoded,
'relationtostudent' => $relationtostudent,
'telnum' => $telnum_encoded,
'second_period' => $epalConfig->activate_second_period->value,
......
......@@ -84,7 +84,7 @@ class CurrentUser extends ControllerBase
}
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
......@@ -145,7 +145,7 @@ class CurrentUser extends ControllerBase
{
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$user = $this->entityTypeManager->getStorage('user')->load($epalUser->user_id->target_id);
......@@ -232,7 +232,7 @@ class CurrentUser extends ControllerBase
$trx = $this->connection->startTransaction();
try {
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$user = $this->entityTypeManager->getStorage('user')->load($epalUser->user_id->target_id);
......@@ -309,7 +309,7 @@ class CurrentUser extends ControllerBase
}
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
......@@ -355,14 +355,19 @@ class CurrentUser extends ControllerBase
}
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$postData = null;
if ($content = $request->getContent()) {
$postData = json_decode($content);
/*
if (isset($postData->userProfile->representRole))
$representRole = $postData->userProfile->representRole;
if (isset($postData->userProfile->userChildren))
$userChildren = $postData->userProfile->userChildren;
*/
$representRole = $postData->userProfile->representRole;
//validate representRole
/*
if ( $epalUser->name->value !== "" && intval($epalUser->representative->value) !== $representRole )
......@@ -396,9 +401,16 @@ class CurrentUser extends ControllerBase
$epalUser->set('surname', $surname_encoded);
$epalUser->set('mothername', $fathername_encoded);
$epalUser->set('fathername', $mothername_encoded);
$epalUser->set('representative', $representRole);
if ($representRole)
$representRole = "0";
if (isset($postData->userProfile->representRole)) {
$representRole = $postData->userProfile->representRole;
$epalUser->set('representative', $representRole);
}
if ($representRole === "1")
$epalUser->set('numchildren', self::CHILDREN_LIMIT);
else if (isset($postData->userProfile->userChildren))
$epalUser->set('numchildren', $postData->userProfile->userChildren);
$epalUser->save();
$user = $this->entityTypeManager->getStorage('user')->load($epalUser->user_id->target_id);
......
......@@ -138,8 +138,6 @@ class DirectorView extends ControllerBase
$regionaddress_decoded = $crypt->decrypt($epalStudent->regionaddress->value);
$regiontk_decoded = $crypt->decrypt($epalStudent->regiontk->value);
$regionarea_decoded = $crypt->decrypt($epalStudent->regionarea->value);
// $certificatetype_decoded = $crypt->decrypt($epalStudent->certificatetype->value); // obsolete
//$relationtostudent_decoded = $crypt->decrypt($epalStudent->relationtostudent->value);
$telnum_decoded = $crypt->decrypt($epalStudent->telnum->value);
$guardian_name_decoded = $crypt->decrypt($epalStudent->guardian_name->value);
$guardian_surname_decoded = $crypt->decrypt($epalStudent->guardian_surname->value);
......@@ -171,8 +169,7 @@ class DirectorView extends ControllerBase
'regionaddress' => $regionaddress_decoded,
'regiontk' => $regiontk_decoded,
'regionarea' => $regionarea_decoded,
'certificatetype' => '', // $certificatetype_decoded, // obsolete
'graduation_year' => $epalStudent->graduation_year->value,
//'graduation_year' => $epalStudent->graduation_year->value,
'telnum' => $telnum_decoded,
'relationtostudent' => $relationtostudent_decoded,
//'birthdate' => substr($epalStudent->birthdate->value, 8, 10) . '/' . substr($epalStudent->birthdate->value, 6, 8) . '/' . substr($epalStudent->birthdate->value, 0, 4),
......@@ -958,7 +955,7 @@ class DirectorView extends ControllerBase
}
}
private function respondWithStatus($arr, $s)
......
......@@ -95,7 +95,7 @@ class InformUnlocatedStudents extends ControllerBase {
$sCon->fields('eStudentClass', array('student_id'))
->fields('eStudent', array('id', 'user_id', 'created'))
->isNull('eStudentClass.student_id');
$sCon->join('epal_users', 'eUsers', 'eUsers.user_id = eStudent.user_id');
$sCon->join('applicant_users', 'eUsers', 'eUsers.user_id = eStudent.user_id');
$sCon->join('users_field_data', 'users', 'users.uid = eUsers.user_id');
$sCon->fields('users', array('mail', 'preferred_langcode'));
$epalNonLocatedStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
......@@ -167,7 +167,7 @@ class InformUnlocatedStudents extends ControllerBase {
}
$sCon->fields('eStudent', array('id', 'user_id', 'created'));
$sCon->join('epal_users', 'eUsers', 'eUsers.user_id = eStudent.user_id');
$sCon->join('applicant_users', 'eUsers', 'eUsers.user_id = eStudent.user_id');
$sCon->join('users_field_data', 'users', 'users.uid = eUsers.user_id');
$sCon->fields('users', array('mail', 'preferred_langcode'));
$sCon->join('eepal_school_field_data', 'eSchool', 'eSchool.id = eStudentClass.user_id');
......@@ -255,7 +255,7 @@ class InformUnlocatedStudents extends ControllerBase {
$sCon->join('epal_student', 'eStudent', 'eStudent.id = eStudentClass.student_id');
}
$sCon->fields('eStudent', array('id', 'user_id', 'created'));
$sCon->join('epal_users', 'eUsers', 'eUsers.user_id = eStudent.user_id');
$sCon->join('applicant_users', 'eUsers', 'eUsers.user_id = eStudent.user_id');
$sCon->join('users_field_data', 'users', 'users.uid = eUsers.user_id');
$sCon->fields('users', array('mail', 'preferred_langcode'));
$sCon->join('eepal_school_field_data', 'eSchool', 'eSchool.id = eStudentClass.user_id');
......
......@@ -92,7 +92,7 @@ class PDFCreator extends ControllerBase {
//Epal-user validation
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userid = $epalUser->id();
......@@ -317,8 +317,6 @@ class PDFCreator extends ControllerBase {
$studentsurname_decoded = $this->crypt->decrypt($student->studentsurname->value);
$fatherfirstname_decoded = $this->crypt->decrypt($student->fatherfirstname->value);
$motherfirstname_decoded = $this->crypt->decrypt($student->motherfirstname->value);
//$certificatetype_decoded = $this->crypt->decrypt($student->certificatetype->value);
//$relationtostudent_decoded = $this->crypt->decrypt($student->relationtostudent->value);
$telnum_decoded = $this->crypt->decrypt($student->telnum->value);
}
catch (\Exception $e) {
......@@ -395,22 +393,6 @@ class PDFCreator extends ControllerBase {
$this->pdf->Ln();
/*
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width+15, $height, $this->prepareString('Τύπος απολυτηρίου:'), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString($certificatetype_decoded), 0, 'L');
$this->pdf->Ln();
*/
/*
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width+15, $height, $this->prepareString('Έτος κτήσης απολυτηρίου:'), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString($student->graduation_year->value), 0, 'L');
$this->pdf->Ln();
*/
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width+15, $height, $this->prepareString('Σχολείο τελευταίας φοίτησης:'), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
......
......@@ -76,7 +76,7 @@ class SubmitedApplications extends ControllerBase
"error_code" => 3002
], Response::HTTP_FORBIDDEN);
}
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userid = $epalUser->id();
......@@ -178,7 +178,7 @@ class SubmitedApplications extends ControllerBase
], Response::HTTP_FORBIDDEN);
}
*/
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userid = $epalUser->id();
......@@ -229,7 +229,7 @@ class SubmitedApplications extends ControllerBase
public function getSubmittedApplications(Request $request)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userid = $epalUser->id();
......@@ -305,7 +305,7 @@ class SubmitedApplications extends ControllerBase
public function getStudentApplications(Request $request, $studentId)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userid = $epalUser->id();
......@@ -364,9 +364,7 @@ class SubmitedApplications extends ControllerBase
'name' => $name_decoded,
'studentsurname' => $studentsurname_decoded,
'fatherfirstname' => $fatherfirstname_decoded,
'fathersurname' => '',
'motherfirstname' => $motherfirstname_decoded,
'mothersurname' => '',
'guardian_name' => $guardian_name_decoded,
'guardian_surname' => $guardian_surname_decoded,
'guardian_fathername' => $guardian_fathername_decoded,
......@@ -381,11 +379,9 @@ class SubmitedApplications extends ControllerBase
'regiontk' => $regiontk_decoded,
'regionarea' => $regionarea_decoded,
'telnum' => $telnum_decoded,
//'relationtostudent' => $relationtostudent_decoded,
'relationtostudent' => $object->relationtostudent->value,
'birthdate' => substr($object->birthdate->value, 8, 2).'/'.substr($object->birthdate->value, 5, 2).'/'.substr($object->birthdate->value, 0, 4),
'created' => date('d/m/Y H:i', $object->created->value),
);
++$i;
......@@ -409,7 +405,7 @@ class SubmitedApplications extends ControllerBase
public function getApplicationDetails(Request $request, $studentId)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
......@@ -568,9 +564,7 @@ class SubmitedApplications extends ControllerBase
'name' => $name_decoded,
'studentsurname' => $studentsurname_decoded,
'fatherfirstname' => $fatherfirstname_decoded,
'fathersurname' => '',
'motherfirstname' => $motherfirstname_decoded,
'mothersurname' => '',
'guardian_name' => $guardian_name_decoded,
'guardian_surname' => $guardian_surname_decoded,
'guardian_fathername' => $guardian_fathername_decoded,
......@@ -581,13 +575,12 @@ class SubmitedApplications extends ControllerBase
'lastschool_schoolyear' => $epalStudent->lastschool_schoolyear,
'lastschool_class' => $epalStudent->lastschool_class,
'currentclass' => $epalStudent->currentclass,
'currentsector' => $epalStudent->eese_name,
'currentcourse' => $epalStudent->eesp_name,
//'currentsector' => $epalStudent->eese_name,
//'currentcourse' => $epalStudent->eesp_name,
'regionaddress' => $regionaddress_decoded,
'regiontk' => $regiontk_decoded,
'regionarea' => $regionarea_decoded,
'telnum' => $telnum_decoded,
//'relationtostudent' => $relationtostudent_decoded,
'relationtostudent' => $epalStudent->relationtostudent,
'birthdate' => substr($epalStudent->birthdate, 8, 2).'/'.substr($epalStudent->birthdate, 5, 2).'/'.substr($epalStudent->birthdate, 0, 4),
//'created' => date('d/m/Y H:i', $epalStudent->created),
......@@ -620,7 +613,7 @@ class SubmitedApplications extends ControllerBase
public function getEpalChosen(Request $request, $studentId)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userid = $epalUser->user_id->entity->id();
......@@ -662,7 +655,7 @@ class SubmitedApplications extends ControllerBase
public function getCritiria(Request $request, $studentId, $type)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userid = $epalUser->user_id->entity->id();
......@@ -715,7 +708,7 @@ class SubmitedApplications extends ControllerBase
//έλεγχος πρόσβασης
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUsers = $this->entityTypeManager->getStorage('applicant_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userid = $epalUser->id();
......
......@@ -187,7 +187,7 @@ class EpalConfig extends ContentEntityBase implements EpalConfigInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setDefaultValue('')
->setDefaultValue('epal_config')
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
......
......@@ -85,27 +85,19 @@ interface EpalStudentInterface extends ContentEntityInterface, EntityChangedInt
public function setBirthdate($val);
public function getFatherFirstname();
public function setFatherFirstname($val);
public function getMotherSurname();
public function setMotherSurname($val);
public function getStudentAmka();
public function setStudentAmka($val);
public function getRegionAddress();
public function setRegionAddress($val);
public function getRegionTK();
public function setRegionTK($val);
public function getRegionArea();
public function setRegionArea($val);
public function getCertificateType();
public function setCertificateType($val);
public function getCurrentclass();
public function setCurrentclass($val);
public function getCurrentepal();
public function setCurrentepal($val);
public function getCurrentsector();
public function setCurrentsector($val);
public function getTelnum();
public function setTelnum($val);
public function getRelationToStudent();
public function setRelationToStudent($val);
}
<?php
namespace Drupal\epal\Entity;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\user\EntityOwnerInterface;
/**
* Provides an interface for defining Epal users entities.
*
* @ingroup epal
*/
interface EpalUsersInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface {
// Add get/set methods for your configuration properties here.
/**
* Gets the Epal users name.
*
* @return string
* Name of the Epal users.
*/
public function getName();
/**
* Sets the Epal users name.
*
* @param string $name
* The Epal users name.
*
* @return \Drupal\epal\Entity\EpalUsersInterface
* The called Epal users entity.
*/
public function setName($name);
/**
* Gets the Epal users creation timestamp.
*
* @return int
* Creation timestamp of the Epal users.
*/
public function getCreatedTime();
/**
* Sets the Epal users creation timestamp.
*
* @param int $timestamp
* The Epal users creation timestamp.
*
* @return \Drupal\epal\Entity\EpalUsersInterface
* The called Epal users entity.
*/
public function setCreatedTime($timestamp);
/**
* Returns the Epal users published status indicator.
*
* Unpublished Epal users are only visible to restricted users.
*
* @return bool
* TRUE if the Epal users is published.
*/
public function isPublished();
/**
* Sets the published status of a Epal users.
*
* @param bool $published
* TRUE to set this Epal users to published, FALSE to set it to unpublished.
*
* @return \Drupal\epal\Entity\EpalUsersInterface
* The called Epal users entity.
*/
public function setPublished($published);
//get/set methods for additional fields for configuration properties.
public function getDrupaluser_id();
public function setDrupaluser_id($val);
public function getTaxis_userid();
public function setTaxis_userid($val);
public function getTaxis_taxid();
public function setTaxis_taxid($val);
public function getSurname();
public function setSurname($val);
public function getFathername();
public function setFathername($val);
public function getMothername();
public function setMothername($val);
//public function getAddress();
//public function setAddress($val);
//public function getAddresstk();
//public function setAddresstk($val);
//public function getAddressarea();
//public function setAddressarea($val);
public function getAccesstoken();
public function setAccesstoken($val);
public function getAuthtoken();
public function setAuthtoken($val);
public function getTimelogin();
public function setTimelogin($val);
public function getTimeregistration();
public function setTimeregistration($val);
public function getTimetokeninvalid();
public function setTimetokeninvalid($val);
public function getUserip();
public function setUserip($val);
}
......@@ -24,8 +24,7 @@ class EpalStudentListBuilder extends EntityListBuilder {
$header['epaluser_id'] = $this->t('ID χρήστη ΕΠΑΛ');
$header['name'] = $this->t('Όνομα');
$header['studentsurname'] = $this->t('Επώνυμο');
$header['studentamka'] = $this->t('AMKA μαθητή');
return $header + parent::buildHeader();
}
......@@ -35,7 +34,7 @@ class EpalStudentListBuilder extends EntityListBuilder {
public function buildRow(EntityInterface $entity) {
/* @var $entity \Drupal\epal\Entity\EpalStudent */
$row['id'] = $entity->id();
$row['epaluser_id'] = $this->l(
$entity->getEpaluser_id(),
new Url(
......@@ -44,7 +43,7 @@ class EpalStudentListBuilder extends EntityListBuilder {
)
)
);
$row['name'] = $this->l(
$entity->getName(),
new Url(
......@@ -63,15 +62,6 @@ class EpalStudentListBuilder extends EntityListBuilder {
)
);
$row['studentAmka'] = $this->l(
$entity->getStudentAmka(),
new Url(
'entity.epal_student.edit_form', array(
'epal_student' => $entity->id(),
)
)
);
return $row + parent::buildRow($entity);
}
......
<?php
namespace Drupal\epal;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Routing\LinkGeneratorTrait;
use Drupal\Core\Url;
/**
* Defines a class to build a listing of Epal users entities.
*
* @ingroup epal
*/
class EpalUsersListBuilder extends EntityListBuilder {
use LinkGeneratorTrait;
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header['id'] = $this->t('ID');
$header['name'] = $this->t('Όνομα');
$header['surname'] = $this->t('Επώνυμο');
$header['fathername'] = $this->t('Όνομα πατέρα');
$header['mothername'] = $this->t('Όνομα μητέρας');
//$header['drupaluser_id'] = $this->t('ID χρήστη Drupal');
//$header['taxis_userid'] = $this->t('ID χρήστη από taxisnet');
//$header['taxis_taxid'] = $this->t('TAXID χρήστη από taxisnet');
//$header['address'] = $this->t('Διεύθυνση');
//$header['addresstk'] = $this->t('ΤΚ');
//$header['addressarea'] = $this->t('Περιοχή');
//$header['accesstoken'] = $this->t('AccessToken');
//$header['authtoken'] = $this->t('AuthToken');
//$header['timelogin'] = $this->t('Time Login');
//$header['timeregistration'] = $this->t('Time Registration');
//$header['timetokeninvalid'] = $this->t('Time Token Invalid');
//$header['userip'] = $this->t('User IP');
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(),
)
)
);
$row['surname'] = $this->l(
$entity->getSurname(),
new Url(
'entity.epal_users.edit_form', array(
'epal_users' => $entity->id(),
)
)
);
$row['fathername'] = $this->l(
$entity->getFathername(),
new Url(
'entity.epal_users.edit_form', array(
'epal_users' => $entity->id(),
)
)
);
$row['mothername'] = $this->l(
$entity->getMothername(),
new Url(
'entity.epal_users.edit_form', array(
'epal_users' => $entity->id(),
)
)
);
return $row + parent::buildRow($entity);
}
}
<?php
namespace Drupal\epal\Form;
use Drupal\Core\Entity\ContentEntityDeleteForm;
/**
* Provides a form for deleting Epal users entities.
*
* @ingroup epal
*/
class EpalUsersDeleteForm extends ContentEntityDeleteForm {
}
CREATE UNIQUE INDEX uidx_region_regno ON eepal_region_field_data(registry_no);
CREATE UNIQUE INDEX uidx_adminarea_regno ON eepal_admin_area_field_data(registry_no);
CREATE UNIQUE INDEX uidx_taxis_userid ON epal_users(taxis_userid);
CREATE INDEX uidx_authtoken ON epal_users(authtoken(150));
CREATE UNIQUE INDEX uidx_taxis_userid ON applicant_users(taxis_userid);
CREATE INDEX uidx_authtoken ON applicant_users(authtoken(150));
......@@ -7,8 +7,8 @@ dependencies:
- hal
- serialization
- user
id: entity.epal_users
plugin_id: 'entity:epal_users'
id: entity.applicant_users
plugin_id: 'entity:applicant_users'
granularity: method
configuration:
GET:
......
......@@ -11,31 +11,31 @@ permissions:
- 'add epal student course field entities'
- 'add epal student epal chosen entities'
- 'add epal student sector field entities'
- 'add epal users entities'
- 'add applicant users entities'
- 'delete epal student class entities'
- 'delete epal student entities'
- 'delete epal student course field entities'
- 'delete epal student epal chosen entities'
- 'delete epal student sector field entities'
- 'delete epal users entities'
- 'delete applicant users entities'
- 'edit epal student class entities'
- 'edit epal student entities'
- 'edit epal student course field entities'
- 'edit epal student epal chosen entities'
- 'edit epal student sector field entities'
- 'edit epal users entities'
- 'edit applicant users entities'
- 'view published epal student class entities'
- 'view published epal student entities'
- 'view published epal student course field entities'
- 'view published epal student epal chosen entities'
- 'view published epal student sector field entities'
- 'view published epal users entities'
- 'view published applicant users entities'
- 'view unpublished epal student class entities'
- 'view unpublished epal student entities'
- 'view unpublished epal student course field entities'
- 'view unpublished epal student epal chosen entities'
- 'view unpublished epal student sector field entities'
- 'view unpublished epal users entities'
- 'view unpublished applicant users entities'
- 'view published eepal admin area entities'
- 'view published eepal prefecture entities'
- 'view published eepal region entities'
......
......@@ -14,7 +14,7 @@ permissions:
- 'view published epal student epal chosen entities'
- 'view published epal student moria entities'
- 'view published epal student sector field entities'
- 'view published epal users entities'
- 'view published applicant users entities'
- 'view unpublished epal student class entities'
- 'view unpublished epal student entities'
- 'view unpublished epal class limits entities'
......@@ -23,7 +23,7 @@ permissions:
- 'view unpublished epal student epal chosen entities'
- 'view unpublished epal student moria entities'
- 'view unpublished epal student sector field entities'
- 'view unpublished epal users entities'
- 'view unpublished applicant users entities'
- 'view published eepal admin area entities'
- 'view published eepal prefecture entities'
- 'view published eepal region entities'
......
......@@ -9,24 +9,24 @@ permissions:
- 'add epal student course field entities'
- 'add epal student epal chosen entities'
- 'add epal student sector field entities'
- 'add epal users entities'
- 'add applicant users entities'
- 'delete epal student course field entities'
- 'delete epal student epal chosen entities'
- 'delete epal student sector field entities'
- 'delete epal users entities'
- 'delete applicant users entities'
- 'edit epal class limits entities'
- 'edit epal student course field entities'
- 'edit epal student epal chosen entities'
- 'edit epal student sector field entities'
- 'edit epal users entities'
- 'edit applicant users entities'
- 'view published epal student course field entities'
- 'view published epal student epal chosen entities'
- 'view published epal student sector field entities'
- 'view published epal users entities'
- 'view published applicant users entities'
- 'view unpublished epal student course field entities'
- 'view unpublished epal student epal chosen entities'
- 'view unpublished epal student sector field entities'
- 'view unpublished epal users entities'
- 'view unpublished applicant users entities'
- 'view published eepal admin area entities'
- 'view published eepal prefecture entities'
- 'view published eepal region entities'
......
......@@ -9,24 +9,24 @@ permissions:
- 'add epal student course field entities'
- 'add epal student epal chosen entities'
- 'add epal student sector field entities'
- 'add epal users entities'
- 'add applicant users entities'
- 'delete epal student course field entities'
- 'delete epal student epal chosen entities'
- 'delete epal student sector field entities'
- 'delete epal users entities'
- 'delete applicant users entities'
- 'edit epal class limits entities'
- 'edit epal student course field entities'
- 'edit epal student epal chosen entities'
- 'edit epal student sector field entities'
- 'edit epal users entities'
- 'edit applicant users entities'
- 'view published epal student course field entities'
- 'view published epal student epal chosen entities'
- 'view published epal student sector field entities'
- 'view published epal users entities'
- 'view published applicant users entities'
- 'view unpublished epal student course field entities'
- 'view unpublished epal student epal chosen entities'
- 'view unpublished epal student sector field entities'
- 'view unpublished epal users entities'
- 'view unpublished applicant users entities'
- 'view published eepal admin area entities'
- 'view published eepal prefecture entities'
- 'view published eepal region entities'
......
......@@ -14,7 +14,7 @@ permissions:
- 'view published epal student epal chosen entities'
- 'view published epal student moria entities'
- 'view published epal student sector field entities'
- 'view published epal users entities'
- 'view published applicant users entities'
- 'view unpublished epal student class entities'
- 'view unpublished epal student entities'
- 'view unpublished epal class limits entities'
......@@ -23,7 +23,7 @@ permissions:
- 'view unpublished epal student epal chosen entities'
- 'view unpublished epal student moria entities'
- 'view unpublished epal student sector field entities'
- 'view unpublished epal users entities'
- 'view unpublished applicant users entities'
- 'view published eepal admin area entities'
- 'view published eepal prefecture entities'
- 'view published eepal region entities'
......
......@@ -2,26 +2,28 @@
/**
* @file
* Contains epal_users.page.inc.
* Contains applicant_users.page.inc.
*
* Page callback for Epal users entities.
* Page callback for Applicant users entities.
*/
use Drupal\Core\Render\Element;
use Drupal\Core\Link;
use Drupal\Core\Url;
/**
* Prepares variables for Epal users templates.
* Prepares variables for Applicant users templates.
*
* Default template: epal_users.html.twig.
* Default template: applicant_users.html.twig.
*
* @param array $variables
* An associative array containing:
* - elements: An associative array containing the user information and any
* - attributes: HTML attributes for the containing element.
*/
function template_preprocess_epal_users(array &$variables) {
// Fetch EpalUsers Entity Object.
$epal_users = $variables['elements']['#epal_users'];
function template_preprocess_applicant_users(array &$variables) {
// Fetch ApplicantUsers Entity Object.
$applicant_users = $variables['elements']['#applicant_users'];
// Helpful $content variable for templates.
foreach (Element::children($variables['elements']) as $key) {
......
......@@ -8,3 +8,8 @@ entity.oauthost_session.add_form:
title: 'Add OAuthOST Session'
appears_on:
- entity.oauthost_session.collection
entity.applicant_users.add_form:
route_name: entity.applicant_users.add_form
title: 'Add Applicant users'
appears_on:
- entity.applicant_users.collection
......@@ -26,3 +26,16 @@ oauthost_session.admin.structure.settings:
description: 'Configure OAuthOST Session entities'
route_name: oauthost_session.settings
parent: system.admin_structure
# Applicant users menu items definition
entity.applicant_users.collection:
title: 'Applicant users list'
route_name: entity.applicant_users.collection
description: 'List Applicant users entities'
parent: system.admin_structure
weight: 100
applicant_users.admin.structure.settings:
title: Applicant users settings
description: 'Configure Applicant users entities'
route_name: applicant_users.settings
parent: system.admin_structure
......@@ -42,3 +42,24 @@ entity.oauthost_session.delete_form:
title: Delete
weight: 10
# Applicant users routing definition
applicant_users.settings_tab:
route_name: applicant_users.settings
title: 'Settings'
base_route: applicant_users.settings
entity.applicant_users.canonical:
route_name: entity.applicant_users.canonical
base_route: entity.applicant_users.canonical
title: 'View'
entity.applicant_users.edit_form:
route_name: entity.applicant_users.edit_form
base_route: entity.applicant_users.canonical
title: Edit
entity.applicant_users.delete_form:
route_name: entity.applicant_users.delete_form
base_route: entity.applicant_users.canonical
title: Delete
weight: 10
......@@ -42,3 +42,22 @@ view published oauthost session entities:
view unpublished oauthost session entities:
title: 'View unpublished OAuthOST Session entities'
add applicant users entities:
title: 'Create new Applicant users entities'
administer applicant users entities:
title: 'Administer Applicant users entities'
description: 'Allow to access the administration form to configure Applicant users entities.'
restrict access: true
delete applicant users entities:
title: 'Delete Applicant users entities'
edit applicant users entities:
title: 'Edit Applicant users entities'
view published applicant users entities:
title: 'View published Applicant users entities'
view unpublished applicant users entities:
title: 'View unpublished Applicant users entities'
services:
logger.channel.oauth:
parent: 'logger.channel_base'
arguments: ['epal']
arguments: ['school']
<?php
namespace Drupal\epal;
namespace Drupal\oauthost;
use Drupal\Core\Entity\EntityAccessControlHandler;
use Drupal\Core\Entity\EntityInterface;
......@@ -8,29 +8,28 @@ use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessResult;
/**
* Access controller for the Epal users entity.
* Access controller for the Applicant users entity.
*
* @see \Drupal\epal\Entity\EpalUsers.
* @see \Drupal\oauthost\Entity\ApplicantUsers.
*/
class EpalUsersAccessControlHandler extends EntityAccessControlHandler {
class ApplicantUsersAccessControlHandler extends EntityAccessControlHandler {
/**
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
/** @var \Drupal\epal\Entity\EpalUsersInterface $entity */
/** @var \Drupal\oauthost\ApplicantUsersInterface $entity */
switch ($operation) {
case 'view':
if (!$entity->isPublished()) {
return AccessResult::allowedIfHasPermission($account, 'view unpublished epal users entities');
return AccessResult::allowedIfHasPermission($account, 'view unpublished applicant users entities');
}
return AccessResult::allowedIfHasPermission($account, 'view published epal users entities');
return AccessResult::allowedIfHasPermission($account, 'view published applicant users entities');
case 'update':
return AccessResult::allowedIfHasPermission($account, 'edit epal users entities');
return AccessResult::allowedIfHasPermission($account, 'edit applicant users entities');
case 'delete':
return AccessResult::allowedIfHasPermission($account, 'delete epal users entities');
return AccessResult::allowedIfHasPermission($account, 'delete applicant users entities');
}
// Unknown operation, no opinion.
......@@ -41,7 +40,7 @@ class EpalUsersAccessControlHandler extends EntityAccessControlHandler {
* {@inheritdoc}
*/
protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
return AccessResult::allowedIfHasPermission($account, 'add epal users entities');
return AccessResult::allowedIfHasPermission($account, 'add applicant users entities');
}
}
<?php
namespace Drupal\epal;
namespace Drupal\oauthost;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
use Symfony\Component\Routing\Route;
/**
* Provides routes for Epal users entities.
* Provides routes for Applicant users entities.
*
* @see Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
* @see Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
*/
class EpalUsersHtmlRouteProvider extends AdminHtmlRouteProvider {
class ApplicantUsersHtmlRouteProvider extends AdminHtmlRouteProvider {
/**
* {@inheritdoc}
*/
......@@ -26,6 +25,10 @@ class EpalUsersHtmlRouteProvider extends AdminHtmlRouteProvider {
$collection->add("entity.{$entity_type_id}.collection", $collection_route);
}
if ($add_form_route = $this->getAddFormRoute($entity_type)) {
$collection->add("entity.{$entity_type_id}.add_form", $add_form_route);
}
if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) {
$collection->add("$entity_type_id.settings", $settings_form_route);
}
......@@ -51,7 +54,44 @@ class EpalUsersHtmlRouteProvider extends AdminHtmlRouteProvider {
'_entity_list' => $entity_type_id,
'_title' => "{$entity_type->getLabel()} list",
])
->setRequirement('_permission', 'access epal users overview')
->setRequirement('_permission', 'view applicant users entities')
->setOption('_admin_route', TRUE);
return $route;
}
}
/**
* Gets the add-form route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*