本文整理汇总了PHP中DatabaseManager::getNameTable方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseManager::getNameTable方法的具体用法?PHP DatabaseManager::getNameTable怎么用?PHP DatabaseManager::getNameTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager::getNameTable方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addChangesLogs
/**
* Insert one changes logs to the database
*
* @author Jonathan Sandoval <jonathan_s_pisis@yahoo.com.mx>
* @param String $typéChange The type of the change to efect (insert, update, delete)
* @param String $descriptionC The description of the change
* @return boolean If was posible to insert the data
*/
static function addChangesLogs($typeChange = "", $descriptionC = "")
{
if ($typeChange == "") {
return false;
}
$date = time();
$user = SessionManager::getCurrentUser();
if ($user === NULL) {
return false;
}
$idUser = $user->getId();
$tableChangesLogs = DatabaseManager::getNameTable('TABLE_CHANGES_LOGS');
$query = "INSERT INTO {$tableChangesLogs}\r\n (date, idUser, type, description) \r\n VALUES \r\n ({$date}, {$idUser}, '{$typeChange}', '{$descriptionC}')";
return DatabaseManager::singleAffectedRow($query);
}
示例2: advancedSearchConfirmation
/**
* Search one confirmation by one similar name
*
* @author Jonathan Sandoval <jonathan_s_pisis@yahoo.com.mx>
* @param Confirmation $confirmation Pseudo-confirmation with the data to search
* @param string $operator To search with 'or' or 'and'
* @param string $order The type of sort of the Confirmation
* @param integer $begin The number of page to display the registry
* @return Array[Confirmation] $confirmations Confirmation with the similar name or null
*/
static function advancedSearchConfirmation($confirmation = null, $operator = 'AND', $order = 'id', $begin = 0)
{
if ($confirmation === null) {
return null;
}
$tableConfirmation = DatabaseManager::getNameTable('TABLE_CONFIRMATION');
$tablePerson = DatabaseManager::getNameTable('TABLE_PERSON');
$tableChurch = DatabaseManager::getNameTable('TABLE_CHURCH');
$celebrationDate = $confirmation->getCelebrationDate();
$queryOwner = "(";
$posibleOwner = $confirmation->getIdOwner()[0];
$queryFather = "(";
$posibleFather = $confirmation->getIdOwner()[1];
$queryMother = "(";
$posibleMother = $confirmation->getIdOwner()[2];
$queryChurch = "(";
$posibleChurch = $confirmation->getIdChurch();
if ($posibleOwner !== NULL) {
for ($i = 0; $i < sizeof($posibleOwner) - 1; $i++) {
$queryOwner = $queryOwner . $posibleOwner[$i]->getId() . ",";
}
$queryOwner = $queryOwner . $posibleOwner[sizeof($posibleOwner) - 1]->getId() . ")";
$queryOwner = "(o.id IN " . $queryOwner . ")";
}
if ($posibleFather !== NULL) {
for ($i = 0; $i < sizeof($posibleFather) - 1; $i++) {
$queryFather = $queryFather . $posibleFather[$i]->getId() . ",";
}
$queryFather = $queryFather . $posibleFather[sizeof($posibleFather) - 1]->getId() . ")";
$queryFather = "((fa.id IN " . $queryFather . ") OR fa.id IS NULL)";
}
if ($posibleMother !== NULL) {
for ($i = 0; $i < sizeof($posibleMother) - 1; $i++) {
$queryMother = $queryMother . $posibleMother[$i]->getId() . ",";
}
$queryMother = $queryMother . $posibleMother[sizeof($posibleMother) - 1]->getId() . ")";
$queryMother = "((mo.id IN " . $queryMother . ") OR mo.id IS NULL)";
}
if ($posibleChurch !== NULL) {
for ($i = 0; $i < sizeof($posibleChurch) - 1; $i++) {
$queryChurch = $queryChurch . $posibleChurch[$i]->getId() . ",";
}
$queryChurch = $queryChurch . $posibleChurch[sizeof($posibleChurch) - 1]->getId() . ")";
$queryChurch = "(c.id IN " . $queryChurch . ")";
}
if ($confirmation->getId() == 0) {
$id = '';
} else {
$id = $confirmation->getId();
}
if ($confirmation->getIdBookRegistry() == 0) {
$idBookRegistry = '';
} else {
$idBookRegistry = $confirmation->getIdBookRegistry()->getId();
}
$query = "SELECT b.* \r\n FROM {$tableConfirmation} AS b LEFT JOIN {$tablePerson} AS o ON b.idOwner = o.id \r\n LEFT JOIN {$tablePerson} AS fa ON o.idFather = fa.id\r\n LEFT JOIN {$tablePerson} AS mo ON o.idMother = mo.id\r\n JOIN {$tableChurch} AS c ON b.idChurch = c.id\r\n WHERE b.id LIKE '%{$id}%' {$operator}\r\n b.confirmationDate LIKE '%{$celebrationDate}%' {$operator} ";
//Join the Query with the posibiitation query
if ($queryOwner != '(') {
$query = $query . $queryOwner . " " . $operator . " ";
} else {
$query = $query . "(o.id IN ())" . $operator . " ";
}
if ($queryFather != '(') {
$query = $query . $queryFather . " " . $operator . " ";
} else {
$query = $query . "(fa.id IN ())" . $operator . " ";
}
if ($queryMother != '(') {
$query = $query . $queryMother . " " . $operator . " ";
} else {
$query = $query . "(mo.id IN ())" . $operator . " ";
}
if ($queryChurch != '(') {
$query = $query . $queryChurch . " " . $operator . " ";
} else {
$query = $query . "(c.id IN ())" . $operator . " ";
}
if ($idBookRegistry !== NULL) {
$query = $query . "b.idConfirmationRegistry LIKE '%{$idBookRegistry}%'";
} else {
$query = $query . "b.idConfirmationRegistry LIKE '%%'";
}
if ($order == 'nameChild') {
$query = $query . " ORDER BY o.names";
} else {
if ($order == 'nameChurch') {
$query = $query . " ORDER BY c.name";
} else {
$query = $query . " ORDER BY b.id DESC";
}
//.........这里部分代码省略.........
示例3: advancedSearchDefuntion
/**
* Search one defuntion by one similar name
*
* @author Jonathan Sandoval <jonathan_s_pisis@yahoo.com.mx>
* @param Defuntion $defuntion Pseudo-defuntion with the data to search
* @param string $operator To search with 'or' or 'and'
* @param string $order The type of sort of the Defuntion
* @param integer $begin The number of page to display the registry
* @return Array[Defuntion] $defuntions Defuntion objects with the similar name or null
*/
static function advancedSearchDefuntion($defuntion = null, $operator = 'AND', $order = 'id', $begin = 0)
{
if ($defuntion === null) {
return null;
}
$tableDefuntion = DatabaseManager::getNameTable('TABLE_DEFUNTION');
$tablePerson = DatabaseManager::getNameTable('TABLE_PERSON');
$tableChurch = DatabaseManager::getNameTable('TABLE_CHURCH');
$celebrationDate = $defuntion->getDeadDate();
$queryOwner = "(";
$posibleOwner = $defuntion->getIdOwner()[0];
$queryChurch = "(";
$posibleChurch = $defuntion->getIdChurch();
if ($posibleOwner !== NULL) {
for ($i = 0; $i < sizeof($posibleOwner) - 1; $i++) {
$queryOwner = $queryOwner . $posibleOwner[$i]->getId() . ",";
}
$queryOwner = $queryOwner . $posibleOwner[sizeof($posibleOwner) - 1]->getId() . ")";
$queryOwner = "(o.id IN " . $queryOwner . ")";
}
if ($posibleChurch !== NULL) {
for ($i = 0; $i < sizeof($posibleChurch) - 1; $i++) {
$queryChurch = $queryChurch . $posibleChurch[$i]->getId() . ",";
}
$queryChurch = $queryChurch . $posibleChurch[sizeof($posibleChurch) - 1]->getId() . ")";
$queryChurch = "(c.id IN " . $queryChurch . ")";
}
$defuntion->getId() == 0 ? $id = '' : ($id = $defuntion->getId());
$query = "SELECT b.* \r\n FROM {$tableDefuntion} AS b LEFT JOIN {$tablePerson} AS o ON b.idOwner = o.id \r\n JOIN {$tableChurch} AS c ON b.idChurch = c.id\r\n WHERE b.id LIKE '%{$id}%' {$operator}\r\n b.deadDate LIKE '%{$celebrationDate}%' {$operator} ";
//Join the Query with the posibiitation query
if ($queryOwner != '(') {
$query = $query . $queryOwner . " " . $operator . " ";
} else {
$query = $query . "(o.id IN ())" . $operator . " ";
}
if ($queryChurch != '(') {
$query = $query . $queryChurch . " ";
} else {
$query = $query . "(c.id IN ())" . " ";
}
if ($order == 'nameChild') {
$query = $query . " ORDER BY o.names";
} else {
if ($order == 'nameChurch') {
$query = $query . " ORDER BY c.name";
} else {
$query = $query . " ORDER BY b.id DESC";
}
}
$query = $query . " LIMIT " . strval($begin * 10) . ", 11 ";
$arrayDefuntions = DatabaseManager::multiFetchAssoc($query);
$defuntions = array();
if ($arrayDefuntions !== NULL) {
$i = 0;
foreach ($arrayDefuntions as $defuntion) {
if ($i == 10) {
continue;
}
$defuntions[] = self::ArrayToDefuntion($defuntion);
$i++;
}
return $defuntions;
} else {
return null;
}
}
示例4: getConversation
/**
* Search one Message by one similar messagename
*
* @author Jonathan Sandoval <jonathan_s_pisis@yahoo.com.mx>
* @param string $value String with the similar messagename
* @return Array[Message] $messages Message objects with the similar messagename
*/
static function getConversation($idUser1 = null, $idUser2 = null, $limit = '10')
{
if ($idUser1 == null || $idUser2 == null) {
return null;
}
$tableMessage = DatabaseManager::getNameTable('TABLE_MESSAGE');
$query = "SELECT {$tableMessage}.*\r\n FROM {$tableMessage}\r\n WHERE ({$tableMessage}.idUserFrom = {$idUser1} AND\r\n {$tableMessage}.idUserTo = {$idUser2}) OR\r\n ({$tableMessage}.idUserTo = {$idUser1} AND\r\n {$tableMessage}.idUserFrom = {$idUser2})\r\n ORDER BY id DESC LIMIT {$limit}";
$arrayMessages = DatabaseManager::multiFetchAssoc($query);
$messages = array();
if ($arrayMessages === null) {
return null;
}
foreach ($arrayMessages as $Message) {
$messages[] = self::ArrayToMessage($Message);
}
return $messages;
}
示例5: advancedSearchChurch
/**
* Search one church by one similar name
*
* @author Jonathan Sandoval <jonathan_s_pisis@yahoo.com.mx>
* @param Church $church Pseudo-church with the data to search
* @param string $order The type of sort of the Church
* @param integer $begin The number of page to display the registry
* @param string $operator To search with 'or' or 'and'
* @return Array[Church] $churchs Church objects with the similar name or null
*/
static function advancedSearchChurch($church = null, $order = 'id', $begin = -1, $operator = 'AND')
{
if ($church === null) {
return null;
}
$tableChurch = DatabaseManager::getNameTable('TABLE_CHURCH');
$tableVicar = DatabaseManager::getNameTable('TABLE_VICAR');
$tableDean = DatabaseManager::getNameTable('TABLE_DEAN');
$tableCity = DatabaseManager::getNameTable('TABLE_CITY');
$church->getId() <= 0 ? $id = '' : ($id = $church->getId());
$name = $church->getName();
$type = $church->getType();
$church->getCode() <= 0 ? $code = '' : ($code = $church->getCode());
$address = $church->getAddress();
$colony = $church->getColony();
$church->getPostalCode() <= 0 ? $postalCode = '' : ($postalCode = $church->getPostalCode());
$phoneNumber = $church->getPhoneNumber();
$vicar = $church->getIdVicar();
$dean = $church->getIdDean();
$city = $church->getIdCity();
$query = "SELECT {$tableChurch}.*\r\n FROM {$tableChurch} \r\n LEFT JOIN {$tableDean} ON {$tableChurch}.idDean = {$tableDean}.id\r\n LEFT JOIN {$tableVicar} ON {$tableChurch}.idVicar = {$tableVicar}.id\r\n LEFT JOIN {$tableCity} ON {$tableChurch}.idCity = {$tableCity}.id\r\n WHERE {$tableChurch}.id LIKE '%{$id}%' {$operator}\r\n {$tableChurch}.name LIKE '%{$name}%' {$operator}\r\n {$tableChurch}.type LIKE '%{$type}%' {$operator}\r\n {$tableChurch}.code LIKE '%{$code}%' {$operator}\r\n {$tableChurch}.address LIKE '%{$address}%' {$operator}\r\n {$tableChurch}.colony LIKE '%{$colony}%' {$operator}\r\n {$tableChurch}.postalCode LIKE '%{$postalCode}%' {$operator}\r\n {$tableChurch}.phoneNumber LIKE '%{$phoneNumber}%' {$operator}\r\n ({$tableDean}.id LIKE '%{$dean}%' OR\r\n {$tableDean}.name LIKE '%{$dean}%' ) {$operator}\r\n ({$tableVicar}.id LIKE '%{$vicar}%' OR\r\n {$tableVicar}.name LIKE '%{$vicar}%' ) {$operator}\r\n ({$tableCity}.id LIKE '%{$city}%' OR\r\n {$tableCity}.name LIKE '%{$city}%' )\r\n ORDER BY {$order}";
$query = $query . " LIMIT " . strval($begin * 10) . ", 11 ";
$arrayChurchs = DatabaseManager::multiFetchAssoc($query);
if ($arrayChurchs === null) {
return null;
} else {
$i = 0;
foreach ($arrayChurchs as $church) {
if ($i == 10) {
continue;
}
$churchs[] = self::ArrayToChurch($church);
$i++;
}
return $churchs;
}
}
示例6: advancedSearchProof
/**
* Search one proof by one similar name
*
* @author Jonathan Sandoval <jonathan_s_pisis@yahoo.com.mx>
* @param Proof $proof Pseudo-proof with the data to search
* @param string $operator To search with 'or' or 'and'
* @param string $order The type of sort of the Proof
* @param integer $begin The number of page to display the registry
* @return Array[Proof] $proofs Proof objects with the similar name or null
*/
static function advancedSearchProof($proof = null, $operator = 'AND', $order = 'id', $begin = 0)
{
if ($proof === null) {
return null;
}
$tableProof = DatabaseManager::getNameTable('TABLE_PROFF_TALKS');
$tablePerson = DatabaseManager::getNameTable('TABLE_PERSON');
$tableChurch = DatabaseManager::getNameTable('TABLE_CHURCH');
$queryOwner = "(";
$posibleOwner = $proof->getIdOwner()[0];
$queryFather = "(";
$posibleFather = $proof->getIdOwner()[1];
$queryMother = "(";
$posibleMother = $proof->getIdOwner()[2];
$queryChurch = "(";
$posibleChurch = $proof->getIdChurch();
if ($posibleOwner !== NULL) {
for ($i = 0; $i < sizeof($posibleOwner) - 1; $i++) {
$queryOwner = $queryOwner . $posibleOwner[$i]->getId() . ",";
}
$queryOwner = $queryOwner . $posibleOwner[sizeof($posibleOwner) - 1]->getId() . ")";
$queryOwner = "(o.id IN " . $queryOwner . ")";
}
if ($posibleFather !== NULL) {
for ($i = 0; $i < sizeof($posibleFather) - 1; $i++) {
$queryFather = $queryFather . $posibleFather[$i]->getId() . ",";
}
$queryFather = $queryFather . $posibleFather[sizeof($posibleFather) - 1]->getId() . ")";
$queryFather = "((fa.id IN " . $queryFather . ") OR fa.id IS NULL)";
}
if ($posibleMother !== NULL) {
for ($i = 0; $i < sizeof($posibleMother) - 1; $i++) {
$queryMother = $queryMother . $posibleMother[$i]->getId() . ",";
}
$queryMother = $queryMother . $posibleMother[sizeof($posibleMother) - 1]->getId() . ")";
$queryMother = "((mo.id IN " . $queryMother . ") OR mo.id IS NULL)";
}
if ($posibleChurch !== NULL) {
for ($i = 0; $i < sizeof($posibleChurch) - 1; $i++) {
$queryChurch = $queryChurch . $posibleChurch[$i]->getId() . ",";
}
$queryChurch = $queryChurch . $posibleChurch[sizeof($posibleChurch) - 1]->getId() . ")";
$queryChurch = "(c.id IN " . $queryChurch . ")";
}
$typeProof = "'%%'";
if ($proof->getType() == '1') {
$typeProof = "'B'";
} else {
if ($proof->getType() == '2') {
$typeProof = "'E'";
} else {
if ($proof->getType() == '3') {
$typeProof = "'C'";
} else {
if ($proof->getType() == '4') {
$typeProof = "'X'";
}
}
}
}
$query = "SELECT b.* \r\n FROM {$tableProof} AS b LEFT JOIN {$tablePerson} AS o ON b.idOwner = o.id \r\n LEFT JOIN {$tablePerson} AS fa ON o.idFather = fa.id\r\n LEFT JOIN {$tablePerson} AS mo ON o.idMother = mo.id\r\n JOIN {$tableChurch} AS c ON b.idChurch = c.id\r\n WHERE b.type LIKE {$typeProof} {$operator} ";
//Join the Query with the posibiitation query
if ($queryOwner != '(') {
$query = $query . $queryOwner . " " . $operator . " ";
} else {
$query = $query . "(o.id IN ())" . $operator . " ";
}
if ($queryFather != '(') {
$query = $query . $queryFather . " " . $operator . " ";
} else {
$query = $query . "(fa.id IN ())" . $operator . " ";
}
if ($queryMother != '(') {
$query = $query . $queryMother . " " . $operator . " ";
} else {
$query = $query . "(mo.id IN ())" . $operator . " ";
}
if ($queryChurch != '(') {
$query = $query . $queryChurch . " ";
} else {
$query = $query . "(c.id IN ())" . " ";
}
if ($order == 'nameChild') {
$query = $query . " ORDER BY o.names";
} else {
if ($order == 'nameChurch') {
$query = $query . " ORDER BY c.name";
} else {
$query = $query . " ORDER BY b.id DESC";
}
//.........这里部分代码省略.........
示例7: searchCity
/**
* search one city by one similar name
*
* @author Jonathan Sandoval <jonathan_s_pisis@yahoo.com.mx>
* @param string $value string with the similar name
* @return Array[City] $cities City objects with the similar name
*/
static function searchCity($value = '')
{
if ($value === '') {
return null;
}
$tableCity = DatabaseManager::getNameTable('TABLE_CITY');
$tableState = DatabaseManager::getNameTable('TABLE_STATE');
$query = "SELECT {$tableCity}.*\n FROM {$tableCity}\n WHERE {$tableCity}.name LIKE '%{$value}%'";
$arrayCities = DatabaseManager::multiFetchAssoc($query);
$cities = array();
foreach ($arrayCities as $city) {
$cities[] = self::ArrayToCity($city);
}
return $cities;
}
示例8: searchPersonsByNames
/**
* Search one Person by one similar names
*
* @author Jonathan Sandoval <jonathan_s_pisis@yahoo.com.mx>
* @param string $names Name of the person to search
* @param string $lastname1 First lastname of the person to search
* @param string $lastname2 Second lastname of the person to search
* @param boolean $exact If wants a exact search or if wants a similar
* @param string $operator Select one operator fot the search like "AND" or "OR"
* @return Array[Person] $persons Person objects with the similar names
*/
static function searchPersonsByNames($names = '', $lastname1 = '', $lastname2 = '', $exact = true, $operator = 'AND')
{
if ($value === '') {
return null;
}
$tablePerson = DatabaseManager::getNameTable('TABLE_PERSON');
$query = '';
if ($exact) {
$query = "SELECT {$tablePerson}.*\n FROM {$tablePerson} \n WHERE {$tablePerson}.names = '{$names}' {$operator}\n {$tablePerson}.lastname1 = '{$lastname1}' {$operator}\n {$tablePerson}.lastname2 = '{$lastname2}'";
} else {
$query = "SELECT {$tablePerson}.*\n FROM {$tablePerson} \n WHERE {$tablePerson}.names LIKE '{$names}%' {$operator}\n {$tablePerson}.lastname1 LIKE '{$lastname1}%' {$operator}\n {$tablePerson}.lastname2 LIKE '{$lastname2}%'";
}
$arrayPersons = DatabaseManager::multiFetchAssoc($query);
$persons = array();
if ($arrayPersons === null) {
return null;
}
foreach ($arrayPersons as $Person) {
$persons[] = self::ArrayToPerson($Person);
}
return $persons;
}
示例9: getAllFormerChurchs
/**
* Recover all the rector from one church
*
* @author Jonathan Sandoval <jonathan_s_pisis@yahoo.com.mx>
* @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;
}
}
}
示例10: advancedSearchMarriage
/**
* Search one marriage by one similar name
*
* @author Jonathan Sandoval <jonathan_s_pisis@yahoo.com.mx>
* @param Marriage $marriage Pseudo-marriage with the data to search
* @param string $operator To search with 'or' or 'and'
* @param string $order The type of sort of the Marriage
* @param integer $begin The number of page to display the registry
* @return Array[Marriage] $marriages Marriage objects with the similar name or null
*/
static function advancedSearchMarriage($marriage = null, $operator = 'AND', $order = 'id', $begin = 0)
{
if ($marriage === null) {
return null;
}
$tableMarriage = DatabaseManager::getNameTable('TABLE_MARRIAGE');
$tablePerson = DatabaseManager::getNameTable('TABLE_PERSON');
$tableChurch = DatabaseManager::getNameTable('TABLE_CHURCH');
$celebrationDate = $marriage->getCelebrationDate();
$queryBoy = "(";
$posibleBoy = $marriage->getIdBoyfriend();
$queryGirl = "(";
$posibleGirl = $marriage->getIdGirlfriend();
$queryChurch = "(";
$posibleChurch = $marriage->getIdChurchMarriage();
if ($posibleBoy !== NULL) {
for ($i = 0; $i < sizeof($posibleBoy) - 1; $i++) {
$queryBoy = $queryBoy . $posibleBoy[$i]->getId() . ",";
}
$queryBoy = $queryBoy . $posibleBoy[sizeof($posibleBoy) - 1]->getId() . ")";
$queryBoy = "((b.id IN " . $queryBoy . ") OR b.id IS NULL)";
}
if ($posibleGirl !== NULL) {
for ($i = 0; $i < sizeof($posibleGirl) - 1; $i++) {
$queryGirl = $queryGirl . $posibleGirl[$i]->getId() . ",";
}
$queryGirl = $queryGirl . $posibleGirl[sizeof($posibleGirl) - 1]->getId() . ")";
$queryGirl = "((g.id IN " . $queryGirl . ") OR g.id IS NULL)";
}
if ($posibleChurch !== NULL) {
for ($i = 0; $i < sizeof($posibleChurch) - 1; $i++) {
$queryChurch = $queryChurch . $posibleChurch[$i]->getId() . ",";
}
$queryChurch = $queryChurch . $posibleChurch[sizeof($posibleChurch) - 1]->getId() . ")";
$queryChurch = "(c.id IN " . $queryChurch . ")";
}
if ($marriage->getId() == 0) {
$id = '';
} else {
$id = $marriage->getId();
}
if ($marriage->getIdBookRegistry() == 0) {
$idBookRegistry = '';
} else {
$idBookRegistry = $marriage->getIdBookRegistry()->getId();
}
$query = "SELECT m.* \r\n FROM {$tableMarriage} AS m \r\n LEFT JOIN {$tablePerson} AS b ON m.idBoyfriend = b.id\r\n LEFT JOIN {$tablePerson} AS g ON m.idGirlfriend = g.id\r\n JOIN {$tableChurch} AS c ON m.idChurchMarriage = c.id\r\n WHERE m.id LIKE '%{$id}%' {$operator}\r\n m.marriageDate LIKE '%{$celebrationDate}%' {$operator} ";
//Join the Query with the posibiitation query
if ($queryBoy != '(') {
$query = $query . $queryBoy . " " . $operator . " ";
} else {
$query = $query . "(b.id IN ())" . $operator . " ";
}
if ($queryGirl != '(') {
$query = $query . $queryGirl . " " . $operator . " ";
} else {
$query = $query . "(g.id IN ())" . $operator . " ";
}
if ($queryChurch != '(') {
$query = $query . $queryChurch . " " . $operator . " ";
} else {
$query = $query . "(c.id IN ())" . $operator . " ";
}
if ($idBookRegistry !== NULL) {
$query = $query . "m.idMarriageRegistry LIKE '%{$idBookRegistry}%'";
} else {
$query = $query . "m.idMarriageRegistry LIKE '%%'";
}
if ($order == 'nameBoy') {
$query = $query . " ORDER BY b.lastname1";
} else {
if ($order == 'nameGirl') {
$query = $query . " ORDER BY g.lastname1";
} else {
if ($order == 'nameChurch') {
$query = $query . " ORDER BY c.name";
} else {
$query = $query . " ORDER BY m.id DESC";
}
}
}
$query = $query . " LIMIT " . strval($begin * 10) . ", 11 ";
$arrayMarriages = DatabaseManager::multiFetchAssoc($query);
$marriages = array();
if ($arrayMarriages !== NULL) {
$i = 0;
foreach ($arrayMarriages as $marriage) {
if ($i == 10) {
continue;
}
//.........这里部分代码省略.........