Cv.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. require_once($path["entity"] . "Entity.php");
  3. require_once($path["entity"] . "Lang.php");
  4. /**
  5. * CV file.
  6. *
  7. * Represents an object from the table 'cv'.
  8. */
  9. class Cv extends Entity{
  10. /**
  11. * CV file identifier.
  12. */
  13. public $id;
  14. /**
  15. * CV {@see Lang}.
  16. */
  17. public $lang;
  18. /**
  19. * Filename.
  20. */
  21. public $file;
  22. /**
  23. * Constructor.
  24. *
  25. * Searches the database and retrieves the information about the
  26. * object, populating it.
  27. *
  28. * @param MySQL_connection $db Connection to the database.
  29. * @param int $id Database identifier of the language.
  30. */
  31. public function __construct($db, $id){
  32. parent::__construct($db, null);
  33. $s =
  34. "SELECT " .
  35. " lang, " .
  36. " file " .
  37. "FROM cv " .
  38. "WHERE " .
  39. " id = '$id'; ";
  40. error_log($s);
  41. $q = mysqli_query($this->db, $s);
  42. if (mysqli_num_rows($q) > 0){
  43. $r = mysqli_fetch_array($q);
  44. $this->id = $id;
  45. $this->lang = new Lang($this->db, $r["lang"]);
  46. $this->file = $r["file"];
  47. }
  48. }
  49. }
  50. ?>