Project_Type.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. require_once($path["entity"] . "Entity.php");
  3. require_once($path["helper"] . "text.php");
  4. /**
  5. * Type of a project.
  6. *
  7. * Represents an object from the table 'project_type'.
  8. */
  9. class Project_Type extends Entity{
  10. /**
  11. * Identifier of the project type.
  12. */
  13. public $id;
  14. /**
  15. * Type denomination, in the defined language.
  16. */
  17. public $title;
  18. /**
  19. * Type description, in the defined language.
  20. */
  21. public $summary;
  22. /**
  23. * Constructor.
  24. *
  25. * Searches the database and retrieves the information about the
  26. * type, populating it.
  27. *
  28. * @param MySQL_connection $db Connection to the database.
  29. * @param string $lang Lowercase, two-letter language code.
  30. * @param string $id Identifier of the project type.
  31. */
  32. public function __construct($db, $lang, $id){
  33. parent::__construct($db, $lang);
  34. $s =
  35. "SELECT " .
  36. " id, " .
  37. " title, " .
  38. " summary " .
  39. "FROM project_type " .
  40. "WHERE id = '$id' ;";
  41. $q = mysqli_query($this->db, $s);
  42. if (mysqli_num_rows($q) > 0){
  43. $r = mysqli_fetch_array($q);
  44. $this->id = $r["id"];
  45. $this->title = text($this, $r["title"]);
  46. $this->summary = text($this, $r["summary"]);
  47. }
  48. }
  49. }
  50. ?>