Commit 27d4ee17 authored by Ασπασία Κατσή's avatar Ασπασία Κατσή

Merge branch 'smallclasses' into 'develop'

Smallclasses

See merge request !7
parents 74234637 4e584c8e
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -396,3 +396,11 @@ epal.undomergeall:
_controller: '\Drupal\epal\Controller\SmallClassDistribution::UndoMergeAll'
requirements:
_user_is_logged_in: 'TRUE'
epal.approveclasses:
path: '/epal/approveclasses'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\SmallClassDistribution::ApproveClasses'
requirements:
_user_is_logged_in: 'TRUE'
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -489,6 +489,8 @@ class DirectorView extends ControllerBase
'classes' => 1,
'limitdown' => $limit,
'capc' => $capacity_class_a,
'approved' => $object-> approved_a-> value,
'approved_id' => $object -> id()
);
}
......@@ -519,6 +521,8 @@ class DirectorView extends ControllerBase
'classes' => 2,
'limitdown' => $limit,
'capc' => $capacity_class_b,
'approved' => $object-> approved_sector -> value,
'approved_id' => $object -> id()
);
}
......@@ -548,6 +552,8 @@ class DirectorView extends ControllerBase
'classes' => 3,
'limitdown' => $limit,
'capc' => $capacity_class_c,
'approved' => $object-> approved_speciality -> value,
'approved_id' => $object -> id()
);
}
......@@ -575,6 +581,8 @@ class DirectorView extends ControllerBase
'classes' => 4,
'limitdown' => $limit,
'capc' => $capacity_class_d,
'approved' => $object-> approved_speciality_d -> value,
'approved_id' => $object -> id()
);
}
}
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -752,7 +752,78 @@ public function findMergingSchoolsforUndo(Request $request, $classId, $sector, $
}
public function ApproveClasses(Request $request)
{
if (!$request->isMethod('POST')) {
return $this->respondWithStatus(['message' => t('Method Not Allowed')], Response::HTTP_METHOD_NOT_ALLOWED);
}
$authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
$userRoles = $user->getRoles();
$userRole = '';
foreach ($userRoles as $tmpRole) {
if ($tmpRole === 'regioneduadmin') {
$userRole = $tmpRole;
}
}
if ($userRole === 'regioneduadmin') {
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', 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);
} 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);
}
} else {
return $this->respondWithStatus(['message' => t('EPAL user not found')], Response::HTTP_FORBIDDEN);
}
}
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -568,6 +568,27 @@ class EepalSchool extends ContentEntityBase implements EepalSchoolInterface {
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['approved_a'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Εγκεκριμένο'))
->setDescription(t('Εγκρίνεται σε περίπτωση ολογοελούς.'))
->setDefaultValue(FALSE)
->setSettings(array(
'text_processing' => 0,
))
->setRequired(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 Eepal school is published.'))
......
......@@ -285,6 +285,30 @@ class EepalSectorsInEpal extends ContentEntityBase implements EepalSectorsInEpal
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['approved_sector'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Εγκεκριμένο'))
->setDescription(t('Εγκρίνεται σε περίπτωση ολογοελούς.'))
->setDefaultValue(FALSE)
->setSettings(array(
'text_processing' => 0,
))
->setRequired(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 Eepal sectors in epal is published.'))
......
......@@ -326,6 +326,49 @@ class EepalSpecialtiesInEpal extends ContentEntityBase implements EepalSpecialti
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['approved_speciality'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Εγκεκριμένο'))
->setDescription(t('Εγκρίνεται σε περίπτωση ολογοελούς.'))
->setDefaultValue(FALSE)
->setSettings(array(
'text_processing' => 0,
))
->setRequired(false)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'boolean',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'boolean',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['approved_speciality_d'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Εγκεκριμένο'))
->setDescription(t('Εγκρίνεται σε περίπτωση ολογοελούς.'))
->setDefaultValue(FALSE)
->setSettings(array(
'text_processing' => 0,
))
->setRequired(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 Eepal specialties in epal is published.'))
......
......@@ -131,7 +131,7 @@ class CBController extends ControllerBase
/* $this->logger->notice('$configRowName='.$configRowName.'***url='.$this->redirect_url);
$cookie = new Cookie('auth_token', $schoolToken, 0, '/', null, false, false);
$cookie2 = new Cookie('auth_role', 'student', 0, '/', null, false, false); */
return new RedirectResponse($this->redirect_url . $schoolToken.'&auth_role=student', 302, []);
return new RedirectResponseWithCookieExt($this->redirect_url . $schoolToken.'&auth_role=student', 302, []);
} else {
\Drupal::service('page_cache_kill_switch')->trigger();
return new RedirectResponseWithCookieExt($this->redirect_url . $schoolToken.'&auth_role=student', 302, []);
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
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