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.

94 lines
3.9 KiB

12 years ago
  1. <?php
  2. require(__DATAGEN_META_CONTROLS__ . '/AccountMetaControlGen.class.php');
  3. /**
  4. * This is a MetaControl customizable subclass, providing a QForm or QPanel access to event handlers
  5. * and QControls to perform the Create, Edit, and Delete functionality of the
  6. * Account class. This code-generated class extends from
  7. * the generated MetaControl class, which contains all the basic elements to help a QPanel or QForm
  8. * display an HTML form that can manipulate a single Account object.
  9. *
  10. * To take advantage of some (or all) of these control objects, you
  11. * must create a new QForm or QPanel which instantiates a AccountMetaControl
  12. * class.
  13. *
  14. * This file is intended to be modified. Subsequent code regenerations will NOT modify
  15. * or overwrite this file.
  16. *
  17. * @package Quasi
  18. * @subpackage MetaControls
  19. */
  20. class AccountMetaControl extends AccountMetaControlGen
  21. {
  22. /**
  23. * Create and setup QTextBox txtUsername
  24. * @param string $strControlId optional ControlId to use
  25. * @return QTextBox
  26. */
  27. public function txtUsername_Create($strControlId = null, $blnNewAccount = false)
  28. {
  29. $this->txtUsername = new QTextBox($this->objParentObject, $strControlId);
  30. $this->txtUsername->Name = QApplication::Translate('Username');
  31. if(! $blnNewAccount)
  32. $this->txtUsername->Text = $this->objAccount->Username;
  33. $this->txtUsername->Required = true;
  34. $this->txtUsername->MaxLength = Account::UsernameMaxLength;
  35. return $this->txtUsername;
  36. }
  37. /**
  38. * Create and setup QTextBox txtPassword
  39. * @param string $strControlId optional ControlId to use
  40. * @return QTextBox
  41. */
  42. public function txtPassword_Create($strControlId = null)
  43. {
  44. $this->txtPassword = new QTextBox($this->objParentObject, $strControlId);
  45. $this->txtPassword->Name = QApplication::Translate('Password');
  46. $this->txtPassword->Required = true;
  47. $this->txtPassword->MaxLength = Account::PasswordMaxLength;
  48. return $this->txtPassword;
  49. }
  50. /**
  51. * This will save this object's Account instance,
  52. * updating only the fields which have had a control created for it.
  53. * It also encrypts the password field.
  54. */
  55. public function SaveAccount()
  56. {
  57. try {
  58. if ($this->txtUsername)
  59. $this->objAccount->Username = $this->txtUsername->Text;
  60. if ($this->txtPassword)
  61. {
  62. $strPassword = $this->txtPassword->Text;
  63. if ( $strPassword && '' != $strPassword )
  64. $this->objAccount->Password = sha1($strPassword);
  65. }
  66. if ($this->txtNotes)
  67. $this->objAccount->Notes = $this->txtNotes->Text;
  68. if ($this->txtLoginCount)
  69. $this->objAccount->LoginCount = $this->txtLoginCount->Text;
  70. if ($this->chkOnline)
  71. $this->objAccount->Online = $this->chkOnline->Checked;
  72. if ($this->chkOnetimePassword)
  73. $this->objAccount->OnetimePassword = $this->chkOnetimePassword->Checked;
  74. if ($this->chkValidPassword)
  75. $this->objAccount->ValidPassword = $this->chkValidPassword->Checked;
  76. if ($this->lstType)
  77. $this->objAccount->TypeId = $this->lstType->SelectedValue;
  78. if ($this->lstStatus)
  79. $this->objAccount->StatusId = $this->lstStatus->SelectedValue;
  80. if ($this->lstPerson)
  81. $this->objAccount->PersonId = $this->lstPerson->SelectedValue;
  82. $this->objAccount->Save();
  83. } catch (QCallerException $objExc) {
  84. $objExc->IncrementOffset();
  85. throw $objExc;
  86. }
  87. }
  88. }
  89. ?>