updated controllers, added fields in entities regarding second period applications

parent 7bbac3f9
......@@ -99,6 +99,7 @@ class MinisterSettings extends ControllerBase {
$directorViewDisabled = $epalConfig->lock_school_students_view->getString();
$applicantsLoginDisabled = $epalConfig->lock_application->getString();
$applicantsResultsDisabled = $epalConfig->lock_results->getString();
$secondPeriodEnabled = $epalConfig->activate_second_period->getString();
}
$config_storage->resetCache();
......@@ -109,6 +110,7 @@ class MinisterSettings extends ControllerBase {
'directorViewDisabled' => $directorViewDisabled,
'applicantsLoginDisabled' => $applicantsLoginDisabled,
'applicantsResultsDisabled' => $applicantsResultsDisabled,
'secondPeriodEnabled' => $secondPeriodEnabled,
], Response::HTTP_OK);
} //end try
......@@ -125,7 +127,7 @@ class MinisterSettings extends ControllerBase {
}
public function storeSettings(Request $request, $capacityDisabled, $directorViewDisabled, $applicantsLoginDisabled, $applicantsResultsDisabled ) {
public function storeSettings(Request $request, $capacityDisabled, $directorViewDisabled, $applicantsLoginDisabled, $applicantsResultsDisabled, $secondPeriodEnabled ) {
try {
if (!$request->isMethod('GET')) {
......@@ -171,6 +173,8 @@ public function storeSettings(Request $request, $capacityDisabled, $directorView
$epalConfig->set('lock_school_students_view', $directorViewDisabled);
$epalConfig->set('lock_application', $applicantsLoginDisabled);
$epalConfig->set('lock_results', $applicantsResultsDisabled);
$epalConfig->set('activate_second_period', $secondPeriodEnabled);
$epalConfig->save();
}
$config_storage->resetCache();
......@@ -182,6 +186,7 @@ public function storeSettings(Request $request, $capacityDisabled, $directorView
'directorViewDisabled' => $directorViewDisabled,
'applicantsLoginDisabled' => $applicantsLoginDisabled,
'applicantsResultsDisabled' => $applicantsResultsDisabled,
'secondPeriodEnabled' => $secondPeriodEnabled,
], Response::HTTP_OK);
} //end try
......@@ -198,8 +203,6 @@ public function storeSettings(Request $request, $capacityDisabled, $directorView
}
private function respondWithStatus($arr, $s) {
$res = new JsonResponse($arr);
$res->setStatusCode($s);
......
......@@ -531,9 +531,8 @@ private function createSchoolChoices($student) {
$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) {
......@@ -545,26 +544,21 @@ private function createSchoolChoices($student) {
$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');
//$this->pdf->Ln();
}
*/
//....
/*
$this->pdf->SetFont($this->fontLight, '', $this->fontSizeRegular);
$this->pdf->Cell($width, $height, $this->prepareString('Όνομα μαθητή:'), 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');
for ($i = 0; $i < 3; $i++) {
$epalSchools = $this->entityTypeManager->getStorage('epal_student_epal_chosen')->loadByProperties(array('student_id'=> $student->id->value, 'choice_no'=> $i+1 ));
if ($epalSchools) {
$epalSchool = reset($epalSchools);
$epalSchoolNames = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id'=> $epalSchool->epal_id->getString()));
$epalSchoolName = reset($epalSchoolNames);
$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($student->studentsurname->value), 0, 'L');
*/
$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');
}
}
}
......
......@@ -280,6 +280,26 @@ class EpalConfig extends ContentEntityBase implements EpalConfigInterface {
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['activate_second_period'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Activate second periods of applications'))
->setDescription(t('Activate second periods of applications.'))
->setSettings(array(
'text_processing' => 0,
))
->setRequired(FALSE)
->setDefaultValue(FALSE)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'boolean',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'boolean',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status'))
->setDescription(t('A boolean indicating whether the Epal config is published.'))
......
......@@ -1034,6 +1034,26 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface
->setDisplayConfigurable('form', true)
->setDisplayConfigurable('view', true);
$fields['second_period'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Δεύτερη περίοδος αιτήσεων'))
->setDescription(t('Δεύτερη περίοδος αιτήσεων.'))
->setSettings(array(
'text_processing' => 0,
))
->setRequired(false)
->setDefaultValue(false)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'boolean',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'boolean',
'weight' => -4,
))
->setDisplayConfigurable('form', true)
->setDisplayConfigurable('view', true);
$fields['guardian_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Όνομα κηδεμόνα'))
->setDescription(t('Δώσε το όνομα κηδεμόνα.'))
......@@ -1218,6 +1238,8 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface
->setDisplayConfigurable('form', true)
->setDisplayConfigurable('view', true);
$fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status'))
->setDescription(t('A boolean indicating whether the EPAL Student is published.'))
......
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