Fixes on corefields internatinalization

This commit is contained in:
Antonio de la Rosa 2015-04-28 18:53:01 +02:00
parent c980654ce5
commit ac0b0f5e5a
6 changed files with 23 additions and 28 deletions

View file

@ -6,6 +6,8 @@
namespace PhangoApp\PhaModels\CoreFields; namespace PhangoApp\PhaModels\CoreFields;
use PhangoApp\PhaI18n\I18n;
class BooleanField extends PhangoField { class BooleanField extends PhangoField {
public $size=1; public $size=1;
@ -63,13 +65,13 @@ class BooleanField extends PhangoField {
{ {
default: default:
return PhangoVar::$l_['common']->lang('no', 'No'); return I18n::lang('common', 'no', 'No');
break; break;
case 1: case 1:
return PhangoVar::$l_['common']->lang('yes', 'Yes'); return I18n::lang('common', 'yes', 'Yes');
break; break;
@ -81,7 +83,7 @@ class BooleanField extends PhangoField {
function get_parameters_default() function get_parameters_default()
{ {
$arr_values=array($this->default_value, PhangoVar::$l_['common']->lang('no', 'No'), 0, PhangoVar::$l_['common']->lang('yes', 'Yes'), 1);; $arr_values=array($this->default_value, I18n::lang('common', 'no', 'No'), 0, I18n::lang('common', 'yes', 'Yes'), 1);;
return array($this->name_component, '', $arr_values); return array($this->name_component, '', $arr_values);

View file

@ -2,6 +2,7 @@
namespace PhangoApp\PhaModels\CoreFields; namespace PhangoApp\PhaModels\CoreFields;
use PhangoApp\PhaUtils\Utils; use PhangoApp\PhaUtils\Utils;
use PhangoApp\PhaI18n\I18n;
/** /**
* *

View file

@ -73,7 +73,7 @@ class FileField extends PhangoField {
else else
{ {
$this->std_error=PhangoVar::$l_['common']->lang('error_cannot_upload_this_file_to_the_server', 'Error: Cannot upload this file to the server'); $this->std_error=I18n::lang('common', 'error_cannot_upload_this_file_to_the_server', 'Error: Cannot upload this file to the server');
return ''; return '';
@ -92,7 +92,7 @@ class FileField extends PhangoField {
else else
{ {
$this->std_error=PhangoVar::$l_['error_model']->lang('check_error_enctype_for_upload_file', 'Please, check enctype form of file form'); $this->std_error=I18n::lang('error_model', 'check_error_enctype_for_upload_file', 'Please, check enctype form of file form');
return ''; return '';
@ -149,7 +149,7 @@ class FileField extends PhangoField {
if(!unlink($this->path.'/'.$file_name)) if(!unlink($this->path.'/'.$file_name))
{ {
$this->std_error=PhangoVar::$l_['common']->lang('cannot_delete_file', 'Cannot delete the file'); $this->std_error=I18n::lang('common', 'cannot_delete_file', 'Cannot delete the file');
} }

View file

@ -1,6 +1,7 @@
<?php <?php
namespace PhangoApp\PhaModels\CoreFields; namespace PhangoApp\PhaModels\CoreFields;
use PhangoApp\PhaI18n\I18n;
/** /**
* ForeignKeyfield is a relantioship between two models... * ForeignKeyfield is a relantioship between two models...
@ -170,7 +171,7 @@ class ForeignKeyField extends IntegerField{
else else
{ {
$arr_values=array('', PhangoVar::$l_['common']->lang('any_option_chosen', 'Any option chosen'), ''); $arr_values=array('', I18n::lang('common', 'any_option_chosen', 'Any option chosen'), '');
return array($this->name_component, '', $arr_values); return array($this->name_component, '', $arr_values);

View file

@ -2,6 +2,7 @@
namespace PhangoApp\PhaModels\CoreFields; namespace PhangoApp\PhaModels\CoreFields;
use PhangoApp\PhaUtils\Utils; use PhangoApp\PhaUtils\Utils;
use PhangoApp\PhaI18n\I18n;
/** /**
* Imagefield is a field for upload images * Imagefield is a field for upload images
@ -112,7 +113,7 @@ class ImageField extends PhangoField {
if($arr_image[0]<$this->min_size[0] || $arr_image[1]<$this->min_size[1]) if($arr_image[0]<$this->min_size[0] || $arr_image[1]<$this->min_size[1])
{ {
$this->std_error=PhangoVar::$l_['common']->lang('image_size_is_not_correct', 'Image size is wrong').'<br />'.PhangoVar::$l_['common']->lang('min_size', 'Minimal size').': '.$this->min_size[0].'x'.$this->min_size[1]; $this->std_error=I18n::lang('common', 'image_size_is_not_correct', 'Image size is wrong').'<br />'.I18n::lang('common', 'min_size', 'Minimal size').': '.$this->min_size[0].'x'.$this->min_size[1];
$this->value=''; $this->value='';
return ''; return '';
@ -122,17 +123,6 @@ class ImageField extends PhangoField {
} }
/*//Check if exists a image with same name.
if(file_exists($this->path.'/'.$_FILES[$file]['name']))
{
$this->std_error=PhangoVar::$l_['common']->lang('a_image_with_same_name_exists', 'There is an image with the same name');
return $image;
}*/
//Delete other image if exists.. //Delete other image if exists..
if($image!='') if($image!='')
@ -310,7 +300,7 @@ class ImageField extends PhangoField {
else else
{ {
$this->std_error=PhangoVar::$l_['common']->lang('error_cannot_upload_this_image_to_the_server', 'Error: Cannot upload this image to the server'); $this->std_error=I18n::lang('common', 'error_cannot_upload_this_image_to_the_server', 'Error: Cannot upload this image to the server');
if(DEBUG==1) if(DEBUG==1)
{ {
@ -328,7 +318,7 @@ class ImageField extends PhangoField {
else else
{ {
$this->std_error.=PhangoVar::$l_['error_model']->lang('img_format_error', 'Img format error, only accept gif, jpg and png formats'); $this->std_error.=I18n::lang('error_model', 'img_format_error', 'Img format error, only accept gif, jpg and png formats');
} }
@ -356,7 +346,7 @@ class ImageField extends PhangoField {
else else
{ {
$this->std_error=PhangoVar::$l_['error_model']->lang('check_error_enctype_for_upload_file', 'Please, check enctype form of file form'); $this->std_error=I18n::lang('error_model', 'check_error_enctype_for_upload_file', 'Please, check enctype form of file form');
return ''; return '';
} }
@ -367,7 +357,7 @@ class ImageField extends PhangoField {
else else
{ {
$this->std_error=PhangoVar::$l_['error_model']->lang('check_error_enctype_for_upload_file', 'Please, check enctype form of file form'); $this->std_error=I18n::lang('error_model', 'check_error_enctype_for_upload_file', 'Please, check enctype form of file form');
} }
@ -418,19 +408,19 @@ class ImageField extends PhangoField {
if(!unlink($this->path.'/'.$key.'_'.$image_name)) if(!unlink($this->path.'/'.$key.'_'.$image_name))
{ {
$this->std_error.=PhangoVar::$l_['common']->lang('cannot_delete_image', 'Cannot delete the image').': '.$key.'_'.$image_name; $this->std_error.=I18n::lang('common', 'cannot_delete_image', 'Cannot delete the image').': '.$key.'_'.$image_name;
} }
} }
$this->std_error.=PhangoVar::$l_['common']->lang('cannot_delete_image', 'Cannot delete the image').': '.$image_name; $this->std_error.=I18n::lang('common', 'cannot_delete_image', 'Cannot delete the image').': '.$image_name;
} }
else else
{ {
$this->std_error.=PhangoVar::$l_['common']->lang('cannot_delete_image', 'Cannot delete the image').': '.$image_name; $this->std_error.=I18n::lang('common', 'cannot_delete_image', 'Cannot delete the image').': '.$image_name;
} }
@ -438,7 +428,7 @@ class ImageField extends PhangoField {
else else
{ {
$this->std_error.=PhangoVar::$l_['common']->lang('cannot_delete_image', 'Cannot delete the image').': '.$image_name; $this->std_error.=I18n::lang('common', 'cannot_delete_image', 'Cannot delete the image').': '.$image_name;
} }

View file

@ -1,6 +1,7 @@
<?php <?php
namespace PhangoApp\PhaModels\CoreFields; namespace PhangoApp\PhaModels\CoreFields;
use PhangoApp\PhaI18n\I18n;
/** /**
* *
@ -60,7 +61,7 @@ class ParentField extends IntegerField{
{ {
$arr_values=array('', PhangoVar::$l_['common']->lang('any_option_chosen', 'Any option chosen'), ''); $arr_values=array('', I18n::lang('common', 'any_option_chosen', 'Any option chosen'), '');
return array($this->name_component, '', $arr_values); return array($this->name_component, '', $arr_values);