public function user_userfieldshop_post() { $data = $this->data; //取得公用數據 $this->form_validation->set_rules('receive_name_Str', '常用收件人姓名', 'required'); $this->form_validation->set_rules('receive_phone_Str', '常用收件人電話', 'required'); $this->form_validation->set_rules('receive_address_Str', '常用收件人地址', 'required'); $uid_Num = $this->input->post('uid_Num', TRUE); if ($this->form_validation->run() !== FALSE) { //基本post欄位 $receive_name_Str = $this->input->post('receive_name_Str', TRUE); $receive_phone_Str = $this->input->post('receive_phone_Str', TRUE); $receive_address_Str = $this->input->post('receive_address_Str', TRUE); //建構User物件,並且更新 $UserFieldShop = new UserFieldShop(); $UserFieldShop->construct(array('uid_Num' => $uid_Num, 'receive_name_Str' => $receive_name_Str, 'receive_phone_Str' => $receive_phone_Str, 'receive_address_Str' => $receive_address_Str)); $UserFieldShop->update(array('db_update_Arr' => array('user_field_shop.receive_name', 'user_field_shop.receive_phone', 'user_field_shop.receive_address'))); //送出成功訊息 $this->load->model('Message'); $this->Message->show(array('message' => '設定成功', 'url' => 'admin/user/global/global_shop/user')); } else { $validation_errors_Str = validation_errors(); $validation_errors_Str = !empty($validation_errors_Str) ? $validation_errors_Str : '設定錯誤'; $this->load->model('Message'); $this->Message->show(array('message' => $validation_errors_Str, 'url' => 'admin/user/global/global_shop/user')); } }
public function edit_userfieldshop_post() { $data = $this->data; //取得公用數據 $uid_Num = $this->input->post('uid_Num', TRUE); //基本post欄位 $receive_name_Str = $this->input->post('receive_name_Str', TRUE); $receive_phone_Str = $this->input->post('receive_phone_Str', TRUE); $receive_address_Str = $this->input->post('receive_address_Str', TRUE); $coupon_count_Num = $this->input->post('coupon_count_Num', TRUE); //建構User物件,並且更新 $UserFieldShop = new UserFieldShop(); $UserFieldShop->construct(array('uid_Num' => $uid_Num, 'receive_name_Str' => $receive_name_Str, 'receive_phone_Str' => $receive_phone_Str, 'receive_address_Str' => $receive_address_Str, 'coupon_count_Num' => $coupon_count_Num)); $UserFieldShop->update(array('db_update_Arr' => array('user_field_shop.receive_name', 'user_field_shop.receive_phone', 'user_field_shop.receive_address', 'user_field_shop.coupon_count'))); //送出成功訊息 $this->load->model('Message'); $this->Message->show(array('message' => '設定成功', 'url' => 'admin/base/user/user_shop/edit/?uid=' . $uid_Num)); }
public function edit_post() { $data = $this->data; //取得公用數據 $this->form_validation->set_rules('username_Str', '會員名稱', 'required'); $uid_Num = $this->input->post('uid_Num', TRUE); if ($this->form_validation->run() !== FALSE) { $data['user_UserFieldShop'] = new UserFieldShop(); $data['user_UserFieldShop']->construct_db(array('db_where_Arr' => array('user.uid' => $uid_Num))); //權限判斷 if (in_array(1, $data['user_UserFieldShop']->group_UserGroupList->uniqueids_Arr) && !in_array(1, $data['User']->group_UserGroupList->uniqueids_Arr) || in_array(2, $data['user_UserFieldShop']->group_UserGroupList->uniqueids_Arr) && !in_array(2, $data['User']->group_UserGroupList->uniqueids_Arr) && !in_array(1, $data['User']->group_UserGroupList->uniqueids_Arr) || in_array(3, $data['user_UserFieldShop']->group_UserGroupList->uniqueids_Arr) && !in_array(2, $data['User']->group_UserGroupList->uniqueids_Arr) && !in_array(1, $data['User']->group_UserGroupList->uniqueids_Arr)) { $this->load->model('Message'); $this->Message->show(array('message' => '不可以編輯權限更高的管理員', 'url' => 'admin/base/user/user/tablelist')); return FALSE; } //基本post欄位 $username_Str = $this->input->post('username_Str', TRUE); $groupids_Arr = $this->input->post('groupids_Arr', TRUE); //建構User物件,並且更新 $UserFieldShop = new UserFieldShop(); $UserFieldShop->construct(array('uid_Num' => $uid_Num, 'username_Str' => $username_Str)); //建立UserGroupList物件 check_comma_array($groupids_Str, $groupids_Arr); $UserFieldShop->group_UserGroupList = new ObjList(); $UserFieldShop->group_UserGroupList->construct_db(array('db_where_or_Arr' => array('groupid_Num' => $groupids_Arr), 'model_name_Str' => 'UserGroup', 'limitstart_Num' => 0, 'limitcount_Num' => 100)); $UserFieldShop->update(array('db_update_Arr' => array('user.username', 'user.updatetime', 'user.groupids'))); //送出成功訊息 $this->load->model('Message'); $this->Message->show(array('message' => '設定成功', 'url' => 'admin/base/user/user/edit/?uid=' . $uid_Num)); } else { $validation_errors_Str = validation_errors(); $validation_errors_Str = !empty($validation_errors_Str) ? $validation_errors_Str : '設定錯誤'; $this->load->model('Message'); $this->Message->show(array('message' => $validation_errors_Str, 'url' => 'admin/base/user/user/edit/?uid=' . $uid_Num)); } }