public function getTableFields() { if (!isset($this->arrFields)) { $q = "DESCRIBE " . addslashes($this->Name); $r = parent::returnResultSet($q); $this->arrFields = array(); foreach ($r as $l) { $this->arrFields[] = array($l->Field, $l->Type, $l->Null, $l->Key, $l->Default, $l->Extra); } } }
public function sortValues($id, $direction) { // Get current sort value $q = "SELECT sort_order FROM homepage_image WHERE id = " . $id; $r = parent::returnResultSet($q); $l = $r[0]; $sortVal = $l->sort_order; if ($direction == 'U') { // Move item that is currently in the new position to this item's position $q = "UPDATE homepage_image SET sort_order = " . $sortVal . " WHERE sort_order = " . ($sortVal - 10); parent::updateQuery($q); // Put selected item in new position $q = "UPDATE homepage_image SET sort_order = " . ($sortVal - 10) . " WHERE id = " . $id; parent::updateQuery($q); } else { // Move item that is currently in the new position to this item's position $q = "UPDATE homepage_image SET sort_order = " . $sortVal . " WHERE sort_order = " . ($sortVal + 10); parent::updateQuery($q); // Put selected item in new position $q = "UPDATE homepage_image SET sort_order = " . ($sortVal + 10) . " WHERE id = " . $id; parent::updateQuery($q); } }
public function delete($deleteID) { $q = "DELETE FROM setting WHERE id = " . intval($deleteID); parent::updateQuery($q); }
public function sortValues($id, $direction) { // Get current sort value $q = "SELECT technology_id, sort_order FROM technology_info WHERE id = " . $id; $r = parent::returnresultSet($q); $l = $r[0]; $sortVal = $l->sort_order; $technology_id = $l->technology_id; if ($direction == 'U') { // Move item that is currently in the new position to this item's position $q = "UPDATE technology_info SET sort_order = " . $sortVal . " WHERE technology_id = " . $technology_id . " AND sort_order = " . ($sortVal - 10); parent::updateQuery($q); // Put selected item in new position $q = "UPDATE technology_info SET sort_order = " . ($sortVal - 10) . " WHERE id = " . $id; parent::updateQuery($q); } else { // Move item that is currently in the new position to this item's position $q = "UPDATE technology_info SET sort_order = " . $sortVal . " WHERE technology_id = " . $technology_id . " AND sort_order = " . ($sortVal + 10); parent::updateQuery($q); // Put selected item in new position $q = "UPDATE technology_info SET sort_order = " . ($sortVal + 10) . " WHERE id = " . $id; parent::updateQuery($q); } }
public function GetItemVideoCountByItemId($item_id) { // Retrieve all ItemImage By ItemId $q = "SELECT COUNT(*) As NumCount FROM item_video WHERE item_id = ?"; $var = $item_id; $r = parent::returnResultSet($q, $var); return $r[0]->NumCount; }
public function getCountLightTestByLightId($light_id) { // Retrieve all ItemImage By ItemId $q = "SELECT COUNT(*) As NumCount FROM light_test WHERE light_id = ?"; $var = $light_id; $r = parent::returnResultSet($q, $var); return $r[0]->NumCount; }
public function getCountSoundImageBySoundId($sound_id) { // Retrieve all ItemImage By ItemId $q = "SELECT COUNT(*) As NumCount FROM sound_image WHERE sound_id = ?"; $var = $sound_id; $r = parent::returnResultSet($q, $var); return $r[0]->NumCount; }
public function getCountColorImageByColorId($color_id) { // Retrieve all ItemImage By ItemId $q = "SELECT COUNT(*) As NumCount FROM color_image WHERE color_id = ?"; $var = $color_id; $r = parent::returnResultSet($q, $var); return $r[0]->NumCount; }
public function getCountIbeaconImageByIbeaconId($ibeacon_id) { // Retrieve all ItemImage By ItemId $q = "SELECT COUNT(*) As NumCount FROM ibeacon_image WHERE ibeacon_id = ?"; $var = $ibeacon_id; $r = parent::returnResultSet($q, $var); return $r[0]->NumCount; }
public function getCountItemImageHighlightByItemImageId($item_image_id = null) { // Retrieve all ItemImageHighlight By ItemImageId $q = "SELECT count(*) AS cnt FROM item_image_highlight WHERE item_image_id = ?"; $var = addslashes($item_image_id); $r = parent::returnResultSet($q, $var); return $r[0]->cnt; }
public function delete($deleteID) { $q = "DELETE FROM item_info_type WHERE id = " . intval($deleteID); parent::updateQuery($q); }
public function getAllTechnologyByCategoryIdLinkUrlIsActive($category_id, $link_url) { // Retrieve all Technology By CategoryId $q = "SELECT * FROM technology WHERE category_id = ? AND link_url = ?"; $var = array(addslashes($category_id), addslashes($link_url)); $r = parent::returnResultSet($q, $var); // Array to hold Technology objects $arrTechnology = array(); // Create a Technology object for each row and add to array if ($r[0]->is_active == 1) { return true; } else { return false; } }
public function checkLogin($username, $password) { // retrieve this row $q = "SELECT * FROM system_user WHERE is_active AND username = '******' AND password = '******'"; $r = parent::returnResultSet($q); $hasRow = false; // set property values to values in result set foreach ($r as $l) { $thisObj = new SystemUser($l->id, $l->first_name, $l->last_name, $l->username, $l->password, $l->email_address, $l->date_created, $l->is_active, $l->is_admin); $hasRow = true; return $thisObj; } // make sure there was a row returned; if not, set ID to -1 to indicate a bad object if (!$hasRow) { $this->Id = -1; } return $this; }
public function getAllItemInfoByItemIdItemInfoTypeId($item_id = 0, $item_info_type_id = 0) { // Retrieve all _item_info $q = "SELECT * FROM item_info WHERE item_id = ? AND item_info_type_id = ? "; $var = array($item_id, $item_info_type_id); $r = parent::returnResultSet($q, $var); // Array to hold ItemInfo objects $arrItemInfo = array(); // Create a ItemInfo object for each row and add to array foreach ($r as $l) { $thisObj = new ItemInfo($l->id, $l->item_id, $l->item_info_type_id, $l->item_info); $arrItemInfo[] = $thisObj; } // Return array of objects return $arrItemInfo; }