...
 
Commits (14)
......@@ -490,5 +490,21 @@ epal.ministryschools:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::getSchoolsMinistry'
requirements:
_user_is_logged_in: 'TRUE'
epal.coursesperschoolsmin:
path: '/epal/coursesperschmin/{schoolid}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::getCoursesPerSchoolMin'
requirements:
_user_is_logged_in: 'TRUE'
epal.approveclassesmin:
path: '/epal/approveclassesmin'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\SmallClassDistribution::ApproveClassesMin'
requirements:
_user_is_logged_in: 'TRUE'
\ No newline at end of file
......@@ -1496,4 +1496,111 @@ public function findStatusNew($id, $classId, $sector, $specialit)
return self::SUCCESS;
}
public function ApproveClassesMin(Request $request)
{
try {
if (!$request->isMethod('POST')) {
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);
}
if ($role === 'ministry') {
if ($content = $request->getContent()) {
$postData = json_decode($content);
$taxi = $postData -> taxi;
$arr = $postData -> classid;
$type = $postData -> type;
$valnew = intval($arr);
$typen = intval($type);
if ($taxi === 1)
$classesForConfirm = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(['id' => $valnew]);
if ($taxi === 2)
$classesForConfirm = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(['id' => $valnew]);
if ($taxi === 3 || $taxi === 4)
$classesForConfirm = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(['id' => $valnew]);
$classConfirm = reset($classesForConfirm);
if ($classConfirm) {
if ($typen === 1) {
if ($taxi === 1)
$classConfirm->set('approved_a', 1);
if ($taxi === 2)
$classConfirm->set('approved_sector', 1);
if ($taxi === 3)
$classConfirm->set('approved_speciality', 1);
if ($taxi === 4)
$classConfirm->set('approved_speciality_d', 1);
$classConfirm->save();
return $this->respondWithStatus(['message' => t('saved')], Response::HTTP_OK);
} elseif ($typen === 2) {
if ($taxi === 1)
$classConfirm->set('approved_a', 0);
if ($taxi === 2)
$classConfirm->set('approved_sector', 0);
if ($taxi === 3)
$classConfirm->set('approved_speciality', 0);
if ($taxi === 4)
$classConfirm->set('approved_speciality_d', 0);
$classConfirm->save();
return $this->respondWithStatus(['message' => t('saved')], Response::HTTP_OK);
} else {
return $this->respondWithStatus(['message' => t('Bad request')], Response::HTTP_FORBIDDEN);
}
} else {
return $this->respondWithStatus(['message' => t('Student not found')], Response::HTTP_FORBIDDEN);
}
} else {
return $this->respondWithStatus(['message' => t('post with no data')], Response::HTTP_BAD_REQUEST);
}
} else {
return $this->respondWithStatus(['error_code' => 4003], Response::HTTP_FORBIDDEN);
}
}//end try
catch (\Exception $e) {
$this->logger->warning($e->getMessage());
return $this->respondWithStatus([
"message" => t("An unexpected problem occured during report")
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
}
}
File mode changed from 100755 to 100644
......@@ -495,7 +495,9 @@ class GelSubmittedApplications extends ControllerBase
)
$canedit = '1';
if ($applicantsResultsDisabled === "0" && ($gelStudent->myschool_promoted === "1" || $gelStudent->myschool_promoted === "2")) {
//if ($applicantsResultsDisabled === "0" && ($gelStudent->myschool_promoted === "1" || $gelStudent->myschool_promoted === "2")) {
if ($applicantsResultsDisabled === "0" && ($gelStudent->myschool_promoted != "3" && $gelStudent->myschool_promoted != "4"
&& $gelStudent->myschool_promoted != "5" && $gelStudent->myschool_promoted != "14")) {
// περιττό (?), στη Β' περίοδο οι αιτήσεις λογικά δεν έχουν ενημερωμένο το myschool_promoted ?
if ($gelStudent->second_period === "1" && $gelStudent->changed >= $dateStartInt)
......@@ -505,9 +507,9 @@ class GelSubmittedApplications extends ControllerBase
else if ($gelStudent->school_id)
//υπάρχει σχολείο στον πίνακα gelstudenthighschool
$status = "1";
else if ($gelStudent->lastschool_unittypeid == 40)
//else if ($gelStudent->lastschool_unittypeid == 40)
//ειδικές περιπτώσεις: μαθητές από ΣΔΕ / σχολεία εξωτερικού
$status = "3";
// $status = "3";
else if ($gelStudent->student_id != null && $gelStudent->school_id == null)
//υπάρχει ο μαθητής αλλά όχι το σχολείο στον πίνακα gelstudenthighschool
$status = "8";
......@@ -534,14 +536,16 @@ class GelSubmittedApplications extends ControllerBase
$status = "8";
}
}
else if ($applicantsResultsDisabled === "0" && ($gelStudent->myschool_promoted === "6" || $gelStudent->myschool_promoted === "7") )
$status = "5";
else if ($applicantsResultsDisabled === "0" &&
$gelStudent->myschool_promoted != null && $gelStudent->myschool_promoted != "0" &&
$gelStudent->myschool_promoted != "1" && $gelStudent->myschool_promoted != "2" &&
$gelStudent->myschool_promoted != "6" && $gelStudent->myschool_promoted != "7"
)
$status = "6";
//else if ($applicantsResultsDisabled === "0" && ($gelStudent->myschool_promoted === "6" || $gelStudent->myschool_promoted === "7") )
// $status = "5";
//else if ($applicantsResultsDisabled === "0" &&
// $gelStudent->myschool_promoted != null && $gelStudent->myschool_promoted != "0" &&
// $gelStudent->myschool_promoted != "1" && $gelStudent->myschool_promoted != "2" &&
// $gelStudent->myschool_promoted != "6" && $gelStudent->myschool_promoted != "7"
// )
// $status = "6";
else if ($applicantsResultsDisabled === "0" && $gelStudent->myschool_promoted === "0" )
$status = "7";
else
......
......@@ -30,23 +30,18 @@ import { IAppState } from "../../store/store";
</div>
<div style="min-height: 500px;">
<div style="min-height: 500px;">
<form>
<div *ngFor="let PdeNames$ of Pde$ | async; let k=index; let isOdd=odd; let isEven=even" style="font-size: 0.8em; font-weight: bold;">
<li class="list-group-item isclickable" (click)="clickPde(PdeNames$.id)"
[class.oddout]="isOdd"
[class.evenout]="isEven" [class.selectedout]="pdeActive === PdeNames$.id" >
<div class="col-md-12">{{PdeNames$.name}}</div>
</li>
</div>
<div class="col-md-12">{{PdeNames$.name}}!</div>
</li>
<div class = "row" [hidden]="PdeNames$.id !== pdeActive" style="margin: 0px 2px 0px 2px;">
<p style="margin-top: 20px; line-height: 2em;">Στην παρακάτω λίστα βλέπετε τα σχολεία ευθύνης σας.
<br/>Επιλέξτε σχολείο για να εμφανιστούν τα ολιγομελή τμήματα του σχολείου.</p>
<div class="row" style="margin-top: 20px; line-height: 2em;"><p><strong>Τα τμήματα</strong></p></div>
<div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" style="font-size: 0.8em; font-weight: bold;">
<div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" style="font-size: 0.8em; font-weight: bold;" [hidden]="PdeNames$.id !== pdeActive">
<li class="list-group-item isclickable" (click)="setActiveRegion(SchoolNames$.id)"
[class.oddout]="isOdd"
[class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id" >
......@@ -84,8 +79,15 @@ import { IAppState } from "../../store/store";
</div>
</div>
</div>
</div>
</div>
</form>
</div>
......@@ -216,7 +218,7 @@ import { IAppState } from "../../store/store";
else {
this.regionActive = ind;
this.showLoader.next(true);
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive)
this.CoursesPerPerfSub = this._hds.getCoursePerPerfectureMin(this.regionActive,this.minedu_userName, this.minedu_userPassword)
.subscribe(data => {
this.CoursesPerPerf$.next(data);
this.showLoader.next(false);
......@@ -242,7 +244,7 @@ import { IAppState } from "../../store/store";
let std = this.CoursesPerPerf$.getValue();
std[ind].approved = rtype;
this.SavedSApprovedSub = this._hds.saveApprovedClasses(taxi, classid, type).subscribe(data => {
this.SavedSApprovedSub = this._hds.saveApprovedClassesMin(taxi, classid, type,this.minedu_userName, this.minedu_userPassword).subscribe(data => {
this.SavedSApproved$.next(data);
this.showLoader.next(false);
},
......
......@@ -2020,4 +2020,38 @@ getPde(username, userpassword)
}
getCoursePerPerfectureMin(PerfectureId,username, userpassword) {
let PerfectureIdNew = PerfectureId.toString();
let headers = new Headers({
"Content-Type": "application/json",
});
this.createMinistryAuthorizationHeader(headers, username, userpassword);
let options = new RequestOptions({ headers: headers });
return this.http.get(`${AppSettings.API_ENDPOINT}/epal/coursesperschmin/` + PerfectureIdNew, options)
.map(response => response.json());
}
saveApprovedClassesMin(taxi, classid, type,username, userpassword)
{
let headers = new Headers({
"Content-Type": "application/json",
});
this.createMinistryAuthorizationHeader(headers, username, userpassword);
let options = new RequestOptions({ headers: headers });
return this.http.post(`${AppSettings.API_ENDPOINT}/epal/approveclassesmin`, { taxi, classid, type }, options)
.map(response => response.json());
}
}