Advertisement
Guest User

Untitled

a guest
May 5th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. <?php
  2. require_once "config_class.php";
  3. require_once "checkvalid_class.php";
  4. require_once "database_class.php";
  5.  
  6. abstract class GlobalClass {
  7.  
  8. private $db;
  9. private $table_name;
  10. protected $config;
  11. protected $valid;
  12.  
  13. protected function __construct($table_name, $db) {
  14. $this->db = $db;
  15. $this->table_name = $table_name;
  16. $this->config = new Config();
  17. $this->valid = new CheckValid();
  18. }
  19.  
  20. protected function add($new_values) {
  21. return $this->db->insert($this->table_name, $new_values);
  22. }
  23.  
  24. protected function edit($id, $upd_fields) {
  25. return $this->db->updateOnID($this->table_name, $id, $upd_fields);
  26. }
  27.  
  28. public function delete($id) {
  29. return $this->db->deleteOnID($this->table_name, $id);
  30. }
  31.  
  32. public function deleteAll() {
  33. return $this->db->deleteAll($this->table_name);
  34. }
  35.  
  36. protected function getField($field_out, $field_in, $value_in) {
  37. return $this->db->getField($this->table_name, $field_out, $field_in, $value_in);
  38. }
  39.  
  40. protected function getFieldOnID($id, $field) {
  41. return $this->db->getFieldOnID($this->table_name, $id, $field);
  42. }
  43.  
  44. protected function setFieldOnID($id, $field, $value) {
  45. return $this->db->setFieldOnID($this->table_name, $id, $field, $value);
  46. }
  47.  
  48. public function get($id) {
  49. return $this->db->getElementOnID($this->table_name, $id);
  50. }
  51.  
  52. public function getAll($order = "", $up = true) {
  53. return $this->db->getAll($this->table_name, $order, $up);
  54. }
  55.  
  56. protected function getAllOnField($field, $value, $order = "", $up = true) {
  57. return $this->db->getAllOnField($this->table_name, $field, $order, $up);
  58. }
  59.  
  60. public function getrandomElement($count) {
  61. return $this->db->getRandomElements($this>table_name, $count);
  62. }
  63.  
  64. public function getLastID() {
  65. return $this->db->getLastID($this->table_name);
  66. }
  67.  
  68. public function getCount() {
  69. return $this->db->getCount($this->table_name);
  70. }
  71.  
  72. protected function isExists($field, $value) {
  73. return $this->db->isExists($this->table_name, $field, $value);
  74. }
  75. }
  76.  
  77. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement