Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 21 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| tao_actions_form_List | |
0.00% |
0 / 21 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| initForm | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |||
| initElements | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2008-2010 (original work) Deutsche Institut für Internationale Pädagogische Forschung |
| 19 | * (under the project TAO-TRANSFER); |
| 20 | * 2009-2012 (update and modification) Public Research Centre Henri Tudor |
| 21 | * (under the project TAO-SUSTAIN & TAO-DEV); |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | /** |
| 26 | * This container initialize the list form. |
| 27 | * |
| 28 | * @access public |
| 29 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> |
| 30 | * @package tao |
| 31 | |
| 32 | */ |
| 33 | class tao_actions_form_List extends tao_helpers_form_FormContainer |
| 34 | { |
| 35 | // --- ASSOCIATIONS --- |
| 36 | |
| 37 | |
| 38 | // --- ATTRIBUTES --- |
| 39 | |
| 40 | // --- OPERATIONS --- |
| 41 | |
| 42 | /** |
| 43 | * Short description of method initForm |
| 44 | * |
| 45 | * @access public |
| 46 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> |
| 47 | * @return mixed |
| 48 | */ |
| 49 | public function initForm() |
| 50 | { |
| 51 | |
| 52 | |
| 53 | $this->form = tao_helpers_form_FormFactory::getForm('list'); |
| 54 | |
| 55 | $addElt = tao_helpers_form_FormFactory::getElement('add', 'Free'); |
| 56 | |
| 57 | $addElt->setValue( |
| 58 | '<a href="#" class="form-submitter btn-success small"><span class="icon-add"></span> ' |
| 59 | . __('Add') . '</a>' |
| 60 | ); |
| 61 | $this->form->setActions([$addElt], 'bottom'); |
| 62 | $this->form->setActions([], 'top'); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Short description of method initElements |
| 67 | * |
| 68 | * @access public |
| 69 | * @author Bertrand Chevrier, <bertrand.chevrier@tudor.lu> |
| 70 | * @return mixed |
| 71 | */ |
| 72 | public function initElements() |
| 73 | { |
| 74 | |
| 75 | |
| 76 | $labelElt = tao_helpers_form_FormFactory::getElement('label', 'Textbox'); |
| 77 | $labelElt->setDescription(__('Name')); |
| 78 | $labelElt->addValidator(tao_helpers_form_FormFactory::getValidator('NotEmpty')); |
| 79 | $this->form->addElement($labelElt); |
| 80 | |
| 81 | $sizeElt = tao_helpers_form_FormFactory::getElement('size', 'Textbox'); |
| 82 | $sizeElt->setDescription(__('Number of elements')); |
| 83 | $sizeElt->setAttribute('size', '4'); |
| 84 | $sizeElt->setValue(1); |
| 85 | $sizeElt->addValidators([ |
| 86 | tao_helpers_form_FormFactory::getValidator('NotEmpty'), |
| 87 | tao_helpers_form_FormFactory::getValidator('Integer', ['min' => 1]) |
| 88 | ]); |
| 89 | $this->form->addElement($sizeElt); |
| 90 | } |
| 91 | } |