home/islapiiu/sites/thegarder/main-functions.php 0000644 00000011353 15076600377 0016070 0 ustar 00 <?php
function getHomePageContents() {
$query = "SELECT * FROM `home-page` WHERE `id` = '1' LIMIT 1";
$db = new DB();
$result = $db->readQuery($query);
$row = mysql_fetch_assoc($result);
return $row;
}
function getAboutUsPageContents() {
$query = "SELECT * FROM `about-us` WHERE `id` = '1' LIMIT 1";
$db = new DB();
$result = $db->readQuery($query);
$row = mysql_fetch_assoc($result);
return $row;
}
function getSliderSettings() {
$query = "SELECT * FROM `slidersettings` WHERE `id` = '1' LIMIT 1";
$db = new DB();
$result = $db->readQuery($query);
$row = mysql_fetch_assoc($result);
return $row;
}
function getMainSliderPhotos() {
$db = new DB();
$sql = "SELECT * FROM `main-slider` ORDER BY sort ASC";
$result = $db->readQuery($sql);
$array_res = array();
while ($row = mysql_fetch_array($result)) {
$property = array(
'id' => $row['id'],
'image_name' => $row['image_name']
);
array_push($array_res, $property);
}
return $array_res;
}
function getTeam() {
$db = new DB();
$sql = "SELECT * FROM `team` ORDER BY sort ASC";
$result = $db->readQuery($sql);
$array_res = array();
while ($row = mysql_fetch_array($result)) {
$property = array(
'id' => $row['id'],
'name' => $row['name'],
'designation' => $row['designation'],
'photo' => $row['photo'],
'details' => $row['details']
);
array_push($array_res, $property);
}
return $array_res;
}
function getAlbumPhotosByAlbumId($id) {
$db = new DB();
$sql = "SELECT * FROM `album-photos` WHERE `album` = '" . $id . "' ORDER BY sort ASC";
$result = $db->readQuery($sql);
$array_res = array();
while ($row = mysql_fetch_array($result)) {
$property = array(
'id' => $row['id'],
'photo' => $row['photo'],
'caption' => $row['caption']
);
array_push($array_res, $property);
}
return $array_res;
}
function getAllAlbums() {
$db = new DB();
$query = "SELECT * FROM `photo-albums` ORDER BY sort ASC";
$result = $db->readQuery($query);
$array_res = array();
while ($row = mysql_fetch_array($result)) {
$things = array(
'id' => $row['id'],
'name' => $row['name'],
'date' => $row['date'],
'photo' => $row['photo'],
'description' => $row['description']
);
array_push($array_res, $things);
}
return $array_res;
}
function getAlbumById($id) {
$query = "SELECT * FROM `photo-albums` WHERE `id` = '$id' LIMIT 1";
$db = new DB();
$result = $db->readQuery($query);
$row = mysql_fetch_assoc($result);
return $row;
}
function getAlbumPhotoById($id) {
$db = new DB();
$sql = "SELECT * FROM `album-photos` WHERE `id` = '$id' ";
$result = $db->readQuery($sql);
return mysql_fetch_assoc($result);
}
function getMemberById($id) {
$db = new DB();
$sql = "SELECT * FROM `team` WHERE `id` = '$id' ";
$result = $db->readQuery($sql);
return mysql_fetch_assoc($result);
}
function getServices() {
$db = new DB();
$sql = "SELECT * FROM `services` ORDER BY sort ASC";
$result = $db->readQuery($sql);
$array_res = array();
while ($row = mysql_fetch_array($result)) {
$property = array(
'id' => $row['id'],
'name' => $row['name'],
'icon' => $row['icon'],
'details' => $row['details']
);
array_push($array_res, $property);
}
return $array_res;
}
function getPricePackages() {
$db = new DB();
$sql = "SELECT * FROM `prices` ORDER BY sort ASC";
$result = $db->readQuery($sql);
$array_res = array();
while ($row = mysql_fetch_array($result)) {
$property = array(
'id' => $row['id'],
'name' => $row['name'],
'price' => $row['price'],
'contents' => $row['contents']
);
array_push($array_res, $property);
}
return $array_res;
}
function getServiceById($id) {
$db = new DB();
$sql = "SELECT * FROM `services` WHERE `id` = '$id' ";
$result = $db->readQuery($sql);
return mysql_fetch_assoc($result);
}
function getPricePackageById($id) {
$db = new DB();
$sql = "SELECT * FROM `prices` WHERE `id` = '$id' ";
$result = $db->readQuery($sql);
return mysql_fetch_assoc($result);
}
////////////////////////Commen Functions////////////////////////////
function calculateResize($newHeight, $width, $height) {
$percent = $newHeight / $height;
$result1 = $percent * 100;
$result2 = $width * $result1 / 100;
return array($result2, $newHeight);
}
|