A Qcodo based CMS/ecommerce framework
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.

123 lines
4.1 KiB

12 years ago
  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 Quasi
  12. * @subpackage ORM
  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. public function UpdateLoginState()
  59. {
  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. {
  72. switch ($strName)
  73. {
  74. case 'Name':
  75. return $this->Person->FirstName . ' ' . $this->Person->LastName;
  76. default:
  77. try {
  78. return parent::__get($strName);
  79. } catch (QCallerException $objExc) {
  80. $objExc->IncrementOffset();
  81. throw $objExc;
  82. }
  83. }
  84. }
  85. public function __set($strName, $mixValue)
  86. {
  87. switch ($strName)
  88. {
  89. case 'LastLogin':
  90. try {
  91. return ($this->strLastLogin = QType::Cast($mixValue, QType::String));
  92. } catch (QInvalidCastException $objExc) {
  93. $objExc->IncrementOffset();
  94. throw $objExc;
  95. }
  96. case 'RegistrationDate':
  97. try {
  98. return ($this->strLastLogin = QType::Cast($mixValue, QType::String));
  99. } catch (QInvalidCastException $objExc) {
  100. $objExc->IncrementOffset();
  101. throw $objExc;
  102. }
  103. default:
  104. try {
  105. return (parent::__set($strName, $mixValue));
  106. } catch (QCallerException $objExc) {
  107. $objExc->IncrementOffset();
  108. throw $objExc;
  109. }
  110. }
  111. }
  112. }
  113. ?>