Cv.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * CV (resume) entity file.
  4. *
  5. * Provides the entity Cv.
  6. *
  7. * @author Iñigo Valentin <i@inigovalentin.com>
  8. * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
  9. * @package IVV
  10. */
  11. require_once(PATH::ENTITY . "Entity.php");
  12. require_once(PATH::ENTITY . "Lang.php");
  13. /**
  14. * CV (resume).
  15. *
  16. * Represents an object from the table 'cv'.
  17. */
  18. class Cv extends Entity{
  19. /**
  20. * CV file identifier.
  21. */
  22. private $id;
  23. /**
  24. * CV {@see Lang}.
  25. */
  26. private $lang;
  27. /**
  28. * Filename.
  29. */
  30. private $file;
  31. /**
  32. * Constructor.
  33. *
  34. * Searches the database and retrieves the information about the
  35. * object, populating it.
  36. *
  37. * @param string $id CV id.
  38. */
  39. public function __construct($id){
  40. $statement = get_context()->get_db()->prepare("SELECT lang, file FROM cv WHERE id = :id");
  41. $statement->bindValue(':id', $id, PDO::PARAM_INT);
  42. $statement->execute();
  43. $r_cv = $statement->fetch(PDO::FETCH_ASSOC);
  44. if ($r_cv !== false){
  45. $this->id = $id;
  46. $this->lang = new Lang($r_cv["lang"]);
  47. $this->file = $r_cv["file"];
  48. }
  49. }
  50. /**
  51. * Retrieves the CV identifier.
  52. *
  53. * @return int CV ID.
  54. */
  55. public function get_id(){
  56. return $this->id;
  57. }
  58. /**
  59. * Retrieves the CV language.
  60. *
  61. * @return int CV language.
  62. */
  63. public function get_lang(){
  64. return $this->lang;
  65. }
  66. /**
  67. * Retrieves the path to the CV file.
  68. *
  69. * @return int CV file path.
  70. */
  71. public function get_file(){
  72. return $this->file;
  73. }
  74. }
  75. ?>