Пример #1
0
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    require_once '../../models/book.php';
    require_once '../../models/person.php';
    $bookName = $_POST['bookName'];
    $personName = $_POST['personName'];
    $date = $_POST['date'];
    try {
        //获取用户对象
        $personName = split("_", $personName);
        if (count($personName) != 3) {
            $errorInfo = "无效的用户名";
            throw new Exception($errorInfo);
        }
        $person = PersonManager::getPerson($personName[1]);
        if ($person === false) {
            $errorInfo = "无效的用户名";
            throw new Exception($errorInfo);
        }
        //获取书籍对象
        $bookName = split("_", $bookName);
        if (count($bookName) != 3) {
            $errorInfo = "无效的书名";
            throw new Exception($errorInfo);
        }
        $book = BookManager::getBook($bookName[1]);
        if ($book === false) {
            $errorInfo = "无效的书名";
            throw new Exception($errorInfo);
        }
Пример #2
0
require_once '../../models/person.php';
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    $page = $_GET['page'];
    $pageSize = $_GET['pageSize'];
    $key = $_GET['searchKey'];
    if (empty($page)) {
        $page = 1;
    }
    if (empty($pageSize)) {
        $pageSize = 10;
    }
    if (empty($key)) {
        $key = "";
    }
    $persons = PersonManager::searchPersonsWithRecordInfo($key, $page, $pageSize);
    if ($persons === false || count($persons["persons"]) == 0) {
        echo "<script>history.back();alert('没有数据');</script>";
        return;
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
  <?php 
require_once "../adminHead.php";
?>
</head>
Пример #3
0
<?php

require_once __DIR__ . "/../../Backend/SessionManager.php";
require_once __DIR__ . "/../../Backend/PersonManager.php";
require_once __DIR__ . "/../../Backend/LanguageSupport.php";
$string = file_get_contents("template/PersonList.html");
$name = $_GET["name"];
$lastname1 = $_GET["lastname1"];
$lastname2 = $_GET["lastname2"];
$posiblePerson = PersonManager::searchPersonsByNames($name, $lastname1, $lastname2);
$personList = "";
if ($posiblePerson !== NULL) {
    foreach ($posiblePerson as $singlePerson) {
        $father = PersonManager::getSinglePerson('id', $singlePerson->getIdFather());
        $mother = PersonManager::getSinglePerson('id', $singlePerson->getIdMother());
        $nameChild = $singlePerson->getNames() . ' ' . $singlePerson->getLastname1() . ' ' . $singlePerson->getLastname2();
        $nameFather = "^Not Father^";
        $nameMother = "^Not Mother^";
        $idString = '"' . $singlePerson->getId() . '",';
        if ($father !== NULL) {
            $nameFather = $father->getNames() . ' ' . $father->getLastname1() . ' ' . $father->getLastname2();
            $idString = $idString . '"' . $father->getId() . '",';
        } else {
            $idString = $idString . '"0",';
        }
        if ($mother !== NULL) {
            $nameMother = $mother->getNames() . ' ' . $mother->getLastname1() . ' ' . $mother->getLastname2();
            $idString = $idString . '"' . $mother->getId() . '",';
        } else {
            $idString = $idString . '"0",';
        }
 /**
  * Update one baptism in the database
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  Baptism $baptism  The baptism to update
  * @return boolean           if was possible to update
  */
 static function updateBaptism($baptism = null)
 {
     if ($baptism === null) {
         return false;
     }
     $tableBaptism = DatabaseManager::getNameTable('TABLE_BAPTISM');
     $id = $baptism->getId();
     $celebrationDate = $baptism->getCelebrationDate();
     $bornPlace = $baptism->getBornPlace();
     $bornDate = $baptism->getBornDate();
     $legitimate = $baptism->getLegitimate();
     $idGodFather = $baptism->getIdGodFather();
     $idGodMother = $baptism->getIdGodMother();
     $idBookRegistry = $baptism->getIdBookRegistry();
     $idCivilRegistry = $baptism->getIdCivilRegistry();
     $idChurch = $baptism->getIdChurch();
     $idRector = $baptism->getIdRector();
     $idOwner = $baptism->getIdOwner();
     $query = "UPDATE {$tableBaptism}\r\n                          SET baptismDate     = '{$celebrationDate}', \r\n                              bornPlace       = '{$bornPlace}', \r\n                              bornDate        = '{$bornDate}',        \r\n                              legitimate      = '{$legitimate}', \r\n                              idOwner         = '{$idOwner}',         \r\n                              idGodFather     = '{$idGodFather}', \r\n                              idGodMother     = '{$idGodMother}',     \r\n                              idCivilRegistry = '{$idCivilRegistry}', \r\n                              idBookRegistry  = '{$idBookRegistry}', \r\n                              idChurch        = '{$idChurch}', \r\n                              idRector        = '{$idRector}' \r\n                          WHERE {$tableBaptism}.id = {$id}";
     $person = PersonManager::getSinglePerson("id", $idOwner);
     ChangesLogsManager::addChangesLogs("C", "Bautismo de " . $person->getFullNameBeginName());
     return DatabaseManager::singleAffectedRow($query);
 }
<?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;
        $witness1->setLastname2($_POST["lastname2Witness1"]);
        PersonManager::addPerson($witness1, 'true');
        $witness1 = PersonManager::getSinglePerson('id', PersonManager::getLastID());
    }
    $marriage->setIdWitness1($witness1->getId());
}
//Process The Witness1
if ($_POST["nameWitness2"] !== '') {
    $witness2 = PersonManager::getSinglePerson('names', $_POST["nameWitness2"], 'lastname1', $_POST["lastname1Witness2"], 'lastname2', $_POST["lastname2Witness2"]);
    if ($witness2 === NULL) {
        $witness2 = new Person();
        $witness2->setNames($_POST["nameWitness2"]);
        $witness2->setLastname1($_POST["lastname1Witness2"]);
        $witness2->setLastname2($_POST["lastname2Witness2"]);
        PersonManager::addPerson($witness2, 'true');
        $witness2 = PersonManager::getSinglePerson('id', PersonManager::getLastID());
    }
    $marriage->setIdWitness2($witness2->getId());
}
//Get The Book Registry Data
$reverse = substr($_POST["reverseBookRegistry"], 0, 1);
if ($reverse === 'Y' || $reverse === 'S') {
    $reverse = 'Y';
}
$bookRegistry = MarriageManager::getSingleMarriageRegistry('book', $_POST["bookBookRegistry"], 'page', $_POST["pageBookRegistry"], 'number', $_POST["numBookRegistry"], 'reverse', $reverse);
if ($bookRegistry === NULL) {
    $bookRegistry = new MarriageRegistry();
    $bookRegistry->setBook($_POST["bookBookRegistry"]);
    $bookRegistry->setPage($_POST["pageBookRegistry"]);
    $bookRegistry->setNumber($_POST["numBookRegistry"]);
    $bookRegistry->setReverse($reverse);
                     </th>
                 </tr>
                 <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 {
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["name"] === NULL) {
    echo "KO";
    die;
}
$status = $_GET["status"];
$rector = new Rector();
$person = PersonManager::getSinglePerson('names', $_GET["name"], 'lastname1', $_GET["lastname1"], 'lastname2', $_GET["lastname2"]);
if ($person === NULL) {
    $person = new Person(0, $_GET["name"], $_GET["lastname1"], $_GET["lastname2"]);
    PersonManager::addPerson($person);
    $person = PersonManager::getSinglePerson('names', $_GET["name"], 'lastname1', $_GET["lastname1"], 'lastname2', $_GET["lastname2"]);
}
$church = ChurchManager::getSingleChurch('name', $_GET["actualChurch"]);
$rector->setIdPerson($person->getId());
$rector->setType($_GET["type"]);
$rector->setPosition($_GET["position"]);
$rector->setIdActualChurch($church->getId());
if ($_GET["statusR"] === 'Activo' || $_GET["statusR"] === 'Active') {
    $rector->setStatus('A');
} else {
    $rector->setStatus('I');
}
if ($status === 'update') {
    $rector->setId($_GET["id"]);
    if (RectorManager::updateRector($rector)) {
        echo "OK";
$marriageDate = DatabaseManager::databaseDateToSingleDate($marriage->getCelebrationDate());
SessionManager::validateUserInPage('marriageChange.php', $churchMarriageId, $churchProcessId);
$idRector = $marriage->getIdRector();
$objRector = RectorManager::getSingleRector('id', $idRector);
$objPerRect = PersonManager::getSinglePerson('id', $objRector->getIdPerson());
$nameRector = $objPerRect->getFullNameBeginName();
$idBookRegistry = $marriage->getIdBookRegistry();
$bookRegistry = MarriageManager::getSingleMarriageRegistry('id', $idBookRegistry);
$idGodFather = $marriage->getIdGodFather();
$idGodMother = $marriage->getIdGodMother();
$godMother = PersonManager::getSinglePerson('id', $idGodMother);
$godFather = PersonManager::getSinglePerson('id', $idGodFather);
$idWitness1 = $marriage->getIdWitness1();
$idWitness2 = $marriage->getIdWitness2();
$witness1 = PersonManager::getSinglePerson('id', $idWitness1);
$witness2 = PersonManager::getSinglePerson('id', $idWitness2);
if ($godFather === NULL) {
    $godFather = new Person();
}
if ($godMother === NULL) {
    $godMother = new Person();
}
if ($witness1 === NULL) {
    $witness1 = new Person();
}
if ($witness2 === NULL) {
    $witness2 = new Person();
}
//Create a String of options of Last Church
$churchString = "";
$churchs = ChurchManager::getAllChurchs('name');
 /**
  * update one ProofTalks in the database
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  ProofTalks $ProofTalks  The ProofTalks to update
  * @return boolean         If was posible to update
  */
 static function updateProofTalks($ProofTalks = null)
 {
     if ($ProofTalks === null) {
         return false;
     }
     $tableProofTalks = DatabaseManager::getNameTable('TABLE_PROFF_TALKS');
     $idOwner = $ProofTalks->getIdOwner();
     $type = $ProofTalks->getType();
     $id = $ProofTalks->getId();
     $idGodFather = $ProofTalks->getIdGodFather();
     $idGodMother = $ProofTalks->getIdGodMother();
     $idChurch = $ProofTalks->getIdChurch();
     if ($idGodFather === NULL) {
         $idGodFather = 'NULL';
     }
     if ($idGodMother === NULL) {
         $idGodMother = 'NULL';
     }
     $query = "UPDATE {$tableProofTalks}\r\n                          SET idOwner = '{$idOwner}', type = '{$type}', idGodMother = {$idGodMother}, \r\n                              idGodFather = {$idGodFather}, idChurch = '{$idChurch}'\r\n                          WHERE {$tableProofTalks}.id = {$id}";
     $person = PersonManager::getSinglePerson("id", $idOwner);
     ChangesLogsManager::addChangesLogs("C", "Comprobante de " . $person->getFullNameBeginName());
     return DatabaseManager::singleAffectedRow($query);
 }
    echo "<script src='../JS/functions.js'></script><script>href('churchMenu.php')</script>";
}
//Getting all registries
$churchRegistries = RectorManager::getAllFormerChurchs($idRector, $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>href('churchrMenu.php')</script>";
}
$person = $rector->getIdPerson();
$person = PersonManager::getSinglePerson('id', $person);
//Display the name of the church
$string = str_replace("|Rector|", "«" . $person->getNames() . " " . $person->getLastname1() . " " . $person->getLastname2() . "»", $string);
//Create contest for button next and prev
$nextButtonString = '<button type="button" 
                                 class="btn btn-warning"
                                 onclick="nextPage(\'true\')">
                        ^Next^</button>';
$prevButtonString = '<button type="button" 
                                 class="btn btn-warning"
                                 onclick="nextPage(\'false\')">
                        ^Previus^</button>';
$beggButtonString = '<button type="button" 
                                 class="btn btn-primary"
                                 onclick="nextPage(\'set\', \'0\')">
                        ^Begin^</button>';
<?php

require_once __DIR__ . "/../../../Backend/SessionManager.php";
require_once __DIR__ . "/../../../Backend/RectorManager.php";
require_once __DIR__ . "/../../../Backend/ChurchManager.php";
require_once __DIR__ . "/../../../Backend/DefuntionManager.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"]);
$defuntion = new Defuntion();
$defuntion->setId($_POST["idDefuntion"]);
$defuntion->setDeadDate(DatabaseManager::singleDateToDatabaseDate($_POST["celebrationDate"]));
$defuntion->setIdChurch($church->getId());
$defuntion->setIdOwner($child->getId());
//Get the defuntion Crypt
if ($_POST["idCrypt"] == '0') {
    if ($_POST["inCrypt"] == "true") {
        $myCrypt = new Crypt();
        $myCrypt->setIdNiche($church->getIdNiche());
        $myCrypt->setCol($_POST["cryptColumn"]);
Пример #13
0
<?php

require_once '../../models/person.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $person = new Person();
    $person->name = $_POST['name'];
    $person->sunccoNo = $_POST['personNo'];
    $ok = PersonManager::addPerson($person);
    if ($ok === false) {
        echo "添加失败";
    } else {
        echo "<script>alert('添加成功');</script>";
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
  <?php 
require_once "../adminHead.php";
?>
</head>

<body>

  <?php 
require_once "../adminNav.html";
?>

  <div class="container-fluid">
Пример #14
0
<?php

require_once '../adminHeader.html';
?>

<?php 
require_once '../../models/person.php';
require_once '../../models/record.php';
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    $personId = $_GET['personId'];
    $person = PersonManager::getPersonWithBorrowCount($personId);
    if ($person === false) {
        echo "<script>history.back();alert('没有数据');</script>";
        return;
    }
    $records = RecordManager::searchRecordsWithBookName($personId);
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
  <?php 
require_once "../adminHead.php";
?>
</head>

<body>

  <?php 
require_once "../adminNav.html";
Пример #15
0
         return;
     }
     $bookNames = array();
     $bookCount = count($books['books']);
     for ($i = 0; $i < $bookCount; $i++) {
         $book = $books['books'][$i];
         $bookNames[$i] = $book->name . "_" . $book->bookId . "_" . $book->sunccoNo;
     }
     echo JSON($bookNames);
     return;
     break;
 case 'getpersons':
     if ($type == 0) {
         $persons = PersonManager::searchPersons($query, 1, -1);
     } else {
         $persons = PersonManager::searchPersonsBySunccoNo($query, 1, -1);
     }
     if ($persons === false) {
         return;
     }
     $personNames = array();
     $personCount = count($persons['persons']);
     for ($i = 0; $i < $personCount; $i++) {
         $person = $persons['persons'][$i];
         $personNames[$i] = $person->name . "_" . $person->personId . "_" . $person->sunccoNo;
     }
     echo JSON($personNames);
     return;
     break;
 case 'getBorrowerInfo':
     if (strlen($query) != 0) {
                     <th style="text-align: center;">^Fullname Boyfriend^</th>
                     <th style="text-align: center;">^Fullname Girlfriend^</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 ($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 {
$ownerId = $confirmation->getIdOwner();
$owner = PersonManager::getSinglePerson('id', $ownerId);
$owner->getIdFather() !== NULL ? $fatherId = $owner->getIdFather() : ($fatherId = 0);
$owner->getIdMother() !== NULL ? $motherId = $owner->getIdMother() : ($motherId = 0);
$gender = $owner->getGender();
$churchId = $confirmation->getIdChurch();
$confirmationDate = DatabaseManager::databaseDateToSingleDate($confirmation->getCelebrationDate());
$idRector = $confirmation->getIdRector();
$objRector = RectorManager::getSingleRector('id', $idRector);
$objPerRect = PersonManager::getSinglePerson('id', $objRector->getIdPerson());
$nameRector = $objPerRect->getFullNameBeginName();
$idBookRegistry = $confirmation->getIdBookRegistry();
$bookRegistry = ConfirmationManager::getSingleConfirmationRegistry('id', $idBookRegistry);
$idGodFather = $confirmation->getIdGodFather();
$godMother = PersonManager::getSinglePerson('id', $idGodMother);
$godFather = PersonManager::getSinglePerson('id', $idGodFather);
if ($godFather === NULL) {
    $godFather = new Person();
}
if ($godMother === NULL) {
    $godMother = new Person();
}
//Create a String of options of Last Church
$churchString = "";
$churchs = ChurchManager::getAllChurchs('name');
foreach ($churchs as $singleChurch) {
    if ($singleChurch->getId() === $churchId) {
        $churchString = $churchString . "<option selected> " . $singleChurch->getName() . "</option>\n";
    } else {
        $churchString = $churchString . "<option> " . $singleChurch->getName() . "</option>\n";
    }
Пример #18
0
$color = "";
$time = "";
$gender = "";
?>
	



<a href="http://greeny.cs.tlu.ee/~helepuh/eksam/table.php">Vaata tabelit</a>


  <?php 
//VÄRVIDE LISAMINE
//uus instants klassist
$ColorManager = new ColorManager($mysqli);
$PersonManager = new PersonManager($mysqli);
//aadressirealt muutuja
if (isset($_GET["new_color"])) {
    $add_new_color = $ColorManager->addColor($_GET["new_color"]);
    var_dump($add_new_color);
}
//rippmenüü valiku kõrval vajutati nuppu
if (isset($_POST["add_person"])) {
    var_dump($_POST);
    $add_new_person_response = $PersonManager->addPerson($_POST["new_dd_selection"], $_POST["date_time"], $_POST["gender"], $POST["add_person"]);
}
?>
	


<h2>Lisa uus värv</h2>
$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() . '")\'>
                      <img src="../icons/save.png" width="50px"><br>
                      <strong>^Save^</strong>
                   </button>';
$cancelButton = '<button type="button" class="btn btn-success" onclick=\'href("' . SessionManager::getLastPage() . '")\'>
                        <img src="../icons/delete.png" width="50px"><br>
                        <strong>^Cancel^</strong>
                    </button>';
$returnButton = '';
//Create a action for button cancel
require_once __DIR__ . "/../../Backend/PersonManager.php";
require_once __DIR__ . "/../../Backend/LanguageSupport.php";
SessionManager::validateUserInPage('defuntionLook.php');
//Get File contest from template
$string = file_get_contents("template/DefuntionInsertion.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 Defuntion', $string);
$string = str_replace("|NavBar|", SessionManager::getNavBar(), $string);
//Get The Data of the Defuntion
$idDefuntion = $_GET["id"];
$defuntion = DefuntionManager::getSingleDefuntion('id', $idDefuntion);
$ownerId = $defuntion->getIdOwner();
$owner = PersonManager::getSinglePerson('id', $ownerId);
$churchId = $defuntion->getIdChurch();
$defuntionDate = DatabaseManager::databaseDateToSingleDate($defuntion->getDeadDate());
//Create a String of options of Last Church
$churchString = "";
$churchs = ChurchManager::getAllChurchs('name');
foreach ($churchs as $singleChurch) {
    if ($singleChurch->getId() === $churchId) {
        $churchString = $churchString . "<option selected> " . $singleChurch->getName() . "</option>\n";
    } else {
        $churchString = $churchString . "<option> " . $singleChurch->getName() . "</option>\n";
    }
}
$string = str_replace("|ChurchOption|", $churchString, $string);
$saveButton = '';
$cancelButton = '';
 /**
  * update one defuntion in the database
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  Defuntion $defuntion  The defuntion to update
  * @return boolean     if was possible to update
  */
 static function updateDefuntion($defuntion = null)
 {
     if ($defuntion === null) {
         return false;
     }
     $tableDefuntion = DatabaseManager::getNameTable('TABLE_DEFUNTION');
     $id = $defuntion->getId();
     $deadDate = $defuntion->getDeadDate();
     $idOwner = $defuntion->getIdOwner();
     $idChurch = $defuntion->getIdChurch();
     $idCrypt = $defuntion->getIdCrypt();
     if ($idCrypt == "") {
         $idCrypt = "NULL";
     }
     $query = "UPDATE {$tableDefuntion}\r\n                          SET deadDate = '{$deadDate}', idOwner = '{$idOwner}', idChurch = '{$idChurch}', \r\n                              idCrypt = {$idCrypt} \r\n                          WHERE {$tableDefuntion}.id = {$id}";
     $person = PersonManager::getSinglePerson("id", $idOwner);
     ChangesLogsManager::addChangesLogs("C", "Defuncion de " . $person->getFullNameBeginName());
     return DatabaseManager::singleAffectedRow($query);
 }
Пример #22
0
    }
    $proof->setIdGodFather($godFather->getId());
} else {
    $proof->setIdGodFather(NULL);
}
//Process The GodFather
if ($_POST["nameGodMother"] !== '') {
    $godMother = PersonManager::getSinglePerson('names', $_POST["nameGodMother"], 'lastname1', $_POST["lastname1GodMother"], 'lastname2', $_POST["lastname2GodMother"]);
    if ($godMother === NULL) {
        $godMother = new Person();
        $godMother->setNames($_POST["nameGodMother"]);
        $godMother->setLastname1($_POST["lastname1GodMother"]);
        $godMother->setLastname2($_POST["lastname2GodMother"]);
        $godMother->setGender('F');
        PersonManager::addPerson($godMother, 'true');
        $godMother = PersonManager::getSinglePerson('id', PersonManager::getLastID());
    }
    $proof->setIdGodMother($godMother->getId());
} else {
    $proof->setIdGodMother(NULL);
}
//Add the registry
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 {
 /**
  * update one confirmation in the database
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  Confirmation $confirmation  The confirmation to update
  * @return boolean     if was possible to update
  */
 static function updateConfirmation($confirmation = null)
 {
     if ($confirmation === null) {
         return false;
     }
     $tableConfirmation = DatabaseManager::getNameTable('TABLE_CONFIRMATION');
     $id = $confirmation->getId();
     $celebrationDate = $confirmation->getCelebrationDate();
     $idGodFather = $confirmation->getIdGodFather();
     $idBookRegistry = $confirmation->getIdBookRegistry();
     $idChurch = $confirmation->getIdChurch();
     $idRector = $confirmation->getIdRector();
     $idOwner = $confirmation->getIdOwner();
     $query = "UPDATE {$tableConfirmation}\r\n                          SET confirmationDate       = '{$celebrationDate}', \r\n                              idOwner                = '{$idOwner}', \r\n                              idGodFather            = '{$idGodFather}', \r\n                              idConfirmationRegistry = '{$idBookRegistry}', \r\n                              idChurch               = '{$idChurch}', \r\n                              idRector               = '{$idRector}' \r\n                          WHERE {$tableConfirmation}.id = {$id}";
     $person = PersonManager::getSinglePerson("id", $idOwner);
     ChangesLogsManager::addChangesLogs("C", "Confirmacion de " . $person->getFullNameBeginName());
     return DatabaseManager::singleAffectedRow($query);
 }
Пример #24
0
                </thead>';
 $table = $table . $header;
 $table = $table . '<tbody>';
 $i = 0;
 foreach ($baptismRegistries as $singleBaptism) {
     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">
}
$stringResponse = "";
$child = PersonManager::getSinglePerson('id', $_GET["id"]);
$father = PersonManager::getSinglePerson('id', $child->getIdFather());
$mother = PersonManager::getSinglePerson('id', $child->getIdMother());
$gpp = NULL;
$gmp = NULL;
$gpm = NULL;
$gmm = NULL;
if ($father !== NULL) {
    $gpp = PersonManager::getSinglePerson('id', $father->getIdFather());
    $gmp = PersonManager::getSinglePerson('id', $father->getIdMother());
}
if ($mother !== NULL) {
    $gpm = PersonManager::getSinglePerson('id', $mother->getIdFather());
    $gmm = PersonManager::getSinglePerson('id', $mother->getIdMother());
}
//Abouth The Child
$stringResponse = $stringResponse . "namec=" . $child->getNames() . "&lastname1c=" . $child->getLastname1() . "&lastname2c=" . $child->getLastname2();
if ($father === NULL) {
    $stringResponse = $stringResponse . "&namef=&lastname1f=&lastname2f=";
} else {
    $stringResponse = $stringResponse . "&namef=" . $father->getNames() . "&lastname1f=" . $father->getLastname1() . "&lastname2f=" . $father->getLastname2();
}
if ($mother === NULL) {
    $stringResponse = $stringResponse . "&namem=&lastname1m=&lastname2m=";
} else {
    $stringResponse = $stringResponse . "&namem=" . $mother->getNames() . "&lastname1m=" . $mother->getLastname1() . "&lastname2m=" . $mother->getLastname2();
}
if ($gpp === NULL) {
    $stringResponse = $stringResponse . "&namegpp=&lastname1gpp=&lastname2gpp=";
 /**
  * update one marriage in the database
  * 
  * @author Jonathan Sandoval <*****@*****.**>
  * @param  Marriage $marriage  The marriage to update
  * @return boolean     if was possible to update
  */
 static function updateMarriage($marriage = null)
 {
     if ($marriage === null) {
         return false;
     }
     $tableMarriage = DatabaseManager::getNameTable('TABLE_MARRIAGE');
     $idBoyfriend = $marriage->getIdBoyfriend();
     $idGirlfriend = $marriage->getIdGirlfriend();
     $id = $marriage->getId();
     $marriageDate = $marriage->getCelebrationDate();
     $idGodFather = $marriage->getIdGodFather();
     $idGodMother = $marriage->getIdGodMother();
     $idChurchMarriage = $marriage->getIdChurchMarriage();
     $idRector = $marriage->getIdRector();
     $idWitness1 = $marriage->getIdWitness1();
     $idWitness2 = $marriage->getIdWitness2();
     $idChurchProcess = $marriage->getIdChurchProcess();
     $idMarriageRegistry = $marriage->getIdBookRegistry();
     $query = "UPDATE {$tableMarriage}\r\n                          SET idBoyfriend        = '{$idBoyfriend}', \r\n                              idGirlfriend       = '{$idGirlfriend}', \r\n                              idGodFather        = '{$idGodFather}', \r\n                              idGodMother        = '{$idGodMother}', \r\n                              idWitness1         = '{$idWitness1}', \r\n                              idWitness2         = '{$idWitness2}',\r\n                              idMarriageRegistry = '{$idMarriageRegistry}', \r\n                              idChurchProcess    = '{$idChurchProcess}', \r\n                              idRector           = '{$idRector}', \r\n                              idChurchMarriage   = '{$idChurchMarriage}', \r\n                              marriageDate       = '{$marriageDate}'\r\n                          WHERE {$tableMarriage}.id = {$id}";
     $personA = PersonManager::getSinglePerson("id", $idBoyfriend);
     $personB = PersonManager::getSinglePerson("id", $idGirlfriend);
     ChangesLogsManager::addChangesLogs("C", "Matrimonio de" . $personA->getFullNameBeginName() . " y " . $personB->getFullNameBeginName());
     return DatabaseManager::singleAffectedRow($query);
 }