Pengenalan Kampus STMIK Bani Saleh
Selasa, 27 Oktober 2020
Rabu, 16 September 2020
Pembuatan Web Sesi 7
Morning Map From Home to Office
Morning Map From Home to Office
Night Map From Office to Home
Selasa, 15 September 2020
Pembuatan Web Sesi 6
Jangan lupa untuk subscribe, like, dan pada kolom komentar tulis NPM dan Nama ya
Senin, 14 September 2020
Pembuatan Web Sesi 5
Jumat, 11 September 2020
Pembuatan Web Sesi 4
Mari simak video berikut ini :
Kamis, 10 September 2020
Sitasi dengan Aplikasi Mendeley
Pembuatan Web Sesi 3
Ok, Jangan lupa untuk like, subscribe, dan kalau ada pertanyaan silahkan di komen ya
Rabu, 09 September 2020
Pembuatan Web Sesi 2
Ok, jangan lupa untuk Like, Komen, dan Subscribe ya
Selasa, 08 September 2020
Pembuatan Web Sesi 1
Senin, 07 September 2020
Kelas 2 SD Tema 2 Sub Tema 2 Bermain di Lingkungan Sekolah Pembelajaran 1
Kelas 2 SD Tema 2 Sub Tema 2 Bermain
di Lingkungan Sekolah
Pembelajaran 1 untuk para
guru guru SD Sekolah Dasar.
Konten kali ini adalah pembagian
Jumat, 28 Agustus 2020
Undangan Seminar STMIK Bani Saleh Paradigma Artificial Intelligence (AI)
INFORMATION TECHNOLOGY SERIES STMIK BANI SALEH
"Paradigma Artificial Intelligence (AI)"
Dalam Konsep Keberlanjutan Industri Manufaktur
.
.
Waktu Pelaksanan
Sabtu, 29 Agustus 2020
Pukul 10.00 sd 11.30 WIB
Live Via
Youtube : https://youtu.be/puVU7eQQoKo
Google Meet : https://meet.google.com/yfv-ndjg-psh
& Live Instagram
.
.
Speakers :
SUHADI. ST., M.KOM
Dosen dan Praktisi IT STMIK Bani Saleh
Moderator:
Ikka Novia Wijayanti
.
.
Daftar :
https://bit.ly/WebinarITSeries
.
.
Fasilitas E-Sertifikat
.
.
For more Information:
Whatswapp 0811 1453 633
Seminar di SMK Bina Siswa Utama
Youtube :
https://www.youtube.com/watch?v=9oydb6a_BrU&feature=youtu.be
Instagram :
@alviender
Rabu, 26 Agustus 2020
Seminar Nasional Strategi Penulisan
Saya Adhitya Ilham Ramdhani, dari STMIK Bani Saleh mengucapkan Materi yang sangat bagus untuk Akademisi bagi para Mahasiswa, Dosen, dan Guru apabila melaksanakan Pengabdian Masyarakat dan Penelitian. Ilmu yang bermanfaat dan luar biasa. Terimakasih kepada para Narasumber dan Panitia Acara, dan Penyelenggara Sang Bumi Ruwa Jurai University Lampung. Sukses Terus. Link Youtube : https://www.youtube.com/watch?v=gtubqD8SxZI&t=998s Video Youtube :
Sabtu, 15 Agustus 2020
Seminar SMK Insan Mulia Bekasi dengan STMIK Bani Saleh (Dokumentasi)
Ini adalah dokumentasi mengenai seminar SMK Insan Mulia Bekasi dengan STMIK Bani Saleh yang bertema "How Be Your Secure Data by Cisco" :
Link Youtube :
https://www.youtube.com/watch?v=fnm8OKNecTY&t=36s
Video Youtube :
Jumat, 14 Agustus 2020
Berbincang dengan Mahasiswa STMIK Bani Saleh Peraih Beasiswa
Hello, bagi kamu yang sedang kuliah di STMIK Bani Saleh, ingin tau cara mendapatkan Beasiswa, dan untuk kamu yang belum kuliah tapi ingin kuliah dengan biaya Beasiswa? Simak video dibawah ini :
Link Youtube : https://www.youtube.com/watch?v=lB8Qc7kLz2E&t=568s
Informasi lebih lanjut, bisa DM di Instagram official.stmikbanisaleh
Kamis, 13 Agustus 2020
Be.Be.Em "Bincang Bareng Mahasiswa Beasiswa Bidikmisi"
Selasa, 04 Agustus 2020
Seminar Kolaborasi SMK Insan Mulia Bekasi dengan STMIK Bani Saleh Bekasi
Kamis, 23 Juli 2020
Cara Membuat Google Form Soal Guru Atau Dosen untuk Tugas Siswa Mahasiswa
Selasa, 21 Juli 2020
Hasil Karya Mahasiswa Web Apotek
Jumat, 10 Juli 2020
Macam Macam Contoh Aplikasi Database
Bagi kalian yang telah hadir, jangan lupa Like, Subscribe, dan tulis Nama sama Kelas di Kolom Komentar ya, Terimakasih
Membuat ERD Relasi Diagram Database di Xampp
Bagi kalian yang telah hadir, Jangan lupa Like,Subscribe, dan Komen Nama sama Kelas di Kolom komentar ya. Terimakasih
Selasa, 07 Juli 2020
Membuat Web Data Siswa dengan Codeigniter Sesi 6
<?php
class grocery_CRUD_Model extends CI_Model {
protected $primary_key = null;
protected $table_name = null;
protected $relation = array();
protected $relation_n_n = array();
protected $primary_keys = array();
function __construct()
{
parent::__construct();
}
function db_table_exists($table_name = null)
{
return $this->db->table_exists($table_name);
}
function get_list()
{
if($this->table_name === null)
return false;
$select = "`{$this->table_name}`.*";
//set_relation special queries
if(!empty($this->relation))
{
foreach($this->relation as $relation)
{
list($field_name , $related_table , $related_field_title) = $relation;
$unique_join_name = $this->_unique_join_name($field_name);
$unique_field_name = $this->_unique_field_name($field_name);
if(strstr($related_field_title,'{'))
{
$related_field_title = str_replace(" "," ",$related_field_title);
$select .= ", CONCAT('".str_replace(array('{','}'),array("',COALESCE({$unique_join_name}.",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $unique_field_name";
}
else
{
$select .= ", $unique_join_name.$related_field_title AS $unique_field_name";
}
if($this->field_exists($related_field_title))
$select .= ", `{$this->table_name}`.$related_field_title AS '{$this->table_name}.$related_field_title'";
}
}
//set_relation_n_n special queries. We prefer sub queries from a simple join for the relation_n_n as it is faster and more stable on big tables.
if(!empty($this->relation_n_n))
{
$select = $this->relation_n_n_queries($select);
}
$this->db->select($select, false);
$results = $this->db->get($this->table_name)->result();
return $results;
}
public function set_primary_key($field_name, $table_name = null)
{
$table_name = $table_name === null ? $this->table_name : $table_name;
$this->primary_keys[$table_name] = $field_name;
}
protected function relation_n_n_queries($select)
{
$this_table_primary_key = $this->get_primary_key();
foreach($this->relation_n_n as $relation_n_n)
{
list($field_name, $relation_table, $selection_table, $primary_key_alias_to_this_table,
$primary_key_alias_to_selection_table, $title_field_selection_table, $priority_field_relation_table) = array_values((array)$relation_n_n);
$primary_key_selection_table = $this->get_primary_key($selection_table);
$field = "";
$use_template = strpos($title_field_selection_table,'{') !== false;
$field_name_hash = $this->_unique_field_name($title_field_selection_table);
if($use_template)
{
$title_field_selection_table = str_replace(" ", " ", $title_field_selection_table);
$field .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE(",", ''),'"),str_replace("'","\\'",$title_field_selection_table))."')";
}
else
{
$field .= "$selection_table.$title_field_selection_table";
}
//Sorry Codeigniter but you cannot help me with the subquery!
$select .= ", (SELECT GROUP_CONCAT(DISTINCT $field) FROM $selection_table "
."LEFT JOIN $relation_table ON $relation_table.$primary_key_alias_to_selection_table = $selection_table.$primary_key_selection_table "
."WHERE $relation_table.$primary_key_alias_to_this_table = `{$this->table_name}`.$this_table_primary_key GROUP BY $relation_table.$primary_key_alias_to_this_table) AS $field_name";
}
return $select;
}
function order_by($order_by , $direction)
{
$this->db->order_by( $order_by , $direction );
}
function where($key, $value = NULL, $escape = TRUE)
{
$this->db->where( $key, $value, $escape);
}
function or_where($key, $value = NULL, $escape = TRUE)
{
$this->db->or_where( $key, $value, $escape);
}
function having($key, $value = NULL, $escape = TRUE)
{
$this->db->having( $key, $value, $escape);
}
function or_having($key, $value = NULL, $escape = TRUE)
{
$this->db->or_having( $key, $value, $escape);
}
function like($field, $match = '', $side = 'both')
{
$this->db->like($field, $match, $side);
}
function or_like($field, $match = '', $side = 'both')
{
$this->db->or_like($field, $match, $side);
}
function limit($value, $offset = '')
{
$this->db->limit( $value , $offset );
}
function get_total_results()
{
//set_relation_n_n special queries. We prefer sub queries from a simple join for the relation_n_n as it is faster and more stable on big tables.
if(!empty($this->relation_n_n))
{
$select = "{$this->table_name}.*";
$select = $this->relation_n_n_queries($select);
$this->db->select($select,false);
return $this->db->get($this->table_name)->num_rows();
}
else
{
return $this->db->get($this->table_name)->num_rows();
}
}
function set_basic_table($table_name = null)
{
if( !($this->db->table_exists($table_name)) )
return false;
$this->table_name = $table_name;
return true;
}
function get_edit_values($primary_key_value)
{
$primary_key_field = $this->get_primary_key();
$this->db->where($primary_key_field,$primary_key_value);
$result = $this->db->get($this->table_name)->row();
return $result;
}
function join_relation($field_name , $related_table , $related_field_title)
{
$related_primary_key = $this->get_primary_key($related_table);
if($related_primary_key !== false)
{
$unique_name = $this->_unique_join_name($field_name);
$this->db->join( $related_table.' as '.$unique_name , "$unique_name.$related_primary_key = {$this->table_name}.$field_name",'left');
$this->relation[$field_name] = array($field_name , $related_table , $related_field_title);
return true;
}
return false;
}
function set_relation_n_n_field($field_info)
{
$this->relation_n_n[$field_info->field_name] = $field_info;
}
protected function _unique_join_name($field_name)
{
return 'j'.substr(md5($field_name),0,8); //This j is because is better for a string to begin with a letter and not with a number
}
protected function _unique_field_name($field_name)
{
return 's'.substr(md5($field_name),0,8); //This s is because is better for a string to begin with a letter and not with a number
}
function get_relation_array($field_name , $related_table , $related_field_title, $where_clause, $order_by, $limit = null, $search_like = null)
{
$relation_array = array();
$field_name_hash = $this->_unique_field_name($field_name);
$related_primary_key = $this->get_primary_key($related_table);
$select = "$related_table.$related_primary_key, ";
if(strstr($related_field_title,'{'))
{
$related_field_title = str_replace(" ", " ", $related_field_title);
$select .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE(",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $field_name_hash";
}
else
{
$select .= "$related_table.$related_field_title as $field_name_hash";
}
$this->db->select($select,false);
if($where_clause !== null)
$this->db->where($where_clause);
if($where_clause !== null)
$this->db->where($where_clause);
if($limit !== null)
$this->db->limit($limit);
if($search_like !== null)
$this->db->having("$field_name_hash LIKE '%".$this->db->escape_like_str($search_like)."%'");
$order_by !== null
? $this->db->order_by($order_by)
: $this->db->order_by($field_name_hash);
$results = $this->db->get($related_table)->result();
foreach($results as $row)
{
$relation_array[$row->$related_primary_key] = $row->$field_name_hash;
}
return $relation_array;
}
function get_ajax_relation_array($search, $field_name , $related_table , $related_field_title, $where_clause, $order_by)
{
return $this->get_relation_array($field_name , $related_table , $related_field_title, $where_clause, $order_by, 10 , $search);
}
function get_relation_total_rows($field_name , $related_table , $related_field_title, $where_clause)
{
if($where_clause !== null)
$this->db->where($where_clause);
return $this->db->get($related_table)->num_rows();
}
function get_relation_n_n_selection_array($primary_key_value, $field_info)
{
$select = "";
$related_field_title = $field_info->title_field_selection_table;
$use_template = strpos($related_field_title,'{') !== false;;
$field_name_hash = $this->_unique_field_name($related_field_title);
if($use_template)
{
$related_field_title = str_replace(" ", " ", $related_field_title);
$select .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE(",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $field_name_hash";
}
else
{
$select .= "$related_field_title as $field_name_hash";
}
$this->db->select('*, '.$select,false);
$selection_primary_key = $this->get_primary_key($field_info->selection_table);
if(empty($field_info->priority_field_relation_table))
{
if(!$use_template){
$this->db->order_by("{$field_info->selection_table}.{$field_info->title_field_selection_table}");
}
}
else
{
$this->db->order_by("{$field_info->relation_table}.{$field_info->priority_field_relation_table}");
}
$this->db->where($field_info->primary_key_alias_to_this_table, $primary_key_value);
$this->db->join(
$field_info->selection_table,
"{$field_info->relation_table}.{$field_info->primary_key_alias_to_selection_table} = {$field_info->selection_table}.{$selection_primary_key}"
);
$results = $this->db->get($field_info->relation_table)->result();
$results_array = array();
foreach($results as $row)
{
$results_array[$row->{$field_info->primary_key_alias_to_selection_table}] = $row->{$field_name_hash};
}
return $results_array;
}
function get_relation_n_n_unselected_array($field_info, $selected_values)
{
$use_where_clause = !empty($field_info->where_clause);
$select = "";
$related_field_title = $field_info->title_field_selection_table;
$use_template = strpos($related_field_title,'{') !== false;
$field_name_hash = $this->_unique_field_name($related_field_title);
if($use_template)
{
$related_field_title = str_replace(" ", " ", $related_field_title);
$select .= "CONCAT('".str_replace(array('{','}'),array("',COALESCE(",", ''),'"),str_replace("'","\\'",$related_field_title))."') as $field_name_hash";
}
else
{
$select .= "$related_field_title as $field_name_hash";
}
$this->db->select('*, '.$select,false);
if($use_where_clause){
$this->db->where($field_info->where_clause);
}
$selection_primary_key = $this->get_primary_key($field_info->selection_table);
if(!$use_template)
$this->db->order_by("{$field_info->selection_table}.{$field_info->title_field_selection_table}");
$results = $this->db->get($field_info->selection_table)->result();
$results_array = array();
foreach($results as $row)
{
if(!isset($selected_values[$row->$selection_primary_key]))
$results_array[$row->$selection_primary_key] = $row->{$field_name_hash};
}
return $results_array;
}
function db_relation_n_n_update($field_info, $post_data ,$main_primary_key)
{
$this->db->where($field_info->primary_key_alias_to_this_table, $main_primary_key);
if(!empty($post_data))
$this->db->where_not_in($field_info->primary_key_alias_to_selection_table , $post_data);
$this->db->delete($field_info->relation_table);
$counter = 0;
if(!empty($post_data))
{
foreach($post_data as $primary_key_value)
{
$where_array = array(
$field_info->primary_key_alias_to_this_table => $main_primary_key,
$field_info->primary_key_alias_to_selection_table => $primary_key_value,
);
$this->db->where($where_array);
$count = $this->db->from($field_info->relation_table)->count_all_results();
if($count == 0)
{
if(!empty($field_info->priority_field_relation_table))
$where_array[$field_info->priority_field_relation_table] = $counter;
$this->db->insert($field_info->relation_table, $where_array);
}elseif($count >= 1 && !empty($field_info->priority_field_relation_table))
{
$this->db->update( $field_info->relation_table, array($field_info->priority_field_relation_table => $counter) , $where_array);
}
$counter++;
}
}
}
function db_relation_n_n_delete($field_info, $main_primary_key)
{
$this->db->where($field_info->primary_key_alias_to_this_table, $main_primary_key);
$this->db->delete($field_info->relation_table);
}
function get_field_types_basic_table()
{
$db_field_types = array();
foreach($this->db->query("SHOW COLUMNS FROM `{$this->table_name}`")->result() as $db_field_type)
{
$type = explode("(",$db_field_type->Type);
$db_type = $type[0];
if(isset($type[1]))
{
if(substr($type[1],-1) == ')')
{
$length = substr($type[1],0,-1);
}
else
{
list($length) = explode(" ",$type[1]);
$length = substr($length,0,-1);
}
}
else
{
$length = '';
}
$db_field_types[$db_field_type->Field]['db_max_length'] = $length;
$db_field_types[$db_field_type->Field]['db_type'] = $db_type;
$db_field_types[$db_field_type->Field]['db_null'] = $db_field_type->Null == 'YES' ? true : false;
$db_field_types[$db_field_type->Field]['db_extra'] = $db_field_type->Extra;
}
$results = $this->db->field_data($this->table_name);
foreach($results as $num => $row)
{
$row = (array)$row;
$results[$num] = (object)( array_merge($row, $db_field_types[$row['name']]) );
}
return $results;
}
function get_field_types($table_name)
{
$results = $this->db->field_data($table_name);
return $results;
}
function db_update($post_array, $primary_key_value)
{
$primary_key_field = $this->get_primary_key();
return $this->db->update($this->table_name,$post_array, array( $primary_key_field => $primary_key_value));
}
function db_insert($post_array)
{
$insert = $this->db->insert($this->table_name,$post_array);
if($insert)
{
return $this->db->insert_id();
}
return false;
}
function db_delete($primary_key_value)
{
$primary_key_field = $this->get_primary_key();
if($primary_key_field === false)
return false;
$this->db->limit(1);
$this->db->delete($this->table_name,array( $primary_key_field => $primary_key_value));
if( $this->db->affected_rows() != 1)
return false;
else
return true;
}
function db_file_delete($field_name, $filename)
{
if( $this->db->update($this->table_name,array($field_name => ''),array($field_name => $filename)) )
{
return true;
}
else
{
return false;
}
}
function field_exists($field,$table_name = null)
{
if(empty($table_name))
{
$table_name = $this->table_name;
}
return $this->db->field_exists($field,$table_name);
}
function get_primary_key($table_name = null)
{
if($table_name == null)
{
if(isset($this->primary_keys[$this->table_name]))
{
return $this->primary_keys[$this->table_name];
}
if(empty($this->primary_key))
{
$fields = $this->get_field_types_basic_table();
foreach($fields as $field)
{
if($field->primary_key == 1)
{
return $field->name;
}
}
return false;
}
else
{
return $this->primary_key;
}
}
else
{
if(isset($this->primary_keys[$table_name]))
{
return $this->primary_keys[$table_name];
}
$fields = $this->get_field_types($table_name);
foreach($fields as $field)
{
if($field->primary_key == 1)
{
return $field->name;
}
}
return false;
}
}
function escape_str($value)
{
return $this->db->escape_str($value);
}
}
Lalu simpan dengan nama grocery_crud_model.php pada directory model, Nah penjelasannya akan dipraktekkan pada video berikut :
Apabila ada error pada controllerVerifyLogin.php coba untuk dianalisa mana yang salahnya dan bandingkan pada script dibawah ini yang benar :
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class controllerVerifyLogin extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->model('modelUser','',TRUE);
}
function index()
{
//This method will have the credentials validation
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean');
$this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|callback_check_database');
if($this->form_validation->run() == FALSE)
{
//Field validation failed. User redirected to login page
$this->load->view('viewLogin');
}
else
{
//Go to private area
redirect('controllerAuthorized', 'refresh');
}
}
function check_database($password)
{
//Field validation succeeded. Validate against database
$username = $this->input->post('username');
//query the database
$result = $this->modelUser->login($username, $password);
if($result)
{
$sess_array = array();
foreach($result as $row)
{
$sess_array = array(
'id' => $row->id,
'username' => $row->username,
);
$this->session->set_userdata('logged_in', $sess_array);
}
return TRUE;
}
else
{
$this->form_validation->set_message('check_database', 'Invalid username or password');
return false;
}
}
}
?>
Apa bila masih ada yang error pada controllerAuthorized.php , cobalah analisa mana yang salah dan bandingkan dengan script yang benar dibawah ini :
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start(); //we need to call PHP's session object to access it through CI
class controllerAuthorized extends CI_Controller {
function __construct()
{
parent::__construct();
/* Standard Libraries of codeigniter are required */
$this->load->database();
$this->load->helper('url');
/* ------------------ */
$this->load->library('grocery_CRUD');
}
/*==============================================================================================================*/
public function index(){
if($this->session->userdata('logged_in')) {
$session_data = $this->session->userdata('logged_in');
/*$data['username'] = $session_data['username'];
$this->load->view('viewAuthorized', $data);*/
/* ## Filter user menggunakan username */
if($session_data['username']=='admin'){
$crud = new grocery_CRUD();
/*$crud->set_theme('datatables');*/
$crud->set_table('tbl_mhs');
$crud->set_subject('Data Mahasiswa');
$crud->unset_columns('id_mhs');
//DATA PENAMAAN ALIAS TABLE
$crud->display_as('nama_mhs','Nama')
->display_as('nim_mhs','NIM')
->display_as('tempat_lahir','Tempat Lahir')
->display_as('tanggal_lahir','Tanggal Lahir')
->display_as('alamat_asal','Alamat Asal')
->display_as('alamat_sekarang','Alamat Sekarang')
->display_as('telp','Telp/HP')
->display_as('email','Email')
->display_as('kelas_mhs','Kelas')
->display_as('dosen_wali','Dosen Wali')
->display_as('jurusan','Jurusan')
->display_as('fakultas','Fakultas');
$crud->set_relation('kelas_mhs','tbl_kelas','nama_kelas')
->set_relation('dosen_wali','tbl_dosen','nama_dosen')
->set_relation('jurusan','tbl_jurusan','{nama_jur} -- {tingkatan}')
->set_relation('fakultas','tbl_fakultas','nama_fakultas');
$crud->fields('nama_mhs','nim_mhs','tempat_lahir','tanggal_lahir','alamat_asal','alamat_sekarang',
'telp','email','dosen_wali','kelas_mhs','jurusan','fakultas')
->required_fields('fakultas','jurusan','dosen_wali','kelas_mhs','nama_mhs');
$output = $crud->render();
$this->groceryOutput($output);
}//End if filter user
else{
//Jika bukan user admin
redirect('controllerAuthorized/userPage', 'refresh');
}
}
else{
//If no session, redirect to login page
redirect('controllerLogin', 'refresh');
}
}
public function dataKelas(){
if($this->session->userdata('logged_in')) {
$session_data = $this->session->userdata('logged_in');
/*$data['username'] = $session_data['username'];
$this->load->view('viewAuthorized', $data);*/
/* ## Filter user menggunakan username */
if($session_data['username']=='admin'){
$crud = new grocery_CRUD();
/*$crud->set_theme('datatables');*/
$crud->set_table('tbl_kelas');
$crud->set_subject('Data Kelas');
$crud->unset_columns('id_kelas');
//DATA PENAMAAN ALIAS TABLE
$crud->display_as('nama_kelas','Deskripsi Kelas')
->display_as('kode_kelas','Kode Kelas')
->display_as('dosen_wali','Dosen Wali')
->display_as('jurusan','Jurusan')
->display_as('fakultas','Fakultas');
$crud->set_relation('dosen_wali','tbl_dosen','nama_dosen')
->set_relation('jurusan','tbl_jurusan','{nama_jur} -- {tingkatan}')
->set_relation('fakultas','tbl_fakultas','nama_fakultas');
$crud->fields('nama_kelas','kode_kelas','dosen_wali','fakultas','jurusan')
->required_fields('nama_kelas','kode_kelas','dosen_wali','fakultas','jurusan');
$output = $crud->render();
$this->groceryOutput($output);
}//End if filter user
else{
//Jika bukan user admin
redirect('controllerAuthorized/userPage', 'refresh');
}
}
else{
//If no session, redirect to login page
redirect('controllerLogin', 'refresh');
}
}
public function dataDosen(){
if($this->session->userdata('logged_in')) {
$session_data = $this->session->userdata('logged_in');
/*$data['username'] = $session_data['username'];
$this->load->view('viewAuthorized', $data);*/
/* ## Filter user menggunakan username */
if($session_data['username']=='admin'){
$crud = new grocery_CRUD();
/*$crud->set_theme('datatables');*/
$crud->set_table('tbl_dosen');
$crud->set_subject('Data Dosen');
$crud->unset_columns('id_dosen');
//DATA PENAMAAN ALIAS TABLE
$crud->display_as('nama_dosen','Nama Dosen')
->display_as('nip_dosen','NIP Dosen')
->display_as('jurusan','Jurusan');
$crud->set_relation('jurusan','tbl_jurusan','{nama_jur} -- {tingkatan}');
$crud->fields('nama_dosen','nip_dosen','jurusan')
->required_fields('nama_dosen','nip_dosen','jurusan');
$output = $crud->render();
$this->groceryOutput($output);
}//End if filter user
else{
//Jika bukan user admin
redirect('controllerAuthorized/userPage', 'refresh');
}
}
else{
//If no session, redirect to login page
redirect('controllerLogin', 'refresh');
}
}
public function dataJurusan(){
if($this->session->userdata('logged_in')) {
$session_data = $this->session->userdata('logged_in');
/*$data['username'] = $session_data['username'];
$this->load->view('viewAuthorized', $data);*/
/* ## Filter user menggunakan username */
if($session_data['username']=='admin'){
$crud = new grocery_CRUD();
/*$crud->set_theme('datatables');*/
$crud->set_table('tbl_jurusan');
$crud->set_subject('Data Jurusan');
$crud->unset_columns('id_jur');
//DATA PENAMAAN ALIAS TABLE
$crud->display_as('nama_jur','Jurusan')
->display_as('kode_jur','Kode Jurusan')
->display_as('tingkatan','Tingkatan')
->display_as('fakultas','Fakultas');
$crud->set_relation('fakultas','tbl_fakultas','nama_fakultas');
$crud->fields('nama_jur','kode_jur','tingkatan','fakultas')
->required_fields('nama_jur','kode_jur','tingkatan','fakultas');
$output = $crud->render();
$this->groceryOutput($output);
}//End if filter user
else{
//Jika bukan user admin
redirect('controllerAuthorized/userPage', 'refresh');
}
}
else{
//If no session, redirect to login page
redirect('controllerLogin', 'refresh');
}
}
public function dataFakultas(){
if($this->session->userdata('logged_in')) {
$session_data = $this->session->userdata('logged_in');
/*$data['username'] = $session_data['username'];
$this->load->view('viewAuthorized', $data);*/
/* ## Filter user menggunakan username */
if($session_data['username']=='admin'){
$crud = new grocery_CRUD();
$crud->set_table('tbl_fakultas');
$crud->set_subject('Data Fakultas');
$crud->columns('id_fak','nama_fakultas');
//DATA PENAMAAN ALIAS TABLE
$crud->display_as('id_fak','Nomor')
->display_as('nama_fakultas','Fakultas');
$crud->fields('nama_fakultas')
->required_fields('nama_fakultas');
$output = $crud->render();
$this->groceryOutput($output);
}//End if filter user
else{
//Jika bukan user admin
redirect('controllerAuthorized/userPage', 'refresh');
}
}
else{
//If no session, redirect to login page
redirect('controllerLogin', 'refresh');
}
}
public function userPage(){
if($this->session->userdata('logged_in')) {
$session_data = $this->session->userdata('logged_in');
/*$data['username'] = $session_data['username'];
$this->load->view('viewAuthorized', $data);*/
/* ## Filter user menggunakan username */
if($session_data['username']=='user'){
$crud = new grocery_CRUD();
/*$crud->set_theme('datatables');*/
$crud->set_table('tbl_mhs');
$crud->set_subject('Data Mahasiswa');
$crud->unset_columns('id_mhs');
$crud->unset_add();
$crud->unset_edit();
$crud->unset_delete();
$crud->unset_print();
$crud->unset_export();
//DATA PENAMAAN ALIAS TABLE
$crud->display_as('nama_mhs','Nama')
->display_as('nim_mhs','NIM')
->display_as('tempat_lahir','Tempat Lahir')
->display_as('tanggal_lahir','Tanggal Lahir')
->display_as('alamat_asal','Alamat Asal')
->display_as('alamat_sekarang','Alamat Sekarang')
->display_as('telp','Telp/HP')
->display_as('email','Email')
->display_as('kelas_mhs','Kelas')
->display_as('dosen_wali','Dosen Wali')
->display_as('jurusan','Jurusan')
->display_as('fakultas','Fakultas');
$crud->set_relation('kelas_mhs','tbl_kelas','nama_kelas')
->set_relation('dosen_wali','tbl_dosen','nama_dosen')
->set_relation('jurusan','tbl_jurusan','{nama_jur} -- {tingkatan}')
->set_relation('fakultas','tbl_fakultas','nama_fakultas');
$crud->fields('nama_mhs','nim_mhs','tempat_lahir','tanggal_lahir','alamat_asal','alamat_sekarang',
'telp','email','dosen_wali','kelas_mhs','jurusan','fakultas')
->required_fields('fakultas','jurusan','dosen_wali','kelas_mhs','nama_mhs');
$output = $crud->render();
$this->groceryOutputUser($output);
}//End if filter user
else{
//Jika bukan user admin
redirect('controllerAuthorized/noPrivilege', 'refresh');
}
}
else{
//If no session, redirect to login page
redirect('controllerLogin', 'refresh');
}
}
public function logout(){
$this->session->unset_userdata('logged_in');
session_destroy();
redirect('controllerAuthorized', 'refresh');
}
function groceryOutput($output = null){
$this->load->view('viewAuthorized.php',$output);
}
function groceryOutputUser($output = null){
$this->load->view('viewUser.php',$output);
}
}
?>