Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Σταύρος Παπαδάκης
e-epal
Commits
7e689996
Commit
7e689996
authored
May 23, 2017
by
Νίκος Κατσαούνος
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added EpalConfig entity
parent
51331a2b
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1356 additions
and
90 deletions
+1356
-90
drupal/modules/epal/epal.links.action.yml
drupal/modules/epal/epal.links.action.yml
+5
-0
drupal/modules/epal/epal.links.menu.yml
drupal/modules/epal/epal.links.menu.yml
+13
-0
drupal/modules/epal/epal.links.task.yml
drupal/modules/epal/epal.links.task.yml
+21
-0
drupal/modules/epal/epal.module
drupal/modules/epal/epal.module
+1
-2
drupal/modules/epal/epal.permissions.yml
drupal/modules/epal/epal.permissions.yml
+19
-0
drupal/modules/epal/epal.routing_MINE.yml
drupal/modules/epal/epal.routing_MINE.yml
+174
-0
drupal/modules/epal/epal_config.page.inc
drupal/modules/epal/epal_config.page.inc
+32
-0
drupal/modules/epal/src/Controller/CreateDemoData.php
drupal/modules/epal/src/Controller/CreateDemoData.php
+283
-0
drupal/modules/epal/src/Entity/EpalConfig.php
drupal/modules/epal/src/Entity/EpalConfig.php
+288
-0
drupal/modules/epal/src/Entity/EpalConfigViewsData.php
drupal/modules/epal/src/Entity/EpalConfigViewsData.php
+27
-0
drupal/modules/epal/src/EpalConfigAccessControlHandler.php
drupal/modules/epal/src/EpalConfigAccessControlHandler.php
+46
-0
drupal/modules/epal/src/EpalConfigHtmlRouteProvider.php
drupal/modules/epal/src/EpalConfigHtmlRouteProvider.php
+125
-0
drupal/modules/epal/src/EpalConfigInterface.php
drupal/modules/epal/src/EpalConfigInterface.php
+75
-0
drupal/modules/epal/src/EpalConfigListBuilder.php
drupal/modules/epal/src/EpalConfigListBuilder.php
+43
-0
drupal/modules/epal/src/Form/EpalConfigDeleteForm.php
drupal/modules/epal/src/Form/EpalConfigDeleteForm.php
+14
-0
drupal/modules/epal/src/Form/EpalConfigForm.php
drupal/modules/epal/src/Form/EpalConfigForm.php
+47
-0
drupal/modules/epal/src/Form/EpalConfigSettingsForm.php
drupal/modules/epal/src/Form/EpalConfigSettingsForm.php
+55
-0
drupal/modules/epal/templates/epal_config.html.twig
drupal/modules/epal/templates/epal_config.html.twig
+22
-0
source/components/minister/report-all-stat.ts
source/components/minister/report-all-stat.ts
+66
-88
No files found.
drupal/modules/epal/epal.links.action.yml
View file @
7e689996
...
...
@@ -43,3 +43,8 @@ entity.epal_class_limits.add_form:
title
:
'
Add
Epal
class
limits'
appears_on
:
-
entity.epal_class_limits.collection
entity.epal_config.add_form
:
route_name
:
entity.epal_config.add_form
title
:
'
Add
Epal
config'
appears_on
:
-
entity.epal_config.collection
drupal/modules/epal/epal.links.menu.yml
View file @
7e689996
...
...
@@ -124,3 +124,16 @@ epal_class_limits.admin.structure.settings:
description
:
'
Configure
Epal
class
limits
entities'
route_name
:
epal_class_limits.settings
parent
:
system.admin_structure
# Epal config menu items definition
entity.epal_config.collection
:
title
:
'
Epal
config
list'
route_name
:
entity.epal_config.collection
description
:
'
List
Epal
config
entities'
parent
:
system.admin_structure
weight
:
100
epal_config.admin.structure.settings
:
title
:
Epal config settings
description
:
'
Configure
Epal
config
entities'
route_name
:
epal_config.settings
parent
:
system.admin_structure
drupal/modules/epal/epal.links.task.yml
View file @
7e689996
...
...
@@ -196,3 +196,24 @@ entity.epal_class_limits.delete_form:
title
:
Delete
weight
:
10
# Epal config routing definition
epal_config.settings_tab
:
route_name
:
epal_config.settings
title
:
'
Settings'
base_route
:
epal_config.settings
entity.epal_config.canonical
:
route_name
:
entity.epal_config.canonical
base_route
:
entity.epal_config.canonical
title
:
'
View'
entity.epal_config.edit_form
:
route_name
:
entity.epal_config.edit_form
base_route
:
entity.epal_config.canonical
title
:
Edit
entity.epal_config.delete_form
:
route_name
:
entity.epal_config.delete_form
base_route
:
entity.epal_config.canonical
title
:
Delete
weight
:
10
drupal/modules/epal/epal.module
View file @
7e689996
<?php
<?php
/**
* @file
...
...
@@ -46,7 +46,6 @@ function epal_mail($key, &$message, $params) {
$message
[
'subject'
]
=
t
(
'Σύστημα υποβολής αιτήσεων εγγραφής σε ΕΠΑΛ: Επιβεβαίωση e-mail'
,
$options
);
$message
[
'body'
][]
=
$params
[
'message'
];
break
;
case
'massive_mail'
:
$message
[
'from'
]
=
\
Drupal
::
config
(
'system.site'
)
->
get
(
'mail'
);
$message
[
'subject'
]
=
t
(
'Μη ικανοποίηση ηλεκτρονικής αίτησης για εγγραφή σε ΕΠΑΛ'
,
$options
);
...
...
drupal/modules/epal/epal.permissions.yml
View file @
7e689996
...
...
@@ -196,3 +196,22 @@ view published epal class limits entities:
view unpublished epal class limits entities
:
title
:
'
View
unpublished
Epal
class
limits
entities'
add epal config entities
:
title
:
'
Create
new
Epal
config
entities'
administer epal config entities
:
title
:
'
Administer
Epal
config
entities'
description
:
'
Allow
to
access
the
administration
form
to
configure
Epal
config
entities.'
restrict access
:
true
delete epal config entities
:
title
:
'
Delete
Epal
config
entities'
edit epal config entities
:
title
:
'
Edit
Epal
config
entities'
view published epal config entities
:
title
:
'
View
published
Epal
config
entities'
view unpublished epal config entities
:
title
:
'
View
unpublished
Epal
config
entities'
drupal/modules/epal/epal.routing_MINE.yml
0 → 100644
View file @
7e689996
epal.user.send_verification_code
:
path
:
'
/epal/user/sendvercode'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\CurrentUser::sendVerificationCode'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.user.verify_verification_code
:
path
:
'
/epal/user/verifyvercode'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\CurrentUser::verifyVerificationCode'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.user.save_profile
:
path
:
'
/epal/user/save'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\CurrentUser::saveUserProfile'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.user.get_data
:
path
:
'
/epal/userdata'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\CurrentUser::getEpalUserData'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.current_user
:
path
:
'
/epal/curuser'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\CurrentUser::getLoginInfo'
requirements
:
_user_is_logged_in
:
'
TRUE'
submitedapplications
:
path
:
'
/epal/subapplic'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\SubmitedApplications::getSubmittedApplications'
requirements
:
_user_is_logged_in
:
'
TRUE'
studentapplication
:
path
:
'
/epal/student/{studentId}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\SubmitedApplications::getStudentApplications'
requirements
:
_user_is_logged_in
:
'
TRUE'
epalchosen
:
path
:
'
/epal/epalchosen/{studentId}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\SubmitedApplications::getEpalChosen'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.application_submit
:
path
:
'
/epal/appsubmit'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\ApplicationSubmit::appSubmit'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.demo_data
:
path
:
'
/epal/demodata'
defaults
:
_controller
:
'
\Drupal\epal\Controller\CreateDemoData::createData'
requirements
:
_access
:
'
TRUE'
epal.allocation
:
path
:
'
/epal/distribution'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\Distribution::createDistribution'
requirements
:
_user_is_logged_in
:
'
TRUE'
sectorperschool
:
path
:
'
/epal/sectorperSchool/{epalId}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::getSectorsPerSchool'
requirements
:
_user_is_logged_in
:
'
TRUE'
specialityperschool
:
path
:
'
/epal/specialityperSchool/{epalId}/{sectorId}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::getSpecialPerSchool'
requirements
:
_user_is_logged_in
:
'
TRUE'
confirmstudents
:
path
:
'
/epal/confirmstudent'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::ConfirmStudents'
requirements
:
_user_is_logged_in
:
'
TRUE'
studentperschool
:
path
:
'
/epal/studentperSchool/{epalId}/{selectId}/{classId}/{limitdown}/{limitup}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::getStudentPerSchool'
requirements
:
_user_is_logged_in
:
'
TRUE'
savecapacity
:
path
:
'
/epal/savecapacity/{taxi}/{tomeas}/{specialit}/{schoolid}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::SaveCapacity'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.log_in_go
:
path
:
'
/ministry/login'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\MinistryLogin::loginGo'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.log_out_go
:
path
:
'
/ministry/logout'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\MinistryLogin::logoutGo'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.general_report
:
path
:
'
/ministry/general-report'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\ReportsCreator::makegGeneralReport'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.report-completeness
:
path
:
'
/ministry/report-completeness'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\ReportsCreator::makeReportCompleteness'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.report-all-stat
:
path
:
'
/ministry/report-all-stat'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\ReportsCreator::makeReportAllStat'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.massive_mail
:
path
:
'
/ministry/send-massive-mail'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\InformUnlocatedStudents::sendMailToStudents'
requirements
:
_user_is_logged_in
:
'
TRUE'
drupal/modules/epal/epal_config.page.inc
0 → 100644
View file @
7e689996
<?php
/**
* @file
* Contains epal_config.page.inc.
*
* Page callback for Epal config entities.
*/
use
Drupal\Core\Render\Element
;
use
Drupal\Core\Link
;
use
Drupal\Core\Url
;
/**
* Prepares variables for Epal config templates.
*
* Default template: epal_config.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_config
(
array
&
$variables
)
{
// Fetch EpalConfig Entity Object.
$epal_config
=
$variables
[
'elements'
][
'#epal_config'
];
// Helpful $content variable for templates.
foreach
(
Element
::
children
(
$variables
[
'elements'
])
as
$key
)
{
$variables
[
'content'
][
$key
]
=
$variables
[
'elements'
][
$key
];
}
}
drupal/modules/epal/src/Controller/CreateDemoData.php
0 → 100644
View file @
7e689996
<?php
/**
* @file
* Contains \Drupal\query_example\Controller\QueryExampleController.
*/
namespace
Drupal\epal\Controller
;
use
Drupal\Core\Entity\Query\QueryFactory
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Symfony\Component\HttpFoundation\JsonResponse
;
use
Drupal\Core\Controller\ControllerBase
;
use
Symfony\Component\HttpFoundation\RedirectResponse
;
use
Drupal\Core\Database\Connection
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Drupal\Core\Logger\LoggerChannelFactoryInterface
;
class
CreateDemoData
extends
ControllerBase
{
protected
$entity_query
;
protected
$entityTypeManager
;
protected
$logger
;
protected
$connection
;
public
function
__construct
(
EntityTypeManagerInterface
$entityTypeManager
,
QueryFactory
$entity_query
,
Connection
$connection
,
LoggerChannelFactoryInterface
$loggerChannel
)
{
$this
->
entityTypeManager
=
$entityTypeManager
;
$this
->
entity_query
=
$entity_query
;
$this
->
connection
=
$connection
;
$this
->
logger
=
$loggerChannel
->
get
(
'epal'
);
}
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'entity.manager'
),
$container
->
get
(
'entity.query'
),
$container
->
get
(
'database'
),
$container
->
get
(
'logger.factory'
)
);
}
public
function
make_seed
()
{
list
(
$usec
,
$sec
)
=
explode
(
' '
,
microtime
());
return
$sec
+
$usec
*
1000000
;
}
public
function
UniqueRandNum
(
$min
,
$max
,
$quantity
)
{
$numbers
=
range
(
$min
,
$max
);
shuffle
(
$numbers
);
return
array_slice
(
$numbers
,
0
,
$quantity
);
}
public
function
createData
()
{
$transaction
=
$this
->
connection
->
startTransaction
();
$school_id_start
=
197
;
$school_id_end
=
228
;
try
{
//insert demo records in entity: epal_student
$entity_manager
=
\
Drupal
::
entityTypeManager
();
$epaluserid
=
\
Drupal
::
currentUser
()
->
id
();
for
(
$i
=
1
;
$i
<=
2500
;
$i
++
)
{
//srand($this->make_seed());
$curclass
=
rand
(
1
,
3
);
//$curclass = 2;
//$currentepal = rand(137,165);
$currentepal
=
rand
(
$school_id_start
,
$school_id_end
);
$student
=
array
(
//'epaluser_id' => $aitisi[0][epaluser_id],
'epaluser_id'
=>
$epaluserid
,
'name'
=>
"firstname"
.
$i
,
'studentsurname'
=>
"surname"
.
$i
,
//'birthdate' => $aitisi[0][birthdate],
'birthdate'
=>
'01/01/1970'
,
//'fatherfirstname' => $aitisi[0][fatherfirstname],
'fatherfirstname'
=>
"fatherfirstname"
.
$i
,
//'fathersurname' => $aitisi[0][fathersurname],
'fathersurname'
=>
"fathersurname"
.
$i
,
//'motherfirstname' => $aitisi[0][motherfirstname],
'motherfirstname'
=>
"motherfirstname"
.
$i
,
//'mothersurname' => $aitisi[0][mothersurname],
'mothersurname'
=>
"mothersurname"
.
$i
,
//'studentamka' => $aitisi[0][studentamka],
//'regionaddress' => $aitisi[0][regionaddress],
'regionaddress'
=>
"regionaddress"
.
$i
,
//'regionarea' => $aitisi[0][regionarea],
'regionarea'
=>
"regionarea"
.
$i
,
//'regiontk' => $aitisi[0][regiontk],
'regiontk'
=>
"tk"
.
$i
,
//'certificatetype' => $aitisi[0][certificatetype],
'certificatetype'
=>
'Απολυτήριο Γυμνασίου'
,
//'lastam' => $aitisi[0][lastam],
'currentclass'
=>
$curclass
,
'currentepal'
=>
$currentepal
,
//'currentsector' => $aitisi[0][currentsector],
//'relationtostudent' => $aitisi[0][relationtostudent],
'relationtostudent'
=>
'Μαθητής'
,
//'telnum' => $aitisi[0][telnum],
'telnum'
=>
'6944123456'
,
'points'
=>
rand
(
0
,
20
)
);
$entity_storage_student
=
$entity_manager
->
getStorage
(
'epal_student'
);
$entity_object
=
$entity_storage_student
->
create
(
$student
);
$entity_storage_student
->
save
(
$entity_object
);
$created_student_id
=
$entity_object
->
id
();
//insert records in entity: epal_student_course_field (αφορά μαθητές Γ' Λυκείου)
// or: epal_student_sector_field (αφορά μαθητές Β' Λυκείου)
$availableSchools
=
array
();
if
(
$curclass
===
3
)
{
do
{
$coursefield_id
=
rand
(
1
,
54
);
$course
=
array
(
'student_id'
=>
$created_student_id
,
'coursefield_id'
=>
$coursefield_id
);
$entity_storage_course
=
$entity_manager
->
getStorage
(
'epal_student_course_field'
);
$entity_object
=
$entity_storage_course
->
create
(
$course
);
//$entity_storage_course->save($entity_object);
//εύρεση ΕΠΑΛ που διαθέτουν την αντίστοιχη ειδικότητα
print_r
(
"<br> EIDIKOTHTA: "
.
$coursefield_id
);
$eepalSpecialtiesInEpal_storage
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_specialties_in_epal'
);
//$eepalSpecialtiesInEpal = $eepalSpecialtiesInEpal_storage->loadByProperties(array('specialty_id' => $coursefield_id) );
$ids
=
$eepalSpecialtiesInEpal_storage
->
getQuery
()
->
condition
(
'specialty_id'
,
$coursefield_id
,
"="
)
//->condition('epal_id', 137, ">=")
//->condition('epal_id', 165, "<=")
->
condition
(
'epal_id'
,
$school_id_start
,
">="
)
->
condition
(
'epal_id'
,
$school_id_end
,
"<="
)
->
execute
();
$eepalSpecialtiesInEpal
=
$eepalSpecialtiesInEpal_storage
->
loadMultiple
(
$ids
);
print_r
(
"<br> NUM_SCHOOLS: "
.
sizeof
(
$eepalSpecialtiesInEpal
));
foreach
(
$eepalSpecialtiesInEpal
as
$eepalSpecialInEp
)
{
array_push
(
$availableSchools
,
$eepalSpecialInEp
->
epal_id
->
getString
());
}
if
(
sizeof
(
$availableSchools
)
!=
0
)
$entity_storage_course
->
save
(
$entity_object
);
}
//end do
while
(
sizeof
(
$availableSchools
)
==
0
);
$entity_storage_course
->
resetCache
();
$eepalSpecialtiesInEpal_storage
->
resetCache
();
}
else
if
(
$curclass
===
2
)
{
do
{
$sectorfield_id
=
rand
(
1
,
9
);
$sector
=
array
(
'student_id'
=>
$created_student_id
,
'sectorfield_id'
=>
$sectorfield_id
);
$entity_storage_sector
=
$entity_manager
->
getStorage
(
'epal_student_sector_field'
);
$entity_object
=
$entity_storage_sector
->
create
(
$sector
);
//$entity_storage_sector->save($entity_object);
//εύρεση ΕΠΑΛ που διαθέτουν τον αντίστοιχο τομέα
print_r
(
"<br> TOMEAS: "
.
$sectorfield_id
);
$eepalSectorsInEpal_storage
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_sectors_in_epal'
);
$ids
=
$eepalSectorsInEpal_storage
->
getQuery
()
->
condition
(
'sector_id'
,
$sectorfield_id
,
"="
)
//->condition('epal_id', 137, ">=")
//->condition('epal_id', 165, "<=")
->
condition
(
'epal_id'
,
$school_id_start
,
">="
)
->
condition
(
'epal_id'
,
$school_id_end
,
"<="
)
->
execute
();
$eepalSectorsInEpal
=
$eepalSectorsInEpal_storage
->
loadMultiple
(
$ids
);
print_r
(
"<br> NUM_SCHOOLS: "
.
sizeof
(
$eepalSectorsInEpal
));
foreach
(
$eepalSectorsInEpal
as
$eepalSecInEp
)
{
array_push
(
$availableSchools
,
$eepalSecInEp
->
epal_id
->
getString
());
}
if
(
sizeof
(
$availableSchools
)
!=
0
)
$entity_storage_sector
->
save
(
$entity_object
);
}
//end do
while
(
sizeof
(
$availableSchools
)
==
0
);
$entity_storage_sector
->
resetCache
();
$eepalSectorsInEpal_storage
->
resetCache
();
}
else
if
(
$curclass
===
1
)
{
print_r
(
"<br> CLASS A: "
);
//$school_id_start = 137;
//$school_id_end = 165;
//$school_id_start = 5;
//for ($l=0; $l < 29; $l++)
for
(
$l
=
0
;
$l
<
$school_id_end
-
$school_id_start
+
1
;
$l
++
)
//for ($l=0; $l < 395; $l++)
array_push
(
$availableSchools
,
$school_id_start
+
$l
);
}
$numEpalsChosen
=
rand
(
1
,
3
);
if
(
$numEpalsChosen
>
sizeof
(
$availableSchools
))
$numEpalsChosen
=
sizeof
(
$availableSchools
);
print_r
(
"<br> NUM_EPAL_CHOSEN "
.
$numEpalsChosen
);
$epal_id_index
=
$this
->
UniqueRandNum
(
0
,
sizeof
(
$availableSchools
)
-
1
,
$numEpalsChosen
);
for
(
$j
=
0
;
$j
<
$numEpalsChosen
;
$j
++
)
{
print_r
(
"<br> EPAL_CHOSEN_ID: "
.
$epal_id_index
[
$j
]);
print_r
(
"<br> EPAL_CHOSEN_REAL_ID: "
.
$availableSchools
[
$epal_id_index
[
$j
]]);
}
for
(
$j
=
0
;
$j
<
$numEpalsChosen
;
$j
++
)
{
$epalchosen
=
array
(
'student_id'
=>
$created_student_id
,
'epal_id'
=>
$availableSchools
[
$epal_id_index
[
$j
]],
'choice_no'
=>
$j
+
1
);
$entity_storage_epalchosen
=
$entity_manager
->
getStorage
(
'epal_student_epal_chosen'
);
$entity_object
=
$entity_storage_epalchosen
->
create
(
$epalchosen
);
$entity_storage_epalchosen
->
save
(
$entity_object
);
}
$entity_storage_epalchosen
->
resetCache
();
$entity_storage_student
->
resetCache
();
/*
//TO BE CONSIDERED
if ($curclass === 2 || $curclass === 3) {
//33% των μαθητών της Β' και Γ' Λυκείου δηλώνουν προτίμηση στο σχολείο που ήδη φοιτούν
if (rand(1,3) === 1) {
$epal_id[0] = $currentepal;
}
}
*/
}
}
catch
(
\
Exception
$e
)
{
$this
->
logger
->
warning
(
$e
->
getMessage
());
$returnmsg
=
"Αποτυχία καταχώρησης demo data!"
;
$response
=
new
JsonResponse
([
$returnmsg
]);
// $transaction->rollback();
return
$response
;
}
$response
=
new
JsonResponse
([
'hello'
=>
'world'
]);
$response
->
headers
->
set
(
'X-AUTH-TOKEN'
,
'HELLOTOKEN'
);
return
$response
;
}
}
drupal/modules/epal/src/Entity/EpalConfig.php
0 → 100644
View file @
7e689996
<?php
namespace
Drupal\epal\Entity
;
use
Drupal\Core\Entity\EntityStorageInterface
;
use
Drupal\Core\Field\BaseFieldDefinition
;
use
Drupal\Core\Entity\ContentEntityBase
;
use
Drupal\Core\Entity\EntityChangedTrait
;
use
Drupal\Core\Entity\EntityTypeInterface
;
use
Drupal\epal\EpalConfigInterface
;
use
Drupal\user\UserInterface
;
/**
* Defines the Epal config entity.
*
* @ingroup epal
*
* @ContentEntityType(