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.

42 lines
2.1 KiB

  1. /**
  2. * Create and setup QDateTimePicker <%= $strControlId %>
  3. * @param string $strControlId optional ControlId to use
  4. * @return QDateTimePicker
  5. */
  6. public function <%= $strControlId %>_Create($strControlId = null) {
  7. $this-><%= $strControlId %> = new QDateTimePicker($this->objParentObject, $strControlId);
  8. $this-><%= $strControlId %>->Name = QApplication::Translate('<%= QConvertNotation::WordsFromCamelCase($objColumn->PropertyName) %>');
  9. $this-><%= $strControlId %>->DateTime = $this-><%= $strObjectName %>-><%= $objColumn->PropertyName %>;
  10. $this-><%= $strControlId %>->DateTimePickerType = QDateTimePickerType::<%
  11. switch ($objColumn->DbType) {
  12. case QDatabaseFieldType::DateTime:
  13. return 'DateTime';
  14. case QDatabaseFieldType::Time:
  15. return 'Time';
  16. default:
  17. return 'Date';
  18. }
  19. %>;
  20. <% if ($objColumn->NotNull) { %>
  21. $this-><%=$strControlId %>->Required = true;
  22. <% } %>
  23. return $this-><%= $strControlId %>;
  24. }
  25. /**
  26. * Create and setup QLabel <%= $strLabelId %>
  27. * @param string $strControlId optional ControlId to use
  28. * @param string $strDateTimeFormat optional DateTimeFormat to use
  29. * @return QLabel
  30. */
  31. public function <%= $strLabelId %>_Create($strControlId = null, $strDateTimeFormat = null) {
  32. $this-><%= $strLabelId %> = new QLabel($this->objParentObject, $strControlId);
  33. $this-><%= $strLabelId %>->Name = QApplication::Translate('<%= QConvertNotation::WordsFromCamelCase($objColumn->PropertyName) %>');
  34. $this->str<%= $objColumn->PropertyName %>DateTimeFormat = $strDateTimeFormat;
  35. $this-><%= $strLabelId %>->Text = $this-><%= $strObjectName %>-><%= $objColumn->PropertyName %>->__toString($strDateTimeFormat);
  36. <% if ($objColumn->NotNull) { %>
  37. $this-><%=$strLabelId %>->Required = true;
  38. <% } %>
  39. return $this-><%= $strLabelId %>;
  40. }
  41. protected $str<%= $objColumn->PropertyName %>DateTimeFormat;