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.

838 lines
38 KiB

  1. <?php
  2. /**
  3. * This is a MetaControl class, providing a QForm or QPanel access to event handlers
  4. * and QControls to perform the Create, Edit, and Delete functionality
  5. * of the Address class. This code-generated class
  6. * contains all the basic elements to help a QPanel or QForm display an HTML form that can
  7. * manipulate a single Address object.
  8. *
  9. * To take advantage of some (or all) of these control objects, you
  10. * must create a new QForm or QPanel which instantiates a AddressMetaControl
  11. * class.
  12. *
  13. * Any and all changes to this file will be overwritten with any subsequent
  14. * code re-generation.
  15. *
  16. * @package Quinta CMS
  17. * @subpackage MetaControls
  18. * property-read Address $Address the actual Address data class being edited
  19. * property QLabel $IdControl
  20. * property-read QLabel $IdLabel
  21. * property QTextBox $TitleControl
  22. * property-read QLabel $TitleLabel
  23. * property QListBox $PersonIdControl
  24. * property-read QLabel $PersonIdLabel
  25. * property QTextBox $Street1Control
  26. * property-read QLabel $Street1Label
  27. * property QTextBox $Street2Control
  28. * property-read QLabel $Street2Label
  29. * property QTextBox $SuburbControl
  30. * property-read QLabel $SuburbLabel
  31. * property QTextBox $CityControl
  32. * property-read QLabel $CityLabel
  33. * property QTextBox $CountyControl
  34. * property-read QLabel $CountyLabel
  35. * property QListBox $ZoneIdControl
  36. * property-read QLabel $ZoneIdLabel
  37. * property QListBox $CountryIdControl
  38. * property-read QLabel $CountryIdLabel
  39. * property QTextBox $PostalCodeControl
  40. * property-read QLabel $PostalCodeLabel
  41. * property QCheckBox $IsCurrentControl
  42. * property-read QLabel $IsCurrentLabel
  43. * property QListBox $TypeIdControl
  44. * property-read QLabel $TypeIdLabel
  45. * property QLabel $CreationDateControl
  46. * property-read QLabel $CreationDateLabel
  47. * property QLabel $LastModificationControl
  48. * property-read QLabel $LastModificationLabel
  49. * property-read string $TitleVerb a verb indicating whether or not this is being edited or created
  50. * property-read boolean $EditMode a boolean indicating whether or not this is being edited or created
  51. */
  52. class AddressMetaControlGen extends QBaseClass {
  53. // General Variables
  54. protected $objAddress;
  55. protected $objParentObject;
  56. protected $strTitleVerb;
  57. protected $blnEditMode;
  58. // Controls that allow the editing of Address's individual data fields
  59. protected $lblId;
  60. protected $txtTitle;
  61. protected $lstPerson;
  62. protected $txtStreet1;
  63. protected $txtStreet2;
  64. protected $txtSuburb;
  65. protected $txtCity;
  66. protected $txtCounty;
  67. protected $lstZone;
  68. protected $lstCountry;
  69. protected $txtPostalCode;
  70. protected $chkIsCurrent;
  71. protected $lstType;
  72. protected $lblCreationDate;
  73. protected $lblLastModification;
  74. // Controls that allow the viewing of Address's individual data fields
  75. protected $lblTitle;
  76. protected $lblPersonId;
  77. protected $lblStreet1;
  78. protected $lblStreet2;
  79. protected $lblSuburb;
  80. protected $lblCity;
  81. protected $lblCounty;
  82. protected $lblZoneId;
  83. protected $lblCountryId;
  84. protected $lblPostalCode;
  85. protected $lblIsCurrent;
  86. protected $lblTypeId;
  87. // QListBox Controls (if applicable) to edit Unique ReverseReferences and ManyToMany References
  88. // QLabel Controls (if applicable) to view Unique ReverseReferences and ManyToMany References
  89. /**
  90. * Main constructor. Constructor OR static create methods are designed to be called in either
  91. * a parent QPanel or the main QForm when wanting to create a
  92. * AddressMetaControl to edit a single Address object within the
  93. * QPanel or QForm.
  94. *
  95. * This constructor takes in a single Address object, while any of the static
  96. * create methods below can be used to construct based off of individual PK ID(s).
  97. *
  98. * @param mixed $objParentObject QForm or QPanel which will be using this AddressMetaControl
  99. * @param Address $objAddress new or existing Address object
  100. */
  101. public function __construct($objParentObject, Address $objAddress) {
  102. // Setup Parent Object (e.g. QForm or QPanel which will be using this AddressMetaControl)
  103. $this->objParentObject = $objParentObject;
  104. // Setup linked Address object
  105. $this->objAddress = $objAddress;
  106. // Figure out if we're Editing or Creating New
  107. if ($this->objAddress->__Restored) {
  108. $this->strTitleVerb = QApplication::Translate('Edit');
  109. $this->blnEditMode = true;
  110. } else {
  111. $this->strTitleVerb = QApplication::Translate('Create');
  112. $this->blnEditMode = false;
  113. }
  114. }
  115. /**
  116. * Static Helper Method to Create using PK arguments
  117. * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  118. * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  119. * static helper methods. Finally, specify a CreateType to define whether or not we are only allowed to
  120. * edit, or if we are also allowed to create a new one, etc.
  121. *
  122. * @param mixed $objParentObject QForm or QPanel which will be using this AddressMetaControl
  123. * @param integer $intId primary key value
  124. * @param QMetaControlCreateType $intCreateType rules governing Address object creation - defaults to CreateOrEdit
  125. * @return AddressMetaControl
  126. */
  127. public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
  128. // Attempt to Load from PK Arguments
  129. if (strlen($intId)) {
  130. $objAddress = Address::Load($intId);
  131. // Address was found -- return it!
  132. if ($objAddress)
  133. return new AddressMetaControl($objParentObject, $objAddress);
  134. // If CreateOnRecordNotFound not specified, throw an exception
  135. else if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound)
  136. throw new QCallerException('Could not find a Address object with PK arguments: ' . $intId);
  137. // If EditOnly is specified, throw an exception
  138. } else if ($intCreateType == QMetaControlCreateType::EditOnly)
  139. throw new QCallerException('No PK arguments specified');
  140. // If we are here, then we need to create a new record
  141. return new AddressMetaControl($objParentObject, new Address());
  142. }
  143. /**
  144. * Static Helper Method to Create using PathInfo arguments
  145. *
  146. * @param mixed $objParentObject QForm or QPanel which will be using this AddressMetaControl
  147. * @param QMetaControlCreateType $intCreateType rules governing Address object creation - defaults to CreateOrEdit
  148. * @return AddressMetaControl
  149. */
  150. public static function CreateFromPathInfo($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
  151. $intId = QApplication::PathInfo(0);
  152. return AddressMetaControl::Create($objParentObject, $intId, $intCreateType);
  153. }
  154. /**
  155. * Static Helper Method to Create using QueryString arguments
  156. *
  157. * @param mixed $objParentObject QForm or QPanel which will be using this AddressMetaControl
  158. * @param QMetaControlCreateType $intCreateType rules governing Address object creation - defaults to CreateOrEdit
  159. * @return AddressMetaControl
  160. */
  161. public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
  162. $intId = QApplication::QueryString('intId');
  163. return AddressMetaControl::Create($objParentObject, $intId, $intCreateType);
  164. }
  165. ///////////////////////////////////////////////
  166. // PUBLIC CREATE and REFRESH METHODS
  167. ///////////////////////////////////////////////
  168. /**
  169. * Create and setup QLabel lblId
  170. * @param string $strControlId optional ControlId to use
  171. * @return QLabel
  172. */
  173. public function lblId_Create($strControlId = null) {
  174. $this->lblId = new QLabel($this->objParentObject, $strControlId);
  175. $this->lblId->Name = QApplication::Translate('Id');
  176. if ($this->blnEditMode)
  177. $this->lblId->Text = $this->objAddress->Id;
  178. else
  179. $this->lblId->Text = 'N/A';
  180. return $this->lblId;
  181. }
  182. /**
  183. * Create and setup QTextBox txtTitle
  184. * @param string $strControlId optional ControlId to use
  185. * @return QTextBox
  186. */
  187. public function txtTitle_Create($strControlId = null) {
  188. $this->txtTitle = new QTextBox($this->objParentObject, $strControlId);
  189. $this->txtTitle->Name = QApplication::Translate('Title');
  190. $this->txtTitle->Text = $this->objAddress->Title;
  191. $this->txtTitle->MaxLength = Address::TitleMaxLength;
  192. return $this->txtTitle;
  193. }
  194. /**
  195. * Create and setup QLabel lblTitle
  196. * @param string $strControlId optional ControlId to use
  197. * @return QLabel
  198. */
  199. public function lblTitle_Create($strControlId = null) {
  200. $this->lblTitle = new QLabel($this->objParentObject, $strControlId);
  201. $this->lblTitle->Name = QApplication::Translate('Title');
  202. $this->lblTitle->Text = $this->objAddress->Title;
  203. return $this->lblTitle;
  204. }
  205. /**
  206. * Create and setup QListBox lstPerson
  207. * @param string $strControlId optional ControlId to use
  208. * @return QListBox
  209. */
  210. public function lstPerson_Create($strControlId = null) {
  211. $this->lstPerson = new QListBox($this->objParentObject, $strControlId);
  212. $this->lstPerson->Name = QApplication::Translate('Person');
  213. $this->lstPerson->Required = true;
  214. if (!$this->blnEditMode)
  215. $this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null);
  216. $objPersonArray = Person::LoadAll();
  217. if ($objPersonArray) foreach ($objPersonArray as $objPerson) {
  218. $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
  219. if (($this->objAddress->Person) && ($this->objAddress->Person->Id == $objPerson->Id))
  220. $objListItem->Selected = true;
  221. $this->lstPerson->AddItem($objListItem);
  222. }
  223. return $this->lstPerson;
  224. }
  225. /**
  226. * Create and setup QLabel lblPersonId
  227. * @param string $strControlId optional ControlId to use
  228. * @return QLabel
  229. */
  230. public function lblPersonId_Create($strControlId = null) {
  231. $this->lblPersonId = new QLabel($this->objParentObject, $strControlId);
  232. $this->lblPersonId->Name = QApplication::Translate('Person');
  233. $this->lblPersonId->Text = ($this->objAddress->Person) ? $this->objAddress->Person->__toString() : null;
  234. $this->lblPersonId->Required = true;
  235. return $this->lblPersonId;
  236. }
  237. /**
  238. * Create and setup QTextBox txtStreet1
  239. * @param string $strControlId optional ControlId to use
  240. * @return QTextBox
  241. */
  242. public function txtStreet1_Create($strControlId = null) {
  243. $this->txtStreet1 = new QTextBox($this->objParentObject, $strControlId);
  244. $this->txtStreet1->Name = QApplication::Translate('Street 1');
  245. $this->txtStreet1->Text = $this->objAddress->Street1;
  246. $this->txtStreet1->MaxLength = Address::Street1MaxLength;
  247. return $this->txtStreet1;
  248. }
  249. /**
  250. * Create and setup QLabel lblStreet1
  251. * @param string $strControlId optional ControlId to use
  252. * @return QLabel
  253. */
  254. public function lblStreet1_Create($strControlId = null) {
  255. $this->lblStreet1 = new QLabel($this->objParentObject, $strControlId);
  256. $this->lblStreet1->Name = QApplication::Translate('Street 1');
  257. $this->lblStreet1->Text = $this->objAddress->Street1;
  258. return $this->lblStreet1;
  259. }
  260. /**
  261. * Create and setup QTextBox txtStreet2
  262. * @param string $strControlId optional ControlId to use
  263. * @return QTextBox
  264. */
  265. public function txtStreet2_Create($strControlId = null) {
  266. $this->txtStreet2 = new QTextBox($this->objParentObject, $strControlId);
  267. $this->txtStreet2->Name = QApplication::Translate('Street 2');
  268. $this->txtStreet2->Text = $this->objAddress->Street2;
  269. $this->txtStreet2->MaxLength = Address::Street2MaxLength;
  270. return $this->txtStreet2;
  271. }
  272. /**
  273. * Create and setup QLabel lblStreet2
  274. * @param string $strControlId optional ControlId to use
  275. * @return QLabel
  276. */
  277. public function lblStreet2_Create($strControlId = null) {
  278. $this->lblStreet2 = new QLabel($this->objParentObject, $strControlId);
  279. $this->lblStreet2->Name = QApplication::Translate('Street 2');
  280. $this->lblStreet2->Text = $this->objAddress->Street2;
  281. return $this->lblStreet2;
  282. }
  283. /**
  284. * Create and setup QTextBox txtSuburb
  285. * @param string $strControlId optional ControlId to use
  286. * @return QTextBox
  287. */
  288. public function txtSuburb_Create($strControlId = null) {
  289. $this->txtSuburb = new QTextBox($this->objParentObject, $strControlId);
  290. $this->txtSuburb->Name = QApplication::Translate('Suburb');
  291. $this->txtSuburb->Text = $this->objAddress->Suburb;
  292. $this->txtSuburb->MaxLength = Address::SuburbMaxLength;
  293. return $this->txtSuburb;
  294. }
  295. /**
  296. * Create and setup QLabel lblSuburb
  297. * @param string $strControlId optional ControlId to use
  298. * @return QLabel
  299. */
  300. public function lblSuburb_Create($strControlId = null) {
  301. $this->lblSuburb = new QLabel($this->objParentObject, $strControlId);
  302. $this->lblSuburb->Name = QApplication::Translate('Suburb');
  303. $this->lblSuburb->Text = $this->objAddress->Suburb;
  304. return $this->lblSuburb;
  305. }
  306. /**
  307. * Create and setup QTextBox txtCity
  308. * @param string $strControlId optional ControlId to use
  309. * @return QTextBox
  310. */
  311. public function txtCity_Create($strControlId = null) {
  312. $this->txtCity = new QTextBox($this->objParentObject, $strControlId);
  313. $this->txtCity->Name = QApplication::Translate('City');
  314. $this->txtCity->Text = $this->objAddress->City;
  315. $this->txtCity->MaxLength = Address::CityMaxLength;
  316. return $this->txtCity;
  317. }
  318. /**
  319. * Create and setup QLabel lblCity
  320. * @param string $strControlId optional ControlId to use
  321. * @return QLabel
  322. */
  323. public function lblCity_Create($strControlId = null) {
  324. $this->lblCity = new QLabel($this->objParentObject, $strControlId);
  325. $this->lblCity->Name = QApplication::Translate('City');
  326. $this->lblCity->Text = $this->objAddress->City;
  327. return $this->lblCity;
  328. }
  329. /**
  330. * Create and setup QTextBox txtCounty
  331. * @param string $strControlId optional ControlId to use
  332. * @return QTextBox
  333. */
  334. public function txtCounty_Create($strControlId = null) {
  335. $this->txtCounty = new QTextBox($this->objParentObject, $strControlId);
  336. $this->txtCounty->Name = QApplication::Translate('County');
  337. $this->txtCounty->Text = $this->objAddress->County;
  338. $this->txtCounty->MaxLength = Address::CountyMaxLength;
  339. return $this->txtCounty;
  340. }
  341. /**
  342. * Create and setup QLabel lblCounty
  343. * @param string $strControlId optional ControlId to use
  344. * @return QLabel
  345. */
  346. public function lblCounty_Create($strControlId = null) {
  347. $this->lblCounty = new QLabel($this->objParentObject, $strControlId);
  348. $this->lblCounty->Name = QApplication::Translate('County');
  349. $this->lblCounty->Text = $this->objAddress->County;
  350. return $this->lblCounty;
  351. }
  352. /**
  353. * Create and setup QListBox lstZone
  354. * @param string $strControlId optional ControlId to use
  355. * @return QListBox
  356. */
  357. public function lstZone_Create($strControlId = null) {
  358. $this->lstZone = new QListBox($this->objParentObject, $strControlId);
  359. $this->lstZone->Name = QApplication::Translate('Zone');
  360. $this->lstZone->Required = true;
  361. foreach (ZoneType::$NameArray as $intId => $strValue)
  362. $this->lstZone->AddItem(new QListItem($strValue, $intId, $this->objAddress->ZoneId == $intId));
  363. return $this->lstZone;
  364. }
  365. /**
  366. * Create and setup QLabel lblZoneId
  367. * @param string $strControlId optional ControlId to use
  368. * @return QLabel
  369. */
  370. public function lblZoneId_Create($strControlId = null) {
  371. $this->lblZoneId = new QLabel($this->objParentObject, $strControlId);
  372. $this->lblZoneId->Name = QApplication::Translate('Zone');
  373. $this->lblZoneId->Text = ($this->objAddress->ZoneId) ? ZoneType::$NameArray[$this->objAddress->ZoneId] : null;
  374. $this->lblZoneId->Required = true;
  375. return $this->lblZoneId;
  376. }
  377. /**
  378. * Create and setup QListBox lstCountry
  379. * @param string $strControlId optional ControlId to use
  380. * @return QListBox
  381. */
  382. public function lstCountry_Create($strControlId = null) {
  383. $this->lstCountry = new QListBox($this->objParentObject, $strControlId);
  384. $this->lstCountry->Name = QApplication::Translate('Country');
  385. $this->lstCountry->Required = true;
  386. foreach (CountryType::$NameArray as $intId => $strValue)
  387. $this->lstCountry->AddItem(new QListItem($strValue, $intId, $this->objAddress->CountryId == $intId));
  388. return $this->lstCountry;
  389. }
  390. /**
  391. * Create and setup QLabel lblCountryId
  392. * @param string $strControlId optional ControlId to use
  393. * @return QLabel
  394. */
  395. public function lblCountryId_Create($strControlId = null) {
  396. $this->lblCountryId = new QLabel($this->objParentObject, $strControlId);
  397. $this->lblCountryId->Name = QApplication::Translate('Country');
  398. $this->lblCountryId->Text = ($this->objAddress->CountryId) ? CountryType::$NameArray[$this->objAddress->CountryId] : null;
  399. $this->lblCountryId->Required = true;
  400. return $this->lblCountryId;
  401. }
  402. /**
  403. * Create and setup QTextBox txtPostalCode
  404. * @param string $strControlId optional ControlId to use
  405. * @return QTextBox
  406. */
  407. public function txtPostalCode_Create($strControlId = null) {
  408. $this->txtPostalCode = new QTextBox($this->objParentObject, $strControlId);
  409. $this->txtPostalCode->Name = QApplication::Translate('Postal Code');
  410. $this->txtPostalCode->Text = $this->objAddress->PostalCode;
  411. $this->txtPostalCode->MaxLength = Address::PostalCodeMaxLength;
  412. return $this->txtPostalCode;
  413. }
  414. /**
  415. * Create and setup QLabel lblPostalCode
  416. * @param string $strControlId optional ControlId to use
  417. * @return QLabel
  418. */
  419. public function lblPostalCode_Create($strControlId = null) {
  420. $this->lblPostalCode = new QLabel($this->objParentObject, $strControlId);
  421. $this->lblPostalCode->Name = QApplication::Translate('Postal Code');
  422. $this->lblPostalCode->Text = $this->objAddress->PostalCode;
  423. return $this->lblPostalCode;
  424. }
  425. /**
  426. * Create and setup QCheckBox chkIsCurrent
  427. * @param string $strControlId optional ControlId to use
  428. * @return QCheckBox
  429. */
  430. public function chkIsCurrent_Create($strControlId = null) {
  431. $this->chkIsCurrent = new QCheckBox($this->objParentObject, $strControlId);
  432. $this->chkIsCurrent->Name = QApplication::Translate('Is Current');
  433. $this->chkIsCurrent->Checked = $this->objAddress->IsCurrent;
  434. return $this->chkIsCurrent;
  435. }
  436. /**
  437. * Create and setup QLabel lblIsCurrent
  438. * @param string $strControlId optional ControlId to use
  439. * @return QLabel
  440. */
  441. public function lblIsCurrent_Create($strControlId = null) {
  442. $this->lblIsCurrent = new QLabel($this->objParentObject, $strControlId);
  443. $this->lblIsCurrent->Name = QApplication::Translate('Is Current');
  444. $this->lblIsCurrent->Text = ($this->objAddress->IsCurrent) ? QApplication::Translate('Yes') : QApplication::Translate('No');
  445. return $this->lblIsCurrent;
  446. }
  447. /**
  448. * Create and setup QListBox lstType
  449. * @param string $strControlId optional ControlId to use
  450. * @return QListBox
  451. */
  452. public function lstType_Create($strControlId = null) {
  453. $this->lstType = new QListBox($this->objParentObject, $strControlId);
  454. $this->lstType->Name = QApplication::Translate('Type');
  455. $this->lstType->Required = true;
  456. foreach (AddressType::$NameArray as $intId => $strValue)
  457. $this->lstType->AddItem(new QListItem($strValue, $intId, $this->objAddress->TypeId == $intId));
  458. return $this->lstType;
  459. }
  460. /**
  461. * Create and setup QLabel lblTypeId
  462. * @param string $strControlId optional ControlId to use
  463. * @return QLabel
  464. */
  465. public function lblTypeId_Create($strControlId = null) {
  466. $this->lblTypeId = new QLabel($this->objParentObject, $strControlId);
  467. $this->lblTypeId->Name = QApplication::Translate('Type');
  468. $this->lblTypeId->Text = ($this->objAddress->TypeId) ? AddressType::$NameArray[$this->objAddress->TypeId] : null;
  469. $this->lblTypeId->Required = true;
  470. return $this->lblTypeId;
  471. }
  472. /**
  473. * Create and setup QLabel lblCreationDate
  474. * @param string $strControlId optional ControlId to use
  475. * @return QLabel
  476. */
  477. public function lblCreationDate_Create($strControlId = null) {
  478. $this->lblCreationDate = new QLabel($this->objParentObject, $strControlId);
  479. $this->lblCreationDate->Name = QApplication::Translate('Creation Date');
  480. if ($this->blnEditMode)
  481. $this->lblCreationDate->Text = $this->objAddress->CreationDate;
  482. else
  483. $this->lblCreationDate->Text = 'N/A';
  484. return $this->lblCreationDate;
  485. }
  486. /**
  487. * Create and setup QLabel lblLastModification
  488. * @param string $strControlId optional ControlId to use
  489. * @return QLabel
  490. */
  491. public function lblLastModification_Create($strControlId = null) {
  492. $this->lblLastModification = new QLabel($this->objParentObject, $strControlId);
  493. $this->lblLastModification->Name = QApplication::Translate('Last Modification');
  494. if ($this->blnEditMode)
  495. $this->lblLastModification->Text = $this->objAddress->LastModification;
  496. else
  497. $this->lblLastModification->Text = 'N/A';
  498. return $this->lblLastModification;
  499. }
  500. /**
  501. * Refresh this MetaControl with Data from the local Address object.
  502. * @param boolean $blnReload reload Address from the database
  503. * @return void
  504. */
  505. public function Refresh($blnReload = false) {
  506. if ($blnReload)
  507. $this->objAddress->Reload();
  508. if ($this->lblId) if ($this->blnEditMode) $this->lblId->Text = $this->objAddress->Id;
  509. if ($this->txtTitle) $this->txtTitle->Text = $this->objAddress->Title;
  510. if ($this->lblTitle) $this->lblTitle->Text = $this->objAddress->Title;
  511. if ($this->lstPerson) {
  512. $this->lstPerson->RemoveAllItems();
  513. if (!$this->blnEditMode)
  514. $this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null);
  515. $objPersonArray = Person::LoadAll();
  516. if ($objPersonArray) foreach ($objPersonArray as $objPerson) {
  517. $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
  518. if (($this->objAddress->Person) && ($this->objAddress->Person->Id == $objPerson->Id))
  519. $objListItem->Selected = true;
  520. $this->lstPerson->AddItem($objListItem);
  521. }
  522. }
  523. if ($this->lblPersonId) $this->lblPersonId->Text = ($this->objAddress->Person) ? $this->objAddress->Person->__toString() : null;
  524. if ($this->txtStreet1) $this->txtStreet1->Text = $this->objAddress->Street1;
  525. if ($this->lblStreet1) $this->lblStreet1->Text = $this->objAddress->Street1;
  526. if ($this->txtStreet2) $this->txtStreet2->Text = $this->objAddress->Street2;
  527. if ($this->lblStreet2) $this->lblStreet2->Text = $this->objAddress->Street2;
  528. if ($this->txtSuburb) $this->txtSuburb->Text = $this->objAddress->Suburb;
  529. if ($this->lblSuburb) $this->lblSuburb->Text = $this->objAddress->Suburb;
  530. if ($this->txtCity) $this->txtCity->Text = $this->objAddress->City;
  531. if ($this->lblCity) $this->lblCity->Text = $this->objAddress->City;
  532. if ($this->txtCounty) $this->txtCounty->Text = $this->objAddress->County;
  533. if ($this->lblCounty) $this->lblCounty->Text = $this->objAddress->County;
  534. if ($this->lstZone) $this->lstZone->SelectedValue = $this->objAddress->ZoneId;
  535. if ($this->lblZoneId) $this->lblZoneId->Text = ($this->objAddress->ZoneId) ? ZoneType::$NameArray[$this->objAddress->ZoneId] : null;
  536. if ($this->lstCountry) $this->lstCountry->SelectedValue = $this->objAddress->CountryId;
  537. if ($this->lblCountryId) $this->lblCountryId->Text = ($this->objAddress->CountryId) ? CountryType::$NameArray[$this->objAddress->CountryId] : null;
  538. if ($this->txtPostalCode) $this->txtPostalCode->Text = $this->objAddress->PostalCode;
  539. if ($this->lblPostalCode) $this->lblPostalCode->Text = $this->objAddress->PostalCode;
  540. if ($this->chkIsCurrent) $this->chkIsCurrent->Checked = $this->objAddress->IsCurrent;
  541. if ($this->lblIsCurrent) $this->lblIsCurrent->Text = ($this->objAddress->IsCurrent) ? QApplication::Translate('Yes') : QApplication::Translate('No');
  542. if ($this->lstType) $this->lstType->SelectedValue = $this->objAddress->TypeId;
  543. if ($this->lblTypeId) $this->lblTypeId->Text = ($this->objAddress->TypeId) ? AddressType::$NameArray[$this->objAddress->TypeId] : null;
  544. if ($this->lblCreationDate) if ($this->blnEditMode) $this->lblCreationDate->Text = $this->objAddress->CreationDate;
  545. if ($this->lblLastModification) if ($this->blnEditMode) $this->lblLastModification->Text = $this->objAddress->LastModification;
  546. }
  547. ///////////////////////////////////////////////
  548. // PROTECTED UPDATE METHODS for ManyToManyReferences (if any)
  549. ///////////////////////////////////////////////
  550. ///////////////////////////////////////////////
  551. // PUBLIC ADDRESS OBJECT MANIPULATORS
  552. ///////////////////////////////////////////////
  553. /**
  554. * This will save this object's Address instance,
  555. * updating only the fields which have had a control created for it.
  556. */
  557. public function SaveAddress() {
  558. try {
  559. // Update any fields for controls that have been created
  560. if ($this->txtTitle) $this->objAddress->Title = $this->txtTitle->Text;
  561. if ($this->lstPerson) $this->objAddress->PersonId = $this->lstPerson->SelectedValue;
  562. if ($this->txtStreet1) $this->objAddress->Street1 = $this->txtStreet1->Text;
  563. if ($this->txtStreet2) $this->objAddress->Street2 = $this->txtStreet2->Text;
  564. if ($this->txtSuburb) $this->objAddress->Suburb = $this->txtSuburb->Text;
  565. if ($this->txtCity) $this->objAddress->City = $this->txtCity->Text;
  566. if ($this->txtCounty) $this->objAddress->County = $this->txtCounty->Text;
  567. if ($this->lstZone) $this->objAddress->ZoneId = $this->lstZone->SelectedValue;
  568. if ($this->lstCountry) $this->objAddress->CountryId = $this->lstCountry->SelectedValue;
  569. if ($this->txtPostalCode) $this->objAddress->PostalCode = $this->txtPostalCode->Text;
  570. if ($this->chkIsCurrent) $this->objAddress->IsCurrent = $this->chkIsCurrent->Checked;
  571. if ($this->lstType) $this->objAddress->TypeId = $this->lstType->SelectedValue;
  572. // Update any UniqueReverseReferences (if any) for controls that have been created for it
  573. // Save the Address object
  574. $this->objAddress->Save();
  575. // Finally, update any ManyToManyReferences (if any)
  576. } catch (QCallerException $objExc) {
  577. $objExc->IncrementOffset();
  578. throw $objExc;
  579. }
  580. }
  581. /**
  582. * This will DELETE this object's Address instance from the database.
  583. * It will also unassociate itself from any ManyToManyReferences.
  584. */
  585. public function DeleteAddress() {
  586. $this->objAddress->Delete();
  587. }
  588. ///////////////////////////////////////////////
  589. // PUBLIC GETTERS and SETTERS
  590. ///////////////////////////////////////////////
  591. /**
  592. * Override method to perform a property "Get"
  593. * This will get the value of $strName
  594. *
  595. * @param string $strName Name of the property to get
  596. * @return mixed
  597. */
  598. public function __get($strName) {
  599. switch ($strName) {
  600. // General MetaControlVariables
  601. case 'Address': return $this->objAddress;
  602. case 'TitleVerb': return $this->strTitleVerb;
  603. case 'EditMode': return $this->blnEditMode;
  604. // Controls that point to Address fields -- will be created dynamically if not yet created
  605. case 'IdControl':
  606. if (!$this->lblId) return $this->lblId_Create();
  607. return $this->lblId;
  608. case 'IdLabel':
  609. if (!$this->lblId) return $this->lblId_Create();
  610. return $this->lblId;
  611. case 'TitleControl':
  612. if (!$this->txtTitle) return $this->txtTitle_Create();
  613. return $this->txtTitle;
  614. case 'TitleLabel':
  615. if (!$this->lblTitle) return $this->lblTitle_Create();
  616. return $this->lblTitle;
  617. case 'PersonIdControl':
  618. if (!$this->lstPerson) return $this->lstPerson_Create();
  619. return $this->lstPerson;
  620. case 'PersonIdLabel':
  621. if (!$this->lblPersonId) return $this->lblPersonId_Create();
  622. return $this->lblPersonId;
  623. case 'Street1Control':
  624. if (!$this->txtStreet1) return $this->txtStreet1_Create();
  625. return $this->txtStreet1;
  626. case 'Street1Label':
  627. if (!$this->lblStreet1) return $this->lblStreet1_Create();
  628. return $this->lblStreet1;
  629. case 'Street2Control':
  630. if (!$this->txtStreet2) return $this->txtStreet2_Create();
  631. return $this->txtStreet2;
  632. case 'Street2Label':
  633. if (!$this->lblStreet2) return $this->lblStreet2_Create();
  634. return $this->lblStreet2;
  635. case 'SuburbControl':
  636. if (!$this->txtSuburb) return $this->txtSuburb_Create();
  637. return $this->txtSuburb;
  638. case 'SuburbLabel':
  639. if (!$this->lblSuburb) return $this->lblSuburb_Create();
  640. return $this->lblSuburb;
  641. case 'CityControl':
  642. if (!$this->txtCity) return $this->txtCity_Create();
  643. return $this->txtCity;
  644. case 'CityLabel':
  645. if (!$this->lblCity) return $this->lblCity_Create();
  646. return $this->lblCity;
  647. case 'CountyControl':
  648. if (!$this->txtCounty) return $this->txtCounty_Create();
  649. return $this->txtCounty;
  650. case 'CountyLabel':
  651. if (!$this->lblCounty) return $this->lblCounty_Create();
  652. return $this->lblCounty;
  653. case 'ZoneIdControl':
  654. if (!$this->lstZone) return $this->lstZone_Create();
  655. return $this->lstZone;
  656. case 'ZoneIdLabel':
  657. if (!$this->lblZoneId) return $this->lblZoneId_Create();
  658. return $this->lblZoneId;
  659. case 'CountryIdControl':
  660. if (!$this->lstCountry) return $this->lstCountry_Create();
  661. return $this->lstCountry;
  662. case 'CountryIdLabel':
  663. if (!$this->lblCountryId) return $this->lblCountryId_Create();
  664. return $this->lblCountryId;
  665. case 'PostalCodeControl':
  666. if (!$this->txtPostalCode) return $this->txtPostalCode_Create();
  667. return $this->txtPostalCode;
  668. case 'PostalCodeLabel':
  669. if (!$this->lblPostalCode) return $this->lblPostalCode_Create();
  670. return $this->lblPostalCode;
  671. case 'IsCurrentControl':
  672. if (!$this->chkIsCurrent) return $this->chkIsCurrent_Create();
  673. return $this->chkIsCurrent;
  674. case 'IsCurrentLabel':
  675. if (!$this->lblIsCurrent) return $this->lblIsCurrent_Create();
  676. return $this->lblIsCurrent;
  677. case 'TypeIdControl':
  678. if (!$this->lstType) return $this->lstType_Create();
  679. return $this->lstType;
  680. case 'TypeIdLabel':
  681. if (!$this->lblTypeId) return $this->lblTypeId_Create();
  682. return $this->lblTypeId;
  683. case 'CreationDateControl':
  684. if (!$this->lblCreationDate) return $this->lblCreationDate_Create();
  685. return $this->lblCreationDate;
  686. case 'CreationDateLabel':
  687. if (!$this->lblCreationDate) return $this->lblCreationDate_Create();
  688. return $this->lblCreationDate;
  689. case 'LastModificationControl':
  690. if (!$this->lblLastModification) return $this->lblLastModification_Create();
  691. return $this->lblLastModification;
  692. case 'LastModificationLabel':
  693. if (!$this->lblLastModification) return $this->lblLastModification_Create();
  694. return $this->lblLastModification;
  695. default:
  696. try {
  697. return parent::__get($strName);
  698. } catch (QCallerException $objExc) {
  699. $objExc->IncrementOffset();
  700. throw $objExc;
  701. }
  702. }
  703. }
  704. /**
  705. * Override method to perform a property "Set"
  706. * This will set the property $strName to be $mixValue
  707. *
  708. * @param string $strName Name of the property to set
  709. * @param string $mixValue New value of the property
  710. * @return mixed
  711. */
  712. public function __set($strName, $mixValue) {
  713. try {
  714. switch ($strName) {
  715. // Controls that point to Address fields
  716. case 'IdControl':
  717. return ($this->lblId = QType::Cast($mixValue, 'QControl'));
  718. case 'TitleControl':
  719. return ($this->txtTitle = QType::Cast($mixValue, 'QControl'));
  720. case 'PersonIdControl':
  721. return ($this->lstPerson = QType::Cast($mixValue, 'QControl'));
  722. case 'Street1Control':
  723. return ($this->txtStreet1 = QType::Cast($mixValue, 'QControl'));
  724. case 'Street2Control':
  725. return ($this->txtStreet2 = QType::Cast($mixValue, 'QControl'));
  726. case 'SuburbControl':
  727. return ($this->txtSuburb = QType::Cast($mixValue, 'QControl'));
  728. case 'CityControl':
  729. return ($this->txtCity = QType::Cast($mixValue, 'QControl'));
  730. case 'CountyControl':
  731. return ($this->txtCounty = QType::Cast($mixValue, 'QControl'));
  732. case 'ZoneIdControl':
  733. return ($this->lstZone = QType::Cast($mixValue, 'QControl'));
  734. case 'CountryIdControl':
  735. return ($this->lstCountry = QType::Cast($mixValue, 'QControl'));
  736. case 'PostalCodeControl':
  737. return ($this->txtPostalCode = QType::Cast($mixValue, 'QControl'));
  738. case 'IsCurrentControl':
  739. return ($this->chkIsCurrent = QType::Cast($mixValue, 'QControl'));
  740. case 'TypeIdControl':
  741. return ($this->lstType = QType::Cast($mixValue, 'QControl'));
  742. case 'CreationDateControl':
  743. return ($this->lblCreationDate = QType::Cast($mixValue, 'QControl'));
  744. case 'LastModificationControl':
  745. return ($this->lblLastModification = QType::Cast($mixValue, 'QControl'));
  746. default:
  747. return parent::__set($strName, $mixValue);
  748. }
  749. } catch (QCallerException $objExc) {
  750. $objExc->IncrementOffset();
  751. throw $objExc;
  752. }
  753. }
  754. }
  755. ?>