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.

38 lines
2.8 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($objColumn->Reference->PropertyName) %>');
  9. <% if ($objColumn->NotNull) { %>
  10. $this-><%=$strControlId %>->Required = true;
  11. if (!$this->blnEditMode)
  12. $this-><%=$strControlId %>->AddItem(QApplication::Translate('- Select One -'), null);
  13. <% } %><% if (!$objColumn->NotNull) { %>
  14. $this-><%=$strControlId %>->AddItem(QApplication::Translate('- Select One -'), null);
  15. <% } %>
  16. $<%= $objColumn->Reference->VariableName %>Array = <%= $objColumn->Reference->VariableType %>::LoadAll();
  17. if ($<%= $objColumn->Reference->VariableName %>Array) foreach ($<%= $objColumn->Reference->VariableName %>Array as $<%= $objColumn->Reference->VariableName %>) {
  18. $objListItem = new QListItem($<%= $objColumn->Reference->VariableName %>->__toString(), $<%= $objColumn->Reference->VariableName %>-><%= $objCodeGen->GetTable($objColumn->Reference->Table)->PrimaryKeyColumnArray[0]->PropertyName %>);
  19. if (($this-><%= $strObjectName %>-><%= $objColumn->Reference->PropertyName %>) && ($this-><%= $strObjectName %>-><%= $objColumn->Reference->PropertyName %>-><%= $objCodeGen->GetTable($objColumn->Reference->Table)->PrimaryKeyColumnArray[0]->PropertyName %> == $<%= $objColumn->Reference->VariableName %>-><%= $objCodeGen->GetTable($objColumn->Reference->Table)->PrimaryKeyColumnArray[0]->PropertyName %>))
  20. $objListItem->Selected = true;
  21. $this-><%=$strControlId %>->AddItem($objListItem);
  22. }
  23. return $this-><%= $strControlId %>;
  24. }
  25. /**
  26. * Create and setup QLabel <%= $strLabelId %>
  27. * @param string $strControlId optional ControlId to use
  28. * @return QLabel
  29. */
  30. public function <%= $strLabelId %>_Create($strControlId = null) {
  31. $this-><%= $strLabelId %> = new QLabel($this->objParentObject, $strControlId);
  32. $this-><%= $strLabelId %>->Name = QApplication::Translate('<%= QConvertNotation::WordsFromCamelCase($objColumn->Reference->PropertyName) %>');
  33. $this-><%= $strLabelId %>->Text = ($this-><%= $strObjectName %>-><%= $objColumn->Reference->PropertyName %>) ? $this-><%= $strObjectName %>-><%= $objColumn->Reference->PropertyName %>->__toString() : null;
  34. <% if ($objColumn->NotNull) { %>
  35. $this-><%=$strLabelId %>->Required = true;
  36. <% } %>
  37. return $this-><%= $strLabelId %>;
  38. }