Templates.php 867 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. namespace We7\Table\Site;
  7. class Templates extends \We7Table {
  8. protected $tableName = 'site_templates';
  9. protected $primaryKey = 'id';
  10. protected $field = array(
  11. 'name',
  12. 'version',
  13. 'title',
  14. 'description',
  15. 'author',
  16. 'url',
  17. 'type',
  18. 'sections',
  19. );
  20. protected $default = array(
  21. 'name' => '',
  22. 'version' => '',
  23. 'title' => '',
  24. 'description' => '',
  25. 'author' => '',
  26. 'url' => '',
  27. 'type' => '',
  28. 'sections' => '',
  29. );
  30. public function getById($id) {
  31. return $this->query->where('id', $id)->get();
  32. }
  33. public function getAllTemplates() {
  34. return $this->query->getall('name');
  35. }
  36. public function getByName($name) {
  37. return $this->query->where('name', $name)->get();
  38. }
  39. }