/**
  * Constructor of the Class
  *
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  integer $idUser    idUser
  * @param  integer $idChurch  idChurch
  * @param  boolean $full      full document
  */
 function __construct($idUser = 0, $idChurch = 0)
 {
     //Define the constructor
     parent::FPDF('L', 'mm', 'Letter');
     $this->church = ChurchManager::getSingleChurch('id', $idChurch);
     $this->user = SessionManager::getSingleUser('id', $idUser);
 }
        $niche->setMaxCol($_GET["maxCol"]);
        $niche->setMaxRow($_GET["maxRow"]);
        $niche->setSize($_GET["size"]);
        $nicheT = ChurchManager::getSingleNiche('maxCol', $niche->getMaxCol(), 'maxRow', $niche->getMaxRow(), 'size', $niche->getSize());
        if ($nicheT === NULL) {
            ChurchManager::addNiche($niche);
            $nicheT = ChurchManager::getSingleNiche('maxCol', $niche->getMaxCol(), 'maxRow', $niche->getMaxRow(), 'size', $niche->getSize());
            $church->setIdNiche($nicheT->getId());
        } else {
            $church->setIdNiche($nicheT->getId());
        }
    } else {
        $church->setIdNiche('NULL');
    }
    if ($status === 'update') {
        $church->setId($_GET["id"]);
        if (ChurchManager::updateChurch($church)) {
            echo "OK";
        } else {
            echo "KO";
        }
    } else {
        if ($status === 'insert') {
            if (ChurchManager::addChurch($church)) {
                echo "OK";
            } else {
                echo "KO";
            }
        }
    }
}
                     <th style="text-align: center;">^Name Church^</th>
                     <th style="text-align: center;">^Type^</th>
                     <th style="text-align: center;">^Options^</th>
                 </tr>
                </thead>';
 $table = $table . $header;
 $table = $table . '<tbody>';
 $i = 0;
 foreach ($userRegistries as $singleUser) {
     if ($i === 10) {
         continue;
     }
     $username = $singleUser->getUsername();
     $type = $singleUser->getType();
     $offline = $singleUser->getOffline();
     $church = ChurchManager::getSingleChurch('id', $singleUser->getIdChurch());
     $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'userMessage.php?id=' . $singleUser->getID() . '\')">
                             <img src="../icons/message.png" class="img-inside" height="30px">
                         </button>
                     </td>';
     if ($_SESSION["user_id"] == $singleUser->getId()) {
         $options = '';
     }
     if ($offline == '1') {
         $offline = "^Offline^";
     } else {
         $offline = "^Online^";
     }
     if ($type == 'A') {
         $type = '^Administrator^';
                     <th style="text-align: center;">^Vicar^</th>
                     <th style="text-align: center;">^Dean^</th>
                     <th style="text-align: center;">^City^</th>
                     <th style="text-align: center;">^Options^</th>
                 </tr>
                </thead>';
 $table = $table . $header;
 $table = $table . '<tbody>';
 $i = 0;
 foreach ($churchRegistries as $singleChurch) {
     if ($i === 10) {
         continue;
     }
     $vicar = ChurchManager::getSingleVicar('id', $singleChurch->getIdVicar());
     $nameVicar = $vicar->getName();
     $dean = ChurchManager::getSingleDean('id', $singleChurch->getIdDean());
     $nameDean = $dean->getName();
     $city = CityManager::getSingleCity('id', $singleChurch->getIdCity());
     $nameCity = $city->getName();
     if ($_SESSION["user_type"] == 'A') {
         $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'churchLook.php?id=' . $singleChurch->getID() . '\')">
                             <img src="../icons/eye.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'churchChange.php?id=' . $singleChurch->getID() . '\')">
                             <img src="../icons/refresh.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="deleteObject(\'church\', \'' . $singleChurch->getID() . '\')">
                             <img src="../icons/delete.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'churchRectorRelationMenu.php?id=' . $singleChurch->getID() . '\')">
 /**
  * Recover all the rector from one church
  *
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  string          $idChurch   Id of one church
  * @return Array[Church]               Rector that worked in the church
  */
 static function getAllFormerChurchs($idRector = '', $order = 'id', $begin = -1)
 {
     if ($idRector == '') {
         return null;
     } else {
         $tableRector = DatabaseManager::getNameTable('TABLE_RECTOR');
         $tableChurch = DatabaseManager::getNameTable('TABLE_CHURCH');
         $tablePerson = DatabaseManager::getNameTable('TABLE_PERSON');
         $tableUnion = DatabaseManager::getNameTable('TABLE_FORMER_RECTOR_CHURCH');
         $query = "SELECT {$tableChurch}.*\r\n                              FROM {$tableChurch}\r\n                              LEFT JOIN {$tableUnion}\r\n                              ON {$tableUnion}.idChurch = {$tableChurch}.id\r\n                              WHERE {$tableUnion}.idRector = {$idRector}\r\n                              ORDER BY {$order}";
         if ($begin !== -1) {
             $query = $query . " LIMIT " . strval($begin * 10) . ", 11 ";
         }
         $arrayChurchs = DatabaseManager::multiFetchAssoc($query);
         $churchs = array();
         if ($arrayChurchs === null) {
             return null;
         } else {
             if ($begin !== -1) {
                 $i = 0;
                 foreach ($arrayChurchs as $church) {
                     if ($i == 10) {
                         continue;
                     }
                     $churchs[] = ChurchManager::ArrayToChurch($church);
                     $i++;
                 }
             } else {
                 foreach ($arrayChurchs as $church) {
                     $churchs[] = ChurchManager::ArrayToChurch($church);
                 }
             }
             return $churchs;
         }
     }
 }
<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/RectorManager.php";
require_once __DIR__ . "/../../../Backend/ChurchManager.php";
require_once __DIR__ . "/../../../Backend/PersonManager.php";
if (!isset($_GET) || $_GET["nameChurch"] === NULL) {
    die;
}
$church = ChurchManager::getSingleChurch('name', $_GET["nameChurch"]);
$rectors = RectorManager::getAllFormerRectors($church->getId());
$response = "";
if ($rectors !== NULL) {
    foreach ($rectors as $singleRector) {
        $person = PersonManager::getSinglePerson('id', $singleRector->getIdPerson());
        $nameRector = $person->getFullNameBeginName();
        $response = $response . "<li><a value='" . $singleRector->getId() . "' onclick='changeParent(\"" . $singleRector->getId() . "\", " . " \" " . $nameRector . " \")'>" . "{$nameRector}</a></li>";
    }
}
echo $response;
                 <tr style="text-align: center;">
                     <th style="text-align: center;">^Fullname^</th>
                     <th style="text-align: center;">^Name Church^</th>
                     <th style="text-align: center;">^Options^</th>
                 </tr>
                </thead>';
 $table = $table . $header;
 $table = $table . '<tbody>';
 $i = 0;
 foreach ($defuntionRegistries as $singleDefuntion) {
     if ($i === 10) {
         continue;
     }
     $child = PersonManager::getSinglePerson('id', $singleDefuntion->getIdOwner());
     $nameChild = $child->getFullName();
     $church = ChurchManager::getSingleChurch('id', $singleDefuntion->getIdChurch());
     if ($_SESSION["user_type"] == 'A' || $singleDefuntion->getIdChurch() == $_SESSION["user_church"]) {
         $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                             <button type="button" class="btn btn-success btn-inside" onclick="href(\'defuntionLook.php?id=' . $singleDefuntion->getID() . '\')">
                                 <img src="../icons/eye.png" class="img-inside" height="30px">
                             </button>
                             <button type="button" class="btn btn-success btn-inside" onclick="href(\'defuntionChange.php?id=' . $singleDefuntion->getID() . '\')">
                                 <img src="../icons/refresh.png" class="img-inside" height="30px">
                             </button>
                             <button type="button" class="btn btn-success btn-inside" onclick="deleteObject(\'defuntion\', \'' . $singleDefuntion->getID() . '\')">
                                 <img src="../icons/delete.png" class="img-inside" height="30px">
                             </button>
                         </td>';
     } else {
         $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                             <button type="button" class="btn btn-success btn-inside" onclick="href(\'defuntionLook.php?id=' . $singleDefuntion->getID() . '\')">
<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/RectorManager.php";
require_once __DIR__ . "/../../../Backend/ChurchManager.php";
require_once __DIR__ . "/../../../Backend/MarriageManager.php";
require_once __DIR__ . "/../../../Backend/PersonManager.php";
if (!isset($_POST) || $_POST["idBoyfriend"] == NULL) {
    echo "KO";
    die;
}
$churchMarriage = ChurchManager::getSingleChurch('name', $_POST["celebrationChurch"]);
$churchProcess = ChurchManager::getSingleChurch('name', $_POST["processChurch"]);
$boyfriend = new Person();
if ($_POST["idBoyfriend"] !== '0') {
    $boyfriend = PersonManager::getSinglePerson('id', $_POST["idBoyfriend"]);
}
$girlfriend = new Person();
if ($_POST["idGirlfriend"] !== '0') {
    $girlfriend = PersonManager::getSinglePerson('id', $_POST["idGirlfriend"]);
}
$boyfriend->setId($_POST["idBoyfriend"]);
$boyfriend->setNames($_POST["boyfriendName"]);
$boyfriend->setLastname1($_POST["lastname1Boyfriend"]);
$boyfriend->setLastname2($_POST["lastname2Boyfriend"]);
$girlfriend->setId($_POST["idGirlfriend"]);
$girlfriend->setNames($_POST["girlfriendName"]);
$girlfriend->setLastname1($_POST["lastname1Girlfriend"]);
$girlfriend->setLastname2($_POST["lastname2Girlfriend"]);
$marriage = new Marriage();
$marriage->setId($_POST["idMarriage"]);
                     <th style="text-align: center;">^Name Church^</th>
                     <th style="text-align: center;">^Options^</th>
                 </tr>
                </thead>';
 $table = $table . $header;
 $table = $table . '<tbody>';
 $i = 0;
 foreach ($marriageRegistries as $singleMarriage) {
     if ($i === 10) {
         continue;
     }
     $boyf = PersonManager::getSinglePerson('id', $singleMarriage->getIdBoyfriend());
     $nameboyf = $boyf->getFullName();
     $girlf = PersonManager::getSinglePerson('id', $singleMarriage->getIdGirlfriend());
     $namegirlf = $girlf->getFullName();
     $church = ChurchManager::getSingleChurch('id', $singleMarriage->getIdChurchMarriage());
     if ($_SESSION["user_type"] == 'A' || $singleMarriage->getIdChurchMarriage() == $_SESSION["user_church"] || $singleMarriage->getIdChurchProcess() == $_SESSION["user_church"]) {
         $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'marriageLook.php?id=' . $singleMarriage->getID() . '\')">
                             <img src="../icons/eye.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'marriageChange.php?id=' . $singleMarriage->getID() . '\')">
                             <img src="../icons/refresh.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="deleteObject(\'marriage\', \'' . $singleMarriage->getID() . '\')">
                             <img src="../icons/delete.png" class="img-inside" height="30px">
                         </button>
                     </td>';
     } else {
         $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'marriageLook.php?id=' . $singleMarriage->getID() . '\')">
 if ($i === 10) {
     continue;
 }
 $child = PersonManager::getSinglePerson('id', $singleConfirmation->getIdOwner());
 $nameChild = $child->getFullName();
 $mother = PersonManager::getSinglePerson('id', $child->getIdMother());
 $nameMother = "";
 if ($mother != NULL) {
     $nameMother = $mother->getFullName();
 }
 $father = PersonManager::getSinglePerson('id', $child->getIdFather());
 $nameFather = "";
 if ($father != NULL) {
     $nameFather = $father->getFullName();
 }
 $church = ChurchManager::getSingleChurch('id', $singleConfirmation->getIdChurch());
 if ($_SESSION["user_type"] == 'A' || $singleConfirmation->getIdChurch() == $_SESSION["user_church"]) {
     $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'confirmationLook.php?id=' . $singleConfirmation->getID() . '\')">
                             <img src="../icons/eye.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'confirmationChange.php?id=' . $singleConfirmation->getID() . '\')">
                             <img src="../icons/refresh.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="deleteObject(\'confirmation\', \'' . $singleConfirmation->getID() . '\')">
                             <img src="../icons/delete.png" class="img-inside" height="30px">
                         </button>
                     </td>';
 } else {
     $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'confirmationLook.php?id=' . $singleConfirmation->getID() . '\')">
SessionManager::validateUserInPage('churchInsertion.php');
//Get File contest from template
$string = file_get_contents("template/ChurchInsertion.html");
//Remplace the nav
$string = str_replace("|title|", 'Insert Church', $string);
$string = str_replace("|NavBar|", SessionManager::getNavBar(), $string);
//Create a String of options of Vicars
$vicarString = "";
$vicars = ChurchManager::getAllVicars();
foreach ($vicars as $singleVicar) {
    $vicarString = $vicarString . "<option> " . $singleVicar->getName() . "</option>\n";
}
$string = str_replace("|VicarOptions|", $vicarString, $string);
//Create a String of options of Deans
$deanString = "";
$deans = ChurchManager::getAllDeans();
foreach ($deans as $singleDean) {
    $deanString = $deanString . "<option> " . $singleDean->getName() . "</option>\n";
}
$string = str_replace("|DeanOptions|", $deanString, $string);
//Create a String of options of Cities
$citiesString = "";
$cities = CityManager::getAllCities();
foreach ($cities as $singleCity) {
    $citiesString = $citiesString . "<option> " . $singleCity->getName() . "</option>\n";
}
$string = str_replace("|CityOptions|", $citiesString, $string);
$saveButton = '<button type="button" class="btn btn-success" onclick=\'validateData("churchInsertion.php", "insert")\'>
                      <img src="../icons/save.png" width="50px"><br>
                      <strong>^Save^</strong>
                   </button>';
Esempio n. 12
0
 if ($i === 10) {
     continue;
 }
 $child = PersonManager::getSinglePerson('id', $singleProof->getIdOwner());
 $nameChild = $child->getFullName();
 $mother = PersonManager::getSinglePerson('id', $child->getIdMother());
 $nameMother = "";
 if ($mother != NULL) {
     $nameMother = $mother->getFullName();
 }
 $father = PersonManager::getSinglePerson('id', $child->getIdFather());
 $nameFather = "";
 if ($father != NULL) {
     $nameFather = $father->getFullName();
 }
 $church = ChurchManager::getSingleChurch('id', $singleProof->getIdChurch());
 if ($_SESSION["user_type"] == 'A' || $singleProof->getIdChurch() == $_SESSION["user_church"]) {
     $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'proofLook.php?id=' . $singleProof->getID() . '\')">
                             <img src="../icons/eye.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'proofChange.php?id=' . $singleProof->getID() . '\')">
                             <img src="../icons/refresh.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="deleteObject(\'proof\', \'' . $singleProof->getID() . '\')">
                             <img src="../icons/delete.png" class="img-inside" height="30px">
                         </button>
                     </td>';
 } else {
     $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'proofLook.php?id=' . $singleProof->getID() . '\')">
<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/ChurchManager.php";
if (!isset($_GET) || $_GET["nameVicar"] === NULL) {
    echo "KO";
    die;
}
$vicar = new Vicar(0, $_GET["nameVicar"]);
if (ChurchManager::addVicar($vicar)) {
    echo "OK";
} else {
    echo "KO";
}
<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/ChurchManager.php";
if (!isset($_POST) || $_POST["username"] === NULL) {
    echo "KO";
    die;
}
$user = new User();
$church = ChurchManager::getSingleChurch('name', $_POST["church"]);
$user->setPassword(sha1($_POST["password"]));
$user->setUsername($_POST["username"]);
if ($_POST["type"] == '0') {
    $user->setType('A');
} else {
    $user->setType('G');
}
$user->setLanguage("es");
$user->setIdChurch($church->getId());
if (SessionManager::addUser($user)) {
    echo "OK";
} else {
    echo "KO";
}
        $churchString = $churchString . "<option> " . $singleChurch->getName() . "</option>\n";
    }
}
$string = str_replace("|ChurchOption|", $churchString, $string);
$saveButton = '';
$cancelButton = '';
$returnButton = '<button type="button" class="btn btn-success" onclick=\'href("defuntionMenu.php")\'>
                        <img src="../icons/return.png" width="50px"><br>
                        <strong>^Return^</strong>
                    </button>';
//Create a action for button cancel
$string = str_replace("|SaveButton|", $saveButton, $string);
$string = str_replace("|CancelButton|", $cancelButton, $string);
$string = str_replace("|ReturnButton|", $returnButton, $string);
//Recuperamos la iglesia
$church = ChurchManager::getSingleChurch('id', $churchId);
if ($church !== NULL) {
    if ($church->getIdNiche() !== NULL) {
        if ($defuntion->getIdCrypt() !== NULL) {
            $cryptData = DefuntionManager::getSingleCrypt('id', $defuntion->getIdCrypt());
            //Load Crypt Data
            $string = str_replace('value="col"', 'value="' . $cryptData->getCol() . '"', $string);
            $string = str_replace('value="row"', 'value="' . $cryptData->getRow() . '"', $string);
            $string = str_replace('value="size"', 'value="' . $cryptData->getNumber() . '"', $string);
            $idCrypt = $defuntion->getIdCrypt();
            //Display the page
            $string = LanguageSupport::HTMLEvalLanguage($string);
            echo $string;
            //put the data of the crypt
            echo "<script>\n                        document.getElementById('inputCrypt').checked = true;\n                        checkCrypt();\n                        \$('#idCrypt').html('{$idCrypt}');\n                      </script>";
        } else {
                    </button>';
$returnButton = '';
//Create a action for button cancel
$string = str_replace("|SaveButton|", $saveButton, $string);
$string = str_replace("|CancelButton|", $cancelButton, $string);
$string = str_replace("|ReturnButton|", $returnButton, $string);
//Clean the fields
$string = str_replace('value="churchName"', 'value="' . $church->getName() . '"', $string);
$string = str_replace('value="churchType"', 'value="' . $church->getType() . '"', $string);
$string = str_replace('value="churchCode"', 'value="' . $church->getCode() . '"', $string);
$string = str_replace('value="churchAddress"', 'value="' . $church->getAddress() . '"', $string);
$string = str_replace('value="churchColony"', 'value="' . $church->getColony() . '"', $string);
$string = str_replace('value="churchPostalCode"', 'value="' . $church->getPostalCode() . '"', $string);
$string = str_replace('value="churchPhoneNumber"', 'value="' . $church->getPhoneNumber() . '"', $string);
if ($church->getIdNiche() !== NULL) {
    $nicheData = ChurchManager::getSingleNiche('id', $church->getidNiche());
    //Load Niche Data
    $string = str_replace('value="maxCol"', 'value="' . $nicheData->getMaxCol() . '"', $string);
    $string = str_replace('value="maxRow"', 'value="' . $nicheData->getMaxRow() . '"', $string);
    $string = str_replace('value="size"', 'value="' . $nicheData->getSize() . '"', $string);
    //Enable all the data
    $string = str_replace("disabled", '', $string);
    //Display the page
    $string = LanguageSupport::HTMLEvalLanguage($string);
    echo $string;
    //put the data of the niche
    echo "<script>document.getElementById('inputNiche').checked = true; checkNiche();</script>";
} else {
    $string = str_replace('value="maxCol"', '', $string);
    $string = str_replace('value="maxRow"', '', $string);
    $string = str_replace('value="size"', '', $string);
<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/RectorManager.php";
require_once __DIR__ . "/../../../Backend/ChurchManager.php";
require_once __DIR__ . "/../../../Backend/ProofManager.php";
require_once __DIR__ . "/../../../Backend/PersonManager.php";
if (!isset($_POST) || $_POST["idChild"] === NULL) {
    echo "KO";
    die;
}
$church = ChurchManager::getSingleChurch('name', $_POST["celebrationChurch"]);
$child = new Person();
if ($_POST["idChild"] !== '0') {
    $child = PersonManager::getSinglePerson('id', $_POST["idChild"]);
}
$child->setId($_POST["idChild"]);
$child->setNames($_POST["nameChild"]);
$child->setLastname1($_POST["lastname1Child"]);
$child->setLastname2($_POST["lastname2Child"]);
$child->setAddress($_POST["addressChild"]);
$child->setPhoneNumber($_POST["phoneChild"]);
$child->setIdCityAddress(CityManager::getSingleCity('name', $_POST["cityChild"])->getId());
$proof = new ProofTalks();
$proof->setId($_POST["idProof"]);
$proof->setIdChurch($church->getId());
$typeProof = "B";
if ($_POST["type"] === '1') {
    $typeProof = "E";
} else {
    if ($_POST["type"] === '2') {
<?php

require_once __DIR__ . "/../../Backend/SessionManager.php";
require_once __DIR__ . "/../../Backend/PersonManager.php";
require_once __DIR__ . "/../../Backend/RectorManager.php";
require_once __DIR__ . "/../../Backend/ChurchManager.php";
require_once __DIR__ . "/../../Backend/LanguageSupport.php";
SessionManager::validateUserInPage('addRelationChurchRector.php');
//Get File contest from template
$string = file_get_contents("template/AddRelationChurchRector.html");
//Remplace the nav
$string = str_replace("|NavBar|", SessionManager::getNavBar(), $string);
//Create a String of Church Options
$churchString = "";
$churchs = ChurchManager::getAllChurchs('name', -1);
foreach ($churchs as $singleChurch) {
    $churchString = $churchString . "<option> " . $singleChurch->getName() . "</option>\n";
}
$string = str_replace("|ChurchOption|", $churchString, $string);
//Create a String of Rector Options
$rectorString = "";
$rectors = RectorManager::getAllRectors('name');
foreach ($rectors as $singleRector) {
    $idRector = $singleRector->getId();
    $person = PersonManager::getSinglePerson('id', $idRector);
    $fullname = $person->getFullName();
    $rectorString = $rectorString . "<option lang='{$idRector}' id='{$fullname}'> " . $fullname . "</option>\n";
}
$string = str_replace("|RectorOption|", $rectorString, $string);
//Create Button contest
$saveButton = '<button type="button" class="btn btn-success" onclick=\'validateData("addRelationChurchRector.php", "' . SessionManager::getLastPage() . '")\'>
                     <th style="text-align: center;">^Status^</th>
                     <th style="text-align: center;">^Position^</th>
                     <th style="text-align: center;">^Actual Church^</th>
                     <th style="text-align: center;">^Options^</th>
                 </tr>
                </thead>';
 $table = $table . $header;
 $table = $table . '<tbody>';
 $i = 0;
 foreach ($rectorRegistries as $singleRector) {
     if ($i === 10) {
         continue;
     }
     $person = PersonManager::getSinglePerson('id', $singleRector->getIdPerson());
     $name = $person->getFullName();
     $church = ChurchManager::getSingleChurch('id', $singleRector->getIdActualChurch());
     $status = "Active";
     if ($singleRector->getStatus() !== 'A') {
         $status = "Inactive";
     }
     if ($_SESSION["user_type"] == 'A') {
         $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                             <button type="button" class="btn btn-success btn-inside" onclick="href(\'rectorLook.php?id=' . $singleRector->getID() . '\')">
                                 <img src="../icons/eye.png" class="img-inside" height="30px">
                             </button>
                             <button type="button" class="btn btn-success btn-inside" onclick="href(\'rectorChange.php?id=' . $singleRector->getID() . '\')">
                                 <img src="../icons/refresh.png" class="img-inside" height="30px">
                             </button>
                             <button type="button" class="btn btn-success btn-inside" onclick="deleteObject(\'rector\', \'' . $singleRector->getID() . '\')">
                                 <img src="../icons/delete.png" class="img-inside" height="30px">
                             </button>
<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/ChurchManager.php";
if (!isset($_GET) || $_GET["nameDean"] === NULL) {
    echo "KO";
    die;
}
$dean = new Dean(0, $_GET["nameDean"]);
if (ChurchManager::addDean($dean)) {
    echo "OK";
} else {
    echo "KO";
}
 if ($i === 10) {
     continue;
 }
 $child = PersonManager::getSinglePerson('id', $singleBaptism->getIdOwner());
 $nameChild = $child->getFullName();
 $mother = PersonManager::getSinglePerson('id', $child->getIdMother());
 $nameMother = "";
 if ($mother != NULL) {
     $nameMother = $mother->getFullName();
 }
 $father = PersonManager::getSinglePerson('id', $child->getIdFather());
 $nameFather = "";
 if ($father != NULL) {
     $nameFather = $father->getFullName();
 }
 $church = ChurchManager::getSingleChurch('id', $singleBaptism->getIdChurch());
 if ($_SESSION["user_type"] == 'A' || $singleBaptism->getIdChurch() == $_SESSION["user_church"]) {
     $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                     <button type="button" class="btn btn-success btn-inside" onclick="href(\'baptismLook.php?id=' . $singleBaptism->getID() . '\')">
                         <img src="../icons/eye.png" class="img-inside" height="30px">
                     </button>
                     <button type="button" class="btn btn-success btn-inside" onclick="href(\'baptismChange.php?id=' . $singleBaptism->getID() . '\')">
                         <img src="../icons/refresh.png" class="img-inside" height="30px">
                     </button>
                     <button type="button" class="btn btn-success btn-inside" onclick="deleteObject(\'baptism\', \'' . $singleBaptism->getID() . '\')">
                         <img src="../icons/delete.png" class="img-inside" height="30px">
                     </button>
                 </td>';
 } else {
     $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                     <button type="button" class="btn btn-success btn-inside" onclick="href(\'baptismLook.php?id=' . $singleBaptism->getID() . '\')">
<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/RectorManager.php";
require_once __DIR__ . "/../../../Backend/ChurchManager.php";
if (!isset($_GET) || $_GET["idChurch"] === NULL) {
    echo "KO";
} else {
    $church = ChurchManager::getSingleChurch("id", $_GET["idChurch"]);
    if ($church === NULL) {
        echo "KO";
    } else {
        if (!isset($_SESSION) || $_SESSION["user_church"] === NULL) {
            echo "KO";
        } else {
            //Check for permision
            if ($_SESSION["user_type"] == 'A') {
                if (ChurchManager::removeChurch($church)) {
                    echo "OK";
                } else {
                    echo "KO";
                }
            }
        }
    }
}
 if ($i === 10) {
     continue;
 }
 $child = PersonManager::getSinglePerson('id', $singleCommunion->getIdOwner());
 $nameChild = $child->getFullName();
 $mother = PersonManager::getSinglePerson('id', $child->getIdMother());
 $nameMother = "";
 if ($mother != NULL) {
     $nameMother = $mother->getFullName();
 }
 $father = PersonManager::getSinglePerson('id', $child->getIdFather());
 $nameFather = "";
 if ($father != NULL) {
     $nameFather = $father->getFullName();
 }
 $church = ChurchManager::getSingleChurch('id', $singleCommunion->getIdChurch());
 if ($_SESSION["user_type"] == 'A' || $singleCommunion->getIdChurch() == $_SESSION["user_church"]) {
     $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'communionLook.php?id=' . $singleCommunion->getID() . '\')">
                             <img src="../icons/eye.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'communionChange.php?id=' . $singleCommunion->getID() . '\')">
                             <img src="../icons/refresh.png" class="img-inside" height="30px">
                         </button>
                         <button type="button" class="btn btn-success btn-inside" onclick="deleteObject(\'communion\', \'' . $singleCommunion->getID() . '\')">
                             <img src="../icons/delete.png" class="img-inside" height="30px">
                         </button>
                     </td>';
 } else {
     $options = '<td data-title="^Options^" class="center-btn" style="text-align: center">
                         <button type="button" class="btn btn-success btn-inside" onclick="href(\'communionLook.php?id=' . $singleCommunion->getID() . '\')">