| @@ 653-674 (lines=22) @@ | ||
| 650 | * @param string $form Form name |
|
| 651 | * @return array |
|
| 652 | */ |
|
| 653 | public function FormGet ($form) { |
|
| 654 | $s_form = 'Form' . StrUnderline2Ucfirst($form, true) . 'Def'; |
|
| 655 | ||
| 656 | // If define method missing, return empty array |
|
| 657 | if (false == method_exists($this, $s_form)) |
|
| 658 | return array(); |
|
| 659 | ||
| 660 | // Do data convert |
|
| 661 | ||
| 662 | $ar_conf = $this->{$s_form}(); |
|
| 663 | // Let key is id from form |
|
| 664 | $ar_conf = array_flip($ar_conf); |
|
| 665 | ||
| 666 | $ar = array(); |
|
| 667 | if (!empty($ar_conf)) { |
|
| 668 | foreach ($ar_conf as $k_form => $k_db) { |
|
| 669 | $ar[$k_db] = GetPost($k_form); |
|
| 670 | } |
|
| 671 | } |
|
| 672 | ||
| 673 | return $ar; |
|
| 674 | } // end of func FormGet |
|
| 675 | ||
| 676 | ||
| 677 | /** |
|
| @@ 685-705 (lines=21) @@ | ||
| 682 | * @return array Can use in Form::AddElementValue() |
|
| 683 | * @see Form::AddElementValue() |
|
| 684 | */ |
|
| 685 | public function FormSet ($form) { |
|
| 686 | $s_form = 'Form' . StrUnderline2Ucfirst($form, true) . 'Def'; |
|
| 687 | ||
| 688 | // If define method missing, return empty array |
|
| 689 | if (false == method_exists($this, $s_form)) |
|
| 690 | return array(); |
|
| 691 | ||
| 692 | // Do data convert |
|
| 693 | ||
| 694 | // Key is id from db |
|
| 695 | $ar_conf = $this->{$s_form}(); |
|
| 696 | ||
| 697 | $ar = array(); |
|
| 698 | if (!empty($ar_conf)) { |
|
| 699 | foreach ($ar_conf as $k_db => $k_form) { |
|
| 700 | $ar[$k_form] = HtmlEncode($k_db); |
|
| 701 | } |
|
| 702 | } |
|
| 703 | ||
| 704 | return $ar; |
|
| 705 | } // end of func FormSet |
|
| 706 | ||
| 707 | ||
| 708 | /** |
|