Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Χάρης Παπαδόπουλος
e-epal
Commits
140d97e2
Commit
140d97e2
authored
Apr 11, 2017
by
Χάρης Παπαδόπουλος
Browse files
merged from remote - resolved conflicts
parents
47e82951
50c623c6
Changes
16
Hide whitespace changes
Inline
Side-by-side
drupal/modules/epal/epal.routing.yml
View file @
140d97e2
...
...
@@ -82,3 +82,44 @@ epal.allocation:
_controller
:
'
\Drupal\epal\Controller\Distribution::createDistribution'
requirements
:
_access
:
'
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}'
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'
drupal/modules/epal/src/Controller/CreateDemoData.php
View file @
140d97e2
...
...
@@ -71,7 +71,7 @@ class CreateDemoData extends ControllerBase {
$epaluserid
=
\
Drupal
::
currentUser
()
->
id
();
for
(
$i
=
1
;
$i
<=
1
1
00
;
$i
++
)
{
for
(
$i
=
1
;
$i
<=
1
00
00
;
$i
++
)
{
//srand($this->make_seed());
//$curclass = rand(1,3);
...
...
drupal/modules/epal/src/Controller/DirectorView.php
0 → 100644
View file @
140d97e2
<?php
namespace
Drupal\epal\Controller
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Symfony\Component\HttpFoundation\JsonResponse
;
use
Drupal\Core\Controller\ControllerBase
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Response
;
use
Drupal\Core\Database\Connection
;
use
Drupal\Core\Logger\LoggerChannelFactoryInterface
;
class
DirectorView
extends
ControllerBase
{
protected
$entityTypeManager
;
public
function
__construct
(
EntityTypeManagerInterface
$entityTypeManager
)
{
$this
->
entityTypeManager
=
$entityTypeManager
;
}
public
static
function
create
(
ContainerInterface
$container
)
{
return
new
static
(
$container
->
get
(
'entity_type.manager'
)
);
}
public
function
getSectorsPerSchool
(
Request
$request
,
$epalId
)
{
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$epalUsers
=
$this
->
entityTypeManager
->
getStorage
(
'epal_users'
)
->
loadByProperties
(
array
(
'authtoken'
=>
$authToken
));
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$userid
=
$epalUser
->
user_id
->
entity
->
id
();
$epalIdNew
=
intval
(
$epalId
);
$sectorPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_sectors_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$epalIdNew
));
$i
=
0
;
if
(
$sectorPerSchool
)
{
$list
=
array
();
foreach
(
$sectorPerSchool
as
$object
)
{
$list
[]
=
array
(
'sector_id'
=>
$object
->
sector_id
->
entity
->
get
(
'name'
)
->
value
,
'id'
=>
$object
->
sector_id
->
entity
->
id
()
);
$i
++
;
}
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"School not found!!!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
public
function
getSpecialPerSchool
(
Request
$request
,
$epalId
,
$sectorId
)
{
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$epalUsers
=
$this
->
entityTypeManager
->
getStorage
(
'epal_users'
)
->
loadByProperties
(
array
(
'authtoken'
=>
$authToken
));
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$userid
=
$epalUser
->
user_id
->
entity
->
id
();
$epalIdNew
=
intval
(
$epalId
);
$specialityPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_specialties_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$epalIdNew
));
$i
=
0
;
if
(
$specialityPerSchool
)
{
$list
=
array
();
$SectorIdNew
=
intval
(
$sectorId
);
foreach
(
$specialityPerSchool
as
$object
)
{
$idSpecial
=
$object
->
specialty_id
->
entity
->
id
()
;
$specialityPerSector
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_specialty'
)
->
loadByProperties
(
array
(
'id'
=>
$idSpecial
,
'sector_id'
=>
$SectorIdNew
));
$specialPerSec
=
reset
(
$specialityPerSector
);
if
(
$specialPerSec
)
{
$list
[]
=
array
(
'specialty_id'
=>
$object
->
specialty_id
->
entity
->
get
(
'name'
)
->
value
,
'id'
=>
$object
->
specialty_id
->
entity
->
id
()
);
$i
++
;
}
}
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"School not found!!!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
public
function
getStudentPerSchool
(
Request
$request
,
$epalId
,
$selectId
,
$classId
)
{
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$epalUsers
=
$this
->
entityTypeManager
->
getStorage
(
'epal_users'
)
->
loadByProperties
(
array
(
'authtoken'
=>
$authToken
));
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$userid
=
$epalUser
->
user_id
->
entity
->
id
();
$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
));
}
else
{
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$epalIdNew
,
'specialization_id'
=>
$selectIdNew
,
'currentclass'
=>
$classId
));
}
$i
=
0
;
if
(
$studentPerSchool
)
{
$list
=
array
();
foreach
(
$studentPerSchool
as
$object
)
{
$studentId
=
$object
->
id
()
;
$epalStudents
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student'
)
->
loadByProperties
(
array
(
'id'
=>
$studentId
));
$epalStudent
=
reset
(
$epalStudents
);
$i
=
0
;
if
(
$epalStudents
)
{
$list
[]
=
array
(
'id'
=>
$epalStudent
->
id
(),
'name'
=>
$epalStudent
->
name
->
value
,
'studentsurname'
=>
$epalStudent
->
studentsurname
->
value
,
'fatherfirstname'
=>
$epalStudent
->
fatherfirstname
->
value
,
'fathersurname'
=>
$epalStudent
->
fathersurname
->
value
,
'motherfirstname'
=>
$epalStudent
->
motherfirstname
->
value
,
'mothersurname'
=>
$epalStudent
->
mothersurname
->
value
,
'birthdate'
=>
$epalStudent
->
birthdate
->
value
,
);
$i
++
;
}
}
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"No students found!!!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
public
function
ConfirmStudents
(
Request
$request
)
{
if
(
!
$request
->
isMethod
(
'POST'
))
{
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Method Not Allowed"
)
],
Response
::
HTTP_METHOD_NOT_ALLOWED
);
}
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$epalUsers
=
$this
->
entityTypeManager
->
getStorage
(
'epal_users'
)
->
loadByProperties
(
array
(
'authtoken'
=>
$authToken
));
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$postData
=
null
;
if
(
$content
=
$request
->
getContent
())
{
$postData
=
json_decode
(
$content
);
$arr
=
$postData
->
students
;
foreach
(
$arr
as
$value
)
{
$valnew
=
intval
(
$value
);
$studentForConfirm
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'id'
=>
$valnew
));
$studentConfirm
=
reset
(
$studentForConfirm
);
if
(
$studentConfirm
)
{
$studentConfirm
->
set
(
'directorconfirm'
,
true
);
$studentConfirm
->
save
();
}
}
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"saved"
),
],
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"post with no data"
),
],
Response
::
HTTP_BAD_REQUEST
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"EPAL user not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
public
function
SaveCapacity
(
Request
$request
,
$taxi
,
$tomeas
,
$specialit
,
$schoolid
)
{
if
(
!
$request
->
isMethod
(
'POST'
))
{
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Method Not Allowed"
)
],
Response
::
HTTP_METHOD_NOT_ALLOWED
);
}
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$epalUsers
=
$this
->
entityTypeManager
->
getStorage
(
'epal_users'
)
->
loadByProperties
(
array
(
'authtoken'
=>
$authToken
));
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$postData
=
null
;
if
(
$content
=
$request
->
getContent
())
{
$postData
=
json_decode
(
$content
);
$cap
=
$postData
->
capacity
;
if
((
$tomeas
==
0
)
||
(
$specialit
==
0
))
{
$CapacityPerClass
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'id'
=>
$schoolid
));
$classcapacity
=
reset
(
$CapacityPerClass
);
if
(
$classcapacity
)
{
$classcapacity
->
set
(
'capacity_class_a'
,
$cap
);
$classcapacity
->
save
();
}
}
if
((
$tomeas
!=
0
)
||
(
$specialit
==
0
))
{
$CapacityPerClass
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_sectors_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'sector_id'
=>
$tomeas
));
$classcapacity
=
reset
(
$CapacityPerClass
);
if
(
$classcapacity
)
{
$classcapacity
->
set
(
'capacity_class_sector'
,
$cap
);
$classcapacity
->
save
();
}
}
if
((
$tomeas
!=
0
)
||
(
$specialit
!=
0
))
{
$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'
,
$cap
);
$classcapacity
->
save
();
}
}
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"saved"
),
],
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"post with no data"
),
],
Response
::
HTTP_BAD_REQUEST
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"EPAL user not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
private
function
respondWithStatus
(
$arr
,
$s
)
{
$res
=
new
JsonResponse
(
$arr
);
$res
->
setStatusCode
(
$s
);
return
$res
;
}
}
drupal/modules/epal/src/Entity/EpalStudentClass.php
View file @
140d97e2
...
...
@@ -122,6 +122,7 @@ class EpalStudentClass extends ContentEntityBase implements EpalStudentClassInte
return
$this
;
}
/**
* {@inheritdoc}
*/
...
...
drupal/modules/epaldeploysystem/config/install/views.view.coursesperschool.yml
View file @
140d97e2
...
...
@@ -13,7 +13,7 @@ dependencies:
-
serialization
-
user
_core
:
default_config_hash
:
X-Hp7xhmfNgEXwpE0VYHvI6BIYiDJDxGhGXtNwpeiCs
default_config_hash
:
7lFDDggbFVzw0CGbo37kC2WLyNHGubRf8VfvN8b5iQ0
id
:
coursesperschool
label
:
coursesperschool
module
:
views
...
...
@@ -368,6 +368,73 @@ display:
entity_type
:
eepal_school
entity_field
:
name
plugin_id
:
field
special_case
:
id
:
special_case
table
:
eepal_school_field_data
field
:
special_case
relationship
:
epal_id
group_type
:
group
admin_label
:
'
'
label
:
'
'
exclude
:
false
alter
:
alter_text
:
false
text
:
'
'
make_link
:
false
path
:
'
'
absolute
:
false
external
:
false
replace_spaces
:
false
path_case
:
none
trim_whitespace
:
false
alt
:
'
'
rel
:
'
'
link_class
:
'
'
prefix
:
'
'
suffix
:
'
'
target
:
'
'
nl2br
:
false
max_length
:
0
word_boundary
:
true
ellipsis
:
true
more_link
:
false
more_link_text
:
'
'
more_link_path
:
'
'
strip_tags
:
false
trim
:
false
preserve_tags
:
'
'
html
:
false
element_type
:
'
'
element_class
:
'
'
element_label_type
:
'
'
element_label_class
:
'
'
element_label_colon
:
false
element_wrapper_type
:
'
'
element_wrapper_class
:
'
'
element_default_classes
:
true
empty
:
'
'
hide_empty
:
false
empty_zero
:
false
hide_alter_empty
:
true
click_sort_column
:
value
type
:
boolean
settings
:
format
:
default
format_custom_true
:
'
'
format_custom_false
:
'
'
group_column
:
value
group_columns
:
{
}
group_rows
:
true
delta_limit
:
0
delta_offset
:
0
delta_reversed
:
false
delta_first_last
:
false
multi_type
:
separator
separator
:
'
,
'
field_api_classes
:
false
entity_type
:
eepal_school
entity_field
:
special_case
plugin_id
:
field
filters
:
{
}
sorts
:
id_1
:
...
...
@@ -519,11 +586,8 @@ display:
name_2
:
alias
:
epal_name
raw_output
:
true
id_2
:
alias
:
course_id
raw_output
:
true
specialty_id
:
alias
:
course_name
special_case
:
alias
:
epal_special_case
raw_output
:
true
path
:
coursesperschool/list
pager
:
...
...
drupal/modules/epaldeploysystem/config/install/views.view.regional_epal.yml
View file @
140d97e2
...
...
@@ -12,7 +12,7 @@ dependencies:
-
serialization
-
user
_core
:
default_config_hash
:
jN_EIEThsJ2oXHaytnygkFnn2JT0t0QskuCm77DjmZk
default_config_hash
:
ZHZhkwcVWVjmlZWp7DXduGPF5RhR1_GHwIV4HQXZC2w
id
:
regional_epal
label
:
regional_epal
module
:
views
...
...
@@ -214,6 +214,73 @@ display:
multi_type
:
separator
separator
:
'
,
'
field_api_classes
:
false
special_case
:
id
:
special_case
table
:
eepal_school_field_data
field
:
special_case
relationship
:
none
group_type
:
group
admin_label
:
'
'
label
:
'
'
exclude
:
false
alter
:
alter_text
:
false
text
:
'
'
make_link
:
false
path
:
'
'
absolute
:
false
external
:
false
replace_spaces
:
false
path_case
:
none
trim_whitespace
:
false
alt
:
'
'
rel
:
'
'
link_class
:
'
'
prefix
:
'
'
suffix
:
'
'
target
:
'
'
nl2br
:
false
max_length
:
0
word_boundary
:
true
ellipsis
:
true
more_link
:
false
more_link_text
:
'
'
more_link_path
:
'
'
strip_tags
:
false
trim
:
false
preserve_tags
:
'
'
html
:
false
element_type
:
'
'
element_class
:
'
'
element_label_type
:
'
'
element_label_class
:
'
'
element_label_colon
:
false
element_wrapper_type
:
'
'
element_wrapper_class
:
'
'
element_default_classes
:
true
empty
:
'
'
hide_empty
:
false
empty_zero
:
false
hide_alter_empty
:
true
click_sort_column
:
value
type
:
boolean
settings
:
format
:
default
format_custom_true
:
'
'
format_custom_false
:
'
'
group_column
:
value
group_columns
:
{
}
group_rows
:
true
delta_limit
:
0
delta_offset
:
0
delta_reversed
:
false
delta_first_last
:
false
multi_type
:
separator
separator
:
'
,
'
field_api_classes
:
false
entity_type
:
eepal_school
entity_field
:
special_case
plugin_id
:
field
id
:
id
:
id
table
: