$persistManager = new EPPersistentDataManager('../php/config.ini');
$_SESSION['prefixList'] = $epListP->getListPrefix();
$_SESSION['groupsList'] = $epListP->getListGroups();
$_SESSION['skillList'] = $epListP->getListSkills($epListP->getListAptitudes());
if (isset($_POST['addSkill'])) {
    $glistInject = array();
    if (isset($_POST['selectedGroups'])) {
        foreach ($_POST['selectedGroups'] as $g) {
            array_push($glistInject, $g);
        }
    }
    $arrayNewGroups = explode(";", $_POST['newGroups']);
    foreach ($arrayNewGroups as $h) {
        array_push($glistInject, $h);
    }
    $skill = new EPSkill($_POST['name'], $_POST['desc'], $epListP->getAptitudeByAbbreviation($_POST['linkedApt']), $_POST['type'], $_POST['defaultable'], $_POST['prefix'], $glistInject);
    if (!$persistManager->persistSkill($skill)) {
        echo $persistManager->getLastError();
        echo "<br><br>";
    } else {
        $_SESSION['skillList'] = $epListP->getListSkills($epListP->getListAptitudes());
        echo "<b> Skill Added ! </b><br><br>";
    }
} else {
    if (isset($_POST['deleteSkill'])) {
        if (!$persistManager->deleteSkill($_POST['deleteSkill'])) {
            echo $persistManager->getLastError();
            echo "<br><br>";
        } else {
            $_SESSION['skillList'] = $epListP->getListSkills($epListP->getListAptitudes());
            echo "<b> Skill Deleted ! </b><br><br>";