Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function approvefile($id){
- $allowed = array(0);
- auth_redirect($allowed);
- $current_user = get_current_login();
- $login_type = get_login_type();
- $datetime = date('Y-m-d H:i:s');
- $con['id'] = $id;
- $file = $this->model_member->get_data('files',$con);
- if ( $login_type != 0 ){
- // Set JSON data
- $data = array(
- 'message' => 'error',
- 'data' => '<button class="close" data-close="alert"></button>Hanya admin yang dapat melakukan aksi ini.',
- );
- die(json_encode($data));
- }
- if ( !$file ){
- // Set JSON data
- $data = array(
- 'message' => 'error',
- 'data' => '<button class="close" data-close="alert"></button>Data file tidak ditemukan.',
- );
- die(json_encode($data));
- }
- if ( $file->status == 2 ){
- // Set JSON data
- $data = array(
- 'message' => 'error',
- 'data' => '<button class="close" data-close="alert"></button>File ini sudah disetujui.',
- );
- die(json_encode($data));
- }
- $data_update = array (
- 'status' => 2,
- 'datemodified' => $datetime
- );
- if ($this->model_member->update_data('files',$con,$data_update)) {
- update_register_document_upload_status($file->id_registration);
- // Set JSON data
- $data = array(
- 'message' => 'success',
- 'data' => '<button class="close" data-close="alert"></button>Status file berhasil diubah menjadi "diterima".',
- 'status' => '<center><span class="label label-sm label-success">Diterima</span></center>',
- );
- die(json_encode($data));
- } else {
- // Set JSON data
- $data = array(
- 'message' => 'error',
- 'data' => '<button class="close" data-close="alert"></button>Ubah status file gagal.',
- );
- die(json_encode($data));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement