Projekt

Obecné

Profil

« Předchozí | Další » 

Revize f3563506

Přidáno uživatelem David Raška před asi 9 roky(ů)

ref #957: Birthday is not required

Zobrazit rozdíly:

application/controllers/members.php
->selected($default_speed_class ? $default_speed_class->id : NULL)
->add_button('speed_classes')
->style('width:200px');
$form->date('birthday')
$empty_birthday = Settings::get('users_birthday_empty_enabled');
$min_age = Settings::get('members_age_min_limit');
if ($empty_birthday == 0)
{
$form->date('birthday')
->label('Birthday')
->years(date('Y')-100, date('Y'))
->years(date('Y') - 100, date('Y'))
->rules('required');
}
else
{
if (empty($min_age))
{
$form->date('birthday')
->label('Birthday')
->years(date('Y') - 100, date('Y'))
->value('');
}
else
{
$form->checkbox('older_than')
->label(__("I'm older than %d years", array($min_age)))
->rules('required');
}
}
$form->date('entrance_date')
->label('Entrance date')
......
$user->surname = $form_data['surname'];
$user->pre_title = $form_data['title1'];
$user->post_title = $form_data['title2'];
$user->birthday = date("Y-m-d",$form_data['birthday']);
$user->birthday = (empty($form_data['birthday']) ? NULL : date("Y-m-d",$form_data['birthday']));
$user->password = sha1($form_data['password']);
$user->type = User_Model::MAIN_USER;
$user->application_password = security::generate_password();
application/controllers/registration.php
$form->input('title2')
->label('Post title')
->rules('length[3,30]');
$form->date('birthday')
$empty_birthday = Settings::get('users_birthday_empty_enabled');
$min_age = Settings::get('members_age_min_limit');
if ($empty_birthday == 0)
{
$form->date('birthday')
->label('Birthday')
->years(date('Y') - 100, date('Y'))
->rules('required');
}
else
{
if (empty($min_age))
{
$form->date('birthday')
->label('Birthday')
->years(date('Y') - 100, date('Y'))
->value('');
}
else
{
$form->checkbox('older_than')
->label(__("I'm older than %d years", array($min_age)))
->rules('required');
}
}
$legalp_group = $form->group('Legal person innformation')->visible(FALSE);
......
$user->surname = $form_data['surname'];
$user->pre_title = $form_data['title1'];
$user->post_title = $form_data['title2'];
$user->birthday = date('Y-m-d', $form_data['birthday']);
$user->birthday = (empty($form_data['birthday']) ? NULL : date("Y-m-d",$form_data['birthday']));
$user->type = User_Model::MAIN_USER;
// entrance fee
application/controllers/settings.php
$this->form->checkbox('user_email_duplicities_enabled')
->label('Enable multiple users to have assigned same e-mail contact')
->checked(Settings::get('user_email_duplicities_enabled'));
$this->form->checkbox('users_birthday_empty_enabled')
->label('Users birthday can be empty')
->checked(Settings::get('users_birthday_empty_enabled'));
$this->form->input('members_age_min_limit')
->label('Minimum age of user')
->rules('valid_numeric')
->value(Settings::get('members_age_min_limit'));
$this->form->group('Security');
application/controllers/users.php
$form->group('Additional information');
$form->date('birthday')
$empty_birthday = Settings::get('users_birthday_empty_enabled');
$min_age = Settings::get('members_age_min_limit');
if ($empty_birthday == 0)
{
$form->date('birthday')
->label('Birthday')
->years(date('Y')-100, date('Y'))
->years(date('Y') - 100, date('Y'))
->rules('required')
->value(strtotime($user->birthday));
}
else
{
if (empty($min_age))
{
$form->date('birthday')
->label('Birthday')
->years(date('Y') - 100, date('Y'))
->value($user->birthday === NULL ? '' : strtotime($user->birthday));
}
else
{
$form->checkbox('older_than')
->label(__("I'm older than %d years", array($min_age)))
->rules('required')
->checked(TRUE);
}
}
if ($this->acl_check_edit(get_class($this), 'comment', $user->member_id))
{
$form->textarea('comment')
......
{
$user_data->login = $form_data['username'];
}
$user_data->birthday = date("Y-m-d",$form_data['birthday']);
$user_data->birthday = (empty($form_data['birthday']) ? NULL : date("Y-m-d",$form_data['birthday']));
$user_data->pre_title = $form_data['pre_title'];
$user_data->name = $form_data['name'];
$user_data->middle_name = $form_data['middle_name'];
......
$form->group('Additional information');
$form->date('birthday')
$empty_birthday = Settings::get('users_birthday_empty_enabled');
$min_age = Settings::get('members_age_min_limit');
if ($empty_birthday == 0)
{
$form->date('birthday')
->label('Birthday')
->years(date('Y')-100, date('Y'))
->years(date('Y') - 100, date('Y'))
->rules('required');
}
else
{
if (empty($min_age))
{
$form->date('birthday')
->label('Birthday')
->years(date('Y') - 100, date('Y'))
->value('');
}
else
{
$form->checkbox('older_than')
->label(__("I'm older than %d years", array($min_age)))
->rules('required');
}
}
if ($this->acl_check_new(get_class($this),'comment',$member_id))
{
......
$form_data = $form->as_array();
$user_data = new User_Model;
$user_data->birthday = date("Y-m-d",$form_data['birthday']);
$user_data->birthday = (empty($form_data['birthday']) ? NULL : date("Y-m-d",$form_data['birthday']));
$user_data->login = $form_data['username'];
$user_data->password = sha1($form_data['password']);
$user_data->pre_title = $form_data['pre_title'];
application/i18n/cs_CZ/texts.php
'ignore' => 'Ignorovat',
'ignore whitelist' => 'Ignorovat bílou listinu',
'im' => 'PČ',
"i'm older than %d years" => 'Jsem starší %d let',
'import addresses' => 'Importovat adresy',
'import dhcp export from mikrotik' => 'Import exportu DHCP z Mikrotiku',
'import has been successfully finished' => 'Import byl úspěšně dokončen.',
......
'minimal password length' => 'Minimální délka hesla',
'minimal password level' => 'Minimální úroveň hesla',
'minimal suggest amount' => 'Minimální navrhovaná částka',
'minimum age of user' => 'Minimální věk uživatele',
'minimum of traffic' => 'Minimální provoz',
'minimum membership interrupt period (months)' => 'Minimální doba přerušení členství (měsíce)',
'minute' => 'minuta',
......
'username or password do not match' => 'Uživatelské jméno nebo heslo nesouhlasí',
'username or e-mail' => 'Uživatelské jméno nebo e-mail',
'users' => 'Uživatelé',
'users birthday can be empty' => 'Datum narození uživatele může být prázdný',
'users has been warned about invoice' => 'Uživatelé byly upozorněni na fakturu',
'users in group' => 'Uživatelé ve skupině',
'users of regular members' => 'Uživatelé řádných členů',
application/libraries/Settings.php
// contact duplicities
'user_email_duplicities_enabled' => FALSE,
'user_phone_duplicities_enabled' => FALSE,
// user birthday settings
'users_birthday_empty_enabled' => 0,
// username regex #360
'username_regex' => '/^[a-z][a-z0-9_]{4,}$/',
application/views/js/settings_users.php
<?php
/**
* Settings users javascript view.
*/
// IDE complementation
if (FALSE): ?><script type="text/javascript"><?php endif
?>
$('#users_birthday_empty_enabled').live('change', function()
{
if ($(this).is(':checked'))
{
$('#members_age_min_limit').parent().parent().show();
}
else
{
$('#members_age_min_limit').parent().parent().hide();
}
}).change();
application/views/members/show.php
</tr>
<tr>
<th><?php echo __('Birthday') ?></th>
<td><?php echo $user->birthday ?></td>
<td><?php echo (Settings::get('users_birthday_empty_enabled') == 1 && Settings::get('members_age_min_limit') !== '' ? "> ".Settings::get('members_age_min_limit').' '.__('years') : $user->birthday) ?></td>
</tr>
<?php if ($this->acl_check_view('Users_Controller', 'application_password', $member->id)) { ?>
<tr>
application/views/users/show.php
</tr>
<tr>
<th><?php echo __('Birthday') ?></th>
<td><?php echo $user_data->birthday ?></td>
<td><?php echo (Settings::get('users_birthday_empty_enabled') == 1 && Settings::get('members_age_min_limit') !== '' ? "> ".Settings::get('members_age_min_limit').' '.__('years') : $user_data->birthday) ?></td>
</tr>
<?php if ($this->acl_check_view('Users_Controller', 'application_password', $user_data->member->id)) { ?>
<tr>

Také k dispozici: Unified diff