/** * create new data */ public function create($data) { $this->name = $data['provinsi']; $this->created = now(); $this->user_id = current_id(); $this->db->insert($this->tablename(), $this); return $this->db->insert_id(); }
/** * create new kabupaten */ public function create($data) { $this->name = $data['name']; $this->user_id = current_id(); $this->provinsi_id = $data['provinsi_id']; $this->created = date('Y-m-d H:i:s'); $this->penduduk = $data['penduduk']; $this->db->insert($this->kabupaten(), $this); return $this->db->insert_id(); }
/** * edit method */ public function edit($id) { if (!is_admin() && current_id() != $id) { redirect(base_url()); } $user = $this->user->get_by_id($id); $data['username'] = $user->username; $data['action'] = 'edit'; $data['id'] = $user->id; $data['group_id'] = $user->group_id; $data['groups'] = $this->group->get(); $this->load->template('user/create', $data); }
<li><a href="<?php echo base_url('kabupaten'); ?> ">Kabupaten</a></li> <?php if (is_admin()) { ?> <li><a href="<?php echo base_url('user'); ?> ">User</a></li> <?php } else { ?> <li><a href="<?php echo base_url('user/edit') . "/" . current_id(); ?> ">Edit Profile</a></li> <?php } ?> <li><a class="dropdown-button" href="#!" data-activates="dropdown1">Report<i class="material-icons right">arrow_drop_down</i></a></li> <li><a href="auth/logout">Log Out</a></li> </ul> <ul class="side-nav" id="mobile-demo"> <li><a href="<?php echo base_url('provinsi'); ?> ">Provinsi</a></li> <li><a href="<?php echo base_url('kabupaten');