Cv_Category.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. require_once($path["entity"] . "Entity.php");
  3. require_once($path["helper"] . "text.php");
  4. /**
  5. * Category of a CV entry.
  6. *
  7. * Represents an object from the table 'cv_category'.
  8. */
  9. class Cv_Category extends Entity{
  10. /**
  11. * Identifier of the category.
  12. */
  13. public $id;
  14. /**
  15. * Category denomination, in the defined language.
  16. */
  17. public $title;
  18. /**
  19. * Category description, in the defined language.
  20. */
  21. public $summary;
  22. /**
  23. * Indicates wether the category must or mustn's be displayed.
  24. */
  25. public $visible;
  26. /**
  27. * Display order.
  28. */
  29. public $priority;
  30. /**
  31. * Constructor.
  32. *
  33. * Searches the database and retrieves the information about the
  34. * category, populating it.
  35. *
  36. * @param MySQL_connection $db Connection to the database.
  37. * @param string $lang Lowercase, two-letter language code.
  38. * @param int $id Identifier of the cv category.
  39. */
  40. public function __construct($db, $lang, $id){
  41. parent::__construct($db, $lang);
  42. $s =
  43. "SELECT " .
  44. " id, " .
  45. " title, " .
  46. " summary, " .
  47. " visible, " .
  48. " priority " .
  49. "FROM cv_category " .
  50. "WHERE id = $id ;";
  51. $q = mysqli_query($this->db, $s);
  52. if (mysqli_num_rows($q) > 0){
  53. $r = mysqli_fetch_array($q);
  54. $this->id = $r["id"];
  55. $this->title = text($this, $r["title"]);
  56. $this->summary = text($this, $r["summary"]);
  57. $this->visible = $r["visible"];
  58. $this->priority = $r["priority"];
  59. }
  60. }
  61. }
  62. ?>