Commit 1b42a987 authored by Open Source Developer's avatar Open Source Developer

trans

parent a4eb4c01
...@@ -98,6 +98,14 @@ specialityperschool: ...@@ -98,6 +98,14 @@ specialityperschool:
_controller: '\Drupal\epal\Controller\DirectorView::getSpecialPerSchool' _controller: '\Drupal\epal\Controller\DirectorView::getSpecialPerSchool'
requirements: requirements:
_user_is_logged_in: 'TRUE' _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: studentperschool:
path: '/epal/studentperSchool/{epalId}/{selectId}' path: '/epal/studentperSchool/{epalId}/{selectId}'
options: options:
...@@ -106,4 +114,5 @@ studentperschool: ...@@ -106,4 +114,5 @@ studentperschool:
_controller: '\Drupal\epal\Controller\DirectorView::getStudentPerSchool' _controller: '\Drupal\epal\Controller\DirectorView::getStudentPerSchool'
requirements: requirements:
_user_is_logged_in: 'TRUE' _user_is_logged_in: 'TRUE'
...@@ -8,6 +8,8 @@ use Symfony\Component\HttpFoundation\JsonResponse; ...@@ -8,6 +8,8 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Drupal\Core\Database\Connection;
use Drupal\Core\Logger\LoggerChannelFactoryInterface;
class DirectorView extends ControllerBase class DirectorView extends ControllerBase
{ {
...@@ -153,7 +155,7 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId) ...@@ -153,7 +155,7 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId)
'name' => $epalStudent -> name ->value, 'name' => $epalStudent -> name ->value,
'studentsurname' => $epalStudent -> studentsurname ->value, 'studentsurname' => $epalStudent -> studentsurname ->value,
'fatherfirstname' => $epalStudent -> fatherfirstname ->value, 'fatherfirstname' => $epalStudent -> fatherfirstname ->value,
'fathersurname' =>$epalStudent -> fathersurtname ->value, 'fathersurname' =>$epalStudent -> fathersurname ->value,
'motherfirstname' => $epalStudent -> motherfirstname ->value, 'motherfirstname' => $epalStudent -> motherfirstname ->value,
'mothersurname' =>$epalStudent -> mothersurname ->value, 'mothersurname' =>$epalStudent -> mothersurname ->value,
'birthdate' =>$epalStudent -> birthdate ->value, 'birthdate' =>$epalStudent -> birthdate ->value,
...@@ -200,16 +202,20 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId) ...@@ -200,16 +202,20 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId)
$epalUser = reset($epalUsers); $epalUser = reset($epalUsers);
if ($epalUser) { if ($epalUser) {
$postData = null; $postData = null;
if ($content = $request->getContent()) if ($content = $request->getContent())
{ {
foreach ($content as &$value) { $postData = json_decode($content);
$studentForConfirm = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('id' => &$value )); $arr = $postData->students;
if ($studentForConfirm) {
foreach ($arr as $value) {
$studentForConfirm->set('directorconfirm', "yes"); $valnew = intval($value);
$studentForConfirm->save(); $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([ return $this->respondWithStatus([
'message' => t("saved"), 'message' => t("saved"),
...@@ -232,14 +238,6 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId) ...@@ -232,14 +238,6 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId)
private function respondWithStatus($arr, $s) { private function respondWithStatus($arr, $s) {
$res = new JsonResponse($arr); $res = new JsonResponse($arr);
$res->setStatusCode($s); $res->setStatusCode($s);
......
...@@ -122,6 +122,7 @@ class EpalStudentClass extends ContentEntityBase implements EpalStudentClassInte ...@@ -122,6 +122,7 @@ class EpalStudentClass extends ContentEntityBase implements EpalStudentClassInte
return $this; return $this;
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -521,7 +521,7 @@ export class HelperDataService { ...@@ -521,7 +521,7 @@ export class HelperDataService {
this.createAuthorizationHeader(headers); this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers }); let options = new RequestOptions({ headers: headers });
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.http.post(`${AppSettings.API_ENDPOINT}/epal/confirmstudent`, {students: students}, options) this.http.post(`${AppSettings.API_ENDPOINT}/epal/confirmstudent`, {students}, options)
.map(response => response.json()) .map(response => response.json())
.subscribe(data => { .subscribe(data => {
resolve(data); resolve(data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment