<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/ProofManager.php";
if (!isset($_GET) || $_GET["idProof"] === NULL) {
    echo "KO";
} else {
    $proof = ProofManager::getSingleProofTalks("id", $_GET["idProof"]);
    if ($proof === NULL) {
        echo "KO";
    } else {
        if (!isset($_SESSION) || $_SESSION["user_church"] === NULL) {
            echo "KO";
        } else {
            //Check for permision
            if ($_SESSION["user_type"] == 'A' || $_SESSION["user_church"] == $proof->getIdChurch()) {
                if (ProofManager::removeProofTalks($proof)) {
                    echo "OK";
                } else {
                    echo "KO";
                }
            }
        }
    }
}
if ($_SESSION["user_type"] != 'A') {
    if ($_SESSION["user_church"] == $church->getId()) {
        if ($_POST["status"] === 'insert') {
            if (ProofManager::addProofTalks($proof)) {
                echo "OK";
            } else {
                echo "KO";
            }
        } else {
            if ($_POST["status"] === 'update') {
                ProofManager::updateProofTalks($proof);
                echo "OK";
            }
        }
    } else {
        echo "KO";
    }
} else {
    if ($_POST["status"] === 'insert') {
        if (ProofManager::addProofTalks($proof)) {
            echo "OK";
        } else {
            echo "KO";
        }
    } else {
        if ($_POST["status"] === 'update') {
            ProofManager::updateProofTalks($proof);
            echo "OK";
        }
    }
}
Пример #3
0
require_once __DIR__ . "/../../Backend/ProofManager.php";
require_once __DIR__ . "/../../Backend/PersonManager.php";
require_once __DIR__ . "/../../Backend/RectorManager.php";
require_once __DIR__ . "/../../Backend/LanguageSupport.php";
SessionManager::validateUserInPage('proofLook.php');
//Get File contest from template
$string = file_get_contents("template/ProofInsertion.html");
if (!isset($_GET) || $_GET["id"] === NULL) {
    echo "<script src='../JS/functions.js'></script><script>href('main.php')</script>";
}
//Remplace the nav
$string = str_replace("|title|", 'Look Proof', $string);
$string = str_replace("|NavBar|", SessionManager::getNavBar(), $string);
//Get The Data of the Proof
$idProof = $_GET["id"];
$proof = ProofManager::getSingleProofTalks('id', $idProof);
$ownerId = $proof->getIdOwner();
$owner = PersonManager::getSinglePerson('id', $ownerId);
$owner->getIdFather() !== NULL ? $fatherId = $owner->getIdFather() : ($fatherId = 0);
$owner->getIdMother() !== NULL ? $motherId = $owner->getIdMother() : ($motherId = 0);
$address = $owner->getAddress();
$phonenum = $owner->getPhoneNumber();
$gender = $owner->getGender();
$churchId = $proof->getIdChurch();
$idGodFather = $proof->getIdGodFather();
$idGodMother = $proof->getIdGodMother();
$godMother = PersonManager::getSinglePerson('id', $idGodMother);
$godFather = PersonManager::getSinglePerson('id', $idGodFather);
if ($godFather === NULL) {
    $godFather = new Person();
}
Пример #4
0
        $klastname2f = $_GET["klastname2f"];
        $knamem = $_GET["knamem"];
        $klastname1m = $_GET["klastname1m"];
        $klastname2m = $_GET["klastname2m"];
        $kchurch = $_GET["kchurch"];
        $ktype = $_GET["ktype"];
        $posibleNames[0] = PersonManager::searchPersonsByNames($knamec, $klastname1c, $klastname2c, false);
        $posibleNames[1] = PersonManager::searchPersonsByNames($knamef, $klastname1f, $klastname2f, false);
        $posibleNames[2] = PersonManager::searchPersonsByNames($knamem, $klastname1m, $klastname2m, false);
        $proofSearch->setIdOwner($posibleNames);
        $posibleChurch = ChurchManager::simpleSearchChurch($kchurch, 'id', -1);
        $proofSearch->setIdChurch($posibleChurch);
        $proofSearch->setType($ktype);
        $proofRegistries = ProofManager::advancedSearchProof($proofSearch, 'AND', $sortType, $numberPage);
    } else {
        $proofRegistries = ProofManager::getAllProofs($sortType, $numberPage);
    }
}
//Get the total of registries
$totalRegistries = DatabaseManager::getAffectedRows();
$affectedRegistries = DatabaseManager::registriesAffectedLastQuery();
$lastPage = floor($affectedRegistries / 10);
if ($affectedRegistries % 10 === 0) {
    $lastPage = floor($affectedRegistries / 10) - 1;
}
if ($totalRegistries === 0 && $numberPage !== 0) {
    echo "<script src='../JS/functions.js'></script><script>nextPage('set', '0')</script>";
}
//Create contest for button next and prev
$nextButtonString = '<button type="button" 
                                 class="btn btn-warning"