public function updateSemaphores()
 {
     include '../../model/generated/include_dao.php';
     $ce = count(DAOFactory::getAlterationDAO()->queryAll());
     $cs = count(DAOFactory::getAlterationDAO()->queryByStateExecution("Successful"));
     $cr = count(DAOFactory::getAlterationDAO()->queryByStateExecution("Rollback"));
     $ci = count(DAOFactory::getAlterationDAO()->queryByStateExecution("Incident"));
     $rs = round((1 - ($cr + $ci) / $cs) * 100);
     $es = round($cs / $ce * 100);
     $eri = round(($cr + $ci) / $ce * 100);
     echo json_encode(array("ce" => $ce, "cs" => $cs, "cr" => $cr, "ci" => $ci, "rs" => $rs, "es" => $es, "eri" => $eri));
 }
 public function searchChange($val2)
 {
     include '../../model/generated/include_dao.php';
     $changeList = DAOFactory::getAlterationDAO()->load($val2);
     $scheduledStartDate = substr($changeList->getScheduledStart(), 0, 10);
     $scheduledStartTime = substr($changeList->getScheduledStart(), 11, 16);
     $rollbackStartDate = substr($changeList->getRollbackStart(), 0, 10);
     $rollbackStartTime = substr($changeList->getRollbackStart(), 11, 16);
     $rollbackEndDate = substr($changeList->getRollbackEnd(), 0, 10);
     $rollbackEndTime = substr($changeList->getRollbackEnd(), 11, 16);
     $scheduledEndDate = substr($changeList->getScheduledEnd(), 0, 10);
     $scheduledEndTime = substr($changeList->getScheduledEnd(), 11, 16);
     $appList = DAOFactory::getApplicationorinfrastructureDAO()->load($changeList->getApplicationOrInfrastructureApplicationOrInfrastructureId());
     $coordinatorList = DAOFactory::getCoordinatorDAO()->load($changeList->getCoordinatorCoordinatorId());
     echo json_encode(array("type" => $changeList->getChangeType(), "shortDescription" => $changeList->getShortDescription(), "impact" => $changeList->getImpact(), "affectation" => $changeList->getAffectation(), "scheduledStartDate" => $scheduledStartDate, "scheduledStartTime" => $scheduledStartTime, "rollbackStartDate" => $rollbackStartDate, "rollbackStartTime" => $rollbackStartTime, "rollbackEndDate" => $rollbackEndDate, "rollbackEndTime" => $rollbackEndTime, "scheduledEndDate" => $scheduledEndDate, "scheduledEndTime" => $scheduledEndTime, "stateExecution" => $changeList->getStateExecution(), "applicationOrInfrastructure" => $appList->getApplicationOrInfrastructureName(), "coordinator" => $coordinatorList->getCoordinatorName()));
 }
                            <th><center>Rollback start</center></th>
                            <th><center>Rollback End</center></th>
                            <th><center>Scheduled End</center></th>
                            <th><center>Execution state</center></th>   
                            <th><center>Application or infrastructure</center></th>
                            <th><center>Coordinator</center></th>
                            <th><center>Boss</center></th>
                            <th><center>Headship IT</center></th>
                            <th><center>Management IT</center></th>
                            <th><center>Direction IT</center></th>
                            </tr>
                            </thead>
                            <tbody>
                                <?php 
include 'model/generated/include_dao.php';
$changeList = DAOFactory::getAlterationDAO()->queryAll();
$managementitList = DAOFactory::getManagementitDAO()->queryAll();
$directionList = DAOFactory::getDirectionitDAO()->queryAll();
foreach ($changeList as $change) {
    echo '<tr class="success">' . '<td>' . $change->getChangeIdSM() . '</td>' . '<td>' . $change->getChangeType() . '</td>' . '<td>' . $change->getShortDescription() . '</td>' . '<td>' . $change->getImpact() . '</td>' . '<td>' . $change->getAffectation() . '</td>' . '<td>' . $change->getScheduledStart() . '</td>' . '<td>' . $change->getRollbackStart() . '</td>' . '<td>' . $change->getRollbackEnd() . '</td>' . '<td>' . $change->getScheduledEnd() . '</td>' . '<td>' . $change->getStateExecution() . '</td>';
    $appList = DAOFactory::getApplicationorinfrastructureDAO()->load($change->getApplicationOrInfrastructureApplicationOrInfrastructureId());
    $coordinatorList = DAOFactory::getCoordinatorDAO()->load($change->getCoordinatorCoordinatorId());
    $bossList = DAOFactory::getBossDAO()->load($change->getBossBossId());
    $headshipList = DAOFactory::getHeadshipitDAO()->load($change->getHeadshipITHeadshipITId());
    $managementList = DAOFactory::getManagementitDAO()->load($change->getManagementITManagementITId());
    $directionList = DAOFactory::getDirectionitDAO()->load($change->getDirectionITDirectionITId());
    echo '<td>' . $appList->getApplicationOrInfrastructureName() . '</td>' . '<td>' . $coordinatorList->getCoordinatorName() . '</td>' . '<td>' . $bossList->getBossName() . '</td>' . '<td>' . $headshipList->getHeadshipITName() . '</td>' . '<td>' . $managementList->getManagementITName() . '</td>' . '<td>' . $directionList->getDirectionITName() . '</td>' . '</tr>';
}
?>
                            </tbody>
                        </table>
<?php

include '../../model/generated/include_dao.php';
DAOFactory::getAlterationDAO()->delete($_POST["changeId"]);
echo "<script>alert ('" . $_POST["changeId"] . " change was deleted successfully .'); window.location='../../index.php';</script>";
<?php

include '../../model/generated/include_dao.php';
$appList = DAOFactory::getApplicationorinfrastructureDAO()->queryByApplicationOrInfrastructureName($_POST["applicationOrInfrastructure"]);
$coordinatorList = DAOFactory::getCoordinatorDAO()->queryByCoordinatorName($_POST["coordinator"]);
$bossList = DAOFactory::getBossDAO()->queryByBossName($_POST["boss"]);
$headshipList = DAOFactory::getHeadshipitDAO()->queryByHeadshipITName($_POST["headship"]);
$managementList = DAOFactory::getManagementitDAO()->queryByManagementITName($_POST["management"]);
$directionList = DAOFactory::getDirectionitDAO()->queryByDirectionITName($_POST["direction"]);
$change = new Alteration();
$change->setChangeIdSM($_POST["changeId"]);
$change->setChangeType($_POST["type"]);
$change->setShortDescription($_POST["shortDescription"]);
$change->setImpact($_POST["impact"]);
$change->setAffectation($_POST["affectation"]);
$change->setScheduledStart($_POST["scheduledStartDate"] . " " . $_POST["scheduledStartTime"] . ":00");
$change->setRollbackStart($_POST["rollbackStartDate"] . " " . $_POST["rollbackStartTime"] . ":00");
$change->setRollbackEnd($_POST["rollbackEndDate"] . " " . $_POST["rollbackEndTime"] . ":00");
$change->setScheduledEnd($_POST["scheduledEndDate"] . " " . $_POST["scheduledEndTime"] . ":00");
$change->setStateExecution($_POST["stateExecution"]);
$change->setApplicationOrInfrastructureApplicationOrInfrastructureId($appList[0]->getApplicationOrInfrastructureId());
$change->setCoordinatorCoordinatorId($coordinatorList[0]->getCoordinatorId());
$change->setBossBossId($bossList[0]->getBossId());
$change->setHeadshipITHeadshipITId($headshipList[0]->getHeadshipITId());
$change->setManagementITManagementITId($managementList[0]->getManagementITId());
$change->setDirectionITDirectionITId($directionList[0]->getDirectionITId());
$change->setStateChange(1);
$change->setChangeManagerIdchangeManager(1);
DAOFactory::getAlterationDAO()->update($change);
unset($change);
echo "<script>alert ('" . $_POST["changeId"] . " change was updated successfully .'); window.location='../../index.php';</script>";
    echo "<script>alert ('" . $_POST["changeId"] . " change is already registered.'); window.location='../../index.php'; </script>";
} else {
    $appList = DAOFactory::getApplicationorinfrastructureDAO()->queryByApplicationOrInfrastructureName($_POST["applicationOrInfrastructure"]);
    $coordinatorList = DAOFactory::getCoordinatorDAO()->queryByCoordinatorName($_POST["coordinator"]);
    $bossList = DAOFactory::getBossDAO()->queryByBossName($_POST["boss"]);
    $headshipList = DAOFactory::getHeadshipitDAO()->queryByHeadshipITName($_POST["headship"]);
    $managementList = DAOFactory::getManagementitDAO()->queryByManagementITName($_POST["management"]);
    $directionList = DAOFactory::getDirectionitDAO()->queryByDirectionITName($_POST["direction"]);
    $change = new Alteration();
    $change->setChangeIdSM($_POST["changeId"]);
    $change->setChangeType($_POST["type"]);
    $change->setShortDescription($_POST["shortDescription"]);
    $change->setImpact($_POST["impact"]);
    $change->setAffectation($_POST["affectation"]);
    $change->setScheduledStart($_POST["scheduledStartDate"] . " " . $_POST["scheduledStartTime"] . ":00");
    $change->setRollbackStart($_POST["rollbackStartDate"] . " " . $_POST["rollbackStartTime"] . ":00");
    $change->setRollbackEnd($_POST["rollbackEndDate"] . " " . $_POST["rollbackEndTime"] . ":00");
    $change->setScheduledEnd($_POST["scheduledEndDate"] . " " . $_POST["scheduledEndTime"] . ":00");
    $change->setStateExecution($_POST["stateExecution"]);
    $change->setApplicationOrInfrastructureApplicationOrInfrastructureId($appList[0]->getApplicationOrInfrastructureId());
    $change->setCoordinatorCoordinatorId($coordinatorList[0]->getCoordinatorId());
    $change->setBossBossId($bossList[0]->getBossId());
    $change->setHeadshipITHeadshipITId($headshipList[0]->getHeadshipITId());
    $change->setManagementITManagementITId($managementList[0]->getManagementITId());
    $change->setDirectionITDirectionITId($directionList[0]->getDirectionITId());
    $change->setStateChange(1);
    $change->setChangeManagerIdchangeManager(1);
    DAOFactory::getAlterationDAO()->insertWithId($change);
    unset($change);
    echo "<script>alert ('" . $_POST["changeId"] . " change was registered successfully.'); window.location='../../index.php';</script>";
}