Beispiel #1
0
 /**
  * Render date column type
  *
  * @param \Engine\Crud\Grid\Column $column
  * @return string
  */
 public static function _date(Column\Date $column)
 {
     $columnCode = [];
     $columnCode[] = "text: '" . $column->getTitle() . "'";
     $columnCode[] = "dataIndex: '" . $column->getKey() . "'";
     $columnCode[] = "width: " . $column->getWidth();
     if ($column->isSortable()) {
         $columnCode[] = "sortable: true";
     }
     if ($column->isHidden()) {
         $columnCode[] = "hidden: true";
     }
     if ($column->isEditable()) {
         $field = $column->getField();
         $format = $field->getFormat();
         $minValue = $field->getMinValue();
         $maxValue = $field->getMaxValue();
         $disabledDays = false;
         $disabledDaysText = false;
         $fieldCode = "field: {\n                    xtype: 'datefield',\n                    ";
         $fieldCode .= "format: '" . $format . "'";
         if ($minValue !== null && $minValue !== false) {
             $fieldCode .= ",\n                    minValue: '" . $minValue . "'";
         }
         if ($maxValue !== null && $maxValue !== false) {
             $fieldCode .= ",\n                    maxValue: '" . $maxValue . "' ";
         }
         if ($disabledDays !== null && $disabledDays !== false) {
             $fieldCode .= ",\n                    disabledDays: '" . $disabledDays . "'";
         }
         if ($disabledDaysText !== null && $disabledDaysText !== false) {
             $fieldCode .= ",\n                    disabledDaysText: '" . $disabledDaysText . "' ";
         }
         $fieldCode .= "\n                }";
         $columnCode[] = $fieldCode;
     }
     return forward_static_call(['static', '_implode'], $columnCode);
 }