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.

34 lines
2.6 KiB

  1. /**
  2. * Create and setup QListBox <%= $strControlId %>
  3. * @param string $strControlId optional ControlId to use
  4. * @return QListBox
  5. */
  6. public function <%= $strControlId %>_Create($strControlId = null) {
  7. $this-><%= $strControlId %> = new QListBox($this->objParentObject, $strControlId);
  8. $this-><%= $strControlId %>->Name = QApplication::Translate('<%= QConvertNotation::WordsFromCamelCase($objReverseReference->ObjectPropertyName) %>');
  9. $this-><%=$strControlId %>->AddItem(QApplication::Translate('- Select One -'), null);
  10. $<%= $objReverseReference->VariableName %>Array = <%= $objReverseReference->VariableType %>::LoadAll();
  11. if ($<%= $objReverseReference->VariableName %>Array) foreach ($<%= $objReverseReference->VariableName %>Array as $<%= $objReverseReference->VariableName %>) {
  12. $objListItem = new QListItem($<%= $objReverseReference->VariableName %>->__toString(), $<%= $objReverseReference->VariableName %>-><%= $objCodeGen->GetTable($objReverseReference->Table)->PrimaryKeyColumnArray[0]->PropertyName %>);
  13. if ($<%= $objReverseReference->VariableName %>-><%= $objReverseReference->PropertyName %> == $this-><%= $strObjectName %>-><%= $objTable->PrimaryKeyColumnArray[0]->PropertyName %>)
  14. $objListItem->Selected = true;
  15. $this-><%=$strControlId %>->AddItem($objListItem);
  16. }
  17. <% if ($objReverseReference->NotNull) { %>
  18. // Because <%= $objReverseReference->VariableType %>'s <%= $objReverseReference->ObjectPropertyName %> is not null, if a value is already selected, it cannot be changed.
  19. if ($this-><%=$strControlId %>->SelectedValue)
  20. $this-><%=$strControlId %>->Enabled = false;
  21. <% } %>
  22. return $this-><%= $strControlId %>;
  23. }
  24. /**
  25. * Create and setup QLabel <%= $strLabelId %>
  26. * @param string $strControlId optional ControlId to use
  27. * @return QLabel
  28. */
  29. public function <%= $strLabelId %>_Create($strControlId = null) {
  30. $this-><%= $strLabelId %> = new QLabel($this->objParentObject, $strControlId);
  31. $this-><%= $strLabelId %>->Name = QApplication::Translate('<%= QConvertNotation::WordsFromCamelCase($objReverseReference->ObjectPropertyName) %>');
  32. $this-><%= $strLabelId %>->Text = ($this-><%= $strObjectName %>-><%= $objReverseReference->ObjectPropertyName %>) ? $this-><%= $strObjectName %>-><%= $objReverseReference->ObjectPropertyName %>->__toString() : null;
  33. return $this-><%= $strLabelId %>;
  34. }