diff --git a/application/controllers/yllapito.php b/application/controllers/yllapito.php index e785d80..d221ef9 100644 --- a/application/controllers/yllapito.php +++ b/application/controllers/yllapito.php @@ -13,6 +13,7 @@ class Yllapito extends CI_Controller $this->load->model('erkanaauth_model', 'erkana'); $this->load->helper('date'); + $this->load->helper('form'); $this->user = $this->erkana->getUser(); @@ -145,6 +146,12 @@ class Yllapito extends CI_Controller $this->user->delete($user_id); redirect('yllapito/users'); break; + case 'save': + $data = $this->input->post(); + $from = $data['from_page']; + $this->users->save($user_id, $data); + redirect($from); + break; case 'show': $data['userid'] = $user_id; $data['userdata'] = $this->users->get($user_id); diff --git a/application/models/user_model.php b/application/models/user_model.php index 2751145..4f33e63 100644 --- a/application/models/user_model.php +++ b/application/models/user_model.php @@ -12,6 +12,21 @@ class User_model extends MY_Model parent::__construct(); } + public function save($uid = null, $data = null) + { + if (empty($uid) || empty($data)) { + return false; + } + + unset( + $data['from_page'], + $data['savedata'], + $data['submit'] + ); + + return $this->update($uid, $data); + } + public function passwordhash($password = null) { return hash( diff --git a/application/views/yllapito/users_show.php b/application/views/yllapito/users_show.php index 82c6a56..91364ec 100644 --- a/application/views/yllapito/users_show.php +++ b/application/views/yllapito/users_show.php @@ -29,9 +29,73 @@ if ($user->can_seeusers == "no") { 'Kyllä voi', 'no' => 'Ei voi'); + $dd = ' class="medium large-6 small-12"'; + + $inputs = array( + 'name' => 'name', + 'id' => 'name', + 'value' => '', + 'required' => null + ); ?>