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.

58 lines
2.9 KiB

  1. <% foreach ($objTable->ColumnArray as $objColumn) { %><%
  2. // Use the "control_create_" subtemplates to generate the code
  3. // required to create/setup the control.
  4. $mixArguments = array(
  5. 'objColumn' => $objColumn,
  6. 'strObjectName' => $objCodeGen->VariableNameFromTable($objTable->Name),
  7. 'strClassName' => $objTable->ClassName,
  8. 'strControlId' => $objCodeGen->FormControlVariableNameForColumn($objColumn),
  9. 'strLabelId' => $objCodeGen->FormLabelVariableNameForColumn($objColumn)
  10. );
  11. // Figure out WHICH "control_create_" to use
  12. if ($objColumn->Identity) {
  13. $strTemplateFilename = 'identity';
  14. } else if ($objColumn->Timestamp) {
  15. $strTemplateFilename = 'identity';
  16. } else if ($objColumn->Reference) {
  17. if ($objColumn->Reference->IsType)
  18. $strTemplateFilename = 'type';
  19. else
  20. $strTemplateFilename = 'reference';
  21. } else {
  22. $strTemplateFilename = $objColumn->VariableType;
  23. }
  24. // Get the subtemplate and evaluate
  25. return $objCodeGen->EvaluateSubTemplate(sprintf('control_create_%s.tpl', $strTemplateFilename), $strModuleName, $mixArguments) . "\n\n";
  26. %><% } %>
  27. <% foreach ($objTable->ReverseReferenceArray as $objReverseReference) { %><%
  28. if ($objReverseReference->Unique) {
  29. // Use the "control_create_" subtemplates to generate the code
  30. // required to create/setup the control.
  31. $mixArguments = array(
  32. 'objReverseReference' => $objReverseReference,
  33. 'objTable' => $objTable,
  34. 'strObjectName' => $objCodeGen->VariableNameFromTable($objTable->Name),
  35. 'strClassName' => $objTable->ClassName,
  36. 'strControlId' => $objCodeGen->FormControlVariableNameForUniqueReverseReference($objReverseReference),
  37. 'strLabelId' => $objCodeGen->FormLabelVariableNameForUniqueReverseReference($objReverseReference)
  38. );
  39. // Get the subtemplate and evaluate
  40. return $objCodeGen->EvaluateSubTemplate('control_create_unique_reversereference.tpl', $strModuleName, $mixArguments) . "\n\n";
  41. } else
  42. return null;
  43. %><% } %>
  44. <% foreach ($objTable->ManyToManyReferenceArray as $objManyToManyReference) { %><%
  45. // Use the "control_create_manytomany_reference" subtemplate to generate the code
  46. // required to create/setup the control.
  47. $mixArguments = array(
  48. 'objManyToManyReference' => $objManyToManyReference,
  49. 'objTable' => $objTable,
  50. 'strObjectName' => $objCodeGen->VariableNameFromTable($objTable->Name),
  51. 'strClassName' => $objTable->ClassName,
  52. 'strControlId' => $objCodeGen->FormControlVariableNameForManyToManyReference($objManyToManyReference),
  53. 'strLabelId' => $objCodeGen->FormLabelVariableNameForManyToManyReference($objManyToManyReference)
  54. );
  55. // Get the subtemplate and evaluate
  56. return $objCodeGen->EvaluateSubTemplate('control_create_manytomany_reference.tpl', $strModuleName, $mixArguments) . "\n\n";
  57. %><% } %>