client.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace MGModule\DNSManager2\models\whmcs\clients;
  3. use MGModule\DNSManager2 as main;
  4. /**
  5. * Client Model
  6. *
  7. * @Table(name=tblclients,preventUpdate,prefixed=false)
  8. * @author Michal Czech <michael@modulesgarden.com>
  9. */
  10. class client extends \MGModule\DNSManager2\mgLibs\models\orm{
  11. /**
  12. *
  13. * @Column(id)
  14. * @var int
  15. */
  16. public $id;
  17. /**
  18. *
  19. * @Column()
  20. * @var string
  21. */
  22. public $firstname;
  23. /**
  24. *
  25. * @Column()
  26. * @var string
  27. */
  28. public $lastname;
  29. /**
  30. *
  31. * @Column()
  32. * @var string
  33. */
  34. public $email;
  35. /**
  36. *
  37. * @Column()
  38. * @var string
  39. */
  40. public $companyname;
  41. /**
  42. *
  43. * @Column()
  44. * @var string
  45. */
  46. public $status;
  47. private $_customFields;
  48. function fullName(){
  49. return $this->firstname.' '.$this->lastname.(($this->companyname)?(' ('.$this->companyname.')'):'');
  50. }
  51. function getProfileUrl(){
  52. return 'clientssummary.php?userid='.$this->id;
  53. }
  54. /**
  55. * Get Custom Fields
  56. *
  57. * @author Michal Czech <michael@modulesgarden.com>
  58. * @return customFields
  59. */
  60. function customFields(){
  61. if(empty($this->_customFields))
  62. {
  63. $this->_customFields = new main\models\whmcs\clients\customFields\repository($this->id);
  64. }
  65. return $this->_customFields;
  66. }
  67. public function getProfileLink()
  68. {
  69. return sprintf('<a href="%s">#%s %s</a>', $this->getProfileUrl(), $this->id, $this->fullName());
  70. }
  71. }