Revize 442
Přidáno uživatelem Jiří Sviták před asi 15 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'member id' => 'ID člena',
|
||
'member name' => 'Jméno člena (organizace)',
|
||
'members account' => 'Účet člena',
|
||
'members name' => 'Jméno člena (organizace)',
|
||
'members' => 'Členové',
|
||
'membership can be ended only to former member' => 'Členství může být ukončeno jen bývalému členovi.',
|
||
'membership interrupts' => 'Přerušení členství',
|
freenetis/trunk/kohana/application/controllers/members.php | ||
---|---|---|
{
|
||
if (!isset($member_id))
|
||
Controller::warning(PARAMETER);
|
||
|
||
$user_model=new User_Model();
|
||
$user_model->select('id, login')
|
||
->where('type=', User_Model::$member)
|
||
->find_by_member_id($member_id);
|
||
|
||
$model_members = new Member_Model($member_id);
|
||
if ($model_members->id == 0)
|
||
Controller::error(RECORD);
|
||
if (!$this->acl_check_edit(get_class($this),'members',$member_id))
|
||
Controller::error(ACCESS);
|
||
|
||
$this->user_id = $user_model->id;
|
||
unset($user_model);
|
||
|
||
$model_members = new Member_Model();
|
||
// member
|
||
$member_data = $model_members->get_member($member_id)->current();
|
||
$this->member_id = $member_id;
|
||
|
||
// address point
|
||
$address_point = new Address_point_Model($member_data->address_point_id);
|
||
|
||
// streets
|
||
$street_model = new Street_Model();
|
||
$streets = $street_model->find_all();
|
||
|
||
$arr_streets = array();
|
||
|
||
foreach ($streets as $street)
|
||
{
|
||
$arr_streets[$street->id] = $street->street;
|
||
}
|
||
asort($arr_streets, SORT_LOCALE_STRING);
|
||
|
||
// towns
|
||
$town_model = new Town_Model();
|
||
$towns = $town_model->find_all();
|
||
|
||
$arr_towns = array();
|
||
|
||
foreach ($towns as $town)
|
||
{
|
||
$arr_towns[$town->id] = $town->town;
|
||
... | ... | |
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
|
||
$form->group('')->label(url_lang::lang('texts.Basic information'));
|
||
//$form->input('title1')->label(url_lang::lang('texts.pre title').':')->rules('length[1,40]')->value($member_data->pre_title);
|
||
//if ($this->acl_check_edit('Users_Controller','name',$member_id))
|
||
// $form->input('name')->label(url_lang::lang('texts.name').':')->rules('required|length[1,30]')->value($member_data->name);
|
||
//$form->input('middle_name')->label(url_lang::lang('texts.middle name').':')->rules('length[1,30]')->value($member_data->middle_name);
|
||
//if ($this->acl_check_edit('Users_Controller','surname',$member_id))
|
||
// $form->input('surname')->label(url_lang::lang('texts.surname').':')->rules('required|length[1,60]')->value($member_data->surname);
|
||
//$form->input('title2')->label(url_lang::lang('texts.post title').':')->rules('length[1,30]')->value($member_data->post_title);
|
||
if ($this->acl_check_edit(get_class($this),'name',$member_id))
|
||
$form->input('membername')->label(url_lang::lang('texts.Member name').':')->rules('required|length[1,60]')->value($member_data->namem);
|
||
if ($this->acl_check_edit(get_class($this),'type',$member_id))
|
||
{
|
||
$enum_types = new Enum_type_Model();
|
||
$types = $enum_types->get_values(Enum_type_Model::$member_type_id);
|
||
$form->dropdown('type')->label(url_lang::lang('texts.Type').':')->options($types)->selected($member_data->typem)->callback(array($this, 'valid_member_type'));
|
||
}
|
||
if ($this->acl_check_edit(get_class($this),'name',$member_id))
|
||
$form->input('membername')->label(url_lang::lang('texts.Name of organization').':')->rules('required|length[1,60]')->value($member_data->namem);
|
||
if ($this->acl_check_edit(get_class($this),'organization_id', $member_id))
|
||
$form->input('organization_identifier')->label(url_lang::lang('texts.Organization identifier').':')->rules('length[3,20]')->value($member_data->organization_identifier);
|
||
if ($this->acl_check_edit('Members_Controller', 'var_sym', $member_id))
|
||
$form->input('variable_symbol')->label(url_lang::lang('texts.Variable symbol').':')->rules('required|length[9,10]')->value($member_data->variable_symbol)->callback(array($this, 'valid_var_sym'));
|
||
|
||
/*
|
||
$form->group('')->label(url_lang::lang('texts.Login data'));
|
||
if ($this->acl_check_edit('Users_Controller','login',$member_id))
|
||
$form->input('login')->label(url_lang::lang('texts.username').':')
|
||
->rules('required|length[3,50]')
|
||
->callback(array($this, 'valid_username'))
|
||
->value($member_data->login);
|
||
*/
|
||
|
||
$form->group('')->label(url_lang::lang('texts.Address'));
|
||
if ($this->acl_check_edit(get_class($this),'address',$member_id))
|
||
{
|
||
... | ... | |
$form->input('street_number')->label(url_lang::lang('texts.street number').':')->rules('required|length[1,50]|valid_numeric')->value($address_point->street_number);
|
||
$form->dropdown('town_id')->label(url_lang::lang('texts.town').':')->rules('required')->options($arr_towns)->selected($address_point->town_id);
|
||
}
|
||
/*
|
||
$form->group('')->label(url_lang::lang('texts.Contact information'));
|
||
if ($this->acl_check_edit('Users_Controller','phone',$member_id))
|
||
$form->input('phone')->label(url_lang::lang('texts.phone').':')->rules('required|length[3,40]')->callback(array($this, 'valid_phone'))->value($member_data->phone);
|
||
if ($this->acl_check_edit('Users_Controller','email',$member_id))
|
||
$form->input('email')->label(url_lang::lang('texts.email').':')
|
||
->rules('length[3,50]|valid_email')
|
||
->callback(array($this, 'valid_email'))->value($member_data->email);
|
||
*/
|
||
|
||
$form->group('')->label(url_lang::lang('texts.Account information'));
|
||
if ($this->acl_check_edit(get_class($this),'en_fee',$member_id) && ($member_data->entrance_fee == $member_data->entrance_fee_left))
|
||
... | ... | |
$form->input('qos_ceil')->label(url_lang::lang('texts.qos ceil').':')->rules('valid_numeric')->value($member_data->qos_ceil);
|
||
if ($this->acl_check_edit(get_class($this),'qos_rate',$member_id))
|
||
$form->input('qos_rate')->label(url_lang::lang('texts.qos rate').':')->rules('valid_numeric')->value($member_data->qos_rate);
|
||
$form->date('birthday')->label(url_lang::lang('texts.birthday').':')->years(date('Y')-100, date('Y'))->rules('required')->value(strtotime($member_data->birthday));
|
||
if ($this->acl_check_edit(get_class($this),'entrance_date',$member_id))
|
||
$form->date('entrance_date')->label(url_lang::lang('texts.Entrance date').':')->years(date('Y')-100, date('Y'))->rules('required')->value(strtotime($member_data->entrance_date));
|
||
if ($this->acl_check_edit(get_class($this),'leaving_date',$member_id))
|
||
... | ... | |
{
|
||
$form_data[$key] = htmlspecialchars($value);
|
||
}
|
||
$user_data = new User_Model;
|
||
$member_data = new Member_Model;
|
||
|
||
$member_data->find_by_id($member_id);
|
||
|
||
$address_point_model = new Address_point_Model();
|
||
$address_point = $address_point_model->get_address_point($form_data['town_id'],$form_data['street_id'],$form_data['street_number']);
|
||
|
||
/*
|
||
$user_data->where('type!=', User_Model::$user);
|
||
$user_data->find_by_member_id($member_id);
|
||
*/
|
||
|
||
// user data
|
||
/*
|
||
if ($this->acl_check_edit(get_class($this),'name',$member_id))
|
||
$user_data->name = $form_data['name'];
|
||
$user_data->middle_name = $form_data['middle_name'];
|
||
if ($this->acl_check_edit('Users_Controller','login',$member_id))
|
||
$user_data->login = $form_data['login'];
|
||
if ($this->acl_check_edit('Users_Controller','surname',$member_id))
|
||
$user_data->surname = $form_data['surname'];
|
||
$user_data->pre_title = $form_data['title1'];
|
||
$user_data->post_title = $form_data['title2'];
|
||
$user_data->birthday = date("Y-m-d",$form_data['birthday']);
|
||
if ($this->acl_check_edit('Users_Controller','phone',$member_id))
|
||
$user_data->phone = $form_data['phone'];
|
||
if ($this->acl_check_edit('Users_Controller','email',$member_id))
|
||
$user_data->email = $form_data['email'];
|
||
*/
|
||
if ($this->acl_check_edit(get_class($this),'type',$member_id))
|
||
$member_data->type = $form_data['type'];
|
||
if ($this->acl_check_edit(get_class($this), 'organization_id', $member_id))
|
||
... | ... | |
$member_data->debt_payment_rate = $form_data['debt_payment_rate'];
|
||
|
||
$member_saved = $member_data->save();
|
||
//$user_data->member_id = $member_data->id;
|
||
|
||
/*
|
||
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_type'))
|
||
Controller::insert_phpgacl($user_data->id,$user_data->surname.' '.$user_data->name,$user_data->login,$form_data['type'], true);
|
||
*/
|
||
|
||
unset($form_data);
|
||
if ($member_saved /*&& $user_data->save()*/)
|
||
if ($member_saved)
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Member has been successfully updated.'));
|
||
}
|
Také k dispozici: Unified diff
uprava editace clena