Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
e-epal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Χάρης Παπαδόπουλος
e-epal
Commits
ebfb4503
Commit
ebfb4503
authored
May 01, 2017
by
Open Source Developer
Browse files
Options
Browse Files
Download
Plain Diff
trans
parents
a18ff2f1
63e47e3a
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
315 additions
and
7 deletions
+315
-7
drupal/modules/casost/src/Controller/CASLogin.php
drupal/modules/casost/src/Controller/CASLogin.php
+1
-1
drupal/modules/epal/epal.routing.yml
drupal/modules/epal/epal.routing.yml
+19
-0
drupal/modules/epal/src/Controller/CurrentUser.php
drupal/modules/epal/src/Controller/CurrentUser.php
+3
-3
drupal/modules/epal/src/Controller/DirectorView.php
drupal/modules/epal/src/Controller/DirectorView.php
+120
-0
source/app.settings.ts
source/app.settings.ts
+1
-0
source/app.ts
source/app.ts
+4
-1
source/components/infoviews/perfecture-view.ts
source/components/infoviews/perfecture-view.ts
+113
-0
source/components/school.home.ts
source/components/school.home.ts
+4
-1
source/containers/globalstyles.css
source/containers/globalstyles.css
+5
-0
source/containers/main.routes.ts
source/containers/main.routes.ts
+5
-1
source/guards/regionedu.auth.guard.ts
source/guards/regionedu.auth.guard.ts
+14
-0
source/services/auth.service.ts
source/services/auth.service.ts
+1
-0
source/services/helper-data-service.ts
source/services/helper-data-service.ts
+25
-0
No files found.
drupal/modules/casost/src/Controller/CASLogin.php
View file @
ebfb4503
...
...
@@ -93,7 +93,7 @@ class CASLogin extends ControllerBase
}
phpCAS
::
setDebug
(
"/home/haris/devel/eepal/drupal/modules/casost/phpcas.log"
);
// Enable verbose error messages. Disable in production!
//
phpCAS::setVerbose(true);
//
phpCAS::setVerbose(true);
phpCAS
::
client
(
$this
->
serverVersion
,
$this
->
serverHostname
,
...
...
drupal/modules/epal/epal.routing.yml
View file @
ebfb4503
...
...
@@ -156,3 +156,22 @@ epal.ministry.report1:
_controller
:
'
\Drupal\epal\Controller\ReportsCreator::makeReportCompleteness'
requirements
:
_user_is_logged_in
:
'
TRUE'
regionview
:
path
:
'
/epal/ScoolperPerf/{perfectureId}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::getSchoolsPerPerfetcure'
requirements
:
_user_is_logged_in
:
'
TRUE'
coursesperschools
:
path
:
'
/epal/CoursesperSch/{schoolid}'
options
:
_auth
:
[
'
basic_auth'
]
defaults
:
_controller
:
'
\Drupal\epal\Controller\DirectorView::getCoursesPerSchool'
requirements
:
_user_is_logged_in
:
'
TRUE'
drupal/modules/epal/src/Controller/CurrentUser.php
View file @
ebfb4503
...
...
@@ -34,7 +34,7 @@ class CurrentUser extends ControllerBase
$container
->
get
(
'entity_type.manager'
),
$container
->
get
(
'database'
),
$container
->
get
(
'logger.factory'
)
);
);
}
public
function
getLoginInfo
(
Request
$request
)
...
...
@@ -51,14 +51,14 @@ class CurrentUser extends ControllerBase
$userRoles
=
$user
->
getRoles
();
foreach
(
$userRoles
as
$userRole
)
{
if
(
$userRole
===
'epal'
)
{
if
(
(
$userRole
===
'epal'
)
||
(
$userRole
===
'regioneduadmin'
)
||
(
$userRole
===
'eduadmin'
)
)
{
return
$this
->
respondWithStatus
([
'name'
=>
$user
->
mail
->
value
,
'title'
=>
$user
->
init
->
value
,
],
Response
::
HTTP_OK
);
}
else
if
(
$userRole
===
'applicant'
)
{
break
;
}
}
}
...
...
drupal/modules/epal/src/Controller/DirectorView.php
View file @
ebfb4503
...
...
@@ -402,6 +402,126 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
public
function
getSchoolsPerPerfetcure
(
Request
$request
,
$perfectureId
)
{
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$users
=
$this
->
entityTypeManager
->
getStorage
(
'user'
)
->
loadByProperties
(
array
(
'name'
=>
$authToken
));
$user
=
reset
(
$users
);
if
(
$user
)
{
$schools
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'region_edu_admin_id'
=>
$perfectureId
));
if
(
$schools
)
{
$list
=
array
();
foreach
(
$schools
as
$object
)
{
$list
[]
=
array
(
'id'
=>
$object
->
id
(),
'name'
=>
$object
->
name
->
value
,
);
$i
++
;
}
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"Perfecture not found!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
public
function
getCoursesPerSchool
(
Request
$request
,
$schoolid
)
{
$authToken
=
$request
->
headers
->
get
(
'PHP_AUTH_USER'
);
$users
=
$this
->
entityTypeManager
->
getStorage
(
'user'
)
->
loadByProperties
(
array
(
'name'
=>
$authToken
));
$user
=
reset
(
$users
);
if
(
$user
)
{
$list
=
array
();
$CourseA
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_school'
)
->
loadByProperties
(
array
(
'id'
=>
$schoolid
));
if
(
$CourseA
)
{
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'specialization_id'
=>
-
1
,
'currentclass'
=>
1
));
$list
=
array
();
foreach
(
$CourseA
as
$object
)
{
$list
[]
=
array
(
'name'
=>
'Α Λυκείου'
,
'id'
=>
sizeof
(
$studentPerSchool
),
);
}
}
$CourseB
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_sectors_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
));
if
(
$CourseB
)
{
foreach
(
$CourseB
as
$object
)
{
$studentPerSchool
=
$this
->
entityTypeManager
->
getStorage
(
'epal_student_class'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
,
'specialization_id'
=>
9
,
'currentclass'
=>
2
));
$list
[]
=
array
(
'name'
=>
'Β Λυκείου '
.
$object
->
sector_id
->
entity
->
get
(
'name'
)
->
value
,
'id'
=>
sizeof
(
$studentPerSchool
),
);
}
}
$CourseC
=
$this
->
entityTypeManager
->
getStorage
(
'eepal_specialties_in_epal'
)
->
loadByProperties
(
array
(
'epal_id'
=>
$schoolid
));
if
(
$CourseC
)
{
foreach
(
$CourseC
as
$object
)
{
$list
[]
=
array
(
'name'
=>
'Γ Λυκείου '
.
$object
->
specialty_id
->
entity
->
get
(
'name'
)
->
value
,
);
}
}
if
(
$CourseA
||
$CourseB
||
$CourseC
){
return
$this
->
respondWithStatus
(
$list
,
Response
::
HTTP_OK
);
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"Perfecture not found!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
else
{
return
$this
->
respondWithStatus
([
'message'
=>
t
(
"User not found!"
),
],
Response
::
HTTP_FORBIDDEN
);
}
}
private
function
respondWithStatus
(
$arr
,
$s
)
{
$res
=
new
JsonResponse
(
$arr
);
$res
->
setStatusCode
(
$s
);
...
...
source/app.settings.ts
View file @
ebfb4503
export
const
API_ENDPOINT
=
'
http://eduslim2.minedu.gov.gr/angular/eepal-front/drupal
'
;
export
class
AppSettings
{
public
static
get
API_ENDPOINT
():
string
{
...
...
source/app.ts
View file @
ebfb4503
...
...
@@ -31,6 +31,7 @@ import {LoaderService} from './services/Spinner.service';
import
{
AuthService
}
from
'
./services/auth.service
'
;
import
SchoolAuthGuard
from
'
./guards/school.auth.guard
'
;
import
StudentAuthGuard
from
'
./guards/student.auth.guard
'
;
import
RegionEduAuthGuard
from
'
./guards/regionedu.auth.guard
'
;
import
{
ACTION_PROVIDERS
}
from
'
./actions
'
;
import
Home
from
'
./components/home
'
;
...
...
@@ -83,7 +84,9 @@ class MyLocalization extends NgLocalization {
LoaderService
,
AuthService
,
SchoolAuthGuard
,
StudentAuthGuard
StudentAuthGuard
,
RegionEduAuthGuard
]
})
class
AppModule
{}
...
...
source/components/infoviews/perfecture-view.ts
0 → 100644
View file @
ebfb4503
import
{
Component
,
OnInit
,
OnDestroy
,
ElementRef
,
ViewChild
}
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
{
FormBuilder
,
FormGroup
,
FormControl
,
FormArray
,
Validators
,
}
from
'
@angular/forms
'
;
@
Component
({
selector
:
'
perfecture-view
'
,
template
:
`
<ul class="list-group main-view">
<div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" >
<li class="list-group-item isclickable" (click)="setActiveRegion(SchoolNames$.id)" [class.oddout]="isOdd" [class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id ">
<h5> {{SchoolNames$.name}}</h5>
</li>
</div>
</ul>
<div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToApplication()" >
<i class="fa fa-forward"></i>
</button>
</div>
`
})
@
Injectable
()
export
default
class
PerfectureView
implements
OnInit
,
OnDestroy
{
public
formGroup
:
FormGroup
;
private
SchoolsPerPerf$
:
BehaviorSubject
<
any
>
;
private
SchoolPerPerfSub
:
Subscription
;
private
StudentsSize$
:
BehaviorSubject
<
any
>
;
private
StudentsSizeSub
:
Subscription
;
public
perfecture
=
1
;
private
regionActive
=
<
number
>-
1
;
constructor
(
private
fb
:
FormBuilder
,
private
router
:
Router
,
private
_hds
:
HelperDataService
,
)
{
this
.
SchoolsPerPerf$
=
new
BehaviorSubject
([{}]);
this
.
StudentsSize$
=
new
BehaviorSubject
({});
this
.
formGroup
=
this
.
fb
.
group
({
});
}
ngOnDestroy
()
{
}
ngOnInit
()
{
this
.
SchoolPerPerfSub
=
this
.
_hds
.
getSchoolPerPerfecture
(
147
).
subscribe
(
data
=>
{
this
.
SchoolsPerPerf$
.
next
(
data
);
},
error
=>
{
this
.
SchoolsPerPerf$
.
next
([{}]);
console
.
log
(
"
Error Getting Schools
"
);
},
()
=>
console
.
log
(
"
Getting Schools
"
));
}
setActiveRegion
(
ind
)
{
console
.
log
(
ind
,
"
ind
"
);
if
(
ind
===
this
.
regionActive
)
ind
=
-
1
;
this
.
regionActive
=
ind
;
}
navigateToApplication
()
{
var
id
:
string
=
String
(
this
.
regionActive
);
this
.
router
.
navigate
([
''
,
{
ids
:
id
}]);
}
calccolor
(
id
)
{
var
newid
=
+
id
;
// this.StudentsSizeSub = this._hds.getStudentPerSchool(147, 1, 2, 0, 0).subscribe(this.StudentsSize$);
if
(
id
==
147
)
return
true
;
if
(
id
==
150
)
return
true
;
}
}
source/components/school.home.ts
View file @
ebfb4503
...
...
@@ -75,7 +75,10 @@ export default class SchoolHome implements OnInit {
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
if
(
this
.
authToken
&&
this
.
authToken
.
length
>
0
)
this
.
router
.
navigate
([
'
/school/director-view
'
]);
if
(
this
.
authRole
=
'
director
'
)
this
.
router
.
navigate
([
'
/school/director-view
'
]);
if
(
this
.
authRole
=
'
dide
'
)
this
.
router
.
navigate
([
'
/school/perfecture-view
'
]);
return
loginInfoToken
;
},
{});
}
...
...
source/containers/globalstyles.css
View file @
ebfb4503
...
...
@@ -176,6 +176,11 @@
background-color
:
#fd9665
;
}
.changecolor
{
background-color
:
cyan
;
}
.roundedNumber
{
width
:
2em
;
background-color
:
coral
;
...
...
source/containers/main.routes.ts
View file @
ebfb4503
...
...
@@ -22,12 +22,14 @@ import ApplicationSubmit from '../components/student-application-form/applicatio
import
SubmitedPreview
from
'
../components/student-application-form/submited.aplication.preview
'
;
import
SubmitedPerson
from
'
../components/student-application-form/submitedstudent.preview
'
;
import
DirectorView
from
'
../components/director/director-view
'
;
import
PerfectureView
from
'
../components/infoviews/perfecture-view
'
;
import
DirectorClassCapacity
from
'
../components/director/director-classcapacity
'
;
import
MinisterView
from
'
../components/minister/minister-view
'
;
import
MinisterReports
from
'
../components/minister/minister-reports
'
;
import
InformStudents
from
'
../components/minister/minister-informstudents
'
;
import
SchoolAuthGuard
from
'
../guards/school.auth.guard
'
;
import
StudentAuthGuard
from
'
../guards/student.auth.guard
'
;
import
RegionEduAuthGuard
from
'
../guards/regionedu.auth.guard
'
;
export
const
MainRoutes
:
Routes
=
[
{
path
:
''
,
component
:
Home
},
...
...
@@ -51,6 +53,7 @@ export const MainRoutes: Routes = [
{
path
:
'
ministry/minister-view
'
,
component
:
MinisterView
},
{
path
:
'
ministry/minister-reports
'
,
component
:
MinisterReports
},
{
path
:
'
ministry/minister-informstudents
'
,
component
:
InformStudents
},
{
path
:
'
school/perfecture-view
'
,
component
:
PerfectureView
,
canActivate
:
[
RegionEduAuthGuard
]
},
];
export
const
MainDeclarations
=
[
...
...
@@ -76,5 +79,6 @@ export const MainDeclarations = [
DirectorClassCapacity
,
MinisterView
,
MinisterReports
,
InformStudents
InformStudents
,
PerfectureView
,
];
source/guards/regionedu.auth.guard.ts
0 → 100644
View file @
ebfb4503
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
CanActivate
}
from
'
@angular/router
'
;
import
{
AuthService
}
from
'
../services/auth.service
'
;
import
{
DIDE_ROLE
}
from
'
../constants
'
;
@
Injectable
()
export
default
class
RegionEduAuthGuard
implements
CanActivate
{
constructor
(
private
authService
:
AuthService
)
{}
canActivate
()
{
return
this
.
authService
.
isLoggedIn
(
DIDE_ROLE
).
then
(
loggedIn
=>
{
return
loggedIn
;}).
catch
(
err
=>
{
return
false
;});
}
}
source/services/auth.service.ts
View file @
ebfb4503
...
...
@@ -22,6 +22,7 @@ export class AuthService {
}).
subscribe
(
loginInfo
=>
{
if
(
loginInfo
.
size
>
0
)
{
loginInfo
.
reduce
(({},
loginInfoToken
)
=>
{
console
.
log
(
loginInfoToken
.
auth_role
,
"
aaaaaaa
"
);
if
(
loginInfoToken
.
auth_token
&&
loginInfoToken
.
auth_token
.
length
>
0
&&
loginInfoToken
.
auth_role
===
role
)
{
resolve
(
true
);
}
...
...
source/services/helper-data-service.ts
View file @
ebfb4503
...
...
@@ -680,6 +680,31 @@ export class HelperDataService implements OnInit, OnDestroy {
}
getSchoolPerPerfecture
(
PerfectureId
)
{
console
.
log
(
PerfectureId
,
"
a
"
);
let
PerfectureIdNew
=
PerfectureId
.
toString
();
this
.
loginInfo$
.
getValue
().
forEach
(
loginInfoToken
=>
{
this
.
authToken
=
loginInfoToken
.
auth_token
;
this
.
authRole
=
loginInfoToken
.
auth_role
;
});
console
.
log
(
"
authToken=
"
+
this
.
authToken
);
console
.
log
(
"
authRole=
"
+
this
.
authRole
);
let
headers
=
new
Headers
({
"
Content-Type
"
:
"
application/json
"
,
});
this
.
createAuthorizationHeader
(
headers
);
let
options
=
new
RequestOptions
({
headers
:
headers
});
return
this
.
http
.
get
(
`
${
AppSettings
.
API_ENDPOINT
}
/epal/CoursesperSch/`
+
PerfectureIdNew
,
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