@@ 645-669 (lines=25) @@ | ||
642 | * @param string $placeholder Default text to show if box is empty |
|
643 | * @param unknown $attributes Additional attributes |
|
644 | */ |
|
645 | public function addNumber($label = '', $name = '', $value = '', $range = false, $required = false, $min = '', $max = '', $step = '', $placeholder = '', $attributes = array()) { |
|
646 | // Creating main data |
|
647 | $data = array( |
|
648 | 'type' => (! $range) ? 'number' : 'range', |
|
649 | 'name' => $name, |
|
650 | 'value' => $value, |
|
651 | ); |
|
652 | ||
653 | ||
654 | if ($required) $data['required'] = 'required'; |
|
655 | if ($min) $data['min'] = $min; |
|
656 | if ($max) $data['max'] = $max; |
|
657 | if ($step) $data['step'] = $step; |
|
658 | if ($placeholder != '') $data['placeholder'] = $placeholder; |
|
659 | if (!empty($attributes)) array_merge($data, $attributes); |
|
660 | ||
661 | // Saving data to object |
|
662 | $content = array( |
|
663 | 'type' => 'input', |
|
664 | 'data' => $data |
|
665 | ); |
|
666 | if ($label != '') $content['label'] = $label; |
|
667 | ||
668 | $this->content[] = $content; |
|
669 | } |
|
670 | ||
671 | /** |
|
672 | * @name addDate This function add input "number" with min, max and step (if you like) |
|
@@ 683-706 (lines=24) @@ | ||
680 | * @param string $placeholder Default text to show if box is empty |
|
681 | * @param unknown $attributes Additional attributes |
|
682 | */ |
|
683 | public function addDate($label = '', $name = '', $value = '', $required = false, $min = '', $max = '', $step = '', $placeholder = '', $attributes = array()) { |
|
684 | // Creating main data |
|
685 | $data = array( |
|
686 | 'type' => 'date', |
|
687 | 'name' => $name, |
|
688 | 'value' => $value, |
|
689 | ); |
|
690 | ||
691 | if ($required) $data['required'] = 'required'; |
|
692 | if ($min) $data['min'] = $min; |
|
693 | if ($max) $data['max'] = $max; |
|
694 | if ($step) $data['step'] = $step; |
|
695 | if ($placeholder != '') $data['placeholder'] = $placeholder; |
|
696 | if (!empty($attributes)) array_merge($data, $attributes); |
|
697 | ||
698 | // Saving data to object |
|
699 | $content = array( |
|
700 | 'type' => 'input', |
|
701 | 'data' => $data |
|
702 | ); |
|
703 | if ($label != '') $content['label'] = $label; |
|
704 | ||
705 | $this->content[] = $content; |
|
706 | } |
|
707 | ||
708 | ||
709 | /** |