function fetch($id, $field = NULL) { $people = parent::fetch($id, $field); if (is_null($field)) { $team = $this->db->from('team')->where('id', $id)->get()->row_array(); return $people + $team; } else { return $people; } }
function profile() { $people_model = new People_model(); $people = array_merge_recursive($people_model->fetch($this->user->id), $this->input->sessionPost('people')); $people_profiles = array_merge_recursive(array_sub($people_model->getProfiles($this->user->id), 'content', 'name'), $this->input->sessionPost('people')); $this->load->addViewArrayData(compact('people', 'people_profiles')); $this->output->title = '用户资料'; $this->load->view('user/profile'); $this->load->view('user/profile_sidebar', true, 'sidebar'); }