/** * Recover from database one Confirmation object by id * * @author Jonathan Sandoval <*****@*****.**> * @param string $key key to search * @param string $value value of the key * @param string $key2 Other Key to search * @param string $value2 Other Value of the key * @return Confirmation $confirmation Confirmation result or null */ static function getSingleConfirmation($key = 'id', $value = '', $key2 = '', $value2 = '') { if ($value === '') { return null; } $tableConfirmation = DatabaseManager::getNameTable('TABLE_CONFIRMATION'); $query = "SELECT {$tableConfirmation}.*\r\n FROM {$tableConfirmation} \r\n WHERE {$tableConfirmation}.{$key} = '{$value}'"; if ($key2 !== '') { $query = $query . "AND {$tableConfirmation}.{$key2} = '{$value2}'"; } $confirmation = DatabaseManager::singleFetchAssoc($query); $confirmation = self::ArrayToConfirmation($confirmation); return $confirmation; }
/** * Recover from database one Defuntion object by id * * @author Jonathan Sandoval <*****@*****.**> * @param string $key key to search * @param string $value value of the key * @return Defuntion $defuntion Defuntion result or null */ static function getSingleDefuntion($key = 'id', $value = '') { if ($value === '') { return null; } $tableDefuntion = DatabaseManager::getNameTable('TABLE_DEFUNTION'); $query = "SELECT {$tableDefuntion}.*\r\n FROM {$tableDefuntion} \r\n WHERE {$tableDefuntion}.{$key} = '{$value}'"; $defuntion = DatabaseManager::singleFetchAssoc($query); $defuntion = self::ArrayToDefuntion($defuntion); return $defuntion; }
/** * Recover from database one Baptism object by id * * @author Jonathan Sandoval <*****@*****.**> * @param string $key Key to search * @param string $value Value of the key * @return Baptism $baptism Baptism result or null */ static function getSingleBaptism($key = 'id', $value = '') { if ($value === '') { return null; } $tableBaptism = DatabaseManager::getNameTable('TABLE_BAPTISM'); $query = "SELECT {$tableBaptism}.*\r\n FROM {$tableBaptism} \r\n WHERE {$tableBaptism}.{$key} = '{$value}'"; $baptism = DatabaseManager::singleFetchAssoc($query); $baptism = self::ArrayToBaptism($baptism); return $baptism; }
/** * Recover from database one Church object by id * * @author Jonathan Sandoval <*****@*****.**> * @param string $key Key to search * @param string $value Value of the key * @return Church $church Church result or null */ static function getSingleChurch($key = 'id', $value = '') { if ($value === '') { return null; } $tableChurch = DatabaseManager::getNameTable('TABLE_CHURCH'); $query = "SELECT {$tableChurch}.*\r\n FROM {$tableChurch} \r\n WHERE {$tableChurch}.{$key} = '{$value}'"; $church = DatabaseManager::singleFetchAssoc($query); $church = self::ArrayToChurch($church); return $church; }
/** * Recover the last ID from the database of paper config * * @author Jonathan Sandoval <*****@*****.**> * @return integer The last id on the database of paper config */ static function getLastIDPaperConfig() { $tablePaperConfig = DatabaseManager::getNameTable('TABLE_PAPER_CONFIG'); $query = "SELECT MAX(id) AS Max FROM {$tablePaperConfig}"; return DatabaseManager::singleFetchAssoc($query)["Max"]; }
/** * Recover from database one ProofTalks object by id * * @author Jonathan Sandoval <*****@*****.**> * @param string $key Key to search * @param string $value Value of the key * @param string $key2 Other Key to search * @param string $value2 Other Value of the key * @param string $key3 Other Key to search * @param string $value3 Other Value of the key * @param string $key4 Other Key to search * @param string $value4 Other Value of the key * @return ProofTalks $myProofTalks proofTalks result or null */ static function getSingleProofTalks($key = 'id', $value = 0, $key2 = '', $value2 = '', $key3 = '', $value3 = '', $key4 = '', $value4 = '') { if ($value === '') { return null; } $tableProofTalks = DatabaseManager::getNameTable('TABLE_PROFF_TALKS'); $query = "SELECT {$tableProofTalks}.*\r\n FROM {$tableProofTalks} \r\n WHERE {$tableProofTalks}.{$key} = '{$value}'"; if ($key2 !== '') { $query = $query . "AND {$tableProofTalks}.{$key2} = '{$value2}'"; } if ($key3 !== '') { $query = $query . "AND {$tableProofTalks}.{$key3} = '{$value3}'"; } if ($key4 !== '') { $query = $query . "AND {$tableProofTalks}.{$key4} = '{$value4}'"; } $myProofTalks = DatabaseManager::singleFetchAssoc($query); $myProofTalks = self::ArrayToProofTalks($myProofTalks); return $myProofTalks; }
/** * Recover from database one City object by id * * @author Jonathan Sandoval <*****@*****.**> * @param string $key key to search * @param string $value value of the key * @return City $city City result or null */ static function getSingleCity($key = 'id', $value = '') { if ($value === '') { return null; } $tableCity = DatabaseManager::getNameTable('TABLE_CITY'); $query = "SELECT {$tableCity}.*\n FROM {$tableCity} \n WHERE {$tableCity}.{$key} = '{$value}'"; $city = DatabaseManager::singleFetchAssoc($query); $city = self::ArrayToCity($city); return $city; }
/** * Recover the last ID from the database * * @author Jonathan Sandoval <*****@*****.**> * @return integer The last id on the database */ static function getLastID() { $tablePerson = DatabaseManager::getNameTable('TABLE_PERSON'); $query = "SELECT MAX(id) AS Max FROM {$tablePerson}"; return DatabaseManager::singleFetchAssoc($query)["Max"]; }
/** * Get the last ID from the database * * @author Jonathan Sandoval <*****@*****.**> * @return boolean If was possible to delete */ static function getLastID() { $tableRector = DatabaseManager::getNameTable('TABLE_RECTOR'); $query = "SELECT MAX(id) AS Max FROM {$tableRector}"; return DatabaseManager::singleFetchAssoc($query)["Max"]; }
/** * Recover from database one Marriage object by id * * @author Jonathan Sandoval <*****@*****.**> * @param string $key key to search * @param string $value value of the key * @return Marriage $marriage Marriage result or null */ static function getSingleMarriage($key = 'id', $value = '', $key2 = '', $value2 = '') { if ($value === '') { return null; } $tableMarriage = DatabaseManager::getNameTable('TABLE_MARRIAGE'); $query = "SELECT {$tableMarriage}.*\r\n FROM {$tableMarriage} \r\n WHERE {$tableMarriage}.{$key} = '{$value}'"; if ($key2 !== '') { $query = $query . "AND {$tableMarriage}.{$key2} = '{$value2}'"; } $marriage = DatabaseManager::singleFetchAssoc($query); $marriage = self::ArrayToMarriage($marriage); return $marriage; }