A QCodo powered CMS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.3 KiB

  1. <?php
  2. require(__DATAGEN_CLASSES__ . '/AccountGen.class.php');
  3. /**
  4. * The Account class defined here contains any
  5. * customized code for the Account class in the
  6. * Object Relational Model. It represents the "account" table
  7. * in the database, and extends from the code generated abstract AccountGen
  8. * class, which contains all the basic CRUD-type functionality as well as
  9. * basic methods to handle relationships and index-based loading.
  10. *
  11. * @package Quinta
  12. * @subpackage Models
  13. *
  14. */
  15. class Account extends AccountGen {
  16. /**
  17. * Protected member variable that maps to the database column account.online
  18. * @var boolean blnOnline
  19. */
  20. protected $blnOnline = false;
  21. const OnlineDefault = false;
  22. /**
  23. * Protected member variable that maps to the database column account.type_id
  24. * @var integer intTypeId
  25. */
  26. protected $intTypeId = 1;
  27. const TypeIdDefault = 1;
  28. /**
  29. * Protected member variable that maps to the database column account.status_id
  30. * @var integer intStatusId
  31. */
  32. protected $intStatusId = 1;
  33. const StatusIdDefault = 1;
  34. /**
  35. * Protected member variable that maps to the database column account.onetime_password
  36. * @var boolean blnOnetimePassword
  37. */
  38. protected $blnOnetimePassword = false;
  39. const OnetimePasswordDefault = false;
  40. /**
  41. * Protected member variable that maps to the database column account.valid_password
  42. * @var boolean blnValidPassword
  43. */
  44. protected $blnValidPassword = true;
  45. const ValidPasswordDefault = true;
  46. /**
  47. * Default "to string" handler
  48. * Allows pages to _p()/echo()/print() this object, and to define the default
  49. * way this object would be outputted.
  50. *
  51. * Can also be called directly via $objAccount->__toString().
  52. *
  53. * @return string a nicely formatted string representation of this object
  54. */
  55. public function __toString() {
  56. return $this->Name;
  57. }
  58. ///@todo remove? appears unused ..
  59. public function UpdateLoginState(){
  60. $objDatabase = Account::GetDatabase();
  61. $online = $this->blnOnline;
  62. $lastlogin = $this->LastLogin;
  63. $logincount = $this->LoginCount;
  64. $id = $this->intId;
  65. $q = "UPDATE `account` SET `online` = '$online', `last_login` = '$lastlogin', `login_count` = '$logincount' WHERE `id` = '$id';";
  66. $objDatabase->NonQuery($q);
  67. $this->__blnRestored = true;
  68. // $this->Reload();
  69. }
  70. public function __get($strName){
  71. switch ($strName){
  72. case 'Name':
  73. return $this->Person->FirstName . ' ' . $this->Person->LastName;
  74. default:
  75. try {
  76. return parent::__get($strName);
  77. } catch (QCallerException $objExc) {
  78. $objExc->IncrementOffset();
  79. throw $objExc;
  80. }
  81. }
  82. }
  83. public function __set($strName, $mixValue){
  84. switch ($strName){
  85. case 'LastLogin':
  86. try {
  87. return ($this->strLastLogin = QType::Cast($mixValue, QType::String));
  88. } catch (QInvalidCastException $objExc) {
  89. $objExc->IncrementOffset();
  90. throw $objExc;
  91. }
  92. case 'RegistrationDate':
  93. try {
  94. return ($this->strLastLogin = QType::Cast($mixValue, QType::String));
  95. } catch (QInvalidCastException $objExc) {
  96. $objExc->IncrementOffset();
  97. throw $objExc;
  98. }
  99. default:
  100. try {
  101. return (parent::__set($strName, $mixValue));
  102. } catch (QCallerException $objExc) {
  103. $objExc->IncrementOffset();
  104. throw $objExc;
  105. }
  106. }
  107. }
  108. }
  109. ?>