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($objManyToManyReference->ObjectDescriptionPlural) %>');
  9. $this-><%=$strControlId %>->SelectionMode = QSelectionMode::Multiple;
  10. $objAssociatedArray = $this-><%= $strObjectName %>->Get<%= $objManyToManyReference->ObjectDescription; %>Array();
  11. $<%= $objManyToManyReference->VariableName %>Array = <%= $objManyToManyReference->VariableType %>::LoadAll();
  12. if ($<%= $objManyToManyReference->VariableName %>Array) foreach ($<%= $objManyToManyReference->VariableName %>Array as $<%= $objManyToManyReference->VariableName %>) {
  13. $objListItem = new QListItem($<%= $objManyToManyReference->VariableName %>->__toString(), $<%= $objManyToManyReference->VariableName %>-><%= $objCodeGen->GetTable($objManyToManyReference->AssociatedTable)->PrimaryKeyColumnArray[0]->PropertyName %>);
  14. foreach ($objAssociatedArray as $objAssociated) {
  15. if ($objAssociated-><%= $objCodeGen->GetTable($objManyToManyReference->AssociatedTable)->PrimaryKeyColumnArray[0]->PropertyName %> == $<%= $objManyToManyReference->VariableName %>-><%= $objCodeGen->GetTable($objManyToManyReference->AssociatedTable)->PrimaryKeyColumnArray[0]->PropertyName %>)
  16. $objListItem->Selected = true;
  17. }
  18. $this-><%=$strControlId %>->AddItem($objListItem);
  19. }
  20. return $this-><%= $strControlId %>;
  21. }
  22. /**
  23. * Create and setup QLabel <%= $strLabelId %>
  24. * @param string $strControlId optional ControlId to use
  25. * @param string $strGlue glue to display in between each associated object
  26. * @return QLabel
  27. */
  28. public function <%= $strLabelId %>_Create($strControlId = null, $strGlue = ', ') {
  29. $this-><%= $strLabelId %> = new QLabel($this->objParentObject, $strControlId);
  30. $this-><%= $strLabelId %>->Name = QApplication::Translate('<%= QConvertNotation::WordsFromCamelCase($objManyToManyReference->ObjectDescriptionPlural) %>');
  31. $objAssociatedArray = $this-><%= $strObjectName %>->Get<%= $objManyToManyReference->ObjectDescription; %>Array();
  32. $strItems = array();
  33. foreach ($objAssociatedArray as $objAssociated)
  34. $strItems[] = $objAssociated->__toString();
  35. $this-><%= $strLabelId %>->Text = implode($strGlue, $strItems);
  36. return $this-><%= $strLabelId %>;
  37. }