[-] Install : Add gender durring install

[*] FO : Add gender_type "neutral"
// Normalization
This commit is contained in:
mDeflotte committed 2011-09-23 09:58:19 +00:00
1 parent 4dd85d92c0
commit 0f2915813f
3 files changed
+40 -16

No files matched your search

+14 -12
View File
@@ -29,14 +29,14 @@ class AdminGenders extends AdminTab
{ {
public function __construct() public function __construct()
{ {
$this->table = 'gender'; $this->table = 'gender';
$this->className = 'Gender'; $this->className = 'Gender';
$this->lang = true; $this->lang = true;
$this->edit = true; $this->edit = true;
$this->delete = true; $this->delete = true;
$this->fieldImageSettings = array('name' => 'image', 'dir' => 'genders'); $this->fieldImageSettings = array('name' => 'image', 'dir' => 'genders');
$this->fieldsDisplay = array( $this->fieldsDisplay = array(
'id_gender' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_gender' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('Name'), 'width' => 150, 'filter_key' => 'b!name'), 'name' => array('title' => $this->l('Name'), 'width' => 150, 'filter_key' => 'b!name'),
'type' => array( 'type' => array(
@@ -44,13 +44,13 @@ class AdminGenders extends AdminTab
'width' => 100, 'width' => 100,
'orderby' => false, 'orderby' => false,
'type' => 'select', 'type' => 'select',
'select' => array(0 => $this->l('Male'), 1 => $this->l('Female')), 'select' => array(0 => $this->l('Male'), 1 => $this->l('Female'), 2 => $this->l('Neutral')),
'filter_key' => 'a!type', 'filter_key' => 'a!type',
'callback' => 'displayGenderType', 'callback' => 'displayGenderType',
'callback_object' => $this, 'callback_object' => $this,
), ),
'image' => array('title' => $this->l('Image'), 'align' => 'center', 'image' => 'genders', 'orderby' => false, 'search' => false), 'image' => array('title' => $this->l('Image'), 'align' => 'center', 'image' => 'genders', 'orderby' => false, 'search' => false),
); );
parent::__construct(); parent::__construct();
} }
@@ -88,6 +88,8 @@ class AdminGenders extends AdminTab
<label class="t" for="type_male"> '.$this->l('Male').'</label> <label class="t" for="type_male"> '.$this->l('Male').'</label>
<input type="radio" name="type" id="type_female" value="1" '.($this->getFieldValue($obj, 'type') == 1 ? 'checked="checked" ' : '').'/> <input type="radio" name="type" id="type_female" value="1" '.($this->getFieldValue($obj, 'type') == 1 ? 'checked="checked" ' : '').'/>
<label class="t" for="type_female"> '.$this->l('Female').'</label> <label class="t" for="type_female"> '.$this->l('Female').'</label>
<input type="radio" name="type" id="type_neutral" value="2" '.($this->getFieldValue($obj, 'type') == 2 ? 'checked="checked" ' : '').'/>
<label class="t" for="type_neutral"> '.$this->l('Neutral').'</label>
</div> </div>
<div class="clear"></div>'; <div class="clear"></div>';
+4 -4
View File
@@ -35,11 +35,11 @@ class GenderCore extends ObjectModel
public $type; public $type;
protected $fieldsRequired = array('type'); protected $fieldsRequired = array('type');
protected $fieldsSize = array(); protected $fieldsSize = array();
protected $fieldsValidate = array(); protected $fieldsValidate = array();
protected $fieldsRequiredLang = array('name'); protected $fieldsRequiredLang = array('name');
protected $fieldsSizeLang = array('name' => 20); protected $fieldsSizeLang = array('name' => 20);
protected $fieldsValidateLang = array('name' => 'isString'); protected $fieldsValidateLang = array('name' => 'isString');
protected $table = 'gender'; protected $table = 'gender';
protected $identifier = 'id_gender'; protected $identifier = 'id_gender';
+22
View File
@@ -1307,3 +1307,25 @@ State:name
Country:name Country:name
phone' where `id_country`=10; phone' where `id_country`=10;
INSERT INTO `PREFIX_gender` (`id_gender`, `type`) VALUES
(1, 0),
(2, 1),
(3, 1);
INSERT INTO `PREFIX_gender_lang` (`id_gender`, `id_lang`, `name`) VALUES
(1, 1, 'Mr.'),
(1, 2, 'M.'),
(1, 3, 'Sr.'),
(1, 4, 'Herr'),
(1, 5, 'Sig.'),
(2, 1, 'Ms.'),
(2, 2, 'Mme'),
(2, 3, 'Sra.'),
(2, 4, 'Frau'),
(2, 5, 'Sig.ra'),
(3, 1, 'Miss'),
(3, 2, 'Melle'),
(3, 3, 'Miss'),
(3, 4, 'Miss'),
(3, 5, 'Miss');