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.

1003 lines
47 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 OrderAddress 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 OrderAddress 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 OrderAddressMetaControl
  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 OrderAddress $OrderAddress the actual OrderAddress data class being edited
  19. * property QLabel $IdControl
  20. * property-read QLabel $IdLabel
  21. * property QListBox $OrderIdControl
  22. * property-read QLabel $OrderIdLabel
  23. * property QTextBox $NamePrefixControl
  24. * property-read QLabel $NamePrefixLabel
  25. * property QTextBox $FirstNameControl
  26. * property-read QLabel $FirstNameLabel
  27. * property QTextBox $MiddleNameControl
  28. * property-read QLabel $MiddleNameLabel
  29. * property QTextBox $LastNameControl
  30. * property-read QLabel $LastNameLabel
  31. * property QTextBox $NameSuffixControl
  32. * property-read QLabel $NameSuffixLabel
  33. * property QTextBox $CompanyControl
  34. * property-read QLabel $CompanyLabel
  35. * property QTextBox $Street1Control
  36. * property-read QLabel $Street1Label
  37. * property QTextBox $Street2Control
  38. * property-read QLabel $Street2Label
  39. * property QTextBox $SuburbControl
  40. * property-read QLabel $SuburbLabel
  41. * property QTextBox $CityControl
  42. * property-read QLabel $CityLabel
  43. * property QTextBox $CountyControl
  44. * property-read QLabel $CountyLabel
  45. * property QListBox $ZoneIdControl
  46. * property-read QLabel $ZoneIdLabel
  47. * property QListBox $CountryIdControl
  48. * property-read QLabel $CountryIdLabel
  49. * property QTextBox $PostalCodeControl
  50. * property-read QLabel $PostalCodeLabel
  51. * property QListBox $TypeIdControl
  52. * property-read QLabel $TypeIdLabel
  53. * property QLabel $CreationDateControl
  54. * property-read QLabel $CreationDateLabel
  55. * property QLabel $LastModificationControl
  56. * property-read QLabel $LastModificationLabel
  57. * property-read string $TitleVerb a verb indicating whether or not this is being edited or created
  58. * property-read boolean $EditMode a boolean indicating whether or not this is being edited or created
  59. */
  60. class OrderAddressMetaControlGen extends QBaseClass {
  61. // General Variables
  62. protected $objOrderAddress;
  63. protected $objParentObject;
  64. protected $strTitleVerb;
  65. protected $blnEditMode;
  66. // Controls that allow the editing of OrderAddress's individual data fields
  67. protected $lblId;
  68. protected $lstOrder;
  69. protected $txtNamePrefix;
  70. protected $txtFirstName;
  71. protected $txtMiddleName;
  72. protected $txtLastName;
  73. protected $txtNameSuffix;
  74. protected $txtCompany;
  75. protected $txtStreet1;
  76. protected $txtStreet2;
  77. protected $txtSuburb;
  78. protected $txtCity;
  79. protected $txtCounty;
  80. protected $lstZone;
  81. protected $lstCountry;
  82. protected $txtPostalCode;
  83. protected $lstType;
  84. protected $lblCreationDate;
  85. protected $lblLastModification;
  86. // Controls that allow the viewing of OrderAddress's individual data fields
  87. protected $lblOrderId;
  88. protected $lblNamePrefix;
  89. protected $lblFirstName;
  90. protected $lblMiddleName;
  91. protected $lblLastName;
  92. protected $lblNameSuffix;
  93. protected $lblCompany;
  94. protected $lblStreet1;
  95. protected $lblStreet2;
  96. protected $lblSuburb;
  97. protected $lblCity;
  98. protected $lblCounty;
  99. protected $lblZoneId;
  100. protected $lblCountryId;
  101. protected $lblPostalCode;
  102. protected $lblTypeId;
  103. // QListBox Controls (if applicable) to edit Unique ReverseReferences and ManyToMany References
  104. // QLabel Controls (if applicable) to view Unique ReverseReferences and ManyToMany References
  105. /**
  106. * Main constructor. Constructor OR static create methods are designed to be called in either
  107. * a parent QPanel or the main QForm when wanting to create a
  108. * OrderAddressMetaControl to edit a single OrderAddress object within the
  109. * QPanel or QForm.
  110. *
  111. * This constructor takes in a single OrderAddress object, while any of the static
  112. * create methods below can be used to construct based off of individual PK ID(s).
  113. *
  114. * @param mixed $objParentObject QForm or QPanel which will be using this OrderAddressMetaControl
  115. * @param OrderAddress $objOrderAddress new or existing OrderAddress object
  116. */
  117. public function __construct($objParentObject, OrderAddress $objOrderAddress) {
  118. // Setup Parent Object (e.g. QForm or QPanel which will be using this OrderAddressMetaControl)
  119. $this->objParentObject = $objParentObject;
  120. // Setup linked OrderAddress object
  121. $this->objOrderAddress = $objOrderAddress;
  122. // Figure out if we're Editing or Creating New
  123. if ($this->objOrderAddress->__Restored) {
  124. $this->strTitleVerb = QApplication::Translate('Edit');
  125. $this->blnEditMode = true;
  126. } else {
  127. $this->strTitleVerb = QApplication::Translate('Create');
  128. $this->blnEditMode = false;
  129. }
  130. }
  131. /**
  132. * Static Helper Method to Create using PK arguments
  133. * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  134. * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  135. * static helper methods. Finally, specify a CreateType to define whether or not we are only allowed to
  136. * edit, or if we are also allowed to create a new one, etc.
  137. *
  138. * @param mixed $objParentObject QForm or QPanel which will be using this OrderAddressMetaControl
  139. * @param integer $intId primary key value
  140. * @param QMetaControlCreateType $intCreateType rules governing OrderAddress object creation - defaults to CreateOrEdit
  141. * @return OrderAddressMetaControl
  142. */
  143. public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
  144. // Attempt to Load from PK Arguments
  145. if (strlen($intId)) {
  146. $objOrderAddress = OrderAddress::Load($intId);
  147. // OrderAddress was found -- return it!
  148. if ($objOrderAddress)
  149. return new OrderAddressMetaControl($objParentObject, $objOrderAddress);
  150. // If CreateOnRecordNotFound not specified, throw an exception
  151. else if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound)
  152. throw new QCallerException('Could not find a OrderAddress object with PK arguments: ' . $intId);
  153. // If EditOnly is specified, throw an exception
  154. } else if ($intCreateType == QMetaControlCreateType::EditOnly)
  155. throw new QCallerException('No PK arguments specified');
  156. // If we are here, then we need to create a new record
  157. return new OrderAddressMetaControl($objParentObject, new OrderAddress());
  158. }
  159. /**
  160. * Static Helper Method to Create using PathInfo arguments
  161. *
  162. * @param mixed $objParentObject QForm or QPanel which will be using this OrderAddressMetaControl
  163. * @param QMetaControlCreateType $intCreateType rules governing OrderAddress object creation - defaults to CreateOrEdit
  164. * @return OrderAddressMetaControl
  165. */
  166. public static function CreateFromPathInfo($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
  167. $intId = QApplication::PathInfo(0);
  168. return OrderAddressMetaControl::Create($objParentObject, $intId, $intCreateType);
  169. }
  170. /**
  171. * Static Helper Method to Create using QueryString arguments
  172. *
  173. * @param mixed $objParentObject QForm or QPanel which will be using this OrderAddressMetaControl
  174. * @param QMetaControlCreateType $intCreateType rules governing OrderAddress object creation - defaults to CreateOrEdit
  175. * @return OrderAddressMetaControl
  176. */
  177. public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
  178. $intId = QApplication::QueryString('intId');
  179. return OrderAddressMetaControl::Create($objParentObject, $intId, $intCreateType);
  180. }
  181. ///////////////////////////////////////////////
  182. // PUBLIC CREATE and REFRESH METHODS
  183. ///////////////////////////////////////////////
  184. /**
  185. * Create and setup QLabel lblId
  186. * @param string $strControlId optional ControlId to use
  187. * @return QLabel
  188. */
  189. public function lblId_Create($strControlId = null) {
  190. $this->lblId = new QLabel($this->objParentObject, $strControlId);
  191. $this->lblId->Name = QApplication::Translate('Id');
  192. if ($this->blnEditMode)
  193. $this->lblId->Text = $this->objOrderAddress->Id;
  194. else
  195. $this->lblId->Text = 'N/A';
  196. return $this->lblId;
  197. }
  198. /**
  199. * Create and setup QListBox lstOrder
  200. * @param string $strControlId optional ControlId to use
  201. * @return QListBox
  202. */
  203. public function lstOrder_Create($strControlId = null) {
  204. $this->lstOrder = new QListBox($this->objParentObject, $strControlId);
  205. $this->lstOrder->Name = QApplication::Translate('Order');
  206. $this->lstOrder->Required = true;
  207. if (!$this->blnEditMode)
  208. $this->lstOrder->AddItem(QApplication::Translate('- Select One -'), null);
  209. $objOrderArray = Order::LoadAll();
  210. if ($objOrderArray) foreach ($objOrderArray as $objOrder) {
  211. $objListItem = new QListItem($objOrder->__toString(), $objOrder->Id);
  212. if (($this->objOrderAddress->Order) && ($this->objOrderAddress->Order->Id == $objOrder->Id))
  213. $objListItem->Selected = true;
  214. $this->lstOrder->AddItem($objListItem);
  215. }
  216. return $this->lstOrder;
  217. }
  218. /**
  219. * Create and setup QLabel lblOrderId
  220. * @param string $strControlId optional ControlId to use
  221. * @return QLabel
  222. */
  223. public function lblOrderId_Create($strControlId = null) {
  224. $this->lblOrderId = new QLabel($this->objParentObject, $strControlId);
  225. $this->lblOrderId->Name = QApplication::Translate('Order');
  226. $this->lblOrderId->Text = ($this->objOrderAddress->Order) ? $this->objOrderAddress->Order->__toString() : null;
  227. $this->lblOrderId->Required = true;
  228. return $this->lblOrderId;
  229. }
  230. /**
  231. * Create and setup QTextBox txtNamePrefix
  232. * @param string $strControlId optional ControlId to use
  233. * @return QTextBox
  234. */
  235. public function txtNamePrefix_Create($strControlId = null) {
  236. $this->txtNamePrefix = new QTextBox($this->objParentObject, $strControlId);
  237. $this->txtNamePrefix->Name = QApplication::Translate('Name Prefix');
  238. $this->txtNamePrefix->Text = $this->objOrderAddress->NamePrefix;
  239. $this->txtNamePrefix->MaxLength = OrderAddress::NamePrefixMaxLength;
  240. return $this->txtNamePrefix;
  241. }
  242. /**
  243. * Create and setup QLabel lblNamePrefix
  244. * @param string $strControlId optional ControlId to use
  245. * @return QLabel
  246. */
  247. public function lblNamePrefix_Create($strControlId = null) {
  248. $this->lblNamePrefix = new QLabel($this->objParentObject, $strControlId);
  249. $this->lblNamePrefix->Name = QApplication::Translate('Name Prefix');
  250. $this->lblNamePrefix->Text = $this->objOrderAddress->NamePrefix;
  251. return $this->lblNamePrefix;
  252. }
  253. /**
  254. * Create and setup QTextBox txtFirstName
  255. * @param string $strControlId optional ControlId to use
  256. * @return QTextBox
  257. */
  258. public function txtFirstName_Create($strControlId = null) {
  259. $this->txtFirstName = new QTextBox($this->objParentObject, $strControlId);
  260. $this->txtFirstName->Name = QApplication::Translate('First Name');
  261. $this->txtFirstName->Text = $this->objOrderAddress->FirstName;
  262. $this->txtFirstName->MaxLength = OrderAddress::FirstNameMaxLength;
  263. return $this->txtFirstName;
  264. }
  265. /**
  266. * Create and setup QLabel lblFirstName
  267. * @param string $strControlId optional ControlId to use
  268. * @return QLabel
  269. */
  270. public function lblFirstName_Create($strControlId = null) {
  271. $this->lblFirstName = new QLabel($this->objParentObject, $strControlId);
  272. $this->lblFirstName->Name = QApplication::Translate('First Name');
  273. $this->lblFirstName->Text = $this->objOrderAddress->FirstName;
  274. return $this->lblFirstName;
  275. }
  276. /**
  277. * Create and setup QTextBox txtMiddleName
  278. * @param string $strControlId optional ControlId to use
  279. * @return QTextBox
  280. */
  281. public function txtMiddleName_Create($strControlId = null) {
  282. $this->txtMiddleName = new QTextBox($this->objParentObject, $strControlId);
  283. $this->txtMiddleName->Name = QApplication::Translate('Middle Name');
  284. $this->txtMiddleName->Text = $this->objOrderAddress->MiddleName;
  285. $this->txtMiddleName->MaxLength = OrderAddress::MiddleNameMaxLength;
  286. return $this->txtMiddleName;
  287. }
  288. /**
  289. * Create and setup QLabel lblMiddleName
  290. * @param string $strControlId optional ControlId to use
  291. * @return QLabel
  292. */
  293. public function lblMiddleName_Create($strControlId = null) {
  294. $this->lblMiddleName = new QLabel($this->objParentObject, $strControlId);
  295. $this->lblMiddleName->Name = QApplication::Translate('Middle Name');
  296. $this->lblMiddleName->Text = $this->objOrderAddress->MiddleName;
  297. return $this->lblMiddleName;
  298. }
  299. /**
  300. * Create and setup QTextBox txtLastName
  301. * @param string $strControlId optional ControlId to use
  302. * @return QTextBox
  303. */
  304. public function txtLastName_Create($strControlId = null) {
  305. $this->txtLastName = new QTextBox($this->objParentObject, $strControlId);
  306. $this->txtLastName->Name = QApplication::Translate('Last Name');
  307. $this->txtLastName->Text = $this->objOrderAddress->LastName;
  308. $this->txtLastName->MaxLength = OrderAddress::LastNameMaxLength;
  309. return $this->txtLastName;
  310. }
  311. /**
  312. * Create and setup QLabel lblLastName
  313. * @param string $strControlId optional ControlId to use
  314. * @return QLabel
  315. */
  316. public function lblLastName_Create($strControlId = null) {
  317. $this->lblLastName = new QLabel($this->objParentObject, $strControlId);
  318. $this->lblLastName->Name = QApplication::Translate('Last Name');
  319. $this->lblLastName->Text = $this->objOrderAddress->LastName;
  320. return $this->lblLastName;
  321. }
  322. /**
  323. * Create and setup QTextBox txtNameSuffix
  324. * @param string $strControlId optional ControlId to use
  325. * @return QTextBox
  326. */
  327. public function txtNameSuffix_Create($strControlId = null) {
  328. $this->txtNameSuffix = new QTextBox($this->objParentObject, $strControlId);
  329. $this->txtNameSuffix->Name = QApplication::Translate('Name Suffix');
  330. $this->txtNameSuffix->Text = $this->objOrderAddress->NameSuffix;
  331. $this->txtNameSuffix->MaxLength = OrderAddress::NameSuffixMaxLength;
  332. return $this->txtNameSuffix;
  333. }
  334. /**
  335. * Create and setup QLabel lblNameSuffix
  336. * @param string $strControlId optional ControlId to use
  337. * @return QLabel
  338. */
  339. public function lblNameSuffix_Create($strControlId = null) {
  340. $this->lblNameSuffix = new QLabel($this->objParentObject, $strControlId);
  341. $this->lblNameSuffix->Name = QApplication::Translate('Name Suffix');
  342. $this->lblNameSuffix->Text = $this->objOrderAddress->NameSuffix;
  343. return $this->lblNameSuffix;
  344. }
  345. /**
  346. * Create and setup QTextBox txtCompany
  347. * @param string $strControlId optional ControlId to use
  348. * @return QTextBox
  349. */
  350. public function txtCompany_Create($strControlId = null) {
  351. $this->txtCompany = new QTextBox($this->objParentObject, $strControlId);
  352. $this->txtCompany->Name = QApplication::Translate('Company');
  353. $this->txtCompany->Text = $this->objOrderAddress->Company;
  354. $this->txtCompany->MaxLength = OrderAddress::CompanyMaxLength;
  355. return $this->txtCompany;
  356. }
  357. /**
  358. * Create and setup QLabel lblCompany
  359. * @param string $strControlId optional ControlId to use
  360. * @return QLabel
  361. */
  362. public function lblCompany_Create($strControlId = null) {
  363. $this->lblCompany = new QLabel($this->objParentObject, $strControlId);
  364. $this->lblCompany->Name = QApplication::Translate('Company');
  365. $this->lblCompany->Text = $this->objOrderAddress->Company;
  366. return $this->lblCompany;
  367. }
  368. /**
  369. * Create and setup QTextBox txtStreet1
  370. * @param string $strControlId optional ControlId to use
  371. * @return QTextBox
  372. */
  373. public function txtStreet1_Create($strControlId = null) {
  374. $this->txtStreet1 = new QTextBox($this->objParentObject, $strControlId);
  375. $this->txtStreet1->Name = QApplication::Translate('Street 1');
  376. $this->txtStreet1->Text = $this->objOrderAddress->Street1;
  377. $this->txtStreet1->MaxLength = OrderAddress::Street1MaxLength;
  378. return $this->txtStreet1;
  379. }
  380. /**
  381. * Create and setup QLabel lblStreet1
  382. * @param string $strControlId optional ControlId to use
  383. * @return QLabel
  384. */
  385. public function lblStreet1_Create($strControlId = null) {
  386. $this->lblStreet1 = new QLabel($this->objParentObject, $strControlId);
  387. $this->lblStreet1->Name = QApplication::Translate('Street 1');
  388. $this->lblStreet1->Text = $this->objOrderAddress->Street1;
  389. return $this->lblStreet1;
  390. }
  391. /**
  392. * Create and setup QTextBox txtStreet2
  393. * @param string $strControlId optional ControlId to use
  394. * @return QTextBox
  395. */
  396. public function txtStreet2_Create($strControlId = null) {
  397. $this->txtStreet2 = new QTextBox($this->objParentObject, $strControlId);
  398. $this->txtStreet2->Name = QApplication::Translate('Street 2');
  399. $this->txtStreet2->Text = $this->objOrderAddress->Street2;
  400. $this->txtStreet2->MaxLength = OrderAddress::Street2MaxLength;
  401. return $this->txtStreet2;
  402. }
  403. /**
  404. * Create and setup QLabel lblStreet2
  405. * @param string $strControlId optional ControlId to use
  406. * @return QLabel
  407. */
  408. public function lblStreet2_Create($strControlId = null) {
  409. $this->lblStreet2 = new QLabel($this->objParentObject, $strControlId);
  410. $this->lblStreet2->Name = QApplication::Translate('Street 2');
  411. $this->lblStreet2->Text = $this->objOrderAddress->Street2;
  412. return $this->lblStreet2;
  413. }
  414. /**
  415. * Create and setup QTextBox txtSuburb
  416. * @param string $strControlId optional ControlId to use
  417. * @return QTextBox
  418. */
  419. public function txtSuburb_Create($strControlId = null) {
  420. $this->txtSuburb = new QTextBox($this->objParentObject, $strControlId);
  421. $this->txtSuburb->Name = QApplication::Translate('Suburb');
  422. $this->txtSuburb->Text = $this->objOrderAddress->Suburb;
  423. $this->txtSuburb->MaxLength = OrderAddress::SuburbMaxLength;
  424. return $this->txtSuburb;
  425. }
  426. /**
  427. * Create and setup QLabel lblSuburb
  428. * @param string $strControlId optional ControlId to use
  429. * @return QLabel
  430. */
  431. public function lblSuburb_Create($strControlId = null) {
  432. $this->lblSuburb = new QLabel($this->objParentObject, $strControlId);
  433. $this->lblSuburb->Name = QApplication::Translate('Suburb');
  434. $this->lblSuburb->Text = $this->objOrderAddress->Suburb;
  435. return $this->lblSuburb;
  436. }
  437. /**
  438. * Create and setup QTextBox txtCity
  439. * @param string $strControlId optional ControlId to use
  440. * @return QTextBox
  441. */
  442. public function txtCity_Create($strControlId = null) {
  443. $this->txtCity = new QTextBox($this->objParentObject, $strControlId);
  444. $this->txtCity->Name = QApplication::Translate('City');
  445. $this->txtCity->Text = $this->objOrderAddress->City;
  446. $this->txtCity->MaxLength = OrderAddress::CityMaxLength;
  447. return $this->txtCity;
  448. }
  449. /**
  450. * Create and setup QLabel lblCity
  451. * @param string $strControlId optional ControlId to use
  452. * @return QLabel
  453. */
  454. public function lblCity_Create($strControlId = null) {
  455. $this->lblCity = new QLabel($this->objParentObject, $strControlId);
  456. $this->lblCity->Name = QApplication::Translate('City');
  457. $this->lblCity->Text = $this->objOrderAddress->City;
  458. return $this->lblCity;
  459. }
  460. /**
  461. * Create and setup QTextBox txtCounty
  462. * @param string $strControlId optional ControlId to use
  463. * @return QTextBox
  464. */
  465. public function txtCounty_Create($strControlId = null) {
  466. $this->txtCounty = new QTextBox($this->objParentObject, $strControlId);
  467. $this->txtCounty->Name = QApplication::Translate('County');
  468. $this->txtCounty->Text = $this->objOrderAddress->County;
  469. $this->txtCounty->MaxLength = OrderAddress::CountyMaxLength;
  470. return $this->txtCounty;
  471. }
  472. /**
  473. * Create and setup QLabel lblCounty
  474. * @param string $strControlId optional ControlId to use
  475. * @return QLabel
  476. */
  477. public function lblCounty_Create($strControlId = null) {
  478. $this->lblCounty = new QLabel($this->objParentObject, $strControlId);
  479. $this->lblCounty->Name = QApplication::Translate('County');
  480. $this->lblCounty->Text = $this->objOrderAddress->County;
  481. return $this->lblCounty;
  482. }
  483. /**
  484. * Create and setup QListBox lstZone
  485. * @param string $strControlId optional ControlId to use
  486. * @return QListBox
  487. */
  488. public function lstZone_Create($strControlId = null) {
  489. $this->lstZone = new QListBox($this->objParentObject, $strControlId);
  490. $this->lstZone->Name = QApplication::Translate('Zone');
  491. $this->lstZone->Required = true;
  492. foreach (ZoneType::$NameArray as $intId => $strValue)
  493. $this->lstZone->AddItem(new QListItem($strValue, $intId, $this->objOrderAddress->ZoneId == $intId));
  494. return $this->lstZone;
  495. }
  496. /**
  497. * Create and setup QLabel lblZoneId
  498. * @param string $strControlId optional ControlId to use
  499. * @return QLabel
  500. */
  501. public function lblZoneId_Create($strControlId = null) {
  502. $this->lblZoneId = new QLabel($this->objParentObject, $strControlId);
  503. $this->lblZoneId->Name = QApplication::Translate('Zone');
  504. $this->lblZoneId->Text = ($this->objOrderAddress->ZoneId) ? ZoneType::$NameArray[$this->objOrderAddress->ZoneId] : null;
  505. $this->lblZoneId->Required = true;
  506. return $this->lblZoneId;
  507. }
  508. /**
  509. * Create and setup QListBox lstCountry
  510. * @param string $strControlId optional ControlId to use
  511. * @return QListBox
  512. */
  513. public function lstCountry_Create($strControlId = null) {
  514. $this->lstCountry = new QListBox($this->objParentObject, $strControlId);
  515. $this->lstCountry->Name = QApplication::Translate('Country');
  516. $this->lstCountry->Required = true;
  517. foreach (CountryType::$NameArray as $intId => $strValue)
  518. $this->lstCountry->AddItem(new QListItem($strValue, $intId, $this->objOrderAddress->CountryId == $intId));
  519. return $this->lstCountry;
  520. }
  521. /**
  522. * Create and setup QLabel lblCountryId
  523. * @param string $strControlId optional ControlId to use
  524. * @return QLabel
  525. */
  526. public function lblCountryId_Create($strControlId = null) {
  527. $this->lblCountryId = new QLabel($this->objParentObject, $strControlId);
  528. $this->lblCountryId->Name = QApplication::Translate('Country');
  529. $this->lblCountryId->Text = ($this->objOrderAddress->CountryId) ? CountryType::$NameArray[$this->objOrderAddress->CountryId] : null;
  530. $this->lblCountryId->Required = true;
  531. return $this->lblCountryId;
  532. }
  533. /**
  534. * Create and setup QTextBox txtPostalCode
  535. * @param string $strControlId optional ControlId to use
  536. * @return QTextBox
  537. */
  538. public function txtPostalCode_Create($strControlId = null) {
  539. $this->txtPostalCode = new QTextBox($this->objParentObject, $strControlId);
  540. $this->txtPostalCode->Name = QApplication::Translate('Postal Code');
  541. $this->txtPostalCode->Text = $this->objOrderAddress->PostalCode;
  542. $this->txtPostalCode->MaxLength = OrderAddress::PostalCodeMaxLength;
  543. return $this->txtPostalCode;
  544. }
  545. /**
  546. * Create and setup QLabel lblPostalCode
  547. * @param string $strControlId optional ControlId to use
  548. * @return QLabel
  549. */
  550. public function lblPostalCode_Create($strControlId = null) {
  551. $this->lblPostalCode = new QLabel($this->objParentObject, $strControlId);
  552. $this->lblPostalCode->Name = QApplication::Translate('Postal Code');
  553. $this->lblPostalCode->Text = $this->objOrderAddress->PostalCode;
  554. return $this->lblPostalCode;
  555. }
  556. /**
  557. * Create and setup QListBox lstType
  558. * @param string $strControlId optional ControlId to use
  559. * @return QListBox
  560. */
  561. public function lstType_Create($strControlId = null) {
  562. $this->lstType = new QListBox($this->objParentObject, $strControlId);
  563. $this->lstType->Name = QApplication::Translate('Type');
  564. $this->lstType->Required = true;
  565. foreach (OrderAddressType::$NameArray as $intId => $strValue)
  566. $this->lstType->AddItem(new QListItem($strValue, $intId, $this->objOrderAddress->TypeId == $intId));
  567. return $this->lstType;
  568. }
  569. /**
  570. * Create and setup QLabel lblTypeId
  571. * @param string $strControlId optional ControlId to use
  572. * @return QLabel
  573. */
  574. public function lblTypeId_Create($strControlId = null) {
  575. $this->lblTypeId = new QLabel($this->objParentObject, $strControlId);
  576. $this->lblTypeId->Name = QApplication::Translate('Type');
  577. $this->lblTypeId->Text = ($this->objOrderAddress->TypeId) ? OrderAddressType::$NameArray[$this->objOrderAddress->TypeId] : null;
  578. $this->lblTypeId->Required = true;
  579. return $this->lblTypeId;
  580. }
  581. /**
  582. * Create and setup QLabel lblCreationDate
  583. * @param string $strControlId optional ControlId to use
  584. * @return QLabel
  585. */
  586. public function lblCreationDate_Create($strControlId = null) {
  587. $this->lblCreationDate = new QLabel($this->objParentObject, $strControlId);
  588. $this->lblCreationDate->Name = QApplication::Translate('Creation Date');
  589. if ($this->blnEditMode)
  590. $this->lblCreationDate->Text = $this->objOrderAddress->CreationDate;
  591. else
  592. $this->lblCreationDate->Text = 'N/A';
  593. return $this->lblCreationDate;
  594. }
  595. /**
  596. * Create and setup QLabel lblLastModification
  597. * @param string $strControlId optional ControlId to use
  598. * @return QLabel
  599. */
  600. public function lblLastModification_Create($strControlId = null) {
  601. $this->lblLastModification = new QLabel($this->objParentObject, $strControlId);
  602. $this->lblLastModification->Name = QApplication::Translate('Last Modification');
  603. if ($this->blnEditMode)
  604. $this->lblLastModification->Text = $this->objOrderAddress->LastModification;
  605. else
  606. $this->lblLastModification->Text = 'N/A';
  607. return $this->lblLastModification;
  608. }
  609. /**
  610. * Refresh this MetaControl with Data from the local OrderAddress object.
  611. * @param boolean $blnReload reload OrderAddress from the database
  612. * @return void
  613. */
  614. public function Refresh($blnReload = false) {
  615. if ($blnReload)
  616. $this->objOrderAddress->Reload();
  617. if ($this->lblId) if ($this->blnEditMode) $this->lblId->Text = $this->objOrderAddress->Id;
  618. if ($this->lstOrder) {
  619. $this->lstOrder->RemoveAllItems();
  620. if (!$this->blnEditMode)
  621. $this->lstOrder->AddItem(QApplication::Translate('- Select One -'), null);
  622. $objOrderArray = Order::LoadAll();
  623. if ($objOrderArray) foreach ($objOrderArray as $objOrder) {
  624. $objListItem = new QListItem($objOrder->__toString(), $objOrder->Id);
  625. if (($this->objOrderAddress->Order) && ($this->objOrderAddress->Order->Id == $objOrder->Id))
  626. $objListItem->Selected = true;
  627. $this->lstOrder->AddItem($objListItem);
  628. }
  629. }
  630. if ($this->lblOrderId) $this->lblOrderId->Text = ($this->objOrderAddress->Order) ? $this->objOrderAddress->Order->__toString() : null;
  631. if ($this->txtNamePrefix) $this->txtNamePrefix->Text = $this->objOrderAddress->NamePrefix;
  632. if ($this->lblNamePrefix) $this->lblNamePrefix->Text = $this->objOrderAddress->NamePrefix;
  633. if ($this->txtFirstName) $this->txtFirstName->Text = $this->objOrderAddress->FirstName;
  634. if ($this->lblFirstName) $this->lblFirstName->Text = $this->objOrderAddress->FirstName;
  635. if ($this->txtMiddleName) $this->txtMiddleName->Text = $this->objOrderAddress->MiddleName;
  636. if ($this->lblMiddleName) $this->lblMiddleName->Text = $this->objOrderAddress->MiddleName;
  637. if ($this->txtLastName) $this->txtLastName->Text = $this->objOrderAddress->LastName;
  638. if ($this->lblLastName) $this->lblLastName->Text = $this->objOrderAddress->LastName;
  639. if ($this->txtNameSuffix) $this->txtNameSuffix->Text = $this->objOrderAddress->NameSuffix;
  640. if ($this->lblNameSuffix) $this->lblNameSuffix->Text = $this->objOrderAddress->NameSuffix;
  641. if ($this->txtCompany) $this->txtCompany->Text = $this->objOrderAddress->Company;
  642. if ($this->lblCompany) $this->lblCompany->Text = $this->objOrderAddress->Company;
  643. if ($this->txtStreet1) $this->txtStreet1->Text = $this->objOrderAddress->Street1;
  644. if ($this->lblStreet1) $this->lblStreet1->Text = $this->objOrderAddress->Street1;
  645. if ($this->txtStreet2) $this->txtStreet2->Text = $this->objOrderAddress->Street2;
  646. if ($this->lblStreet2) $this->lblStreet2->Text = $this->objOrderAddress->Street2;
  647. if ($this->txtSuburb) $this->txtSuburb->Text = $this->objOrderAddress->Suburb;
  648. if ($this->lblSuburb) $this->lblSuburb->Text = $this->objOrderAddress->Suburb;
  649. if ($this->txtCity) $this->txtCity->Text = $this->objOrderAddress->City;
  650. if ($this->lblCity) $this->lblCity->Text = $this->objOrderAddress->City;
  651. if ($this->txtCounty) $this->txtCounty->Text = $this->objOrderAddress->County;
  652. if ($this->lblCounty) $this->lblCounty->Text = $this->objOrderAddress->County;
  653. if ($this->lstZone) $this->lstZone->SelectedValue = $this->objOrderAddress->ZoneId;
  654. if ($this->lblZoneId) $this->lblZoneId->Text = ($this->objOrderAddress->ZoneId) ? ZoneType::$NameArray[$this->objOrderAddress->ZoneId] : null;
  655. if ($this->lstCountry) $this->lstCountry->SelectedValue = $this->objOrderAddress->CountryId;
  656. if ($this->lblCountryId) $this->lblCountryId->Text = ($this->objOrderAddress->CountryId) ? CountryType::$NameArray[$this->objOrderAddress->CountryId] : null;
  657. if ($this->txtPostalCode) $this->txtPostalCode->Text = $this->objOrderAddress->PostalCode;
  658. if ($this->lblPostalCode) $this->lblPostalCode->Text = $this->objOrderAddress->PostalCode;
  659. if ($this->lstType) $this->lstType->SelectedValue = $this->objOrderAddress->TypeId;
  660. if ($this->lblTypeId) $this->lblTypeId->Text = ($this->objOrderAddress->TypeId) ? OrderAddressType::$NameArray[$this->objOrderAddress->TypeId] : null;
  661. if ($this->lblCreationDate) if ($this->blnEditMode) $this->lblCreationDate->Text = $this->objOrderAddress->CreationDate;
  662. if ($this->lblLastModification) if ($this->blnEditMode) $this->lblLastModification->Text = $this->objOrderAddress->LastModification;
  663. }
  664. ///////////////////////////////////////////////
  665. // PROTECTED UPDATE METHODS for ManyToManyReferences (if any)
  666. ///////////////////////////////////////////////
  667. ///////////////////////////////////////////////
  668. // PUBLIC ORDERADDRESS OBJECT MANIPULATORS
  669. ///////////////////////////////////////////////
  670. /**
  671. * This will save this object's OrderAddress instance,
  672. * updating only the fields which have had a control created for it.
  673. */
  674. public function SaveOrderAddress() {
  675. try {
  676. // Update any fields for controls that have been created
  677. if ($this->lstOrder) $this->objOrderAddress->OrderId = $this->lstOrder->SelectedValue;
  678. if ($this->txtNamePrefix) $this->objOrderAddress->NamePrefix = $this->txtNamePrefix->Text;
  679. if ($this->txtFirstName) $this->objOrderAddress->FirstName = $this->txtFirstName->Text;
  680. if ($this->txtMiddleName) $this->objOrderAddress->MiddleName = $this->txtMiddleName->Text;
  681. if ($this->txtLastName) $this->objOrderAddress->LastName = $this->txtLastName->Text;
  682. if ($this->txtNameSuffix) $this->objOrderAddress->NameSuffix = $this->txtNameSuffix->Text;
  683. if ($this->txtCompany) $this->objOrderAddress->Company = $this->txtCompany->Text;
  684. if ($this->txtStreet1) $this->objOrderAddress->Street1 = $this->txtStreet1->Text;
  685. if ($this->txtStreet2) $this->objOrderAddress->Street2 = $this->txtStreet2->Text;
  686. if ($this->txtSuburb) $this->objOrderAddress->Suburb = $this->txtSuburb->Text;
  687. if ($this->txtCity) $this->objOrderAddress->City = $this->txtCity->Text;
  688. if ($this->txtCounty) $this->objOrderAddress->County = $this->txtCounty->Text;
  689. if ($this->lstZone) $this->objOrderAddress->ZoneId = $this->lstZone->SelectedValue;
  690. if ($this->lstCountry) $this->objOrderAddress->CountryId = $this->lstCountry->SelectedValue;
  691. if ($this->txtPostalCode) $this->objOrderAddress->PostalCode = $this->txtPostalCode->Text;
  692. if ($this->lstType) $this->objOrderAddress->TypeId = $this->lstType->SelectedValue;
  693. // Update any UniqueReverseReferences (if any) for controls that have been created for it
  694. // Save the OrderAddress object
  695. $this->objOrderAddress->Save();
  696. // Finally, update any ManyToManyReferences (if any)
  697. } catch (QCallerException $objExc) {
  698. $objExc->IncrementOffset();
  699. throw $objExc;
  700. }
  701. }
  702. /**
  703. * This will DELETE this object's OrderAddress instance from the database.
  704. * It will also unassociate itself from any ManyToManyReferences.
  705. */
  706. public function DeleteOrderAddress() {
  707. $this->objOrderAddress->Delete();
  708. }
  709. ///////////////////////////////////////////////
  710. // PUBLIC GETTERS and SETTERS
  711. ///////////////////////////////////////////////
  712. /**
  713. * Override method to perform a property "Get"
  714. * This will get the value of $strName
  715. *
  716. * @param string $strName Name of the property to get
  717. * @return mixed
  718. */
  719. public function __get($strName) {
  720. switch ($strName) {
  721. // General MetaControlVariables
  722. case 'OrderAddress': return $this->objOrderAddress;
  723. case 'TitleVerb': return $this->strTitleVerb;
  724. case 'EditMode': return $this->blnEditMode;
  725. // Controls that point to OrderAddress fields -- will be created dynamically if not yet created
  726. case 'IdControl':
  727. if (!$this->lblId) return $this->lblId_Create();
  728. return $this->lblId;
  729. case 'IdLabel':
  730. if (!$this->lblId) return $this->lblId_Create();
  731. return $this->lblId;
  732. case 'OrderIdControl':
  733. if (!$this->lstOrder) return $this->lstOrder_Create();
  734. return $this->lstOrder;
  735. case 'OrderIdLabel':
  736. if (!$this->lblOrderId) return $this->lblOrderId_Create();
  737. return $this->lblOrderId;
  738. case 'NamePrefixControl':
  739. if (!$this->txtNamePrefix) return $this->txtNamePrefix_Create();
  740. return $this->txtNamePrefix;
  741. case 'NamePrefixLabel':
  742. if (!$this->lblNamePrefix) return $this->lblNamePrefix_Create();
  743. return $this->lblNamePrefix;
  744. case 'FirstNameControl':
  745. if (!$this->txtFirstName) return $this->txtFirstName_Create();
  746. return $this->txtFirstName;
  747. case 'FirstNameLabel':
  748. if (!$this->lblFirstName) return $this->lblFirstName_Create();
  749. return $this->lblFirstName;
  750. case 'MiddleNameControl':
  751. if (!$this->txtMiddleName) return $this->txtMiddleName_Create();
  752. return $this->txtMiddleName;
  753. case 'MiddleNameLabel':
  754. if (!$this->lblMiddleName) return $this->lblMiddleName_Create();
  755. return $this->lblMiddleName;
  756. case 'LastNameControl':
  757. if (!$this->txtLastName) return $this->txtLastName_Create();
  758. return $this->txtLastName;
  759. case 'LastNameLabel':
  760. if (!$this->lblLastName) return $this->lblLastName_Create();
  761. return $this->lblLastName;
  762. case 'NameSuffixControl':
  763. if (!$this->txtNameSuffix) return $this->txtNameSuffix_Create();
  764. return $this->txtNameSuffix;
  765. case 'NameSuffixLabel':
  766. if (!$this->lblNameSuffix) return $this->lblNameSuffix_Create();
  767. return $this->lblNameSuffix;
  768. case 'CompanyControl':
  769. if (!$this->txtCompany) return $this->txtCompany_Create();
  770. return $this->txtCompany;
  771. case 'CompanyLabel':
  772. if (!$this->lblCompany) return $this->lblCompany_Create();
  773. return $this->lblCompany;
  774. case 'Street1Control':
  775. if (!$this->txtStreet1) return $this->txtStreet1_Create();
  776. return $this->txtStreet1;
  777. case 'Street1Label':
  778. if (!$this->lblStreet1) return $this->lblStreet1_Create();
  779. return $this->lblStreet1;
  780. case 'Street2Control':
  781. if (!$this->txtStreet2) return $this->txtStreet2_Create();
  782. return $this->txtStreet2;
  783. case 'Street2Label':
  784. if (!$this->lblStreet2) return $this->lblStreet2_Create();
  785. return $this->lblStreet2;
  786. case 'SuburbControl':
  787. if (!$this->txtSuburb) return $this->txtSuburb_Create();
  788. return $this->txtSuburb;
  789. case 'SuburbLabel':
  790. if (!$this->lblSuburb) return $this->lblSuburb_Create();
  791. return $this->lblSuburb;
  792. case 'CityControl':
  793. if (!$this->txtCity) return $this->txtCity_Create();
  794. return $this->txtCity;
  795. case 'CityLabel':
  796. if (!$this->lblCity) return $this->lblCity_Create();
  797. return $this->lblCity;
  798. case 'CountyControl':
  799. if (!$this->txtCounty) return $this->txtCounty_Create();
  800. return $this->txtCounty;
  801. case 'CountyLabel':
  802. if (!$this->lblCounty) return $this->lblCounty_Create();
  803. return $this->lblCounty;
  804. case 'ZoneIdControl':
  805. if (!$this->lstZone) return $this->lstZone_Create();
  806. return $this->lstZone;
  807. case 'ZoneIdLabel':
  808. if (!$this->lblZoneId) return $this->lblZoneId_Create();
  809. return $this->lblZoneId;
  810. case 'CountryIdControl':
  811. if (!$this->lstCountry) return $this->lstCountry_Create();
  812. return $this->lstCountry;
  813. case 'CountryIdLabel':
  814. if (!$this->lblCountryId) return $this->lblCountryId_Create();
  815. return $this->lblCountryId;
  816. case 'PostalCodeControl':
  817. if (!$this->txtPostalCode) return $this->txtPostalCode_Create();
  818. return $this->txtPostalCode;
  819. case 'PostalCodeLabel':
  820. if (!$this->lblPostalCode) return $this->lblPostalCode_Create();
  821. return $this->lblPostalCode;
  822. case 'TypeIdControl':
  823. if (!$this->lstType) return $this->lstType_Create();
  824. return $this->lstType;
  825. case 'TypeIdLabel':
  826. if (!$this->lblTypeId) return $this->lblTypeId_Create();
  827. return $this->lblTypeId;
  828. case 'CreationDateControl':
  829. if (!$this->lblCreationDate) return $this->lblCreationDate_Create();
  830. return $this->lblCreationDate;
  831. case 'CreationDateLabel':
  832. if (!$this->lblCreationDate) return $this->lblCreationDate_Create();
  833. return $this->lblCreationDate;
  834. case 'LastModificationControl':
  835. if (!$this->lblLastModification) return $this->lblLastModification_Create();
  836. return $this->lblLastModification;
  837. case 'LastModificationLabel':
  838. if (!$this->lblLastModification) return $this->lblLastModification_Create();
  839. return $this->lblLastModification;
  840. default:
  841. try {
  842. return parent::__get($strName);
  843. } catch (QCallerException $objExc) {
  844. $objExc->IncrementOffset();
  845. throw $objExc;
  846. }
  847. }
  848. }
  849. /**
  850. * Override method to perform a property "Set"
  851. * This will set the property $strName to be $mixValue
  852. *
  853. * @param string $strName Name of the property to set
  854. * @param string $mixValue New value of the property
  855. * @return mixed
  856. */
  857. public function __set($strName, $mixValue) {
  858. try {
  859. switch ($strName) {
  860. // Controls that point to OrderAddress fields
  861. case 'IdControl':
  862. return ($this->lblId = QType::Cast($mixValue, 'QControl'));
  863. case 'OrderIdControl':
  864. return ($this->lstOrder = QType::Cast($mixValue, 'QControl'));
  865. case 'NamePrefixControl':
  866. return ($this->txtNamePrefix = QType::Cast($mixValue, 'QControl'));
  867. case 'FirstNameControl':
  868. return ($this->txtFirstName = QType::Cast($mixValue, 'QControl'));
  869. case 'MiddleNameControl':
  870. return ($this->txtMiddleName = QType::Cast($mixValue, 'QControl'));
  871. case 'LastNameControl':
  872. return ($this->txtLastName = QType::Cast($mixValue, 'QControl'));
  873. case 'NameSuffixControl':
  874. return ($this->txtNameSuffix = QType::Cast($mixValue, 'QControl'));
  875. case 'CompanyControl':
  876. return ($this->txtCompany = QType::Cast($mixValue, 'QControl'));
  877. case 'Street1Control':
  878. return ($this->txtStreet1 = QType::Cast($mixValue, 'QControl'));
  879. case 'Street2Control':
  880. return ($this->txtStreet2 = QType::Cast($mixValue, 'QControl'));
  881. case 'SuburbControl':
  882. return ($this->txtSuburb = QType::Cast($mixValue, 'QControl'));
  883. case 'CityControl':
  884. return ($this->txtCity = QType::Cast($mixValue, 'QControl'));
  885. case 'CountyControl':
  886. return ($this->txtCounty = QType::Cast($mixValue, 'QControl'));
  887. case 'ZoneIdControl':
  888. return ($this->lstZone = QType::Cast($mixValue, 'QControl'));
  889. case 'CountryIdControl':
  890. return ($this->lstCountry = QType::Cast($mixValue, 'QControl'));
  891. case 'PostalCodeControl':
  892. return ($this->txtPostalCode = QType::Cast($mixValue, 'QControl'));
  893. case 'TypeIdControl':
  894. return ($this->lstType = QType::Cast($mixValue, 'QControl'));
  895. case 'CreationDateControl':
  896. return ($this->lblCreationDate = QType::Cast($mixValue, 'QControl'));
  897. case 'LastModificationControl':
  898. return ($this->lblLastModification = QType::Cast($mixValue, 'QControl'));
  899. default:
  900. return parent::__set($strName, $mixValue);
  901. }
  902. } catch (QCallerException $objExc) {
  903. $objExc->IncrementOffset();
  904. throw $objExc;
  905. }
  906. }
  907. }
  908. ?>