", data :"idCategory="+category_id, success: function( data ) { $( '#topic' ).html(data); } }); } else { $('#topic').empty(); } }); }); </script> <script type="text/javascript"> function private(){ if(($("#addLabel").length <= 0) && ($("#addMember").length <= 0)){ $('#addUser').append( '<label id="addLabel">Pilih anggota</label>' ); $('#addUser').append( '<select id="addMember" required class="form-control" multiple name="member[]"><?php usersOption($users); ?> </select>' ); } } function public(){ $('#addLabel').remove(); $('#addMember').remove(); } </script> <?php endcustom_script(); get_footer('private');
public function getSelectedMember() { $idTopic = $this->input->post('topic'); $getTopic = $this->model_topic->selectTopic($idTopic); $idThread = $this->input->post('thread'); $getMember = $this->model_thread->get_thread_members_by_id($idThread); $user = sentinel()->getUser(); foreach ($getTopic as $t) { $daerah = $t->daerah; } if ($daerah != '00.00.00.0000') { $users = Model\User::getByWilayah($daerah); } else { $users = Model\User::all(); } if (!empty($getMember)) { userSelectedOption($users, $getMember, $user->id); } else { usersOption($users, $user->id); } }