Commit 86f2d533 authored by Νίκος Κατσαούνος's avatar Νίκος Κατσαούνος
Browse files

several updates in Drupal Controllers

parent 4fb6c85a
......@@ -182,6 +182,14 @@ epal.ministry.massive_mail_unallocated:
_controller: '\Drupal\epal\Controller\InformUnlocatedStudents::sendMailToUnallocatedStudents'
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.massive_mail_unallocated_smallclass:
path: '/ministry/send-unallocated-sc-massive-mail'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\InformUnlocatedStudents::sendMailToUnallocatedStudentsSC'
requirements:
_user_is_logged_in: 'TRUE'
epal.ministry.massive_mail_located:
path: '/ministry/send-located-massive-mail'
options:
......
......@@ -559,9 +559,10 @@ public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup,
//Αν δεν απέμειναν θέσεις (δηλαδή αν η χωρητικότητα είναι μικρότερη ή ίση από το πλήθος μαθητών που ήδη φοιτούν στο σχολείο)
//τότε διέγραψέ τους από τον προσωρινό πίνακα αποτελεσμάτων και βάλε τους στον στον πίνακα εκκρεμοτήτων
if ($newlimit <= 0) {
foreach($students as $student) {
foreach($students as $student) {
if ($student->currentepal !== $student->epal_id) {
if ($newlimit <= 0) {
//print_r("<br>ΣΕ ΕΚΚΡΕΜΟΤΗΤΑ - ΔΙΑΓΡΑΦΗ: " . $student->student_id);
array_push($this->pendingStudents, $student->student_id);
try {
......@@ -574,9 +575,27 @@ public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup,
$transaction->rollback();
return ERROR_DB;
}
} //end if currentepal
} //end foreach
} //endif newlimit
} //endif new limit
else { //$newlimit > 0
//NEW CODE LINES
if ($this->choice_id !== 1)
$this->removeFromPendingStudents($student->student_id);
}
//END NEW CODE LINES
} //endif currentepal
} //end foreach
//NEW CODE LINES
/*
else {
foreach($students as $student)
if ($student->currentepal !== $student->epal_id)
if ($this->choice_id !== 1)
$this->removeFromPendingStudents($student->student_id);
}
*/
//END NEW CODE LINES
return SUCCESS;
......
......@@ -92,14 +92,15 @@ class InformUnlocatedStudents extends ControllerBase {
$cnt_success = 0;
$cnt_fail = 0;
// εύρεση μαθητών που η αίτησή τους ΔΕΝ ικανοποιήθηκε
// εύρεση μαθητών που η αίτησή τους ΔΕΝ ικανοποιήθηκε,
//(δεν κατανεμήθηκαν πουθενά)
$sCon = $this->connection->select('epal_student_class', 'eStudent')
->fields('eStudent', array('student_id'))
->condition('eStudent.finalized', 0 , '=');
->fields('eStudent', array('student_id'));
//->condition('eStudent.finalized', 0 , '=');
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$studentIds = array();
//array_push($studentIds,-1);
array_push($studentIds,-1);
foreach ($epalStudents as $epalStudent)
array_push($studentIds, $epalStudent->student_id);
......@@ -107,7 +108,6 @@ class InformUnlocatedStudents extends ControllerBase {
$sCon = $this->connection->select('epal_student', 'eStudent')
->fields('eStudent', array('id', 'user_id', 'created'))
->condition('eStudent.id', $studentIds, 'NOT IN');
//$numNoAllocated = $sCon->countQuery()->execute()->fetchField();
$epalNonLocatedStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($epalNonLocatedStudents as $epalNonLocatedStudent) {
......@@ -155,6 +155,106 @@ class InformUnlocatedStudents extends ControllerBase {
}
public function sendMailToUnallocatedStudentsSC(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);
}
$cnt_success = 0;
$cnt_fail = 0;
// εύρεση μαθητών που η αίτησή τους ΔΕΝ ικανοποιήθηκε,
//(δεν κατανεμήθηκαν πουθενά)
$sCon = $this->connection->select('epal_student_class', 'eStudent')
->fields('eStudent', array('student_id'))
->condition('eStudent.finalized', 0 , '=');
$epalStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
$studentIds = array();
array_push($studentIds,-1);
foreach ($epalStudents as $epalStudent)
array_push($studentIds, $epalStudent->student_id);
$sCon = $this->connection->select('epal_student', 'eStudent')
->fields('eStudent', array('id', 'user_id', 'created'))
->condition('eStudent.id', $studentIds, 'IN');
$epalNonLocatedStudents = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($epalNonLocatedStudents as $epalNonLocatedStudent) {
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('user_id' => $epalNonLocatedStudent->user_id));
$epalUser = reset($epalUsers);
if ($epalUser) {
$user = $this->entityTypeManager->getStorage('user')->load($epalUser->user_id->target_id);
//$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('uid' => $epalUser->user_id));
//$user = reset($users);
if ($user) {
$langcode = $user->getPreferredLangcode();
if ($this->sendEmailToUnallocated($user->getEmail(), $epalNonLocatedStudent->id, $epalNonLocatedStudent->created, $langcode))
$cnt_success++;
}
else {
return $this->respondWithStatus([
'message' => t("user not found"),
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
} else {
$cnt_fail++;
}
} //end foreach
return $this->respondWithStatus([
'message' => t("post successful"),
'num_success_mail' => $cnt_success,
'num_fail_mail' => $cnt_fail,
//'test' => $test,
], Response::HTTP_OK);
} //end try
catch (\Exception $e) {
$this->logger->warning($e->getMessage());
return $this->respondWithStatus([
"message" => t("An unexpected problem occured during sendMailToStudents Method ")
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
}
//sendEmail(e-mail address, A/A, application Date, lang)
private function sendEmailToUnallocated($email, $appId, $appDate, $langcode) {
$mailManager = \Drupal::service('plugin.manager.mail');
......@@ -163,9 +263,10 @@ class InformUnlocatedStudents extends ControllerBase {
$key = 'massive_mail_unallocated'; //to be checked..
$to = $email;
$params['message'] = "Σας ενημερώνουμε ότι η αίτησή σας με Α/Α: " . $appId . " - " . date('d-m-y H:i:s', $appDate)
. " δεν ικανοποιήθηκε. Παρακαλώ επικοινωνήστε άμεσα τηλεφωνικά με τη Διεύθυνση Δευτεροβάθμιας Εκπαίδευσης / Τμήμα Επαγγελματικής Εκπαίδευσης,"
. "\r\nΤεστ1\nΤεστ2" ;//e-mail body
$params['message'] = "Σας ενημερώνουμε ότι η αίτησή σας με Α/Α: " . $appId . " / " . date('d-m-y H:i:s', $appDate)
. " δεν ικανοποιήθηκε. Παρακαλώ επικοινωνήστε άμεσα τηλεφωνικά με τη Διεύθυνση Δευτεροβάθμιας Εκπαίδευσης / Τμήμα Επαγγελματικής Εκπαίδευσης."
. "\r\n\r\n Ομάδα Διαχείρισης της εφαρμογής e-epal."
. "\r\n Προσοχή: το μήνυμα που διαβάζετε είναι αυτοματοποιημένο. Παρακαλώ μην απαντάτε σε αυτό το μήνυμα.." ;//e-mail body" ;//e-mail body
//add new lines with SENDER name - check it
//$params['subject'] = t('Μη ικανοποίηση ηλεκτρονικής αίτησης για εγγραφή σε ΕΠΑΛ');
......@@ -231,7 +332,7 @@ class InformUnlocatedStudents extends ControllerBase {
$studentIds = array();
//if sizeof(studentIds = 0..distribution has not been made!)
//array_push($studentIds, -1);
array_push($studentIds, -1);
foreach ($epalStudents as $epalStudent)
array_push($studentIds, $epalStudent->student_id);
......@@ -328,12 +429,13 @@ class InformUnlocatedStudents extends ControllerBase {
$key = 'massive_mail_located';
$to = $email;
$params['message'] = "Σας ενημερώνουμε ότι η αίτησή σας με Α/Α: " . $appId . " - " . date('d-m-y H:i:s', $appDate)
$params['message'] = "Σας ενημερώνουμε ότι η αίτησή σας με Α/Α: " . $appId . " / " . date('d-m-y H:i:s', $appDate)
. " ΙΚΑΝΟΠΟΙΗΘΗΚΕ. Έχετε επιλεγεί να γίνει η εγγραφή σας στο " . $schName .", που βρίσκεται στη διεύθυνση: " . $schStreet
. ". Παρακαλώ επικοινωνήστε άμεσα με τη Σχολική Μονάδα τοποθέτησής σας"
. ", ώστε να ενημερωθείτε για τη διαδικασία που πρέπει να ακολουθήσετε για την εγγραφή σας στο σχολείο. "
. "Τηλέφωνο επικοινωνίας σχολείου: " . $schTel
. "\r\nΤεστ1\nΤεστ2" ;//e-mail body
. "\r\n\r\n Ομάδα Διαχείρισης της εφαρμογής e-epal."
. "\r\n Προσοχή: το μήνυμα που διαβάζετε είναι αυτοματοποιημένο. Παρακαλώ μην απαντάτε σε αυτό το μήνυμα." ;//e-mail body
//$this->logger->info($params['message']);
......
......@@ -32,6 +32,10 @@ class PDFCreator extends ControllerBase {
protected $logger;
protected $connection;
protected $pdf;
protected $fontLight;
protected $fontBold;
protected $fontSizeHeader;
protected $fontSizeRegular;
public function __construct(
EntityTypeManagerInterface $entityTypeManager,
......@@ -117,6 +121,11 @@ class PDFCreator extends ControllerBase {
], Response::HTTP_INTERNAL_SERVER_ERROR);
}
$this->fontLight = "open-sans.light";
$this->fontBold = "open-sans.bold";
$this->fontSizeHeader = 14;
$this->fontSizeRegular = 11;
$this->initPdfHandler();
$this->createHeader($epalStudent);
......@@ -170,17 +179,17 @@ class PDFCreator extends ControllerBase {
$this->pdf->AliasNbPages();
$this->pdf->AddPage();
$this->pdf->AddFont('open-sans.light', '', 'open-sans.light.php');
$this->pdf->AddFont('open-sans.bold', '', 'open-sans.bold.php');
$this->pdf->AddFont($this->fontLight, '', 'open-sans.light.php');
$this->pdf->AddFont($this->fontBold, '', 'open-sans.bold.php');
}
private function createHeader($student) {
$this->pdf->SetFont('open-sans.bold', '', 16);
$this->pdf->SetFont($this->fontBold, '', 16);
$this->pdf->MultiCell(0, 8, $this->prepareString('Ηλεκτρονική Αίτηση Εγγραφής Μαθητή σε ΕΠΑΛ'), 0, 'C');
$this->pdf->SetFont('open-sans.bold', '', 14);
$this->pdf->MultiCell(0, 8, $this->prepareString('με αρ.πρωτ. ' . $student->id->value . ' / ' . date('d-m-y (ώρα: H:i:s)', $student->created->value)), 0, 'C');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeHeader);
$this->pdf->MultiCell(0, 8, $this->prepareString('με αριθμό αίτησης: ' . $student->id->value . ' / ' . date('d-m-y (ώρα: H:i:s)', $student->created->value)), 0, 'C');
$this->pdf->Ln();
}
......@@ -190,35 +199,52 @@ class PDFCreator extends ControllerBase {
$width = 45;
$height = 8;
$this->pdf->SetFont('open-sans.bold', '', 14);
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeHeader);
$this->pdf->SetFillColor(255,178,102);
$this->pdf->MultiCell(0, $height, $this->prepareString('Στοιχεία αιτούμενου κηδεμόνα'), 0, 'C',true);
$this->pdf->MultiCell(0, $height, $this->prepareString('Στοιχεία αιτούμενου'), 0, 'C',true);
$this->pdf->Ln(4);
$this->pdf->SetFont('open-sans.light', '', 12);
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString('Όνομα:'), 0, 'L');
$this->pdf->Cell($width, $height, $this->prepareString($student->guardian_name->value), 0, 'L');
$x=$this->pdf->GetX(); $y=$this->pdf->GetY();
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->guardian_name->value), 0, 'L');
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->SetXY($x+$width,$y);
$this->pdf->Cell($width, $height, $this->prepareString('Επώνυμο:'), 0, 'L');
$this->pdf->Cell($width, $height, $this->prepareString($student->guardian_surname->value), 0, 'L');
$this->pdf->Ln();
//$x=$this->pdf->GetX(); $y=$this->pdf->GetY();
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->guardian_surname->value), 0, 'L');
//$this->pdf->Ln();
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString('Όνομα πατέρα:'), 0, 'L');
$this->pdf->Cell($width, $height, $this->prepareString($student->guardian_fathername->value), 0, 'L');
$x=$this->pdf->GetX(); $y=$this->pdf->GetY();
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->guardian_fathername->value), 0, 'L');
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->SetXY($x+$width,$y);
$this->pdf->Cell($width, $height, $this->prepareString('Όνομα μητέρας:'), 0, 'L');
$this->pdf->Cell($width, $height, $this->prepareString($student->guardian_mothername->value), 0, 'L');
$this->pdf->Ln();
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->guardian_mothername->value), 0, 'L');
//$this->pdf->Ln();
$fullAddressTxt = /*'Διεύθυνση κατοικίας: ' . */ $student->regionaddress->value . ', ΤΚ: ' . $student->regiontk->value . ', ' . $student->regionarea->value;
//$fullAddressTxt = $student->regionaddress->value . ', ΤΚ: ' . $student->regiontk->value . ', ' . $student->regionarea->value;
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$regAddressTxt = 'ΤΚ: ' . $student->regiontk->value . ', ' . $student->regionarea->value;
$this->pdf->Cell($width, $height, $this->prepareString('Διεύθυνση κατοικίας: '), 0, 'L');
$this->pdf->Cell($width, $height, $this->prepareString($fullAddressTxt), 0, 'L');
$this->pdf->Ln();
$this->pdf->Ln();
$this->pdf->Cell($width+30, $height, $this->prepareString('Αποδοχή όρων χρήσης συστήματος:'), 0, 'L');
$this->pdf->SetFont('open-sans.bold', '', 12);
$this->pdf->Cell($width, $height, $this->prepareString($this->retrieveAgreementLiteral($student->agreement->value) ), 0, 'L');
$x=$this->pdf->GetX(); $y=$this->pdf->GetY();
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->regionaddress->value), 0, 'L');
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->SetXY($x+$width,$y);
$this->pdf->Cell($width, $height, $this->prepareString('ΤΚ - Πόλη: '), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($regAddressTxt), 0, 'L');
$this->pdf->Ln();
$this->pdf->Ln();
......@@ -232,55 +258,84 @@ class PDFCreator extends ControllerBase {
$height = 8;
$heightln = 4;
$this->pdf->SetFont('open-sans.bold', '', 14);
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeHeader);
$this->pdf->SetFillColor(255,178,102);
$this->pdf->MultiCell(0, $height, $this->prepareString('Στοιχεία μαθητή'), 0, 'C',true);
$this->pdf->Ln(4);
$this->pdf->SetFont('open-sans.light', '', 12);
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString('Όνομα μαθητή:'), 0, 'L');
$this->pdf->Cell($width, $height, $this->prepareString($student->name->value), 0, 'L');
$x=$this->pdf->GetX(); $y=$this->pdf->GetY();
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->name->value), 0, 'L');
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->SetXY($x+$width,$y);
$this->pdf->Cell($width, $height, $this->prepareString('Επώνυμο μαθητή:'), 0, 'L');
$this->pdf->Cell($width, $height, $this->prepareString($student->studentsurname->value), 0, 'L');
$this->pdf->Ln();
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->studentsurname->value), 0, 'L');
//$this->pdf->Ln();
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString('Όνομα πατέρα:'), 0, 'L');
$this->pdf->Cell($width, $height, $this->prepareString($student->fatherfirstname->value), 0, 'L');
$x=$this->pdf->GetX(); $y=$this->pdf->GetY();
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->fatherfirstname->value), 0, 'L');
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->SetXY($x+$width,$y);
$this->pdf->Cell($width, $height, $this->prepareString('Όνομα μητέρας:'), 0, 'L');
$this->pdf->Cell($width, $height, $this->prepareString($student->motherfirstname->value), 0, 'L');
$this->pdf->Ln();
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->motherfirstname->value), 0, 'L');
//$this->pdf->Ln();
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString('Ημ/νία γέννησης:'), 0, 'L');
$this->pdf->Cell($width, $height, $this->prepareString($student->birthdate->value), 0, 'L');
$x=$this->pdf->GetX(); $y=$this->pdf->GetY();
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->birthdate->value), 0, 'L');
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->SetXY($x+$width,$y);
$this->pdf->Cell($width, $height, $this->prepareString('Τηλ. επικ/νίας:'), 0, 'L');
$this->pdf->Cell($width, $height, $this->prepareString($student->telnum->value), 0, 'L');
$this->pdf->Ln();
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell($width, $height, $this->prepareString($student->telnum->value), 0, 'L');
$this->pdf->Ln();
//$this->pdf->Ln();
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width+15, $height, $this->prepareString('Τύπος απολυτηρίου:'), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString($student->certificatetype->value), 0, 'L');
$this->pdf->Ln();
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width+15, $height, $this->prepareString('Έτος κτήσης απολυτηρίου:'), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString($student->graduation_year->value), 0, 'L');
$this->pdf->Ln();
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width+15, $height, $this->prepareString('Σχολείο τελευταίας φοίτησης:'), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell(0, $height, $this->prepareString($student->lastschool_schoolname->value), 0, 'L');
//$this->pdf->Ln();
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width+15, $height, $this->prepareString('Τάξη τελευταίας φοίτησης:'), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString($this->retrieveClassName($student->lastschool_class->value)), 0, 'L');
$this->pdf->Ln();
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width+15, $height, $this->prepareString('Σχ.έτος τελευταίας φοίτησης:'), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString($student->lastschool_schoolyear->value), 0, 'L');
$this->pdf->Ln();
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width+15, $height, $this->prepareString('Αίτηση από:'), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString($student->relationtostudent->value), 0, 'L');
$this->pdf->Ln();
$this->pdf->Ln();
......@@ -292,13 +347,14 @@ class PDFCreator extends ControllerBase {
$width = 45;
$height = 8;
$this->pdf->SetFont('open-sans.bold', '', 14);
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeHeader);
$this->pdf->SetFillColor(255,178,102);
$this->pdf->MultiCell(0, $height, $this->prepareString('Επιλεχθέντα σχολεία'), 0, 'C',true);
$this->pdf->Ln(4);
$this->pdf->SetFont('open-sans.light', '', 12);
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString('Τάξη εγγραφής:'), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString($this->retrieveClassName($student->currentclass->value)), 0, 'L');
$this->pdf->Ln();
......@@ -309,17 +365,13 @@ class PDFCreator extends ControllerBase {
$this->createSchoolChoices($student);
//$this->pdf->Cell($width, $height, $this->prepareString('Επώνυμο μαθητή:'), 0, 'L');
//$this->pdf->Cell($width, $height, $this->prepareString($student->studentsurname->value), 0, 'L');
//$this->pdf->Ln();
}
private function createSectorChoice($student) {
$width = 45;
$height = 8;
$this->pdf->SetFont('open-sans.light', '', 12);
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$epalSectors = $this->entityTypeManager->getStorage('epal_student_sector_field')->loadByProperties(array('student_id'=> $student->id->value));
$this->pdf->Cell($width, $height, $this->prepareString('Τομέας Επιλογής:'), 0, 'L');
......@@ -335,6 +387,7 @@ class PDFCreator extends ControllerBase {
}
else {
$sectorName = reset($sectorNames);
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell(0, $height, $this->prepareString($sectorName->name->value), 0, 'L');
}
}
......@@ -346,7 +399,7 @@ private function createCourseChoice($student) {
$width = 45;
$height = 8;
$this->pdf->SetFont('open-sans.light', '', 12);
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$epalCourses = $this->entityTypeManager->getStorage('epal_student_course_field')->loadByProperties(array('student_id'=> $student->id->value));
$this->pdf->Cell($width, $height, $this->prepareString('Ειδικότητα Επιλογής:'), 0, 'L');
......@@ -362,6 +415,7 @@ private function createCourseChoice($student) {
}
else {
$courseName = reset($courseNames);
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell(0, $height, $this->prepareString($courseName->name->value), 0, 'L');
}
}
......@@ -374,11 +428,11 @@ private function createCourseChoice($student) {
}
private function createSchoolChoices($student) {
private function createSchoolChoices_Ver1($student) {
//$width = 55;
//$width = 45;
$height = 8;
$this->pdf->SetFont('open-sans.light', '', 12);
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Ln(4);
......@@ -396,20 +450,69 @@ private function createSchoolChoices($student) {
$epalSchoolNames = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id'=> $epalSchool->epal_id->getString()));
$epalSchoolName = reset($epalSchoolNames);
//$this->pdf->Cell($width, $height, $this->prepareString($epalSchoolName->name->value), 0, 'L');
//$msg .= $epalSchoolName->name->value;
$schName = $epalSchoolName->name->value;
//$this->pdf->multiCell(0, $height, $this->prepareString($msg), 0, 'J');
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell(80, $height, $this->prepareString($msg), 0, 'L');
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
$this->pdf->multiCell(0, $height, $this->prepareString($schName), 0, 'L');
//$this->pdf->ln();
}
}
private function createSchoolChoices($student) {
$width = 45;
$height = 8;
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Ln(4);
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString('Σειρά προτίμησης'), 0, 0, 'L');
$this->pdf->multiCell($width, $height, $this->prepareString('ΕΠΑΛ επιλογής'), 0, 'L');
//$this->pdf->Ln();
//$x=$this->pdf->GetX(); $y=$this->pdf->GetY();
$epalSchools = $this->entityTypeManager->getStorage('epal_student_epal_chosen')->loadByProperties(array('student_id'=> $student->id->value));
foreach ($epalSchools as $epalSchool) {
$epalSchoolNames = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id'=> $epalSchool->epal_id->getString()));
$epalSchoolName = reset($epalSchoolNames);
$this->pdf->SetFont($this->fontBold, '', $this->fontSizeRegular);
//$epalSchool->choice_no->value
$this->pdf->Cell($width, $height, $this->prepareString($epalSchool->choice_no->value), 0, 0, 'C');
$this->pdf->multiCell(4*width, $height, $this->prepareString($epalSchoolName->name->value), 0, 'L');