Added properties to BooleanField for change the showed texts and added NoForm form

This commit is contained in:
Antonio de la Rosa 2015-11-20 02:21:49 +01:00
parent afafa75504
commit 1c88f85a99
2 changed files with 27 additions and 2 deletions

View file

@ -19,12 +19,16 @@ class BooleanField extends PhangoField {
public $quot_close='\''; public $quot_close='\'';
public $std_error=''; public $std_error='';
public $default_value=0; public $default_value=0;
public $text_yes='';
public $text_no='';
function __construct() function __construct()
{ {
$this->size=1; $this->size=1;
$this->form='PhangoApp\PhaModels\Forms\SelectForm'; $this->form='PhangoApp\PhaModels\Forms\SelectForm';
$this->text_no=I18n::lang('common', 'no', 'No');
$this->text_yes=I18n::lang('common', 'yes', 'Yes');
} }
@ -65,13 +69,13 @@ class BooleanField extends PhangoField {
{ {
default: default:
return I18n::lang('common', 'no', 'No'); return $this->text_no;
break; break;
case 1: case 1:
return I18n::lang('common', 'yes', 'Yes'); return $this->text_yes;
break; break;

21
src/Forms/NoForm.php Normal file
View file

@ -0,0 +1,21 @@
<?php
namespace PhangoApp\PhaModels\Forms;
use PhangoApp\PhaModels\Forms\BaseForm;
use PhangoApp\PhaUtils\Utils;
use PhangoApp\PhaView\View;
use PhangoApp\PhaRouter\Routes;
use PhangoApp\PhaI18n\I18n;
class NoForm extends BaseForm {
public function form()
{
return strip_tags($this->default_value);
}
}
?>