[eluser]The Wizard[/eluser]
Code:
$city_id = $this->input->post ('city_id');
$country_code = $this->input->post ('country_code');
if ( $this->model_user->Custom_City_Check( $country_code, $city_id ) == FALSE )
{
$_POST['city_id'] = '-1';
//$this->form_validation->set_rules( 'dummy', '', 'required' );
}
//TODO: language
$this->form_validation->set_rules( 'name', 'Name', 'required|min_length[3]|max_length[32]' );
$this->form_validation->set_rules( 'city_id', 'City ID', 'required|is_natural' );
$this->form_validation->set_rules( 'work', 'Work', 'required' );
$this->form_validation->set_rules( 'country_code', 'Country', 'required' );
/**
birthday ile ilgili seyler.
**/
$this->form_validation->set_rules( 'birthday_d', 'birthday_d', '' );
$this->form_validation->set_rules( 'birthday_m', 'birthday_m', '' );
$this->form_validation->set_rules( 'birthday_y', 'birthday_y', 'required' );
switch ( $this->form_validation->run() )
{
case FALSE :
$data['values']['name'] = set_value( 'name' );
$data['values']['city_id'] = set_value( 'city_id' );
$data['values']['work'] = set_value( 'work' );
$data['values']['birthday_d'] = $this->model_user->Dropdown_date ( 'birthday_d', set_value( 'birthday_d' ), 'day', FALSE );
$data['values']['birthday_m'] = $this->model_user->Dropdown_date ( 'birthday_m', set_value( 'birthday_m' ), 'month', FALSE );
$data['values']['birthday_y'] = $this->model_user->Dropdown_date ( 'birthday_y', set_value( 'birthday_y' ), 'year', FALSE );
$data['values']['country_code'] = set_value( 'country_code' );
$this->load->view( $data['theme_folder_vault'] . 'master-user-set_info.php', $data );
break;
case TRUE:
/* this can be replaced with foreach code for POST and propper element names */
$data_post['name'] = $this->input->post ('name');
$data_post['city_id'] = $this->input->post ('city_id');
$data_post['work'] = $this->input->post ('work');
$data_post['country_code'] = $this->input->post ('country_code');
//FIX for WRONG CITY/COUNTRY BUG
$city_id = $this->input->post ('city_id');
$country_code = $this->input->post ('country_code');
if ( $this->model_user->Custom_City_Check( $country_code, $city_id ) == FALSE )
{
$data_post['city_id'] = -1;
}
$data_post['birthday'] = set_value( 'birthday_y' ) .'-'. set_value( 'birthday_m' ) .'-'. set_value( 'birthday_d' ) ;
// echo '<pre>';
// print_r( $data_post );
// echo '</pre>';
// die();
$user_id = $this->model_user->Session_UserID();
$info_result = $this->model_user->User_SetUserInfo( $user_id, $data_post );
redirect ( 'user/settings/success' );
break;
default:
die ( 'error - ftw? ');
break;
}
break;
look at the dummy line