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
245bf2d6
Commit
245bf2d6
authored
Jun 12, 2017
by
Νίκος Κατσαούνος
Browse files
added report CountApplications, updated several components/controllers
parent
512d5de2
Changes
9
Hide whitespace changes
Inline
Side-by-side
drupal/modules/epal/epal.routing.yml
View file @
245bf2d6
...
...
@@ -134,6 +134,14 @@ epal.ministry.log_out_go:
_controller
:
'
\Drupal\epal\Controller\MinistryLogin::logoutGo'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.report_users
:
path
:
'
/ministry/report-users'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\ReportsCreator::makeReportUsers'
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.general_report
:
path
:
'
/ministry/general-report'
options
:
...
...
@@ -207,7 +215,7 @@ epal.ministry.retrievesettings:
requirements
:
_user_is_logged_in
:
'
TRUE'
epal.ministry.storesettings
:
path
:
'
/ministry/store-settings/{capacityDisabled}/{directorViewDisabled}/{applicantsLoginDisabled}/{applicantsResultsDisabled}'
path
:
'
/ministry/store-settings/{capacityDisabled}/{directorViewDisabled}/{applicantsLoginDisabled}/{applicantsResultsDisabled}
/{secondPeriodEnabled}
'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
...
...
drupal/modules/epal/src/Controller/ApplicationSubmit.php
View file @
245bf2d6
...
...
@@ -131,6 +131,7 @@ class ApplicationSubmit extends ControllerBase
],
Response
::
HTTP_FORBIDDEN
);
}
$second_period
=
$this
->
retrievePeriod
();
$student
=
array
(
'langcode'
=>
'el'
,
...
...
@@ -170,7 +171,9 @@ class ApplicationSubmit extends ControllerBase
'guardian_mothername'
=>
$guardian_mothername_encoded
,
'agreement'
=>
$applicationForm
[
0
][
'disclaimer_checked'
],
'relationtostudent'
=>
$relationtostudent_encoded
,
'telnum'
=>
$telnum_encoded
'telnum'
=>
$telnum_encoded
,
'second_period'
=>
$second_period
,
);
if
((
$errorCode
=
$this
->
validateStudent
(
$student
))
>
0
)
{
...
...
@@ -253,12 +256,28 @@ class ApplicationSubmit extends ControllerBase
return
$res
;
}
private
function
retrievePeriod
()
{
$config_storage
=
$this
->
entityTypeManager
->
getStorage
(
'epal_config'
);
$epalConfigs
=
$config_storage
->
loadByProperties
(
array
(
'name'
=>
'epal_config'
));
$epalConfig
=
reset
(
$epalConfigs
);
if
(
!
$epalConfig
)
return
0
;
else
$secondPeriodEnabled
=
$epalConfig
->
activate_second_period
->
getString
();
return
$secondPeriodEnabled
;
}
/**
*
* @return int error code ελέγχου; 0 εάν ο έλεγχος επιτύχει, μη μηδενικό εάν αποτύχει:
* 1001 δεν επιλέχθηκε το πλαίσιο συμφωνης γνώμης
* 1002 λανθασμένο τελευταίο έτος φοίτησης
* 1003 λανθασμένη ημερομηνία
* 1004-> 1023: λανθασμένα πεδία αίτησης
* 8000 μη αναμενόμενο λάθος
* 8001 δικτυακό λάθος κλήσης υπηρεσίας επιβεβαίωσης στοιχείων
* 8002 τα στοιχεία φοίτησης δεν επικυρώθηκαν
...
...
@@ -281,6 +300,67 @@ class ApplicationSubmit extends ControllerBase
}
$birthdate
=
"
{
$date_parts
[
2
]
}
-
{
$date_parts
[
1
]
}
-
{
$date_parts
[
0
]
}
"
;
if
(
!
$student
[
"name"
])
{
return
1004
;
}
if
(
!
$student
[
"studentsurname"
])
{
return
1005
;
}
if
(
!
$student
[
"fatherfirstname"
])
{
return
1006
;
}
if
(
!
$student
[
"motherfirstname"
])
{
return
1007
;
}
if
(
!
$student
[
"regionaddress"
])
{
return
1008
;
}
if
(
!
$student
[
"regiontk"
])
{
return
1009
;
}
if
(
!
$student
[
"regionarea"
])
{
return
1010
;
}
if
(
!
$student
[
"certificatetype"
])
{
return
1011
;
}
if
(
!
$student
[
"graduation_year"
])
{
return
1012
;
}
if
(
!
$student
[
"currentclass"
]
||
(
$student
[
"currentclass"
]
!==
"1"
&&
$student
[
"currentclass"
]
!==
"2"
&&
$student
[
"currentclass"
]
!==
"3"
&&
$student
[
"currentclass"
]
!==
"4"
)
)
{
return
1013
;
}
if
(
!
$student
[
"relationtostudent"
])
{
return
1014
;
}
if
(
!
$student
[
"telnum"
])
{
return
1015
;
}
if
(
!
$student
[
"guardian_name"
])
{
return
1016
;
}
if
(
!
$student
[
"guardian_surname"
])
{
return
1017
;
}
if
(
!
$student
[
"guardian_fathername"
])
{
return
1018
;
}
if
(
!
$student
[
"guardian_mothername"
])
{
return
1019
;
}
if
(
!
$student
[
"lastschool_registrynumber"
])
{
return
1020
;
}
if
(
!
$student
[
"lastschool_unittypeid"
])
{
return
1021
;
}
if
(
!
$student
[
"lastschool_schoolname"
])
{
return
1022
;
}
if
(
!
$student
[
"lastschool_class"
])
{
return
1023
;
}
// check as per specs:
// - can't check certification prior to 2014, pass through
// - check certification if last passed class is gym
...
...
drupal/modules/epal/src/Controller/PdfCreator.php
View file @
245bf2d6
...
...
@@ -75,18 +75,34 @@ class PDFCreator extends ControllerBase {
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$users
=
$this
->
entityTypeManager
->
getStorage
(
'user'
)
->
loadByProperties
(
array
(
'name'
=>
$authToken
));
$user
=
reset
(
$users
);
/*
return $this->respondWithStatus([
'message' => t("User:") . $authToken,
], Response::HTTP_FORBIDDEN);
*/
if
(
!
$user
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
//test
/*
return $this->respondWithStatus([
'message' => t("User:") . $authToken,
], Response::HTTP_FORBIDDEN);
*/
//New epal-user validation
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$epalUsers
=
$this
->
entityTypeManager
->
getStorage
(
'epal_users'
)
->
loadByProperties
(
array
(
'authtoken'
=>
$authToken
));
$epalUser
=
reset
(
$epalUsers
);
if
(
$epalUser
)
{
$userid
=
$epalUser
->
id
();
$epalStudents
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student'
)
->
loadByProperties
(
array
(
'epaluser_id'
=>
$userid
));
if
(
!
$epalStudents
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"EPAL User not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
//end New User validation
//user role validation
$roles
=
$user
->
getRoles
();
...
...
drupal/modules/epal/src/Controller/ReportsCreator.php
View file @
245bf2d6
...
...
@@ -61,6 +61,71 @@ class ReportsCreator extends ControllerBase {
}
public
function
makeReportUsers
(
Request
$request
)
{
try
{
if
(
!
$request
->
isMethod
(
'GET'
))
{
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Method Not Allowed"
)
],
Response
::
HTTP_METHOD_NOT_ALLOWED
);
}
//user validation
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$users
=
$this
->
entityTypeManager
->
getStorage
(
'user'
)
->
loadByProperties
(
array
(
'name'
=>
$authToken
));
$user
=
reset
(
$users
);
if
(
!
$user
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found"
),
],
Response
::
HTTP_FORBIDDEN
);
}
//user role validation
$roles
=
$user
->
getRoles
();
$validRole
=
false
;
foreach
(
$roles
as
$role
)
if
(
$role
===
"ministry"
)
{
$validRole
=
true
;
break
;
}
if
(
!
$validRole
)
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User Invalid Role"
),
],
Response
::
HTTP_FORBIDDEN
);
}
//υπολογισμός αριθμού δηλώσεων
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
));
$numApplications
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
//υπολογισμός αριθμού χρηστών
$sCon
=
$this
->
connection
->
select
(
'epal_users'
,
'eUser'
)
->
fields
(
'eUser'
,
array
(
'id'
));
$numUsers
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
$list
=
array
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Αιτήσεων"
,
'numStudents'
=>
$numApplications
));
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Εγγεγραμένων Χρηστών"
,
'numStudents'
=>
$numUsers
));
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
//end try
catch
(
\
Exception
$e
)
{
$this
->
logger
->
warning
(
$e
->
getMessage
());
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"An unexpected problem occured during makegGeneralReport Method"
)
],
Response
::
HTTP_INTERNAL_SERVER_ERROR
);
}
}
public
function
makegGeneralReport
(
Request
$request
)
{
try
{
...
...
source/components/minister/minister-reports.ts
View file @
245bf2d6
...
...
@@ -61,6 +61,13 @@ import { API_ENDPOINT } from '../../app.settings';
<br><br>
</div>
-->
<div *ngIf = "minedu_userName != '' && userRole != 'pde' && userRole != 'dide'">
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(0)" >
<i class="fa fa-file-text"></i>
Αριθμός Αιτήσεων / Εγγεγραμμένων Χρηστών
</button>
<br><br>
</div>
<div *ngIf = "minedu_userName != '' && userRole != 'pde' && userRole != 'dide'">
<button type="button" class="btn btn-alert" (click)="nav_to_reportpath(1)" >
...
...
@@ -167,6 +174,8 @@ import { API_ENDPOINT } from '../../app.settings';
nav_to_reportpath
(
repId
)
{
if
(
repId
==
0
)
this
.
router
.
navigate
([
'
/ministry/report-users
'
,
repId
]);
if
(
repId
==
1
)
this
.
router
.
navigate
([
'
/ministry/report-general
'
,
repId
]);
else
if
(
repId
==
2
||
repId
==
3
||
repId
==
5
)
...
...
source/components/minister/report-users.ts
0 → 100644
View file @
245bf2d6
import
{
Component
,
OnInit
,
OnDestroy
,
ElementRef
,
ViewChild
,
Input
}
from
"
@angular/core
"
;
import
{
Injectable
}
from
"
@angular/core
"
;
import
{
AppSettings
}
from
'
../../app.settings
'
;
import
{
HelperDataService
}
from
'
../../services/helper-data-service
'
;
import
{
Observable
}
from
"
rxjs/Observable
"
;
import
{
Http
,
Headers
,
RequestOptions
}
from
'
@angular/http
'
;
import
{
NgRedux
,
select
}
from
'
ng2-redux
'
;
import
{
IAppState
}
from
'
../../store/store
'
;
import
{
Router
,
ActivatedRoute
,
Params
}
from
'
@angular/router
'
;
import
{
BehaviorSubject
,
Subscription
}
from
'
rxjs/Rx
'
;
import
{
ILoginInfo
}
from
'
../../store/logininfo/logininfo.types
'
;
import
{
Ng2SmartTableModule
,
LocalDataSource
}
from
'
ng2-smart-table
'
;
import
{
reportsSchema
,
TableColumn
}
from
'
./reports-schema
'
;
import
{
LOGININFO_INITIAL_STATE
}
from
'
../../store/logininfo/logininfo.initial-state
'
;
import
{
csvCreator
}
from
'
./csv-creator
'
;
import
{
API_ENDPOINT
}
from
'
../../app.settings
'
;
@
Component
({
selector
:
'
report-users
'
,
template
:
`
<div>
<div
class = "loading" *ngIf="validCreator == 0" >
</div>
<h5> >Επιλογή Φίλτρων <br><br></h5>
<h6> Δεν υπάρχουν διαθέσιμα φίλτρα <br><br><br></h6>
<button type="submit" class="btn btn-alert" (click)="createReport()" [hidden]="minedu_userName == ''" >
<i class="fa fa-file-text"></i>
Δημιουργία Αναφοράς
</button>
<button type="submit" class="btn btn-alert pull-right" (click)="navigateBack()" [hidden]="minedu_userName == ''" >
Επιστροφή
</button>
<br><br>
<div *ngIf="validCreator == 1 ">
<input #search class="search" type="text" placeholder="Αναζήτηση..." (keydown.enter)="onSearch(search.value)">
<div class="smart-table-container" reportScroll>
<ng2-smart-table [settings]="settings" [source]="source"></ng2-smart-table>
</div>
</div>
<button type="button" class="alert alert-info pull-right" (click)="export2Csv()" [hidden]="validCreator != 1">
<i class="fa fa-download"></i>
<br>Εξαγωγή σε csv
</button>
</div>
`
})
@
Injectable
()
export
default
class
ReportUsers
implements
OnInit
,
OnDestroy
{
loginInfo$
:
BehaviorSubject
<
ILoginInfo
>
;
loginInfoSub
:
Subscription
;
private
generalReport$
:
BehaviorSubject
<
any
>
;
private
generalReportSub
:
Subscription
;
private
apiEndPoint
=
API_ENDPOINT
;
private
minedu_userName
:
string
;
private
minedu_userPassword
:
string
;
private
distStatus
=
"
READY
"
;
private
data
;
private
validCreator
:
number
;
//private reportId: number;
private
routerSub
:
any
;
private
source
:
LocalDataSource
;
columnMap
:
Map
<
string
,
TableColumn
>
=
new
Map
<
string
,
TableColumn
>
();
@
Input
()
settings
:
any
;
private
reportSchema
=
new
reportsSchema
();
private
csvObj
=
new
csvCreator
();
constructor
(
private
_ngRedux
:
NgRedux
<
IAppState
>
,
private
_hds
:
HelperDataService
,
private
activatedRoute
:
ActivatedRoute
,
private
router
:
Router
)
{
this
.
loginInfo$
=
new
BehaviorSubject
(
LOGININFO_INITIAL_STATE
);
this
.
generalReport$
=
new
BehaviorSubject
([{}]);
this
.
minedu_userName
=
''
;
this
.
validCreator
=
-
1
;
}
ngOnInit
()
{
this
.
loginInfoSub
=
this
.
_ngRedux
.
select
(
state
=>
{
if
(
state
.
loginInfo
.
size
>
0
)
{
state
.
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
this
.
minedu_userName
=
loginInfoToken
.
minedu_username
;
this
.
minedu_userPassword
=
loginInfoToken
.
minedu_userpassword
;
return
loginInfoToken
;
},
{});
}
return
state
.
loginInfo
;
}).
subscribe
(
this
.
loginInfo$
);
//this.routerSub = this.activatedRoute.params.subscribe(params => {
//this.reportId = +params['reportId'];
//});
}
ngOnDestroy
()
{
if
(
this
.
loginInfoSub
)
this
.
loginInfoSub
.
unsubscribe
();
if
(
this
.
generalReportSub
)
this
.
generalReportSub
.
unsubscribe
();
if
(
this
.
loginInfo$
)
this
.
loginInfo$
.
unsubscribe
();
if
(
this
.
generalReport$
)
this
.
generalReport$
.
unsubscribe
();
}
createReport
()
{
this
.
validCreator
=
0
;
let
route
;
//if (this.reportId === 0) {
route
=
"
/ministry/report-users/
"
;
this
.
settings
=
this
.
reportSchema
.
ReportUsersSchema
;
//}
this
.
generalReportSub
=
this
.
_hds
.
makeReport
(
this
.
minedu_userName
,
this
.
minedu_userPassword
,
route
,
0
,
0
,
0
,
0
,
0
,
0
,
0
).
subscribe
(
data
=>
{
this
.
generalReport$
.
next
(
data
);
this
.
data
=
data
;
},
error
=>
{
this
.
generalReport$
.
next
([{}]);
this
.
validCreator
=
-
1
;
console
.
log
(
"
Error Getting ReportUsers
"
);
},
()
=>
{
console
.
log
(
"
Success Getting ReportUsers
"
);
this
.
validCreator
=
1
;
this
.
source
=
new
LocalDataSource
(
this
.
data
);
this
.
columnMap
=
new
Map
<
string
,
TableColumn
>
();
//pass parametes to csv class object
this
.
csvObj
.
columnMap
=
this
.
columnMap
;
this
.
csvObj
.
source
=
this
.
source
;
this
.
csvObj
.
settings
=
this
.
settings
;
this
.
csvObj
.
prepareColumnMap
();
}
)
}
navigateBack
()
{
this
.
router
.
navigate
([
'
/ministry/minister-reports
'
]);
}
onSearch
(
query
:
string
=
''
)
{
this
.
csvObj
.
onSearch
(
query
);
}
export2Csv
()
{
this
.
csvObj
.
export2Csv
();
}
}
source/components/minister/reports-schema.ts
View file @
245bf2d6
...
...
@@ -24,6 +24,20 @@ export class reportsSchema {
}
};
*/
ReportUsersSchema
=
{
actions
:
false
,
noDataMessage
:
'
Δεν υπάρχουν δεδομένα που περιέχουν το κείμενο αναζήτησης
'
,
columns
:
{
name
:
{
title
:
'
Περιγραφή
'
,
filter
:
false
},
numStudents
:
{
title
:
'
Αριθμός
'
,
filter
:
false
}
}
};
genReportSchema
=
{
actions
:
false
,
...
...
source/containers/main.routes.ts
View file @
245bf2d6
...
...
@@ -33,6 +33,7 @@ import MinisterView from '../components/minister/minister-view';
import
MinisterReports
from
'
../components/minister/minister-reports
'
;
import
ReportAllStat
from
'
../components/minister/report-all-stat
'
;
import
ReportGeneral
from
'
../components/minister/report-general
'
;
import
ReportUsers
from
'
../components/minister/report-users
'
;
import
ReportNoCapacity
from
'
../components/minister/report-no-capacity
'
;
import
InformStudents
from
'
../components/minister/minister-informstudents
'
;
import
MinisterSettings
from
'
../components/minister/minister-settings
'
;
...
...
@@ -75,9 +76,10 @@ export const MainRoutes: Routes = [
{
path
:
'
school/director-buttons
'
,
component
:
DirectorButtons
,
canActivate
:
[
SchoolAuthGuard
]
},
{
path
:
'
school/director-classcapacity
'
,
component
:
DirectorClassCapacity
,
canActivate
:
[
SchoolAuthGuard
,
SchoolCapacityLockedGuard
]
},
{
path
:
'
ministry/minister-view
'
,
component
:
MinisterView
,
canActivate
:
[
MinistryAuthGuard
]
},
{
path
:
'
ministry/minister-reports
'
,
component
:
MinisterReports
,
canActivate
:
[
MinistryAuthGuard
]
},
{
path
:
'
ministry/report-all-stat/:reportId
'
,
component
:
ReportAllStat
,
canActivate
:
[
MinistryAuthGuard
]
},
{
path
:
'
ministry/minister-reports
'
,
component
:
MinisterReports
},
{
path
:
'
ministry/report-all-stat/:reportId
'
,
component
:
ReportAllStat
},
{
path
:
'
ministry/report-general/:reportId
'
,
component
:
ReportGeneral
,
canActivate
:
[
MinistryAuthGuard
]
},
{
path
:
'
ministry/report-users/:reportId
'
,
component
:
ReportUsers
,
canActivate
:
[
MinistryAuthGuard
]
},
{
path
:
'
ministry/report-no-capacity/:reportId
'
,
component
:
ReportNoCapacity
,
canActivate
:
[
MinistryAuthGuard
]
},
{
path
:
'
ministry/minister-informstudents
'
,
component
:
InformStudents
,
canActivate
:
[
MinistryAuthGuard
]
},
{
path
:
'
ministry/minister-settings
'
,
component
:
MinisterSettings
,
canActivate
:
[
MinistryAuthGuard
]
},
...
...
@@ -113,6 +115,7 @@ export const MainDeclarations = [
MinisterReports
,
ReportAllStat
,
ReportGeneral
,
ReportUsers
,
ReportNoCapacity
,
InformStudents
,
MinisterSettings
,
...
...
source/services/helper-data-service.ts
View file @
245bf2d6
...
...
@@ -642,7 +642,11 @@ export class HelperDataService implements OnInit, OnDestroy {
this
.
createMinistryAuthorizationHeader
(
headers
,
username
,
userpassword
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
if
(
routepath
==
"
/ministry/general-report/
"
)
{
if
(
routepath
==
"
/ministry/report-users/
"
)
{
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
`
+
routepath
,
options
)
.
map
(
response
=>
response
.
json
());
}
else
if
(
routepath
==
"
/ministry/general-report/
"
)
{
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
`
+
routepath
,
options
)
.
map
(
response
=>
response
.
json
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment