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

trans

parent a4eb4c01
......@@ -98,6 +98,14 @@ specialityperschool:
_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}'
options:
......@@ -106,4 +114,5 @@ studentperschool:
_controller: '\Drupal\epal\Controller\DirectorView::getStudentPerSchool'
requirements:
_user_is_logged_in: 'TRUE'
......@@ -8,6 +8,8 @@ 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
{
......@@ -153,7 +155,7 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId)
'name' => $epalStudent -> name ->value,
'studentsurname' => $epalStudent -> studentsurname ->value,
'fatherfirstname' => $epalStudent -> fatherfirstname ->value,
'fathersurname' =>$epalStudent -> fathersurtname ->value,
'fathersurname' =>$epalStudent -> fathersurname ->value,
'motherfirstname' => $epalStudent -> motherfirstname ->value,
'mothersurname' =>$epalStudent -> mothersurname ->value,
'birthdate' =>$epalStudent -> birthdate ->value,
......@@ -200,16 +202,20 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId)
$epalUser = reset($epalUsers);
if ($epalUser) {
$postData = null;
if ($content = $request->getContent())
{
foreach ($content as &$value) {
$studentForConfirm = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('id' => &$value ));
if ($studentForConfirm) {
$studentForConfirm->set('directorconfirm', "yes");
$studentForConfirm->save();
}
{
$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"),
......@@ -232,14 +238,6 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId)
private function respondWithStatus($arr, $s) {
$res = new JsonResponse($arr);
$res->setStatusCode($s);
......
......@@ -122,6 +122,7 @@ class EpalStudentClass extends ContentEntityBase implements EpalStudentClassInte
return $this;
}
/**
* {@inheritdoc}
*/
......
......@@ -521,7 +521,7 @@ export class HelperDataService {
this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers });
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())
.subscribe(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