├── img ├── msg.gif ├── edit.png ├── delete.png ├── detail.png ├── big_bottom.gif ├── big_middle.gif ├── misc │ └── logo.jpg ├── smilies │ ├── cool.png │ ├── hmm.png │ ├── lol.png │ ├── mad.png │ ├── roll.png │ ├── sad.png │ ├── smile.png │ ├── wink.png │ ├── yikes.png │ ├── neutral.png │ ├── tongue.png │ └── big_smile.png └── users │ └── nobody.jpg ├── msg.css ├── login.php ├── inc ├── func.js ├── NotFound.php ├── Profile.php ├── Settings.php ├── Message.php ├── Page.php ├── Dashboard.php ├── Matakuliah.php ├── Dosen.php └── Mahasiswa.php ├── lib ├── AddSlashes.php ├── Session.php ├── Thumbnail.php ├── Auth.php └── MySQL.php ├── connect.php ├── index.php └── style.css /img/msg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/msg.gif -------------------------------------------------------------------------------- /img/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/edit.png -------------------------------------------------------------------------------- /img/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/delete.png -------------------------------------------------------------------------------- /img/detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/detail.png -------------------------------------------------------------------------------- /msg.css: -------------------------------------------------------------------------------- 1 | textarea{ 2 | width:100%; 3 | background-color:#F6E5A4; 4 | } 5 | 6 | -------------------------------------------------------------------------------- /img/big_bottom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/big_bottom.gif -------------------------------------------------------------------------------- /img/big_middle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/big_middle.gif -------------------------------------------------------------------------------- /img/misc/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/misc/logo.jpg -------------------------------------------------------------------------------- /img/smilies/cool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/smilies/cool.png -------------------------------------------------------------------------------- /img/smilies/hmm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/smilies/hmm.png -------------------------------------------------------------------------------- /img/smilies/lol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/smilies/lol.png -------------------------------------------------------------------------------- /img/smilies/mad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/smilies/mad.png -------------------------------------------------------------------------------- /img/smilies/roll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/smilies/roll.png -------------------------------------------------------------------------------- /img/smilies/sad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/smilies/sad.png -------------------------------------------------------------------------------- /img/smilies/smile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/smilies/smile.png -------------------------------------------------------------------------------- /img/smilies/wink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/smilies/wink.png -------------------------------------------------------------------------------- /img/smilies/yikes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/smilies/yikes.png -------------------------------------------------------------------------------- /img/users/nobody.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/users/nobody.jpg -------------------------------------------------------------------------------- /img/smilies/neutral.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/smilies/neutral.png -------------------------------------------------------------------------------- /img/smilies/tongue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/smilies/tongue.png -------------------------------------------------------------------------------- /img/smilies/big_smile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATA/dynebolic/master/img/smilies/big_smile.png -------------------------------------------------------------------------------- /login.php: -------------------------------------------------------------------------------- 1 | 9 | -------------------------------------------------------------------------------- /inc/func.js: -------------------------------------------------------------------------------- 1 | function makeMsg(uid){ 2 | var win = window.open('index.php?page=message&uid='+uid,'', 3 | 'width=350,height=480,scrollbars=no,resizable=no,status=yes,toolbar=no,location=no' 4 | ); 5 | return win; 6 | } 7 | -------------------------------------------------------------------------------- /lib/AddSlashes.php: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /inc/NotFound.php: -------------------------------------------------------------------------------- 1 | page .= << 6 |
7 |

Error.. Page Not Found... !!!

8 |
9 | 10 | 11 | EOD; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /connect.php: -------------------------------------------------------------------------------- 1 | 15 | -------------------------------------------------------------------------------- /lib/Session.php: -------------------------------------------------------------------------------- 1 | 27 | -------------------------------------------------------------------------------- /inc/Profile.php: -------------------------------------------------------------------------------- 1 | auth->session->get(POST_LOGIN_VAR); 7 | $result = $this->db->query("SELECT usr_id FROM tbl_users WHERE usr_login ='$usr_login'"); 8 | $row = $result->fetch(); 9 | if($this->privilege == MHS) { 10 | $content .= 'lihat nilai'; 11 | $content .= $this->displayDetailMhs($row['usr_id']); 12 | if(isset($_GET['view']) && $_GET['view']=='nilai'){ 13 | $content = $this->viewNilai($this->usr_id); 14 | } 15 | if(isset($_GET['view']) && $_GET['view']=='history_nilai'){ 16 | $mk_id = $_GET['mk_id']; 17 | $content = $this->historyNilai($this->usr_id,$mk_id); 18 | } 19 | } 20 | else{ 21 | $content = $this->displayDetailDosen($row['usr_id']); 22 | } 23 | $this->page .= << 25 |
26 | $content 27 |
28 | 29 | EOD; 30 | } 31 | } 32 | 33 | ?> 34 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | logout(); 17 | } 18 | if(!isset($_GET['page'])){ 19 | $page = new Dashboard('dashboard','Dashboard Page',$db,$auth); 20 | } 21 | else{ 22 | switch($_GET['page']){ 23 | case 'dashboard': $page = new Dashboard('dashboard','Dashboard Page',$db,$auth);break; 24 | case 'matakuliah': $page = new Matakuliah('matakuliah','Data matakuliah',$db,$auth);break; 25 | case 'mahasiswa': $page = new Mahasiswa('mahasiswa','Data Mahasiswa',$db,$auth);break; 26 | case 'dosen': $page = new Dosen('dosen','Data Dosen',$db,$auth);break; 27 | case 'profile': $page = new Profile('profile','halaman Profile',$db,$auth);break; 28 | case 'settings': $page = new Settings('settings','halaman Setting',$db,$auth);break; 29 | case 'message': $pgae = new Message('message','Pesan',$db,$auth);break; 30 | case 'notfound':$page = new NotFound('notfound','Not Found',$db,$auth);break; 31 | default:$page = new NotFound('notfound','Not Found',$db,$auth);break; 32 | } 33 | } 34 | ?> 35 | -------------------------------------------------------------------------------- /inc/Settings.php: -------------------------------------------------------------------------------- 1 | privilege != ADM){ 6 | header('Location:'.$_SERVER['PHP_SELF'].'?page=notfound'); 7 | } 8 | if(isset($_POST['save'])){ 9 | $this->storeSettings(); 10 | header('Location:'.$_SERVER['REQUEST_URI']); 11 | $status='
Setting Tersimpan!
'; 12 | } 13 | else{ 14 | $_POST = $this->getValueSettings(); 15 | } 16 | $uri = $_SERVER['REQUEST_URI']; 17 | $this->page .= '
'; 18 | $this->page .= '

Setting Website

'.$status; 19 | $this->page .= '
'; 20 | $this->page .= ''; 21 | $this->page .= ''; 22 | $this->page .= ''; 23 | $this->page .= ''; 24 | $this->page .= ''; 25 | $this->page .= ''; 26 | $this->page .= ''; 27 | $this->page .= ''; 28 | $this->page .= ''; 29 | $this->page .= ''; 30 | $this->page .= '
Nama prodi/Jurusan
Nama Lembaga/Pendidikan
Logo
Sambutan halaman depan:
'; 31 | $this->page .= '
'; 32 | } 33 | function getValueSettings(){ 34 | 35 | $res = $this->db->query("SELECT * FROM tbl_settings"); 36 | while($row = $res->fetch()){ 37 | $val[] = $row['set_value']; 38 | } 39 | $set['prodi'] = $val[0]; 40 | $set['universitas'] = $val[1]; 41 | $set['url_logo'] = $val[2]; 42 | $set['sambutan'] = $val[3]; 43 | return $set; 44 | } 45 | function storeSettings(){ 46 | $input = array_map('mysql_real_escape_string',$_POST); 47 | 48 | $this->db->query("UPDATE tbl_settings SET set_value='".$input['prodi']."' WHERE set_option='prodi'"); 49 | $this->db->query("UPDATE tbl_settings SET set_value='".$input['universitas']."' WHERE set_option='universitas'"); 50 | $this->db->query("UPDATE tbl_settings SET set_value='".$input['sambutan']."' WHERE set_option='sambutan'"); 51 | if($_FILES['url_logo']['type']== 'image/jpeg'){ 52 | move_uploaded_file($_FILES['url_logo']['tmp_name'],'img/misc/logo.jpg'); 53 | } 54 | } 55 | 56 | } 57 | 58 | ?> 59 | -------------------------------------------------------------------------------- /lib/Thumbnail.php: -------------------------------------------------------------------------------- 1 | initialfilesize = filesize($file); 11 | $this->imageproperties = getimagesize($file) or die('tipe file salah'); 12 | $this->mimetype = image_type_to_mime_type($this->imageproperties[2]); 13 | switch($this->imageproperties[2]){ 14 | case IMAGETYPE_JPEG: 15 | $this->image = imagecreatefromjpeg($file); 16 | break; 17 | case IMAGETYPE_GIF: 18 | $this->image = imagecreatefromgif($file); 19 | break; 20 | case IMAGETYPE_PNG: 21 | $this->image = imagecreatefrompng($file); 22 | break; 23 | default: 24 | die('tidak bisa membuat image'); 25 | } 26 | $this->createThumb($thumbsize); 27 | } 28 | function createThumb($thumbsize){ 29 | $srcW = $this->imageproperties[0]; 30 | $srcH = $this->imageproperties[1]; 31 | if($srcW > $thumbsize || $srcH > $thumbsize){ 32 | $reduction = $this->calculateReduction($thumbsize); 33 | $desW = $srcW / $reduction; 34 | $desH = $srcH / $reduction; 35 | $copy = imagecreatetruecolor($desW,$desH); 36 | imagecopyresampled($copy,$this->image,0,0,0,0,$desW,$desH,$srcW,$srcH) or die('gagal copy image'); 37 | imagedestroy($this->image); 38 | $this->image = $copy; 39 | } 40 | } 41 | function calculateReduction($thumbsize){ 42 | $srcW = $this->imageproperties[0]; 43 | $srcH = $this->imageproperties[1]; 44 | if($srcW < $srcH){ 45 | $reduction = round($srcH/$thumbsize); 46 | } 47 | else{ 48 | $reduction = round($srcW/$thumbsize); 49 | } 50 | return $reduction; 51 | } 52 | function getImage($output = ''){ 53 | header('Content-type:'.$this->mimetype); 54 | switch($this->imageproperties[2]){ 55 | case IMAGETYPE_JPEG: 56 | imagejpeg($this->image,$output,$this->quality); 57 | break; 58 | case IMAGETYPE_GIF: 59 | imagegif($this->image,$output); 60 | break; 61 | case IMAGETYPE_PNG: 62 | imagepng($this->image,$output,$this->quality); 63 | break; 64 | default: 65 | die('tidak bisa membuat image'); 66 | } 67 | } 68 | function setQuality($quality){ 69 | if($quality > 100 || $quality < 1){ 70 | $quality = 75; 71 | } 72 | if($this->imageproperties == IMAGETYPE_JPEG || $this->imageproperties == IMAGETYPE_PNG){ 73 | $this->quality = $quality; 74 | } 75 | } 76 | function getQuality(){ 77 | $quality = null; 78 | if($this->imageproperties == IMAGETYPE_JPEG || $this->imageproperties == IMAGETYPE_PNG){ 79 | $quality = $this->quality; 80 | } 81 | return $quality; 82 | } 83 | function getMimeType(){ 84 | return $this->mimetype; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /lib/Auth.php: -------------------------------------------------------------------------------- 1 | db = &$db; 17 | $this->login_page = $login_page; 18 | $this->session = &new Session(); 19 | $this->login(); 20 | } 21 | 22 | function login() { 23 | if($this->session->get('login_hash')){ 24 | $this->confirmAuth(); 25 | return; 26 | } 27 | if(isset($_POST[POST_LOGIN_VAR]) && isset($_POST[POST_LOGIN_PASS])){ 28 | $login = mysql_escape_string(strtolower($_POST[POST_LOGIN_VAR])); 29 | $password = mysql_escape_string(md5($_POST[POST_LOGIN_PASS])); 30 | $sql = "SELECT COUNT(*) AS num_users,".USER_PRIV." FROM " . TABLE_USERS ." 31 | WHERE 32 | " . USER_LOGIN . " = '$login' AND 33 | " . USER_PASS . " = '$password' 34 | GROUP BY usr_id"; 35 | //echo $sql; 36 | $result = $this->db->query($sql); 37 | $row = $result->fetch(); 38 | $privilege = $row[USER_PRIV]; 39 | if($row['num_users'] != 1){ 40 | $this->redirect(); 41 | } 42 | else{ 43 | $this->storeAuth($login,$password,$privilege); 44 | } 45 | } 46 | else{ 47 | $this->redirect(); 48 | } 49 | } 50 | 51 | function storeAuth($login, $password, $privilege){ 52 | $sql = "UPDATE ". TABLE_USERS . " SET " . USER_LAST_LOGIN . "=NOW() 53 | WHERE ".USER_LOGIN." = '$login' AND " .USER_PASS ."='$password'"; 54 | $this->db->query($sql); 55 | $this->session->set(POST_LOGIN_VAR, $login); 56 | $this->session->set(POST_LOGIN_PASS, $password); 57 | $this->session->set(USER_PRIV, $privilege); 58 | $hash_key = md5($this->hash_key . $login . $password . $privilege); 59 | $this->session->set('login_hash',$hash_key); 60 | } 61 | 62 | function confirmAuth(){ 63 | $login = $this->session->get(POST_LOGIN_VAR); 64 | $password = $this->session->get(POST_LOGIN_PASS); 65 | $privilege = $this->session->get(USER_PRIV); 66 | $hash_key = $this->session->get('login_hash'); 67 | if(md5($this->hash_key . $login . $password . $privilege) != $hash_key) { 68 | $this->logout(true); 69 | } 70 | } 71 | 72 | function getPrivilege(){ 73 | return $this->session->get(USER_PRIV); 74 | } 75 | 76 | function logout($from = false) { 77 | $this->session->del(POST_LOGIN_VAR); 78 | $this->session->del(USER_PASSW_VAR); 79 | $this->session->del('login_hash'); 80 | $this->session->del(USER_PRIV); 81 | $this->session->destroy(); 82 | $this->redirect($from); 83 | } 84 | 85 | function redirect($from = true){ 86 | if ($from){ 87 | header('Location:'.$this->login_page.'?from='.$_SERVER['REQUEST_URI']); 88 | } 89 | else{ 90 | header('Location:'.$this->login_page); 91 | } 92 | exit(); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /lib/MySQL.php: -------------------------------------------------------------------------------- 1 | host = $host; 14 | $this->dbUser = $dbUser; 15 | $this->dbPass = $dbPass; 16 | $this->dbName = $dbName; 17 | $this->displayError = $displayError; 18 | $this->connectToDb(); 19 | } 20 | function connectToDb(){ 21 | if(!$this->dbConn = @mysql_connect($this->host,$this->dbUser,$this->dbPass)){ 22 | if($this->displayError){ 23 | trigger_error('tidak bisa connect ke Database'); 24 | } 25 | $this->connectError = true; 26 | } 27 | else if(!@mysql_select_db($this->dbName,$this->dbConn)){ 28 | if($this->displayError){ 29 | trigger_error('data Base salah'); 30 | } 31 | $this->dbFalse = true; 32 | $this->connectError = true; 33 | } 34 | } 35 | function &query($sql){ 36 | if(!$result = mysql_query($sql,$this->dbConn)){ 37 | trigger_error('Kesalahan Query: '.mysql_error($this->dbConn).' SQL: '.$sql); 38 | echo 'Query input:' . $sql; 39 | } 40 | return new MySQLResult($this, $result); 41 | } 42 | function isError(){ 43 | if($this->connectError){ 44 | return true; 45 | } 46 | $error = mysql_error($this->dbConn); 47 | if(empty($error)){ 48 | return false; 49 | } 50 | else{ 51 | return true; 52 | } 53 | } 54 | } 55 | class MySQLResult{ 56 | var $mysql; 57 | var $query; 58 | var $result; 59 | function MySQLResult(&$mysql,$query){ 60 | $this->mysql = &$mysql; 61 | $this->query = $query; 62 | $this->result = ''; 63 | } 64 | function fetch(){ 65 | if($row = mysql_fetch_assoc($this->query)){ 66 | return $row; 67 | } 68 | else if($this->size() > 0){ 69 | return false; 70 | } 71 | else{ 72 | return false; 73 | } 74 | } 75 | function fetch_row(){ 76 | if($row = mysql_fetch_row($this->query)){ 77 | return $row; 78 | } 79 | else if($this->size() > 0){ 80 | return false; 81 | } 82 | else{ 83 | return false; 84 | } 85 | } 86 | function lenght_field(){ 87 | return mysql_num_fields($this->query);; 88 | } 89 | function field_name($no){ 90 | return mysql_field_name($this->query,$no); 91 | } 92 | function size(){ 93 | return mysql_num_rows($this->query); 94 | } 95 | function tableResult(){ 96 | $this->result = ''; 97 | for ($i = 0; $i < $this->lenght_field(); $i++){ 98 | $this->result .= ''; 99 | } 100 | $this->result .= ''; 101 | while ($row = $this->fetch_row()){ 102 | $this->result .= ''; 103 | for($i = 0; $i < $this->lenght_field();$i++){ 104 | $this->result .= ''; 105 | } 106 | $this->result .= ''; 107 | } 108 | $this->result .= '
'.$this->field_name($i).'
'.$row[$i].'
'; 109 | return $this->result; 110 | } 111 | function isError(){ 112 | return $this->mysql->isError(); 113 | } 114 | } 115 | ?> 116 | -------------------------------------------------------------------------------- /inc/Message.php: -------------------------------------------------------------------------------- 1 | getImage(); 10 | } 11 | $this->page .= << 13 | 14 | 15 | Sistem Informasi Wali - $this->title 16 | 17 | 18 | 19 | 20 | 21 | EOD; 22 | $page->page .= 'Halaman Pesan'; 23 | } 24 | function Message($id,$title,&$db,&$auth){ 25 | $this->page = ''; 26 | $this->id = $id; 27 | $this->title = $title; 28 | $this->db = &$db; 29 | $this->auth =&$auth; 30 | $this->privilege = $this->auth->getPrivilege(); 31 | $this->login = $this->auth->session->get(POST_LOGIN_VAR); 32 | $res = $this->db->query("SELECT usr_id FROM tbl_users WHERE usr_login='$this->login'"); 33 | $row = $res->fetch(); 34 | $this->usr_id = $row['usr_id']; 35 | $this->addHeader(); 36 | $this->addContent(); 37 | $this->addFooter(); 38 | $this->display(); 39 | } 40 | function addContent(){ 41 | $smile = array( 42 | ':D' => '', 43 | '8,' => '', 44 | ':/' => '', 45 | ':))' => '', 46 | ':C' => '', 47 | ':|' => '', 48 | '8/' => '', 49 | ':(' => '', 50 | ':)' => '', 51 | ':b' => '', 52 | ';)' => '', 53 | ':()' => '', 54 | ); 55 | $uri = $_SERVER['REQUEST_URI']; 56 | $self = $_SERVER['PHP_SELF']; 57 | if(isset($_POST['send'])){ 58 | $uid = $_GET['uid']; 59 | $pesan = mysql_real_escape_string($_POST['pesan']); 60 | $pesan = strip_tags($pesan,''); 61 | $pesan = str_replace(array_keys($smile),array_values($smile),$pesan); 62 | $pesan = trim($pesan); 63 | $this->db->query("INSERT INTO tbl_pesan(usr_id_asal,usr_id_tujuan,pesan_isi) 64 | VALUE($this->usr_id,$uid,'$pesan')"); 65 | 66 | } 67 | if(!isset($_GET['view'])){ 68 | $uid = $_GET['uid']; 69 | $res = $this->db->query("SELECT usr_nama, usr_url_pic FROM tbl_users WHERE usr_id=$uid"); 70 | $row = $res->fetch(); 71 | $nama = $row['usr_nama']; 72 | $pic = $row['usr_url_pic']; 73 | $this->page .= << 75 | 76 | 77 | 78 | 79 | 80 | 81 | 85 | 86 |
$nama
82 | Pesan | 83 | History 84 |
87 |

88 |

95 | 102 | EOD; 103 | foreach($smile as $key => $img){ 104 | $this->page .= ''.$img.' '; 105 | } 106 | $this->page .= << 108 |
109 |
110 | 111 |
112 |

copyright © kelompok Dyne:Bolic

113 | EOD; 114 | } 115 | else if($_GET['view'] == 'read'){ 116 | $this->chatBoard(); 117 | } 118 | else if($_GET['view'] == 'history'){ 119 | $this->chatBoard(10000); 120 | } 121 | } 122 | 123 | function chatBoard($limit = 20){ 124 | $uid = $_GET['uid']; 125 | $sql = <<usr_id AND tbl_pesan.usr_id_tujuan = $uid ) 130 | OR (tbl_pesan.usr_id_asal = $uid AND tbl_pesan.usr_id_tujuan = $this->usr_id )) 131 | AND tbl_users.usr_id = tbl_pesan.usr_id_asal 132 | ORDER by pesan_id DESC LIMIT 0,$limit 133 | EOD; 134 | $res = $this->db->query($sql); 135 | $message = array(); 136 | while($row = $res->fetch()){ 137 | $message[] = '

'.$row['usr_nama'].' :
'.$row['pesan_isi'].'

'; 138 | } 139 | for($i = count($message) - 1; $i >= 0; $i-- ){ 140 | $this->page .= $message[$i]; 141 | } 142 | $this->db->query("UPDATE tbl_pesan SET pesan_status = 1 WHERE usr_id_tujuan = $this->usr_id AND usr_id_asal = $uid"); 143 | $this->page .= ''; 144 | } 145 | 146 | function addFooter(){ 147 | $this->page .= << 149 | 150 | EOD; 151 | } 152 | } 153 | 154 | ?> 155 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | body{ 2 | font-family:Verdana, Arial, Helvetica, sans-serif; 3 | font-size:0.8em; 4 | padding:0; 5 | margin:0; 6 | background: #F0F0F0; 7 | color:#333333; 8 | text-align:center; 9 | } 10 | .wraper{ 11 | width:768px; 12 | background:url(img/big_middle.gif) repeat-y; 13 | text-align:center; 14 | margin:0 auto; 15 | } 16 | .main{ 17 | margin:0; 18 | padding:0 10px 10px 10px; 19 | background:url(img/big_bottom.gif) no-repeat bottom left; 20 | } 21 | .header{ 22 | position:relative; 23 | height:150px; 24 | padding:0; 25 | margin:0 auto; 26 | border-bottom:1px solid #999999; 27 | } 28 | #logo{ 29 | text-transform:capitalize; 30 | position:absolute; 31 | top:0; 32 | left:20px; 33 | width:150px; 34 | height:150px; 35 | text-align:center; 36 | } 37 | #logo h3{ 38 | position:absolute; 39 | font-size:12px; 40 | padding:0; 41 | margin:0; 42 | bottom:0; 43 | right:0; 44 | left:0; 45 | } 46 | #logo h2{ 47 | text-transform:uppercase; 48 | position:absolute; 49 | color:#FF0006; 50 | font-size:14px; 51 | padding:0; 52 | margin:0; 53 | right:0; 54 | left:0; 55 | bottom:30px;; 56 | } 57 | #logo img{ 58 | /*height:120px; 59 | width:120px;*/ 60 | margin:0 auto; 61 | } 62 | #status{ 63 | position:absolute; 64 | right:0; 65 | top:5px; 66 | } 67 | #status p{ 68 | margin:0; 69 | padding:0; 70 | } 71 | #name{ 72 | text-align:right; 73 | position:absolute; 74 | bottom:10px; 75 | right:0; 76 | } 77 | #name h2{ 78 | font-size:30px; 79 | text-transform:capitalize; 80 | padding:0; 81 | margin:0; 82 | } 83 | #name h3{ 84 | text-transform:uppercase; 85 | padding:0; 86 | margin:0; 87 | } 88 | .menu{ 89 | text-align:left; 90 | background:#F5F5F5; 91 | font-size:90%; 92 | } 93 | .menu ul{ 94 | list-style:none; 95 | margin:0; 96 | margin-left:220px; 97 | padding:0; 98 | padding-top:1em; 99 | } 100 | .menu li{ 101 | display:inline; 102 | } 103 | .menu a:link,.menu a:visited{ 104 | padding:0.4em 1em 0 1em; 105 | color:#404040; 106 | background:#FFFFFF; 107 | text-decoration:none; 108 | font-weight:bold; 109 | border:1px solid #999999; 110 | border-bottom:none; 111 | } 112 | .menu a:hover{ 113 | padding:0.6em 1em 0 1em; 114 | } 115 | .content{ 116 | background:#F5F5F5; 117 | text-align:left; 118 | border-top:1px solid #999999; 119 | } 120 | #content{ 121 | margin:10px; 122 | text-align:left; 123 | } 124 | #content #result{ 125 | text-align:center; 126 | } 127 | #content #paging{ 128 | text-align:center; 129 | } 130 | #content #paging a{ 131 | margin:5px; 132 | } 133 | #result h2{ 134 | margin:10px 0; 135 | padding:0; 136 | } 137 | #content table{ 138 | margin:0 auto; 139 | text-align:left; 140 | } 141 | #content th{ 142 | color:#FFFFFF; 143 | background:#333333; 144 | padding:5px 5px; 145 | } 146 | #content td{ 147 | padding:5px; 148 | vertical-align:top; 149 | } 150 | #content a:link, #content a:visited{ 151 | text-decoration:none; 152 | color:#0011FF; 153 | border:none; 154 | } 155 | #content a:hover{ 156 | text-decoration:underline; 157 | } 158 | #content img{ 159 | border:none; 160 | } 161 | .maincontent{ 162 | background-color:#FFFFFF; 163 | float:left; 164 | width:auto; 165 | margin:0 ; 166 | width:547px; 167 | border-left:1px solid #999999; 168 | border-bottom:1px solid #999999; 169 | } 170 | .sidebar{ 171 | text-align:center; 172 | width:200px; 173 | margin:0; 174 | margin-top:-2px; 175 | float:left; 176 | background:#F5F5F5; 177 | padding:0; 178 | } 179 | .boxside{ 180 | font-size:10px; 181 | text-align:left; 182 | margin:10px; 183 | margin-top:0; 184 | margin-left:0; 185 | background:#FFFFFF; 186 | padding:0; 187 | border:1px solid #999999; 188 | } 189 | .boxside h4{ 190 | font-size:12px; 191 | color:#FFFFFF; 192 | background-color:#333333; 193 | padding:3px; 194 | margin:-1px; 195 | margin-bottom:5px; 196 | } 197 | .boxside a:link,.boxside a:visited{ 198 | margin-left:5px; 199 | text-decoration:none; 200 | color:#333333; 201 | } 202 | .boxside table{ 203 | } 204 | .boxside td{ 205 | background-color:#F5F5F5; 206 | vertical-align:top; 207 | } 208 | .boxside p{ 209 | margin:5px; 210 | text-align:center; 211 | } 212 | .boxside img{ 213 | border:none; 214 | } 215 | .footer{ 216 | background-color:#FFFFFF; 217 | border-top:1px solid #CCCCCC; 218 | clear:both; 219 | margin:0 auto; 220 | height:30px; 221 | text-align:right; 222 | } 223 | .footer p{ 224 | margin-top:5px; 225 | } 226 | #formlogin{ 227 | font-weight:bold; 228 | width:160px; 229 | text-align:left; 230 | margin:20px auto; 231 | } 232 | #form input,#form select,#form textarea{ 233 | width:200px; 234 | background-color:#FFF4E8; 235 | } 236 | #form input:focus,#form select:focus,#form textarea:focus{ 237 | background-color:#FFDA89; 238 | } 239 | #form textarea{ 240 | height:100px; 241 | } 242 | #form #submit{ 243 | margin-top:20px; 244 | } 245 | .t{ 246 | width:520px; 247 | } 248 | .t td{ 249 | background-color:#F8F8F8; 250 | } 251 | #dash table{ 252 | width:520px; 253 | } 254 | #dash td{ 255 | background-color:#F5F5F5; 256 | vertical-align:top; 257 | } 258 | #dash textarea{ 259 | width:300px; 260 | } 261 | #msgerror{ 262 | background-color:#FFDDDD; 263 | border:2px solid #FF0000; 264 | font-size:small; 265 | color:#FF0000; 266 | } 267 | #saveedit{ 268 | background-color:#C4FBC8; 269 | padding:5px; 270 | text-align:center; 271 | border:2px solid #00FF13; 272 | color:#00A30C; 273 | margin:0 100px; 274 | } 275 | textarea#lebar{ 276 | width:400px; 277 | height:300px; 278 | } 279 | -------------------------------------------------------------------------------- /inc/Page.php: -------------------------------------------------------------------------------- 1 | page = ''; 16 | $this->db = &$db; 17 | $this->id = $id; 18 | $this->title = $title; 19 | $this->addHeader(); 20 | $this->addSidebar(); 21 | $this->addContent(); 22 | $this->addFooter(); 23 | $this->display(); 24 | } 25 | 26 | function addHeader(){ 27 | if(isset($_GET['img']) && isset($_GET['size'])){ 28 | $img = $_GET['img']; 29 | $size = $_GET['size']; 30 | $thumb = new Thumbnail($img,$size); 31 | $thumb->getImage(); 32 | } 33 | $q_prodi = "SELECT set_value FROM tbl_settings WHERE set_option='prodi'"; 34 | $q_univ = "SELECT set_value FROM tbl_settings WHERE set_option='universitas'"; 35 | $q_url_logo = "SELECT set_value FROM tbl_settings WHERE set_option='url_logo'"; 36 | 37 | $rs_prodi = $this->db->query($q_prodi); 38 | $rs_univ = $this->db->query($q_univ); 39 | $rs_url_logo = $this->db->query($q_url_logo); 40 | 41 | $r_prodi = $rs_prodi->fetch(); 42 | $r_univ = $rs_univ->fetch(); 43 | $r_url_logo = $rs_url_logo->fetch(); 44 | // set variabel 45 | $prodi = $r_prodi['set_value']; 46 | $univ = $r_univ['set_value']; 47 | $url_logo = $r_url_logo['set_value']; 48 | session_start(); 49 | if(isset($_SESSION['login_hash'])){ 50 | $usr_login = $_SESSION[POST_LOGIN_VAR]; 51 | $sql = "SELECT usr_nama FROM tbl_users WHERE usr_login ='$usr_login'"; 52 | $res = $this->db->query($sql); 53 | $row = $res->fetch(); 54 | $status = 'Anda login sebagai '.$row['usr_nama'].' | Log Out'; 55 | $sql = "UPDATE ". TABLE_USERS . " SET " . USER_LAST_LOGIN . "=NOW() 56 | WHERE ".USER_LOGIN." = '$usr_login'"; 57 | $this->db->query($sql); 58 | } 59 | else{ 60 | $status = ''; 61 | } 62 | $self = $_SERVER['PHP_SELF']; 63 | $icon = $self.'?size=20&img='.$url_logo; 64 | $logo = $self.'?size=130&img='.$url_logo; 65 | $this->page .= << 67 | 68 | 69 | Sistem Informasi Wali - $this->title 70 | 71 | 72 | 73 | 74 | 75 | 82 | 83 | 84 |
85 |
86 |
87 | 92 |
93 |

$status

94 |
95 |
96 |

$prodi

97 |

$univ

98 |
99 |
100 | 101 | EOD; 102 | } 103 | 104 | function addSidebar(){ 105 | if(!isset($_GET['from'])){ 106 | $target = 'index.php'; 107 | } 108 | else{ 109 | $target = $_GET['from']; 110 | } 111 | $this->page .=<< 113 | 122 | EOD; 123 | 124 | } 125 | 126 | function addContent(){ 127 | $q_content = "SELECT set_value FROM tbl_settings WHERE set_option='sambutan'"; 128 | $rs_content = $this->db->query($q_content); 129 | $r_content = $rs_content->fetch(); 130 | $content = $r_content['set_value']; 131 | $this->page .= << 133 |
134 |
135 | $content 136 |
137 |
138 |
139 | 140 | EOD; 141 | } 142 | function addFooter(){ 143 | $this->page .= << 145 |

copyright © kelompok Dyne:Bolic

146 |
147 | 148 | 149 | 150 | 151 | 152 | EOD; 153 | } 154 | function setPaging($sql_nolimit, $page_entry){ 155 | $current_page = isset($_GET['current_page']) ? $_GET['current_page'] : 0; 156 | $self = $_SERVER['PHP_SELF']; 157 | $req_uri = $_SERVER['REQUEST_URI']; 158 | $res = $this->db->query($sql_nolimit); 159 | $size_res = $res->size(); 160 | $total_page = ceil($size_res / $page_entry); 161 | 162 | $page_str = ''; 163 | // jika berada pada halaman ketiga atau lebih 164 | if ($current_page > 1) { 165 | $page_str .= ' <<pertama '; 166 | } 167 | // jika berada pada halaman kedua atau lebih 168 | if ($current_page > 0) { 169 | $previous = $current_page - 1; 170 | $page_str .= ' <sebelumnya '; 171 | } 172 | // ambil semua no halamn dan jadikan link (kecuali berada pada halaman tsb ) 173 | for ($i = 0; $i < $total_page ; $i++) { 174 | $current = $i + 1; 175 | if($i == $current_page){ 176 | $page_str .= ''. $current.''; 177 | } 178 | else{ 179 | $page_str .= ' '.$current .' '; 180 | } 181 | } 182 | if ($current_page < ($total_page - 1)) { 183 | $next = $current_page + 1; 184 | $page_str .= ' selanjutnya> '; 185 | } 186 | if ($current_page < ($total_page - 2)) { 187 | $last = $total_page - 1; 188 | $page_str .= ' terakhir>> '; 189 | } 190 | return $page_str; 191 | } 192 | function display(){ 193 | echo $this->page; 194 | } 195 | } 196 | 197 | ?> 198 | -------------------------------------------------------------------------------- /inc/Dashboard.php: -------------------------------------------------------------------------------- 1 | page = ''; 10 | $this->id = $id; 11 | $this->title = $title; 12 | $this->db = &$db; 13 | $this->auth =&$auth; 14 | $this->privilege = $this->auth->getPrivilege(); 15 | $this->login = $this->auth->session->get(POST_LOGIN_VAR); 16 | $this->usr_login = $this->login; 17 | $res = $this->db->query("SELECT usr_id FROM tbl_users WHERE usr_login='$this->login'"); 18 | $row = $res->fetch(); 19 | $this->usr_id = $row['usr_id']; 20 | $this->addHeader(); 21 | $this->addMenu(); 22 | $this->addSidebar(); 23 | $this->addContent(); 24 | $this->addFooter(); 25 | $this->display(); 26 | } 27 | function addmenu(){ 28 | $self = $_SERVER['PHP_SELF']; 29 | $this->page .= << 31 | '; 43 | } 44 | function addSidebar(){ 45 | if($this->privilege == MHS){ 46 | $info = $this->getStatusKontrak(); 47 | } 48 | else{ 49 | $info = $this->getAjuanKontrak(); 50 | } 51 | $how_online = $this->getHowOnline(); 52 | $message = $this->getMessage(); 53 | $this->page .=<< 55 | 66 | EOD; 67 | } 68 | function getHowOnline(){ 69 | $sql = "SELECT usr_login, usr_nama,usr_last_login,usr_privilege,usr_id FROM tbl_users WHERE (NOW() - usr_last_login) < 1200 ORDER BY usr_last_login DESC"; 70 | $res = $this->db->query($sql); 71 | $self = $_SERVER['PHP_SELF']; 72 | $ho = '

20 menit terakhir

'; 73 | if($res->size() != 0){ 74 | while($row = $res->fetch()){ 75 | if($row['usr_privilege'] == MHS){ 76 | $ho .= ''.$row['usr_nama'].' '; 77 | } 78 | else if($row['usr_privilege'] == DSN){ 79 | $ho .= ''.$row['usr_nama'].' ';; 80 | } 81 | else{ 82 | $ho .= ''.$row['usr_nama'].''; 83 | } 84 | if($row['usr_login'] != $this->auth->session->get(POST_LOGIN_VAR)){ 85 | $ho .= 'db->query("DELETE FROM tbl_kontrak WHERE kontrak_id = $kontrak_id"); 100 | } 101 | if(isset($_POST['ajukan'])){ 102 | $this->db->query("UPDATE tbl_kontrak SET kontrak_status = 1 WHERE kontrak_status=0 103 | AND mhs_id = (SELECT mhs_id FROM tbl_mahasiswa WHERE usr_id = $this->usr_id)"); 104 | } 105 | $display = ''; 106 | $display .= '

Status Matakuliah

'; 107 | if($this->setListStatus() != false){ 108 | $display .= '

Matakuliah yang akan di ajukan:

'; 109 | $display .= $this->setListStatus(); 110 | $display .= '
'; 111 | } 112 | else if($this->setListStatus(1) != false){ 113 | $display .= '

Matakuliah yang sudah di ajukan:

'; 114 | $display .= $this->setListStatus(1); 115 | } 116 | else if($this->setListStatus(2) != false){ 117 | $display .= '

Matakuliah yang di ajukan yaitu :

'; 118 | $display .= $this->setListStatus(2); 119 | $display .= '

Sudah disetujui Oleh wali

'; 120 | } 121 | else{ 122 | $display .= '

No Activity

'; 123 | } 124 | return $display; 125 | } 126 | function setListStatus($status = 0,$lokasi = 'side',$uid = null){ 127 | if($uid != null){ 128 | $usr_id = $uid; 129 | } 130 | else{ 131 | $usr_id = $this->usr_id; 132 | } 133 | $display = ''; 134 | $sql=<<db->query($sql); 153 | if($res->size() > 0){ 154 | $display .= ''; 155 | if($lokasi == 'main'){ 156 | $display .= ''; 157 | if($status == 0){ 158 | $display .= ''; 159 | } 160 | $display .=''; 161 | } 162 | $jml_sks = 0; 163 | while($row = $res->fetch()){ 164 | $display .= ''; 167 | if($lokasi == 'main'){ 168 | $display .= ''; 169 | } 170 | if($status == 0){ 171 | $display .= ''; 178 | $jml_sks += $row['mk_sks']; 179 | } 180 | if($status == 0){ 181 | $col = ($lokasi == 'main')? 5 : 3; 182 | } 183 | else{ 184 | $col = ($lokasi == 'main')? 4 : 2; 185 | } 186 | $display .= ''; 187 | $display .= '
KodeNama MatakuliahsksDosenbatal
'.$row['mk_kode'].''; 165 | $display .= ''; 166 | $display .= $row['mk_nama'].''.$row['mk_sks'].''.$row['usr_nama'].''; 172 | $display .= ''; 173 | $display .= ''; 174 | $display .= ''; 175 | $display .= ''; 176 | } 177 | $display .= '
Total SKS : '.$jml_sks.'
'; 188 | if($status == 0){ 189 | $display .= '
'; 190 | $display .= '

'; 191 | } 192 | }else{ 193 | $display = false; 194 | } 195 | return $display; 196 | } 197 | function getAjuanKontrak($lokasi='side'){ 198 | $display = ''; 199 | $sql = <<usr_id) 214 | GROUP BY tbl_kontrak.mhs_id 215 | ORDER BY tbl_kontrak.kontrak_waktu 216 | EOD; 217 | $res = $this->db->query($sql); 218 | $display .= '

Ajuan Kontrak

'; 219 | if($res->size() > 0){ 220 | $display .= ''; 221 | if($lokasi == 'main'){ 222 | $display .= ''; 223 | } 224 | while($row = $res->fetch()){ 225 | $display .= ''; 226 | $display .= ''; 228 | if($lokasi == 'main'){ 229 | $display .= ''; 230 | } 231 | $display .= ''; 232 | } 233 | $display .= '
NIMNamaSKS Kontrak
'.$row['mhs_nim'].''; 227 | $display .= $row['usr_nama'].''.$row['sks_kontrak'].'
'; 234 | } 235 | else{ 236 | $display .= '

Tidak ada ajuan

'; 237 | } 238 | return $display; 239 | } 240 | function getMessage(){ 241 | $display = ''; 242 | $sql = <<usr_id 251 | AND tbl_pesan.pesan_status = 0 252 | AND tbl_pesan.usr_id_asal = tbl_users.usr_id 253 | GROUP BY tbl_users.usr_id 254 | EOD; 255 | $res = $this->db->query($sql); 256 | $display .= '

Status Pesan

'; 257 | if($res->size() > 0){ 258 | while($row = $res->fetch()){ 259 | if($row['usr_privilege'] == MHS){ 260 | $display .= '
'.$row['usr_nama'].' '; 261 | } 262 | else if($row['usr_privilege'] == DSN){ 263 | $display .= ''.$row['usr_nama'].' ';; 264 | } 265 | else{ 266 | $display .= ''.$row['usr_nama'].''; 267 | } 268 | $display .= '
'; 270 | } 271 | } 272 | else{ 273 | $display .= '

Tidak ada pesan

'; 274 | } 275 | return $display; 276 | } 277 | function addContent(){ 278 | $content = ''; 279 | if($this->privilege == MHS){ 280 | if($this->setListStatus() != false){ 281 | $content .= '

Matakuliah yang akan di ajukan:

'; 282 | $content .= $this->setListStatus(0,'main'); 283 | $content .= '
'; 284 | } 285 | else if($this->setListStatus(1) != false){ 286 | $content .= '

Matakuliah yang sudah di ajukan:

'; 287 | $content .= $this->setListStatus(1,'main'); 288 | } 289 | else if($this->setListStatus(2) != false){ 290 | $content .= '

Matakuliah yang di ajukan yaitu :

'; 291 | $content .= $this->setListStatus(2,'main'); 292 | $content .= '

Sudah disetujui Oleh wali

'; 293 | } 294 | else{ 295 | $content .= '

No Activity

'; 296 | } 297 | } 298 | else{ 299 | if(isset($_GET['view']) && $_GET['view'] == 'kontrak_detail'){ 300 | if(isset($_GET['uid'])){ 301 | $uid = $_GET['uid']; 302 | $content .= $this->detailKontrak($uid); 303 | } 304 | } 305 | else{ 306 | $content .= $this->getAjuanKontrak('main'); 307 | } 308 | } 309 | if($this->privilege != MHS){ 310 | $content .= '

Statistik Jumlah Mahasiswa yang mengontrak

'; 311 | $content .= $this->getBebanDosen($this->usr_id); 312 | } 313 | if($this->privilege == ADM){ 314 | $content .= '

Statik beban Dosen Lain

'; 315 | $content .= $this->getStaticDosen(); 316 | } 317 | if(isset($_GET['view']) && isset($_GET['id']) && $_GET['view'] == 'isi_nilai'){ 318 | $mk_id = $_GET['id']; 319 | $content = $this->isiNilai($mk_id); 320 | } 321 | $this->page .= << 323 |
324 |
325 | $content 326 |
327 |
328 | 329 | EOD; 330 | } 331 | function getBebanDosen($uid){ 332 | $display = ''; 333 | $sql = <<db->query($sql); 343 | $display .= ''; 344 | $display .= ''; 345 | if($uid == $this->usr_id){ 346 | $display .= ''; 347 | } 348 | $display .=''; 349 | while($row = $res->fetch()){ 350 | $display .= ''; 351 | $display .= ''; 352 | $display .= ''; 353 | if($uid == $this->usr_id){ 354 | $display .= ''; 355 | } 356 | $display .= ''; 357 | } 358 | $display .= '
kodeNama MatakuliahJumlah Mahasiswanilai
'.$row['mk_kode'].''.$row['mk_nama'].''.$this->jumlahMhs($uid,$row['mk_id']).' nilai
'; 359 | return $display; 360 | } 361 | function getStaticDosen(){ 362 | $display = ''; 363 | $res = $this->db->query("SELECT tbl_users.usr_id,tbl_users.usr_nama 364 | FROM tbl_users,tbl_dosen,tbl_mk_dsn 365 | WHERE tbl_dosen.usr_id = tbl_users.usr_id 366 | AND tbl_dosen.dsn_id = tbl_mk_dsn.dsn_id 367 | GROUP BY tbl_users.usr_id 368 | "); 369 | while($row = $res->fetch()){ 370 | $display .= ' 424 | 425 | 426 | 427 | 428 | 429 |
'.$row['usr_nama']; 371 | $display .= ' getBebanDosen($row['usr_id']); 375 | $display .= '

'; 376 | } 377 | return $display; 378 | } 379 | function jumlahMhs($uid,$mk_id){ 380 | $res = $this->db->query("SELECT kontrak_id FROM tbl_kontrak 381 | WHERE dsn_id = (SELECT dsn_id FROM tbl_dosen WHERE usr_id=$uid) 382 | AND mk_id = $mk_id 383 | AND kontrak_status > 1 384 | "); 385 | $size = $res->size(); 386 | return $size; 387 | } 388 | function detailKontrak($uid){ 389 | $content = ''; 390 | 391 | if(isset($_POST['ok'])){ 392 | $pesan = mysql_real_escape_string($_POST['pesan']); 393 | $pesan = strip_tags($pesan,''); 394 | $pesan = trim($pesan); 395 | if(!empty($pesan)){ 396 | $this->db->query("INSERT INTO tbl_pesan(usr_id_asal,usr_id_tujuan,pesan_isi) 397 | VALUE($this->usr_id,$uid,'$pesan') 398 | "); 399 | } 400 | if($_POST['ok'] == 'terima'){ 401 | $this->db->query("UPDATE tbl_kontrak SET kontrak_status = 2 402 | WHERE mhs_id = (SELECT mhs_id FROM tbl_mahasiswa WHERE usr_id = $uid) 403 | AND kontrak_status = 1 404 | "); 405 | $this->db->query("UPDATE tbl_mahasiswa SET mhs_semester = (mhs_semester +1) 406 | WHERE usr_id = $uid"); 407 | header('Location:'.$SERVER['PHP_SELF'].'?page=dashboard'); 408 | } 409 | else{ 410 | $this->db->query("UPDATE tbl_kontrak SET kontrak_status = 0 411 | WHERE mhs_id = (SELECT mhs_id FROM tbl_mahasiswa WHERE usr_id = $uid) 412 | AND kontrak_status = 1 413 | "); 414 | header('Location:'.$SERVER['PHP_SELF'].'?page=dashboard'); 415 | } 416 | } 417 | $res = $this->db->query("SELECT usr_nama FROM tbl_users WHERE usr_id = $uid"); 418 | $row = $res->fetch(); 419 | $content .= '

Matakuliah yang diajukan oleh '.$row['usr_nama'].'

'; 420 | $content .= $this->setListStatus(1,'main',$uid); 421 | $uri = $_SERVER['REQUEST_URI']; 422 | $content .= <<
Tambahkan pesan :
  
430 | EOD; 431 | $content .= '

<<kembali

'; 432 | 433 | return $content; 434 | } 435 | function isiNilai($mk_id){ 436 | if(isset($_POST['ok'])){ 437 | $input = array_map('htmlentities',$_POST); 438 | $input = array_map('mysql_real_escape_string',$input); 439 | $this->db->query("UPDATE tbl_kontrak SET 440 | kontrak_nilai = '".$input['kontrak_nilai']."', 441 | kontrak_status = 3 442 | WHERE kontrak_id = ".$input['kontrak_id']." 443 | "); 444 | } 445 | $display = ''; 446 | $sql = <<usr_id) 460 | ORDER BY tbl_mahasiswa.mhs_nim 461 | EOD; 462 | $res = $this->db->query($sql); 463 | $display .= '

Pengesian Nilai mahasiswa

'; 464 | $display .= ''; 465 | $display .= ''; 466 | $i = 1; 467 | while($row = $res->fetch()){ 468 | $display .= ''; 469 | $display .= ''; 470 | $display .= ''; 471 | $display .= ''; 472 | $display .= ''; 473 | $display .= ''; 487 | $display .= ''; 488 | $i++; 489 | } 490 | $display .= '
NoNIMNamanilaiisi nilai
'.$i.''.$row['mhs_nim'].''.$row['usr_nama'].''.$row['kontrak_nilai'].''; 474 | $display .= '
'; 475 | $display .= ''; 476 | $display .=''; 484 | $display .= ''; 485 | $display .= '
'; 486 | $display .= '
'; 491 | return $display; 492 | } 493 | } 494 | -------------------------------------------------------------------------------- /inc/Matakuliah.php: -------------------------------------------------------------------------------- 1 | listMatakuliah(); 7 | if((isset($_GET['view']) && $_GET['view']=='detail')){ 8 | $id = $_GET['id']; 9 | $content = $this->detailMatakuliah($id); 10 | } 11 | if((isset($_GET['view']) && $_GET['view']=='kontrak')){ 12 | $id = $_GET['id']; 13 | if(isset($id) && $this->privilege == MHS){ 14 | $content = $this->kontrak($id); 15 | } 16 | } 17 | $this->page .= << 19 |
20 | $content 21 |
22 | 23 | EOD; 24 | } 25 | function listMatakuliah(){ 26 | $display = ''; 27 | $self = $_SERVER['PHP_SELF']; 28 | $display .= '

Daftar Matakuliah

'; 29 | if(!isset($_GET['view']) || $_GET['view'] == 'available'){ 30 | $display .= '

Tampilkan Matakuliah : '; 31 | $display .= 'Tersedia | '; 32 | $display .= 'Semua


'; 33 | $display .= $this->listMatakuliahAvailable(); 34 | } 35 | else if(isset($_GET['view']) && $_GET['view'] == 'all'){ 36 | $display .= '

Tampilkan Matakuliah : '; 37 | $display .= 'Tersedia | '; 38 | $display .= 'Semua

'; 39 | $display .= $this->listMatakuliahAll(); 40 | } 41 | return $display; 42 | } 43 | function listMatakuliahAvailable(){ 44 | if(isset($_POST['delete'])){ 45 | $mk_id = mysql_real_escape_string($_POST['mk_id']); 46 | $this->db->query("DELETE FROM tbl_mk_dsn WHERE mk_id=$mk_id"); 47 | } 48 | $display = ''; 49 | $sql = <<< EOD 50 | SELECT 51 | tbl_matakuliah.mk_id, 52 | tbl_matakuliah.mk_semester, 53 | tbl_matakuliah.mk_kode, 54 | tbl_matakuliah.mk_nama, 55 | tbl_matakuliah.mk_sks 56 | FROM 57 | tbl_matakuliah, 58 | tbl_mk_dsn 59 | WHERE 60 | tbl_matakuliah.mk_id = tbl_mk_dsn.mk_id 61 | GROUP BY 62 | tbl_mk_dsn.mk_id 63 | ORDER BY 64 | tbl_matakuliah.mk_semester 65 | EOD; 66 | $res = $this->db->query($sql); 67 | $display .= ''; 68 | $display .= ''; 69 | $display .= ''; 70 | if($this->privilege == MHS){ 71 | $display .= ''; 72 | } 73 | if($this->privilege == ADM){ 74 | $display .= ''; 75 | } 76 | $display .= ''; 77 | $self = $_SERVER['PHP_SELF']; 78 | while ($row = $res->fetch()) { 79 | $display .= ''; 80 | $display .= ''; 81 | $display .= ''; 82 | $display .= ''; 83 | $display .= ''; 85 | if($this->privilege == MHS){ 86 | $display .= ''; 87 | } 88 | if($this->privilege == ADM){ 89 | $display .= ''; 94 | } 95 | $display .= ''; 96 | } 97 | $display .= '
KodeNama MatakuliahSemesterSKSDetailKontrakHapus
'.$row['mk_kode'].''.$row['mk_nama'].''.$row['mk_semester'].''.$row['mk_sks'].''; 84 | $display .= ''; 90 | $display .= '
'; 91 | $display .= ''; 92 | $display .= '
'; 93 | $display .= '
'; 98 | return $display; 99 | } 100 | function listMatakuliahAll(){ 101 | $display = ''; 102 | $sql = <<db->query($sql); 127 | $display .= ''; 128 | $col = 5; 129 | if($this->privilege == ADM){ 130 | $display .= ''; 131 | $col = 7; 132 | } 133 | else{ 134 | $display .= ''; 135 | } 136 | $display .= ''; 137 | $no_jenis = 0; 138 | while ($row = $res->fetch()) { 139 | if($no_jenis != $row['no_jenis']){ 140 | $display .= ''; 141 | $no_jenis = $row['no_jenis']; 142 | } 143 | $display .= ''; 144 | $display .= ''; 145 | $display .= ''; 146 | $display .= ''; 147 | $display .= ''; 149 | if($this->privilege == ADM){ 150 | $display .= ''; 152 | $display .= ''; 154 | } 155 | $display .= ''; 156 | } 157 | $display .= '
KodeNamaSKSSemesterPilihanDetail

'.$row['jenis'].'
'.$row['mk_kode'].''.$row['mk_nama'].''.$row['mk_sks'].''.$row['mk_semester'].''; 148 | $display .= ''; 151 | $display .= ''; 153 | $display .= '
'; 158 | return $display; 159 | } 160 | function detailMatakuliah($id){ 161 | $display = ''; 162 | $sql_detail = <<auth->session->get(POST_LOGIN_VAR); 181 | $res_user = $this->db->query("SELECT usr_id FROM tbl_users WHERE usr_login = '$login'"); 182 | $ruid = $res_user->fetch(); 183 | $uid = $ruid['usr_id']; 184 | $res = $this->db->query($sql_detail); 185 | $row = $res->fetch(); 186 | $display .= '

Detail Matakuliah

'; 187 | $display .= ''; 188 | $display .= ''; 189 | $display .= ''; 190 | $display .= ''; 191 | $display .= ''; 192 | if($this->privilege == MHS){ 193 | $display .= ''; 194 | if($this->isKontrak($uid,$row['mk_id'])){ 195 | $display .= ''; 196 | } 197 | else{ 198 | $display .= ''; 199 | } 200 | } 201 | $display .= ''; 202 | $display .= ''; 203 | $display .= $this->getSyarat($id); 204 | $display .= ''; 205 | $display .= $this->getPengajar($id); 206 | if($this->privilege == MHS){ 207 | $display .= ''; 211 | } 212 | $display .= '
Nama Matakuliah:'.$row['mk_nama'].'
Kode Matakuliah:'.$row['mk_kode'].'
Jenis Matakuliah:'.$row['jenis'].'
Sifat Matakuliah:'.$row['sifat'].'
Status Kontrak:Sudah dikontrak
Belum atau Sedang dikontrak
Deskripsi:'.$row['mk_desc'].'
Persyaratan matakuliah
Info Dosen Pengajar
'; 208 | $display .= '
'; 209 | $display .= ''; 210 | $display .= '

'; 213 | $display .= '

Kembali ke : '; 214 | $display .= ' matakukuliah tersedia | '; 215 | $display .= ' Semua matakuliah

'; 216 | 217 | return $display; 218 | } 219 | function getPengajar($id){ 220 | if($this->privilege == ADM && isset($_POST['add'])){ 221 | $dsn_id = mysql_real_escape_string($_POST['dsn_id']); 222 | $this->db->query("INSERT INTO tbl_mk_dsn(mk_id,dsn_id) VALUE($id,$dsn_id)"); 223 | } 224 | if($this->privilege == ADM && isset($_POST['delete'])){ 225 | $dsn_id = mysql_real_escape_string($_POST['dsn_id']); 226 | $this->db->query("DELETE FROM tbl_mk_dsn WHERE mk_id= $id AND dsn_id = $dsn_id"); 227 | } 228 | $sql = <<db->query($sql); 240 | $display = ''; 241 | if($res->size() != 0){ 242 | while($row = $res->fetch()){ 243 | $display .= ''.$row['dsn_kode'].''.$row['usr_nama'].''; 244 | if($this->privilege == ADM){ 245 | $display .= '
'; 246 | $display .= ''; 247 | $display .= ''; 248 | $display .= '
'; 249 | } 250 | $display .= ''; 251 | } 252 | } 253 | else{ 254 | $display .= ' tidak tersedia pengajar untuk matakuliah ini'; 255 | } 256 | if($this->privilege == ADM){ 257 | $rp = $this->db->query("SELECT tbl_dosen.dsn_id,tbl_dosen.dsn_kode,tbl_users.usr_nama 258 | FROM tbl_users,tbl_dosen WHERE tbl_users.usr_id = tbl_dosen.usr_id 259 | ORDER BY tbl_users.usr_nama"); 260 | $display .= 'Tambah Pengajar:'; 261 | $display .= '
'; 262 | $display .= ''; 267 | $display .= '
'; 268 | } 269 | return $display; 270 | } 271 | function getSyarat($id){ 272 | if(isset($_POST['sy_delete'])){ 273 | $syarat_id = mysql_real_escape_string($_POST['id']); 274 | $this->db->query("DELETE FROM tbl_mk_syarat WHERE id=$syarat_id"); 275 | } 276 | if(isset($_POST['add_syarat'])){ 277 | $mk_syarat_id = mysql_real_escape_string($_POST['mk_syarat_id']); 278 | $this->db->query("INSERT INTO tbl_mk_syarat(mk_id,mk_syarat_id) VALUE($id,$mk_syarat_id)"); 279 | } 280 | $display = ''; 281 | $sql = <<db->query($sql); 291 | $size = $res->size(); 292 | if($size == 0){ 293 | $display .= 'Tidak ada syarat untuk mata kuliah ini'; 294 | } 295 | else{ 296 | $login = $this->auth->session->get(POST_LOGIN_VAR); 297 | $res_user = $this->db->query("SELECT usr_id FROM tbl_users WHERE usr_login = '$login'"); 298 | $ruid = $res_user->fetch(); 299 | $uid = $ruid['usr_id']; 300 | while($row = $res->fetch()){ 301 | $display .= ''.$row['mk_kode'].''; 302 | $display .= ''.$row['mk_nama'].''; 303 | if($this->privilege == MHS){ 304 | if($this->isKontrak($uid,$row['mk_syarat_id'])){ 305 | $display .= ' Sudah di Kontrak'; 306 | } 307 | else{ 308 | $display .= ''; 309 | } 310 | } 311 | if($this->privilege == ADM){ 312 | $display .= '
'; 313 | $display .= ''; 314 | $display .= ''; 315 | $display .= '
'; 316 | } 317 | $display .= ''; 318 | } 319 | } 320 | if($this->privilege == ADM){ 321 | $res_syarat = $this->db->query("SELECT mk_id,mk_kode,mk_nama FROM tbl_matakuliah ORDER BY mk_nama"); 322 | $display .= 'Tambah Syarat:'; 323 | $display .= '
'; 324 | $display .= ''; 329 | $display .= '
'; 330 | $display .= ''; 331 | } 332 | return $display; 333 | } 334 | function isKontrak($uid,$mk_id,$status = 3){ 335 | $res = $this->db->query("SELECT COUNT(*) as nums FROM tbl_kontrak WHERE mk_id=$mk_id 336 | AND mhs_id = (SELECT mhs_id FROM tbl_mahasiswa WHERE usr_id = $uid) AND kontrak_status=$status"); 337 | $row = $res->fetch(); 338 | if($row['nums'] != 0){ 339 | return true; 340 | } 341 | else{ 342 | return false; 343 | } 344 | } 345 | function kontrak($mk_id){ 346 | if($this->isKontrak($this->usr_id,$mk_id,0)){ 347 | header('Location:'.$_SERVER['PHP_SELF'].'?page=matakuliah'); 348 | } 349 | $mhs_res = $this->db->query("SELECT mhs_id FROM tbl_mahasiswa WHERE usr_id = $this->usr_id"); 350 | $r = $mhs_res->fetch(); 351 | $mhs_id = $r['mhs_id']; 352 | if(isset($_POST['ok'])){ 353 | $dsn_id = mysql_real_escape_string($_POST['dsn_id']); 354 | $this->db->query("INSERT INTO tbl_kontrak(mhs_id,mk_id,dsn_id,kontrak_semester) 355 | VALUE($mhs_id, $mk_id,$dsn_id,(SELECT mhs_semester FROM tbl_mahasiswa WHERE mhs_id=$mhs_id)+1) 356 | "); 357 | header('Location:'.$_SERVER['PHP_SELF'].'?page=matakuliah'); 358 | } 359 | $display = ''; 360 | $sql = <<db->query($sql); 370 | $display .= '

Kontrak Matakuliah

'; 371 | $mk_id_blm = array(); 372 | $mk_kode_blm = array(); 373 | $mk_nama_blm = array(); 374 | while($row = $res->fetch()){ 375 | if(!$this->isKontrak($this->usr_id, $row['mk_syarat_id'])){ 376 | $mk_id_blm[] = $row['mk_syarat_id']; 377 | $mk_kode_blm[] = $row['mk_kode']; 378 | $mk_nama_blm[] = $row['mk_nama']; 379 | } 380 | } 381 | if(count($mk_id_blm) > 0){ 382 | $display .= '

Maaf, anda tidak bisa mengontrak matakuliah ini karena syarat belum terpenuhi, silahkan kontrak matakuliah dibawah ini terlebih dahulu:

'; 383 | $display .= ''; 384 | for($i = 0; $i < count($mk_id_blm);$i++){ 385 | $display .= ''; 386 | $display .= ''; 387 | $display .= ''; 388 | $display .= ''; 389 | $display .= ''; 390 | } 391 | $display .= '
'.$mk_kode_blm[$i].''.$mk_nama_blm[$i].'Detail
'; 392 | $display .= '

<<kembali

'; 393 | } 394 | else{ 395 | $sql = <<db->query($sql); 407 | if($res->size() == 0){ 408 | $display .= '

Maaf Matakuliah ini tidak tersedia

'; 409 | $display .= '

<<kembali

'; 410 | } 411 | else{ 412 | $display .= '
'; 413 | $display .= '

Pilih dosen : '; 414 | $display .= ' '; 419 | $display .= '



'; 420 | } 421 | } 422 | if($this->isKontrak($this->usr_id,$mk_id,1)){ 423 | $display = '

Kontrak Matakuliah

'; 424 | $display .= '

Maaf, matakuliah ini sudah anda ajukan ke dosen wali anda

'; 425 | $display .= '

<<kembali

'; 426 | } 427 | if($this->isPengajuan()){ 428 | $display = '

Kontrak Matakuliah

'; 429 | $display .= '

Maaf, Anda sudah mengajukan kontrak. Mohon tunggu konfirmasi dari dosen wali anda

'; 430 | $display .= '

<<kembali

'; 431 | } 432 | if($this->isPengajuan(2)){ 433 | $display = '

Kontrak Matakuliah

'; 434 | $display .= '

Maaf, Anda sudah mengajukan kontrak. Dan disetujui oleh dosen

'; 435 | $display .= '

<<kembali

'; 436 | } 437 | return $display; 438 | } 439 | function isPengajuan($status=1){ 440 | $res = $this->db->query("SELECT kontrak_id FROM tbl_kontrak WHERE kontrak_status=$status AND mhs_id=(SELECT mhs_id FROM tbl_mahasiswa WHERE usr_id = $this->usr_id)"); 441 | if($res->size() > 0){ 442 | return true; 443 | } 444 | else{ 445 | return false; 446 | } 447 | } 448 | } 449 | 450 | ?> 451 | -------------------------------------------------------------------------------- /inc/Dosen.php: -------------------------------------------------------------------------------- 1 | setQueryList(); 9 | $sql = $sql_nolimit . ' LIMIT '.$start.', '.$page_entry; 10 | $result = $this->displayListDosen($sql); 11 | $page_str = $this->setPaging($sql_nolimit, $page_entry); 12 | $content = << 14 | $result 15 | 16 |
17 | $page_str 18 |
19 |

20 | EOD; 21 | if($_GET['view'] == 'detail'){ 22 | $content = $this->displayDetailDosen($_GET['uid']); 23 | } 24 | if($this->privilege == ADM && isset($_GET['view']) ){ 25 | if($_GET['view'] == 'add_dosen'){ 26 | $content = $this->addDosen(); 27 | } 28 | if($_GET['view'] == 'delete_dsn'){ 29 | $uid = $_GET['uid']; 30 | $res = $this->db->query("SELECT usr_login FROM tbl_users WHERE usr_id='".$_GET['uid']."'"); 31 | $row = $res->fetch(); 32 | if($this->auth->session->get(POST_LOGIN_VAR) != $row['usr_login']){ 33 | $content = $this->deleteDosen($uid); 34 | } 35 | } 36 | } 37 | if($this->privilege == ADM || $_GET['uid'] == $this->usr_id){ 38 | if(isset($_GET['view']) && $_GET['view'] == 'edit_dosen'){ 39 | $uid = $_GET['uid']; 40 | $content = $this->displayFormEditDosen($uid); 41 | } 42 | } 43 | $this->page .= << 45 |
46 | $content 47 |
48 | 49 | EOD; 50 | } 51 | 52 | function setQueryList(){ 53 | if($this->privilege == ADM){ 54 | $sql .= <<db->query($sql); 95 | $display .= '

Daftar Dosen

'; 96 | if($this->privilege == ADM){ 97 | $display .='
'; 98 | } 99 | $display .= ''; 100 | if($this->privilege == ADM){ 101 | $display .= ''; 102 | } 103 | else{ 104 | $display .= ''; 105 | } 106 | $display .= ''; 107 | $i = $_GET['current_page'] *20 +1; 108 | while($row = $res->fetch()){ 109 | $display .= ''; 110 | $display .= ''; 111 | $display .= ''; 112 | $display .= ''; 113 | $display .= ''; 115 | if($this->auth->session->get(POST_LOGIN_VAR) != $row['usr_login']){ 116 | $display .= ''; 125 | if($this->auth->session->get(POST_LOGIN_VAR) != $row['usr_login']){ 126 | $display .= ''; 128 | } 129 | else{ 130 | $display .= ''; 131 | } 132 | } 133 | $display .= ''; 134 | $i++; 135 | } 136 | $display .= '
NofotoNIPKodeNamaPilihanPilihan
'.$i.''.$row['dsn_nip'].''.$row['dsn_kode'].''.$row['usr_nama'].''; 114 | $display .= 'privilege == ADM){ 123 | $display .= ''; 124 | $display .= ''; 127 | $display .= '
'; 137 | if($this->privilege == ADM){ 138 | $display .='
'; 139 | } 140 | return $display; 141 | } 142 | function displayDetailDosen($uid){ 143 | $display = ''; 144 | $display .= '
'; 145 | if($this->privilege == ADM || $this->usr_id == $uid){ 146 | $display .= ''; 147 | $display .= '

'; 148 | } 149 | $display .= ''; 150 | $display .= $this->displayDetailUser($uid); 151 | $display .= '
'; 152 | if($this->privilege == ADM || $this->usr_id == $uid){ 153 | $display .= ''; 154 | $display .= '

'; 155 | } 156 | $display .= '

Matakuliah yang di Pegang

'; 157 | $display .= $this->getBebanDosen($uid); 158 | $display .= '
'; 159 | return $display; 160 | } 161 | function displayDetailUser($uid){ 162 | $sql = <<db->query($sql); 192 | $row = $result->fetch(); 193 | $display .= 'Data Pribadi'; 194 | $display .= 'Nama:'.$row['usr_nama'].''; 195 | $display .= ''; 196 | if($row['usr_privilege'] == MHS){ 197 | $display .= 'NIM:'.$row['NIM'].''; 198 | } 199 | else{ 200 | $display .= 'NIP:'.$row['NIP'].''; 201 | $display .= 'Kode Dosen:'.$row['KODE'].''; 202 | } 203 | $display .= 'jenis Kelamin:'.$row['usr_kelamin'].''; 204 | $display .= 'Email:'.$row['usr_email'].''; 205 | $display .= 'No.Kontak:'.$row['usr_kontak'].''; 206 | $display .= 'Deskripsi:

'.$row['usr_desc'].'

'; 207 | $display .= 'Terakhir login:'.$row['usr_last_login'].''; 208 | $display .= 'Alamat Tinggal'; 209 | $display .= 'Lokasi:'.$row['addr_lokasi_tinggal'].''; 210 | $display .= 'Kota / Kabupaten :'.$row['addr_wilayah_tinggal'].''; 211 | $display .= 'Provinsi:'.$row['addr_provinsi_tinggal'].''; 212 | $display .= 'Kode Pos:'.$row['addr_kodepos_tinggal'].''; 213 | $display .= 'Alamat Asal'; 214 | $display .= 'Lokasi:'.$row['addr_lokasi_asal'].''; 215 | $display .= 'Kota / Kabupaten :'.$row['addr_wilayah_asal'].''; 216 | $display .= 'Provinsi:'.$row['addr_provinsi_asal'].''; 217 | $display .= 'Kode Pos:'.$row['addr_kodepos_asal'].''; 218 | return $display; 219 | } 220 | function isValue($var){ 221 | if(isset($var)){ 222 | $var = trim($var); 223 | if(!empty($var)){ 224 | return true; 225 | } 226 | else{ 227 | return false; 228 | } 229 | } 230 | else{ 231 | return false; 232 | } 233 | } 234 | function isEmail($var){ 235 | //$res = $this->db->query("SELECT usr_email FROM tbl_users WHERE usr_email='$var'"); 236 | //$size = $res->size(); 237 | if(ereg('^[^@]+@([a-z\-]+\.)+[a-z]{2,6}$',$var)){ 238 | return true; 239 | } 240 | else{ 241 | return false; 242 | } 243 | } 244 | function isNIP($nip){ 245 | $sql = "SELECT dsn_nip FROM tbl_dosen WHERE dsn_nip = '$nip'"; 246 | $res = $this->db->query($sql); 247 | $size = $res->size(); 248 | if($size == 0 && ctype_digit($nip) && $this->isValue($nip)){ 249 | return true; 250 | } 251 | else{ 252 | return false; 253 | } 254 | } 255 | function isKode($kode){ 256 | $sql = "SELECT dsn_kode FROM tbl_dosen WHERE dsn_kode = '$kode'"; 257 | $res = $this->db->query($sql); 258 | $size = $res->size(); 259 | if($size == 0 && ctype_digit($kode) && $this->isValue($kode)){ 260 | return true; 261 | } 262 | else{ 263 | return false; 264 | } 265 | } 266 | function isLogin($var,$opt=0){ 267 | $var = strtolower($var); 268 | $sql = "SELECT usr_login FROM tbl_users WHERE usr_login ='$var'"; 269 | $res = $this->db->query($sql); 270 | $size = $res->size(); 271 | if($size == $opt && $this->isValue($var)){ 272 | return true; 273 | } 274 | else{ 275 | return false; 276 | } 277 | } 278 | function isPassword($var1,$var2){ 279 | if(strlen($var1) >= 6 && $var1 == $var2){ 280 | return true; 281 | } 282 | else{ 283 | return false; 284 | } 285 | } 286 | function addDosen(){ 287 | $display = ''; 288 | if(isset($_POST['tambah'])){ 289 | $display .= $this->checkFormDosen($error, $print_again); 290 | } 291 | else{ 292 | $display .= $this->displayFormDosen($error, $print_again); 293 | } 294 | return $display; 295 | } 296 | function displayFormDosen($error, $print_again){ 297 | $display = ''; 298 | $target = $_SERVER['PHP_SELF'].'page=dosen&view=add_dosen'; 299 | $msg= array( 300 | 'usr_login' => '*', 301 | 'usr_password' => '* (>= 6 karakter)', 302 | 'verify' => '*', 303 | 'dsn_nip' => '* (numerik)', 304 | 'dsn_kode' => '* (numerik)', 305 | 'usr_nama' => '*', 306 | 'usr_email' =>'*', 307 | 'foto' =>'format jpeg', 308 | ); 309 | $fields = array ( 310 | 'usr_login' => 'text', 311 | 'usr_password' => 'password', 312 | 'verify' => 'password', 313 | 'dsn_nip' => 'text', 314 | 'dsn_kode' => 'text', 315 | 'usr_nama' => 'text', 316 | 'usr_kelamin' => 'option', 317 | 'usr_email' => 'text', 318 | 'usr_kontak' => 'text', 319 | 'usr_desc' => 'text', 320 | 'foto' => 'file', 321 | 'addr_lokasi_tinggal' => 'text', 322 | 'addr_wilayah_tinggal' => 'text', 323 | 'addr_provinsi_tinggal' => 'text', 324 | 'addr_kodepos_tinggal' => 'text', 325 | 'addr_lokasi_asal' => 'text', 326 | 'addr_wilayah_asal' => 'text', 327 | 'addr_provinsi_asal' => 'text', 328 | 'addr_kodepos_asal' => 'text' 329 | ); 330 | $labels = array ( 331 | 'usr_login' => 'User Login', 332 | 'usr_password' => 'Password', 333 | 'verify' => 'Verifikasi', 334 | 'dsn_nip' => 'NIP', 335 | 'dsn_kode' => 'Kode Dosen', 336 | 'usr_nama' => 'Nama', 337 | 'usr_kelamin' => 'Jenis Kelamin', 338 | 'usr_email' => 'Email', 339 | 'usr_kontak' => 'Kontak', 340 | 'usr_desc' => 'Deskripsi', 341 | 'foto' => 'Foto', 342 | 'addr_lokasi_tinggal' => 'Alamat Tinggal', 343 | 'addr_wilayah_tinggal' => 'Kota / Kabupaten', 344 | 'addr_provinsi_tinggal' => 'Propinsi', 345 | 'addr_kodepos_tinggal' => 'Kodepost', 346 | 'addr_lokasi_asal' => 'Alamat Asal', 347 | 'addr_wilayah_asal' => 'Kota / Kabupaten', 348 | 'addr_provinsi_asal' => 'Propinsi', 349 | 'addr_kodepos_asal' => 'Kodepost' 350 | ); 351 | $display .= '

Tambah Dosen

'; 352 | if($print_again){ 353 | $display .= '

Kesalahan Pengisian!! Periksa kembali!

'; 354 | } 355 | $display .= '
'; 356 | $display .= ''; 357 | foreach ($fields as $name => $type){ 358 | if($name == 'usr_kelamin'){ 359 | $display .= ''; 360 | $display .= ''; 364 | } 365 | else if($name == 'usr_desc'){ 366 | $display .= ''; 367 | $display .= ''; 372 | } 373 | else{ 374 | $display .= ''; 375 | $display .= ''; 376 | $display .= ''; 386 | } 387 | } 388 | $display .= ''; 389 | $display .= '
'.$labels[$name].'
'.$labels[$name].''; 368 | if($print_again){ 369 | $display .= $this->errorFlag($error,$name,$fields); 370 | } 371 | $display .= '
'.$labels[$name].''; 377 | if($print_again){ 378 | $display .= $this->errorFlag($error,$name,$fields); 379 | } 380 | else{ 381 | if(isset($msg[$name])){ 382 | $display .= ''.$msg[$name].''; 383 | } 384 | } 385 | $display .= '
 
'; 390 | return $display; 391 | } 392 | 393 | function checkFormDosen($error, $print_again){ 394 | $print_again = false; 395 | if(!$this->isValue($_POST['usr_nama'])){ 396 | $error['usr_nama'] = true; 397 | $print_again = true; 398 | } 399 | if(!$this->isValue($_POST['usr_kelamin'])){ 400 | $error['usr_kelamin'] = true; 401 | $print_again = true; 402 | } 403 | if(!$this->isPassword($_POST['usr_password'],$_POST['verify'])){ 404 | $error['usr_password'] = true; 405 | $error['verify'] = true; 406 | $print_again = true; 407 | } 408 | if(!$this->isEmail($_POST['usr_email'])){ 409 | $error['usr_email'] = true; 410 | $print_again = true; 411 | } 412 | if(!$this->isLogin($_POST['usr_login'])){ 413 | $error['usr_login'] = true; 414 | $print_again = true; 415 | } 416 | if(!$this->isNIP($_POST['dsn_nip'])){ 417 | $error['dsn_nip'] = true; 418 | $print_again = true; 419 | } 420 | if(!$this->isKode($_POST['dsn_kode'])){ 421 | $error['dsn_kode'] = true; 422 | $print_again = true; 423 | } 424 | if($print_again){ 425 | $display = $this->displayFormDosen($error, $print_again); 426 | } 427 | else{ 428 | $display = $this->storeDosen(); 429 | } 430 | return $display; 431 | } 432 | 433 | function errorFlag($error,$name){ 434 | if($error[$name]){ 435 | $display = 'Tidak Valid!'; 436 | if($name=='usr_login'||$name=='dsn_nip'|| $name=='dsn_kode' ||$name=='mhs_nim' || $name=='usr_email'){ 437 | $display = 'Sudah Terpakai atau Tidak Valid! '; 438 | } 439 | } 440 | else{ 441 | $display = ''; 442 | } 443 | return $display; 444 | } 445 | function storeDosen(){ 446 | $this-> storeDataUser(); 447 | $this->storeAlamat(); 448 | $this->storeDataDosen(); 449 | $msg = << 451 | Data tersimpan!

Kembali ke: 452 | Form pengisian | 453 | Daftar Dosen 454 | 455 | EOD; 456 | return $msg; 457 | } 458 | function storeDataUser(){ 459 | $input = array_map('htmlentities',$_POST); 460 | $input = array_map('mysql_real_escape_string',$input); 461 | $sql =" 462 | INSERT INTO tbl_users( 463 | usr_login, 464 | usr_password, 465 | usr_nama, 466 | usr_privilege, 467 | usr_kelamin, 468 | usr_email, 469 | usr_kontak, 470 | usr_desc 471 | ) 472 | VALUE( 473 | '".strtolower($input['usr_login'])."', 474 | MD5('".$input['usr_password']."'), 475 | '".$input['usr_nama']."', 476 | 1 , 477 | '".$input['usr_kelamin']."', 478 | '".$input['usr_email']."', 479 | '".$input['usr_kontak']."', 480 | '".$input['usr_desc']."' 481 | )"; 482 | $this->db->query($sql); 483 | if(isset($_FILES['foto'])){ 484 | $this->storeFoto($input['usr_login']); 485 | } 486 | } 487 | function storeFoto($login){ 488 | $res = $this->db->query("SELECT usr_id FROM tbl_users WHERE usr_login = '$login'"); 489 | $row = $res->fetch(); 490 | if($_FILES['foto']['type']== 'image/jpeg'){ 491 | if(move_uploaded_file($_FILES['foto']['tmp_name'],'img/users/'.$row['usr_id'].'.jpg')){ 492 | $this->db->query("UPDATE tbl_users SET usr_url_pic='img/users/".$row['usr_id'].".jpg' WHERE usr_login='$login'"); 493 | } 494 | } 495 | } 496 | function storeDataDosen(){ 497 | $input = array_map('htmlentities',$_POST); 498 | $input = array_map('mysql_real_escape_string',$input); 499 | $sql = " 500 | INSERT INTO tbl_dosen(dsn_nip, dsn_kode, usr_id) 501 | VALUE('".$input['dsn_nip']."', '".$input['dsn_kode']."', 502 | (SELECT usr_id FROM tbl_users WHERE usr_login='".$input['usr_login']."') 503 | )"; 504 | $this->db->query($sql); 505 | } 506 | function storeAlamat(){ 507 | $input = array_map('htmlentities',$_POST); 508 | $input = array_map('mysql_real_escape_string',$input); 509 | $sql1 = " 510 | INSERT INTO tbl_alamat( 511 | addr_jenis, 512 | usr_id, 513 | addr_lokasi, 514 | addr_wilayah, 515 | addr_provinsi, 516 | addr_kodepos 517 | ) 518 | VALUE( 519 | 'tinggal', 520 | (SELECT usr_id FROM tbl_users WHERE usr_login='".$input['usr_login']."'), 521 | '".$input['addr_lokasi_tinggal']."', 522 | '".$input['addr_wilayah_tinggal']."', 523 | '".$input['addr_provinsi_tinggal']."', 524 | '".$input['addr_kodepos_tinggal']."' 525 | ) 526 | "; 527 | $sql2 = " 528 | INSERT INTO tbl_alamat( 529 | addr_jenis, 530 | usr_id, 531 | addr_lokasi, 532 | addr_wilayah, 533 | addr_provinsi, 534 | addr_kodepos 535 | ) 536 | VALUE( 537 | 'asal', 538 | (SELECT usr_id FROM tbl_users WHERE usr_login='".$input['usr_login']."'), 539 | '".$input['addr_lokasi_asal']."', 540 | '".$input['addr_wilayah_asal']."', 541 | '".$input['addr_provinsi_asal']."', 542 | '".$input['addr_kodepos_asal']."' 543 | ) 544 | "; 545 | $this->db->query($sql1); 546 | $this->db->query($sql2); 547 | } 548 | function deleteDosen($uid){ 549 | if(!isset($_POST['confirm'])){ 550 | $res = $this->db->query("SELECT usr_nama FROM tbl_users WHERE usr_id = '$uid'"); 551 | $row = $res->fetch(); 552 | $nama = $row['usr_nama']; 553 | $uri = $_SERVER['REQUEST_URI']; 554 | $display = << 556 | Anda Yakin akan menghapus Dosen dengan nama $nama

557 |
558 |   559 |   560 |
561 | 562 | EOD; 563 | return $display; 564 | } 565 | else if($_POST['confirm'] == 'yes'){ 566 | $this->db->query("DELETE FROM tbl_users WHERE usr_id='$uid'"); 567 | $this->db->query("DELETE FROM tbl_alamat WHERE usr_id='$uid'"); 568 | $this->db->query("DELETE FROM tbl_pesan WHERE usr_id_asal='$uid'"); 569 | $this->db->query("DELETE FROM tbl_pesan WHERE usr_id_tujuan='$uid'"); 570 | $this->db->query("DELETE FROM tbl_mk_dsn WHERE dsn_id = (SELECT dsn_id FROM tbl_dosen WHERE usr_id='$uid')"); 571 | $this->db->query("DELETE FROM tbl_dosen WHERE usr_id='$uid'"); 572 | header('Location:'.$_SERVER['PHP_SELF'].'?page=dosen'); 573 | } 574 | else{ 575 | header('Location:'.$_SERVER['PHP_SELF'].'?page=dosen'); 576 | } 577 | } 578 | function storeEditUser(){ 579 | $uid = $_GET['uid']; 580 | $input = array_map('htmlentities',$_POST); 581 | $input = array_map('mysql_real_escape_string',$input); 582 | $this->db->query("UPDATE tbl_users SET 583 | usr_nama='".$input['usr_nama']."', 584 | usr_kelamin='".$input['usr_kelamin']."', 585 | usr_email='".$input['usr_email']."', 586 | usr_kontak='".$input['usr_kontak']."', 587 | usr_desc= '".$input['usr_desc']."' 588 | WHERE usr_id=$uid 589 | "); 590 | if(isset($_FILES['foto'])){ 591 | if($this->privilege == ADM){ 592 | $this->storeFoto($input['usr_login']); 593 | } 594 | else{ 595 | $this->storeFoto($this->login); 596 | } 597 | } 598 | } 599 | function storeEditPassword(){ 600 | $input = array_map('htmlentities',$_POST); 601 | $input = array_map('mysql_real_escape_string',$input); 602 | if($this->privilege == ADM){ 603 | $this->db->query("UPDATE tbl_users SET usr_password=MD5('".$input['usr_password']."') 604 | WHERE usr_login ='".$input['usr_login']."'"); 605 | } 606 | else{ 607 | $this->db->query("UPDATE tbl_users SET usr_password=MD5('".$input['usr_password']."') 608 | WHERE usr_login ='$this->login'"); 609 | } 610 | } 611 | function storeEditAlamat(){ 612 | $input = array_map('htmlentities',$_POST); 613 | $input = array_map('mysql_real_escape_string',$input); 614 | if($this->privilege == ADM){ 615 | $id = $_GET['uid']; 616 | } 617 | else{ 618 | $id = $this->usr_id; 619 | } 620 | $this->db->query(" 621 | UPDATE tbl_alamat SET 622 | addr_lokasi ='".$input['addr_lokasi_tinggal']."', 623 | addr_wilayah ='".$input['addr_wilayah_tinggal']."', 624 | addr_provinsi = '".$input['addr_provinsi_tinggal']."', 625 | addr_kodepos = '".$input['addr_kodepos_tinggal']."' 626 | WHERE addr_jenis = 'tinggal' 627 | AND usr_id = $id 628 | "); 629 | $this->db->query(" 630 | UPDATE tbl_alamat SET 631 | addr_lokasi ='".$input['addr_lokasi_asal']."', 632 | addr_wilayah ='".$input['addr_wilayah_asal']."', 633 | addr_provinsi = '".$input['addr_provinsi_asal']."', 634 | addr_kodepos = '".$input['addr_kodepos_asal']."' 635 | WHERE addr_jenis = 'asal' 636 | AND usr_id = $id 637 | "); 638 | } 639 | function displayFormEditDosen($uid){ 640 | $labels = array ( 641 | 'usr_login' => 'User Login', 642 | 'usr_password' => 'Password', 643 | 'usr_password_verify' => 'Verifikasi', 644 | 'dsn_nip' => 'NIP', 645 | 'dsn_kode' => 'Kode Dosen', 646 | 'usr_nama' => 'Nama', 647 | 'usr_kelamin' => 'Jenis Kelamin', 648 | 'usr_email' => 'Email', 649 | 'usr_kontak' => 'Kontak', 650 | 'usr_desc' => 'Deskripsi', 651 | 'foto' => 'Foto', 652 | 'addr_lokasi_tinggal' => 'Alamat Tinggal', 653 | 'addr_wilayah_tinggal' => 'Kota / Kabupaten Tinggal', 654 | 'addr_provinsi_tinggal' => 'Propinsi Tinggal', 655 | 'addr_kodepos_tinggal' => 'Kodepost Tinggal', 656 | 'addr_lokasi_asal' => 'Alamat Asal', 657 | 'addr_wilayah_asal' => 'Kota / Kabupaten Asal', 658 | 'addr_provinsi_asal' => 'Propinsi Asal', 659 | 'addr_kodepos_asal' => 'Kodepost Asal' 660 | ); 661 | $display = ''; 662 | $display .= '

Ubah Profile Dosen

'; 663 | if(isset($_POST['save'])){ 664 | if($_POST['save'] == 'simpan'){ 665 | unset($_POST['usr_password']); 666 | unset($_POST['usr_password_verify']); 667 | } 668 | $msg_error = $this->checkFormEditDosen($labels); 669 | if($msg_error != ''){ 670 | $display .= '
    '.$msg_error.'
'; 671 | } 672 | else{ 673 | $this->storeEditDosen(); 674 | $display .= '
Data Tersimpan!!


'; 675 | } 676 | $_POST['foto'] = ''; 677 | unset($_POST['usr_password']); 678 | unset($_POST['usr_password_verify']); 679 | } 680 | else{ 681 | $_POST = $this->getValueEdit($uid); 682 | } 683 | $read_only = array('dsn_nip','dsn_kode','usr_login'); 684 | $display .= '
$value){ 688 | if(in_array($key,$read_only)){ 689 | $use = ' readonly="readonly"'; 690 | } 691 | else{ 692 | $use = ''; 693 | } 694 | if(isset($labels[$key])){ 695 | if($key == 'usr_kelamin'){ 696 | $display .= ''.$labels[$key] .':'; 697 | $display .= ''; 706 | } 707 | else if($key == 'usr_desc'){ 708 | $display .= ''.$labels[$key] .':'; 709 | $display .= ''; 710 | } 711 | else if($key == 'foto'){ 712 | $display .= ''.$labels[$key] .':'; 713 | $display .= ''; 714 | } 715 | else{ 716 | $display .= ''.$labels[$key] .':'; 717 | $display .= ''; 718 | } 719 | } 720 | } 721 | $display .= ''; 722 | $display .= 'Password:'; 723 | $display .= ''; 724 | $display .= 'Verifikasi:'; 725 | $display .= ''; 726 | $display .= ''; 727 | $display .= ''; 728 | $display .= ''; 729 | 730 | return $display; 731 | } 732 | function getValueEdit($uid){ 733 | $sql = <<db->query($sql); 758 | $row = $res->fetch(); 759 | return $row; 760 | } 761 | function checkFormEditDosen($fields){ 762 | $display = ''; 763 | $not_req = array('addr_lokasi_asal'=>'', 764 | 'addr_wilayah_asal'=>'','addr_provinsi_asal'=>'','addr_kodepos_asal'=>''); 765 | if(!$this->isEmail($_POST['usr_email'])){ 766 | $display .= '
  • Email Tidak valid
  • '; 767 | } 768 | foreach ($_POST AS $key => $value){ 769 | if(!$this->isValue($value) && !isset($not_req[$key])){ 770 | $display .= '
  • '.$fields[$key].' Harus diisi!
  • '; 771 | } 772 | } 773 | if($_POST['save'] == 'simpan & ubah password' && !$this->isPassword($_POST['usr_password'],$_POST['usr_password_verify'])){ 774 | $display .= '
  • Password tidak valid atau tidak sama
  • '; 775 | } 776 | return $display; 777 | } 778 | function storeEditDosen(){ 779 | $this->storeEditUser(); 780 | if($_POST['save'] != 'simpan'){ 781 | $this->storeEditPassword(); 782 | } 783 | $this->storeEditAlamat(); 784 | } 785 | } 786 | 787 | ?> 788 | -------------------------------------------------------------------------------- /inc/Mahasiswa.php: -------------------------------------------------------------------------------- 1 | setQueryList(); 10 | $sql = $sql_nolimit . ' LIMIT '.$start.', '.$page_entry; 11 | $result = $this->displayListMhs($sql); 12 | $page_str = $this->setPaging($sql_nolimit, $page_entry); 13 | $content = << 15 | $result 16 | 17 |
    18 | $page_str 19 |
    20 |

    21 | EOD; 22 | if($_GET['view'] == 'detail'){ 23 | $content = $this->displayDetailMhs($_GET['uid']); 24 | } 25 | if($this->privilege == ADM && isset($_GET['view']) ){ 26 | if($_GET['view'] == 'add_mhs'){ 27 | $content = $this->addMhs(); 28 | } 29 | else if($_GET['view'] == 'delete_mhs'){ 30 | $uid = $_GET['uid']; 31 | $content = $this->deleteMhs($uid); 32 | } 33 | } 34 | if($this->privilege == ADM || $_GET['uid'] == $this->usr_id){ 35 | if(isset($_GET['view']) && $_GET['view'] == 'edit_mhs'){ 36 | $uid = $_GET['uid']; 37 | $content = $this->displayFormEditMhs($uid); 38 | } 39 | } 40 | if($this->privilege != MHS){ 41 | if(isset($_GET['view']) && $_GET['view']=='nilai'){ 42 | $uid = $_GET['uid']; 43 | $content = $this->viewNilai($uid); 44 | } 45 | if(isset($_GET['view']) && $_GET['view']=='history_nilai'){ 46 | $uid = $_GET['uid']; 47 | $mk_id = $_GET['mk_id']; 48 | $content = $this->historyNilai($uid,$mk_id); 49 | } 50 | } 51 | $this->page .= << 53 |
    54 | $content 55 |
    56 | 57 | EOD; 58 | } 59 | 60 | function displayListMhs($sql){ 61 | $display = ''; 62 | $self = $_SERVER['PHP_SELF']; 63 | $res = $this->db->query($sql); 64 | $display .= '

    Daftar Mahasiswa

    '; 65 | if($this->privilege == ADM){ 66 | $display .='
    '; 67 | } 68 | if($this->privilege != MHS) { 69 | if(!isset($_GET['view']) || $_GET['view'] == 'mhs'){ 70 | $display .='
    Tampilkan : Mahasiswa Bimbingan | Semua Mahasiswa

    '; 71 | } 72 | else if($_GET['view'] == 'all'){ 73 | $display .='Tampilkan : Mahasiswa Bimbingan | Semua Mahasiswa

    '; 74 | } 75 | 76 | } 77 | $display .= ''; 78 | $display .= ''; 79 | if($this->privilege == DSN || $this->privilege == ADM){ 80 | $display .= ''; 81 | $display .= ''; 82 | } 83 | if($this->privilege == ADM){ 84 | $display .= ''; 85 | } 86 | else{ 87 | $display .= ''; 88 | } 89 | $display .= ''; 90 | $i = $_GET['current_page']*20 +1; 91 | while($row = $res->fetch()){ 92 | $IPK = $this->getIPK($row['usr_id']); 93 | $display .= ''; 94 | $display .= ''; 95 | $display .= ''; 96 | if($this->privilege != MHS){ 97 | $display .= ''; 98 | $display .= ''; 100 | } 101 | $display .= ''; 103 | if($this->auth->session->get(POST_LOGIN_VAR) != $row['usr_login']){ 104 | $display .= ''; 113 | $display .= ''; 115 | } 116 | $display .= ''; 117 | $i++; 118 | } 119 | $display .= '
    NofotoNIMNamaIPKnilaiPilihanPilihan
    '.$i.''.$row['mhs_nim'].''.$row['usr_nama'].''.$IPK.''; 99 | $display .= 'lihat nilai'; 102 | $display .= 'privilege == ADM){ 111 | $display .= ''; 112 | $display .= ''; 114 | $display .= '
    '; 120 | if($this->privilege == ADM){ 121 | $display .='


    '; 122 | } 123 | return $display; 124 | } 125 | function getIPK($uid,$format = 0){ 126 | $sql = <<db->query($sql); 146 | $total_sks = 0; 147 | $total_mutu = 0; 148 | while ($row = $res->fetch()){ 149 | $mutu = $row['mk_sks'] * $row['nilai']; 150 | $total_mutu = $total_mutu + $mutu; 151 | $total_sks = $total_sks + $row['mk_sks']; 152 | } 153 | if($total_sks == 0){ 154 | $total_sks = 1; 155 | } 156 | $ipk = $total_mutu/$total_sks; 157 | if($format == 0){ 158 | $ipk =number_format($ipk,2,',','.'); 159 | } 160 | return $ipk; 161 | } 162 | function setQueryList(){ 163 | if($this->privilege != MHS){ 164 | if(!isset($_GET['view']) || $_GET['view'] == 'mhs'){ 165 | $usr_login = $this->auth->session->get(POST_LOGIN_VAR); 166 | $sql = <<privilege == MHS){ 215 | $sql = <<db->query("SELECT usr_login FROM tbl_users WHERE usr_id=$uid"); 237 | $row = $res->fetch(); 238 | $login = $row['usr_login']; 239 | $display = ''; 240 | $display .= '

    Detail Profile Mahasiswa

    '; 241 | $display .= '
    '; 242 | if($this->privilege == ADM || $this->usr_id == $uid){ 243 | $display .= ''; 244 | $display .= '

    '; 245 | } 246 | $display .= ''; 247 | $display .= $this->displayDetailUser($uid); 248 | if($this->privilege != MHS || ($this->privilege == MHS && $this->auth->session->get(POST_LOGIN_VAR) == $login)){ 249 | $display .= $this->dataOrtu($uid); 250 | $display .= $this->dataBeasiswa($uid); 251 | if(isset($_GET['action']) && $_GET['action'] == 'tambahbeasiswa'){ 252 | $display = '
    '; 253 | $display .= $this->tambahBeasiswa($uid); 254 | } 255 | } 256 | $display .= '


    '; 257 | if($this->privilege == ADM || $this->usr_id == $uid){ 258 | $display .= ''; 259 | $display .= ''; 260 | } 261 | $display .= '
    '; 262 | return $display; 263 | } 264 | function tambahBeasiswa($uid){ 265 | if(!isset($_POST['add'])){ 266 | $display = ''; 267 | $display .= '

    Tambahkan beasiswa

    '; 268 | $display .= '
    '; 269 | $display .= 'Nama Beasiswa:'; 270 | $display .= ''; 271 | $display .= 'Nominal:'; 272 | $display .= ''; 273 | $display .= 'Tenggang:'; 274 | $display .= ''; 275 | $display .= ''; 276 | $display .='
    '; 277 | } 278 | else{ 279 | $input = array_map('htmlentities',$_POST); 280 | $input = array_map('mysql_real_escape_string',$input); 281 | $sql = "INSERT INTO tbl_beasiswa(mhs_id, bea_nama, bea_nominal, bea_tenggang) 282 | VALUE( 283 | (SELECT mhs_id FROM tbl_mahasiswa WHERE usr_id=$uid), 284 | '".$input['bea_nama']."', 285 | '".$input['bea_nominal']."', 286 | '".$input['bea_tenggang']."' 287 | )"; 288 | $this->db->query($sql); 289 | header('Location:'.$_SERVER['PHP_SELF'].'?page=mahasiswa&view=detail&uid='.$uid); 290 | } 291 | return $display; 292 | } 293 | function dataOrtu($uid){ 294 | $res = $this->db->query("SELECT * FROM tbl_mahasiswa WHERE usr_id = $uid"); 295 | $display = ''; 296 | $display .= 'Data Orangtua'; 297 | $row = $res->fetch(); 298 | $display .= 'Nama Ayah:'.$row['ortu_ayah'].''; 299 | $display .= 'Pekerjaan Ayah:'.$row['ortu_job_ayah'].''; 300 | $display .= 'Nama Ibu:'.$row['ortu_ibu'].''; 301 | $display .= 'Pekerjaan Ibu:'.$row['ortu_job_ibu'].''; 302 | $display .= 'Total Penghasilan:'.$row['ortu_penghasilan'].''; 303 | $display .= 'Email Orangtua:'.$row['ortu_email'].''; 304 | $display .= 'Kontak Orang tua:'.$row['ortu_kontak'].''; 305 | 306 | return $display; 307 | } 308 | function dataBeasiswa($uid){ 309 | if(isset($_POST['hapus'])){ 310 | $this->db->query("DELETE FROM tbl_beasiswa WHERE bea_id=".$_POST['bea_id']); 311 | } 312 | $res = $this->db->query("SELECT * FROM tbl_beasiswa WHERE mhs_id=(SELECT mhs_id FROM tbl_mahasiswa WHERE usr_id=$uid)"); 313 | $display = ''; 314 | $display .= 'Beasiswa yang diterima'; 315 | if($res->size() == 0){ 316 | $display .= 'Mahasiswa ini tidak memiliki beasiswa'; 317 | } 318 | else if($res->size() == 1){ 319 | $row = $res->fetch(); 320 | $jlh = number_format($row['bea_nominal'],2,',','.'); 321 | $display .= 'Nama Besiswa:'.$row['bea_nama'].''; 322 | $display .= 'Nominal Besiswa:Rp. '.$jlh.''; 323 | $display .= 'Tenggang Pemberian:'.$row['bea_tenggang'].''; 324 | $display .= ''; 325 | $display .= '
    '; 326 | $display .= ''; 327 | $display .= '
    '; 328 | $display .= ''; 329 | } 330 | else{ 331 | $i = 1; 332 | while ($row = $res->fetch()) { 333 | $jlh = number_format($row['bea_nominal'],2,',','.'); 334 | $display .= 'Besiswa ke-'.$i.''; 335 | $display .= 'Nama Besiswa:'.$row['bea_nama'].''; 336 | $display .= 'Nominal Besiswa:Rp. '.$jlh.''; 337 | $display .= 'Tenggang Pemberian:'.$row['bea_tenggang'].''; 338 | $display .= ''; 339 | $display .= '
    '; 340 | $display .= ''; 341 | $display .= '
    '; 342 | $display .= ''; 343 | } 344 | } 345 | $display .= ''; 346 | return $display; 347 | } 348 | function addMhs(){ 349 | $display = ''; 350 | if(isset($_POST['tambah'])){ 351 | $display .= $this->checkFormMhs($error, $print_again); 352 | } 353 | else{ 354 | $display .= $this->displayFormMhs($error, $print_again); 355 | } 356 | return $display; 357 | } 358 | function displayFormMhs($error, $print_again){ 359 | $display = ''; 360 | $target = $_SERVER['PHP_SELF'].'page=dosen&view=add_dosen'; 361 | $msg= array( 362 | 'usr_login' => '*', 363 | 'usr_password' => '* (>= 6 karakter)', 364 | 'verify' => '*', 365 | 'mhs_nim' => '* (numerik)', 366 | 'usr_nama' => '*', 367 | 'usr_kelamin' => '*', 368 | 'usr_email' =>'*', 369 | 'foto' =>'harus jpeg', 370 | ); 371 | $fields = array ( 372 | 'usr_login' => 'text', 373 | 'usr_password' => 'password', 374 | 'verify' => 'password', 375 | 'mhs_nim' => 'text', 376 | 'mhs_angkatan' => 'option', 377 | 'dsn_id' => 'option', 378 | 'usr_nama' => 'text', 379 | 'usr_kelamin' => 'option', 380 | 'usr_email' => 'text', 381 | 'usr_kontak' => 'text', 382 | 'usr_desc' => 'text', 383 | 'foto' => 'file', 384 | 'addr_lokasi_tinggal' => 'text', 385 | 'addr_wilayah_tinggal' => 'text', 386 | 'addr_provinsi_tinggal' => 'text', 387 | 'addr_kodepos_tinggal' => 'text', 388 | 'addr_lokasi_asal' => 'text', 389 | 'addr_wilayah_asal' => 'text', 390 | 'addr_provinsi_asal' => 'text', 391 | 'addr_kodepos_asal' => 'text', 392 | 'ortu_ayah' => 'text', 393 | 'ortu_ibu' => 'text', 394 | 'ortu_job_ayah' => 'text', 395 | 'ortu_job_ibu' => 'text', 396 | 'ortu_penghasilan' => 'option', 397 | 'ortu_kontak' => 'text', 398 | 'ortu_email' => 'text' 399 | ); 400 | $labels = array ( 401 | 'usr_login' => 'User Login', 402 | 'usr_password' => 'Password', 403 | 'verify' => 'Verifikasi', 404 | 'mhs_nim' => 'NIM', 405 | 'mhs_angkatan' => 'Angkatan', 406 | 'dsn_id' => 'Pembimbing Akademik', 407 | 'usr_nama' => 'Nama', 408 | 'usr_kelamin' => 'Jenis Kelamin', 409 | 'usr_email' => 'Email', 410 | 'usr_kontak' => 'Kontak', 411 | 'usr_desc' => 'Deskripsi', 412 | 'foto' => 'Foto', 413 | 'addr_lokasi_tinggal' => 'Alamat Tinggal', 414 | 'addr_wilayah_tinggal' => 'Kota / Kabupaten', 415 | 'addr_provinsi_tinggal' => 'Propinsi', 416 | 'addr_kodepos_tinggal' => 'Kodepost', 417 | 'addr_lokasi_asal' => 'Alamat Asal', 418 | 'addr_wilayah_asal' => 'Kota / Kabupaten', 419 | 'addr_provinsi_asal' => 'Propinsi', 420 | 'addr_kodepos_asal' => 'Kodepost', 421 | 'ortu_ayah' => 'Nama Ayah', 422 | 'ortu_ibu' => 'Nama Ibu', 423 | 'ortu_job_ayah' => 'Pakerjaan Ayah', 424 | 'ortu_job_ibu' => 'Pekerjaan Ibu', 425 | 'ortu_penghasilan' => 'Total Penghasilan', 426 | 'ortu_kontak' => 'No. Kontak', 427 | 'ortu_email' => 'Email Orangtua' 428 | ); 429 | $display .= '

    Tambah Mahasiswa

    '; 430 | if($print_again){ 431 | $display .= '

    Kesalahan Pengisian!! Periksa kembali!

    '; 432 | } 433 | $display .= '
    '; 434 | $display .= ''; 435 | foreach ($fields as $name => $type){ 436 | if($name == 'usr_kelamin'){ 437 | $display .= ''; 438 | $display .= ''; 442 | } 443 | else if($name == 'usr_desc'){ 444 | $display .= ''; 445 | $display .= ''; 450 | } 451 | else if($name == 'dsn_id'){ 452 | $res = $this->db->query("SELECT tbl_dosen.dsn_id,tbl_users.usr_nama FROM tbl_users,tbl_dosen WHERE tbl_users.usr_id = tbl_dosen.usr_id"); 453 | $display .= ''; 454 | $display .= ''; 459 | } 460 | else if($name == 'mhs_angkatan'){ 461 | $display .= ''; 462 | $display .= ''; 467 | } 468 | else if($name == 'ortu_penghasilan'){ 469 | $display .= ''; 470 | $display .= ''; 478 | } 479 | else{ 480 | $display .= ''; 481 | $display .= ''; 482 | $display .= ''; 492 | } 493 | } 494 | $display .= ''; 495 | $display .= '
    '.$labels[$name].'
    '.$labels[$name].''; 446 | if($print_again){ 447 | $display .= $this->errorFlag($error,$name,$fields); 448 | } 449 | $display .= '
    '.$labels[$name].'
    '.$labels[$name].'
    '.$labels[$name].'
    '.$labels[$name].''; 483 | if($print_again){ 484 | $display .= $this->errorFlag($error,$name,$fields); 485 | } 486 | else{ 487 | if(isset($msg[$name])){ 488 | $display .= ''.$msg[$name].''; 489 | } 490 | } 491 | $display .= '
     
    '; 496 | return $display; 497 | } 498 | function checkFormMhs($error, $print_again){ 499 | $print_again = false; 500 | if(!$this->isValue($_POST['usr_nama'])){ 501 | $error['usr_nama'] = true; 502 | $print_again = true; 503 | } 504 | if(!$this->isPassword($_POST['usr_password'],$_POST['verify'])){ 505 | $error['usr_password'] = true; 506 | $error['verify'] = true; 507 | $print_again = true; 508 | } 509 | if(!$this->isEmail($_POST['usr_email'])){ 510 | $error['usr_email'] = true; 511 | $print_again = true; 512 | } 513 | if(!$this->isLogin($_POST['usr_login'])){ 514 | $error['usr_login'] = true; 515 | $print_again = true; 516 | } 517 | if(!$this->isNIM($_POST['mhs_nim'])){ 518 | $error['mhs_nim'] = true; 519 | $print_again = true; 520 | } 521 | if($print_again){ 522 | $display = $this->displayFormMhs($error, $print_again); 523 | } 524 | else{ 525 | $display = $this->storeMhs(); 526 | } 527 | return $display; 528 | } 529 | function deleteMhs($uid){ 530 | if(!isset($_POST['confirm'])){ 531 | $res = $this->db->query("SELECT usr_nama FROM tbl_users WHERE usr_id = '$uid'"); 532 | $row = $res->fetch(); 533 | $nama = $row['usr_nama']; 534 | $uri = $_SERVER['REQUEST_URI']; 535 | $display = << 537 | Anda Yakin akan menghapus Mahasiswa dengan nama $nama

    538 |
    539 |   540 |   541 |
    542 | 543 | EOD; 544 | return $display; 545 | } 546 | else if($_POST['confirm'] == 'yes'){ 547 | $this->db->query("DELETE FROM tbl_users WHERE usr_id='$uid'"); 548 | $this->db->query("DELETE FROM tbl_users WHERE usr_id='$uid'"); 549 | $this->db->query("DELETE FROM tbl_alamat WHERE usr_id='$uid'"); 550 | $this->db->query("DELETE FROM tbl_pesan WHERE usr_id_asal='$uid'"); 551 | $this->db->query("DELETE FROM tbl_pesan WHERE usr_id_tujuan='$uid'"); 552 | $this->db->query("DELETE FROM tbl_kontrak WHERE mhs_id=(SELECT mhs_id FROM tbl_mahasiswa WHERE usr_id='$uid')"); 553 | $this->db->query("DELETE FROM tbl_mahasiswa WHERE usr_id='$uid'"); 554 | header('Location:'.$_SERVER['PHP_SELF'].'?page=mahasiswa'); 555 | } 556 | else{ 557 | header('Location:'.$_SERVER['PHP_SELF'].'?page=mahasiswa'); 558 | } 559 | } 560 | function storeMhs(){ 561 | $this-> storeDataUser(); 562 | $this->storeAlamat(); 563 | $this->storeDataMhs(); 564 | $self = $_SERVER['PHP_SELF']; 565 | $msg = << 567 | Data tersimpan!

    Kembali ke: 568 | Form pengisian | 569 | Daftar Mahasiswa 570 | 571 | EOD; 572 | return $msg; 573 | } 574 | function storeDataMhs(){ 575 | $input = array_map('htmlentities',$_POST); 576 | $input = array_map('mysql_real_escape_string',$input); 577 | $sql = " 578 | INSERT INTO tbl_mahasiswa( 579 | usr_id, 580 | mhs_nim, 581 | dsn_id, 582 | mhs_angkatan, 583 | ortu_ayah, 584 | ortu_ibu, 585 | ortu_job_ayah, 586 | ortu_job_ibu, 587 | ortu_penghasilan, 588 | ortu_kontak, 589 | ortu_email 590 | ) 591 | VALUE( 592 | (SELECT usr_id FROM tbl_users WHERE usr_login='".$input['usr_login']."'), 593 | '".$input['mhs_nim']."', 594 | '".$input['dsn_id']."', 595 | '".$input['mhs_angkatan']."', 596 | '".$input['ortu_ayah']."', 597 | '".$input['ortu_ibu']."', 598 | '".$input['ortu_job_ayah']."', 599 | '".$input['ortu_job_ibu']."', 600 | '".$input['ortu_penghasilan']."', 601 | '".$input['ortu_kontak']."', 602 | '".$input['ortu_email']."' 603 | )"; 604 | $this->db->query($sql); 605 | } 606 | function storeDataUser(){ 607 | $input = array_map('htmlentities',$_POST); 608 | $input = array_map('mysql_real_escape_string',$input); 609 | $sql =" 610 | INSERT INTO tbl_users( 611 | usr_login, 612 | usr_password, 613 | usr_nama, 614 | usr_privilege, 615 | usr_kelamin, 616 | usr_email, 617 | usr_kontak, 618 | usr_desc 619 | ) 620 | VALUE( 621 | '".strtolower($input['usr_login'])."', 622 | MD5('".$input['usr_password']."'), 623 | '".$input['usr_nama']."', 624 | 0 , 625 | '".$input['usr_kelamin']."', 626 | '".$input['usr_email']."', 627 | '".$input['usr_kontak']."', 628 | '".$input['usr_desc']."' 629 | )"; 630 | $this->db->query($sql); 631 | if(isset($_FILES['foto'])){ 632 | $this->storeFoto($input['usr_login']); 633 | } 634 | } 635 | function isNIM($nim,$opt=0){ 636 | $sql = "SELECT mhs_nim FROM tbl_mahasiswa WHERE mhs_nim = '$nim'"; 637 | $res = $this->db->query($sql); 638 | $size = $res->size(); 639 | if($size == $opt && ctype_digit($nim) && $this->isValue($nim)){ 640 | return true; 641 | } 642 | else{ 643 | return false; 644 | } 645 | } 646 | function viewNilai($uid){ 647 | $display = ''; 648 | $res = $this->db->query(" SELECT tbl_users.usr_nama,tbl_mahasiswa.mhs_semester FROM tbl_users,tbl_mahasiswa WHERE tbl_users.usr_id= tbl_mahasiswa.usr_id AND tbl_users.usr_id=$uid"); 649 | $row = $res->fetch(); 650 | $display .= '

    Transkrip nilai '.$row['usr_nama'].'

    '; 651 | $display .= '

    IPK '.$this->getIPK($uid).'

    '; 652 | $display .= ''; 653 | for($i=1;$i<=$row['mhs_semester'];$i++){ 654 | $display .= $this->nilaiSemester($i,$uid); 655 | } 656 | $display .= '
    '; 657 | $display .= '<<kembali'; 658 | return $display; 659 | } 660 | function nilaiSemester($semester,$uid){ 661 | $semester_string = array(1 => 'I',2 => 'II',3 => 'III', 4 => 'IV',5 =>'V',6=>'VI', 662 | 7 => 'VII',8 => 'VIII', 9 => 'IX',10 => 'X',11=>'XI',12 => 'XII', 663 | 13 => 'XIII',14 => 'XIV',15 => 'XV', 16 => 'XIV' 664 | ); 665 | $sql= <<=2 692 | AND tbl_kontrak.mk_id = tbl_matakuliah.mk_id 693 | GROUP BY tbl_kontrak.mk_id 694 | EOD; 695 | $jml_mk = 0; 696 | $total_mutu=0; 697 | $sks_kontrak = 0; 698 | $sks_bl = 0; 699 | $self = $_SERVER['PHP_SELF']; 700 | $result = $this->db->query($sql); 701 | $display = ''; 702 | $display .= ' Semester '.$semester_string[$semester].''; 703 | $display .= 'KodeNama MatakuliahSKSNilaiMutuHistory'; 704 | while($row = $result->fetch()){ 705 | if($row['kontrak_semester']==$semester){ 706 | $mutu = $row['beban'] * $row['mk_sks']; 707 | $display .= ''.$row['mk_kode'].''; 708 | $display .= ''.$row['mk_nama'].''; 709 | $display .= ''.$row['mk_sks'].''; 710 | $display .= ''.$row['nilai'].''; 711 | $display .= ''.$mutu.''; 712 | if($this->privilege == MHS){ 713 | $display .= 'history'; 714 | } 715 | else{ 716 | $display .= 'history'; 717 | } 718 | $total_mutu = $total_mutu + $mutu; 719 | if($row['kontrak_status'] == 2 || $row['nilai'] == 'BL'){ 720 | $sks_bl = $sks_bl + $row['mk_sks']; 721 | } 722 | $sks_kontrak = $sks_kontrak + $row['mk_sks']; 723 | } 724 | } 725 | $sks_selesai = $sks_kontrak - $sks_bl; 726 | if($sks_selesai == 0){ 727 | $sks_tmp =1; 728 | } 729 | else{ 730 | $sks_tmp = $sks_selesai; 731 | } 732 | $ip = $total_mutu / $sks_tmp; 733 | $ip = number_format($ip,2,',','.'); 734 | $display .= ''; 735 | $display .= ' SKS KONTRAK : '.$sks_kontrak.'      '; 736 | $display .= ' SKS SELESAI : '.$sks_selesai.'      '; 737 | $display .= ' MUTU : '.$total_mutu.'       '; 738 | $display .= ' IP : '.$ip; 739 | $display .= '

    '; 740 | return $display; 741 | } 742 | function historyNilai($uid,$mk_id){ 743 | $semester_string = array(1 => 'I',2 => 'II',3 => 'III', 4 => 'IV',5 =>'V',6=>'VI', 744 | 7 => 'VII',8 => 'VIII', 9 => 'IX',10 => 'X',11=>'XI',12 => 'XII', 745 | 13 => 'XIII',14 => 'XIV',15 => 'XV', 16 => 'XIV' 746 | ); 747 | $res_nama = $this->db->query("SELECT usr_nama FROM tbl_users WHERE usr_id = $uid"); 748 | $res_mk = $this->db->query("SELECT mk_nama FROM tbl_matakuliah WHERE mk_id = $mk_id"); 749 | $row_nama = $res_nama->fetch(); 750 | $row_mk = $res_mk->fetch(); 751 | $sql = <<db->query($sql); 773 | $display = ''; 774 | $display = '

    History Nilai / Kontrak
    '.$row_nama['usr_nama'].'
    pada matakuliah
    '.$row_mk['mk_nama'].'

    '; 775 | $display .= ''; 776 | $display .= ''; 777 | while($row = $res->fetch()){ 778 | $display .= ''; 779 | $display .= ''; 780 | $display .= ''; 781 | $display .= ''; 782 | $display .= ''; 783 | } 784 | $display .= '
    Di Kontrak padaNilaiDosen
    Semester '.$semester_string[$row['kontrak_semester']].''.$row['kontrak_nilai'].''.$row['usr_nama'].'
    '; 785 | $self = $_GET['PHP_SELF']; 786 | if($this->privilege != MHS){ 787 | $display .= <<

    Kembali ke: 789 | Transkrip Nilai | 790 | Daftar Mahasiswa 791 | 792 | EOD; 793 | } 794 | else{ 795 | $display .= '<<kembali'; 796 | } 797 | return $display; 798 | } 799 | function displayFormEditMhs($uid){ 800 | $labels = array ( 801 | 'usr_login' => 'User Login', 802 | 'usr_password' => 'Password', 803 | 'usr_password_verify' => 'Verifikasi', 804 | 'mhs_nim' => 'NIM', 805 | 'mhs_angkatan' => 'Angkatan', 806 | 'dsn_id' => 'Pembimbing Akademik', 807 | 'usr_nama' => 'Nama', 808 | 'usr_kelamin' => 'Jenis Kelamin', 809 | 'usr_email' => 'Email', 810 | 'usr_kontak' => 'Kontak', 811 | 'usr_desc' => 'Deskripsi', 812 | 'foto' => 'Foto', 813 | 'addr_lokasi_tinggal' => 'Alamat Tinggal', 814 | 'addr_wilayah_tinggal' => 'Kota / Kabupaten Tinggal', 815 | 'addr_provinsi_tinggal' => 'Propinsi Tinggal', 816 | 'addr_kodepos_tinggal' => 'Kodepost Tinggal', 817 | 'addr_lokasi_asal' => 'Alamat Asal', 818 | 'addr_wilayah_asal' => 'Kota / Kabupaten Asal', 819 | 'addr_provinsi_asal' => 'Propinsi Asal', 820 | 'addr_kodepos_asal' => 'Kodepost Asal', 821 | 'ortu_ayah' => 'Nama Ayah', 822 | 'ortu_ibu' => 'Nama Ibu', 823 | 'ortu_job_ayah' => 'Pakerjaan Ayah', 824 | 'ortu_job_ibu' => 'Pekerjaan Ibu', 825 | 'ortu_penghasilan' => 'Total Penghasilan', 826 | 'ortu_kontak' => 'No. Kontak', 827 | 'ortu_email' => 'Email Orangtua' 828 | ); 829 | $display = ''; 830 | $display .= '

    Ubah Profile Mahasiswa

    '; 831 | if(isset($_POST['save'])){ 832 | if($_POST['save'] == 'simpan'){ 833 | unset($_POST['usr_password']); 834 | unset($_POST['usr_password_verify']); 835 | } 836 | $msg_error = $this->checkFormEditMhs($labels); 837 | if($msg_error != ''){ 838 | $display .= '
      '.$msg_error.'
    '; 839 | } 840 | else{ 841 | $this->storeEditMhs(); 842 | $display .= '
    Data Tersimpan!!


    '; 843 | } 844 | $_POST['foto'] = ''; 845 | unset($_POST['usr_password']); 846 | unset($_POST['usr_password_verify']); 847 | } 848 | else{ 849 | $_POST = $this->getValueEdit($uid); 850 | } 851 | $read_only = array('mhs_nim','mhs_angkatan','usr_login'); 852 | $display .= '
    $value){ 856 | if(in_array($key,$read_only)){ 857 | $use = ' readonly="readonly"'; 858 | } 859 | else{ 860 | $use = ''; 861 | } 862 | if(isset($labels[$key])){ 863 | if($key == 'dsn_id'){ 864 | $res = $this->db->query("SELECT tbl_dosen.dsn_id,tbl_users.usr_nama 865 | FROM tbl_users,tbl_dosen 866 | WHERE tbl_users.usr_id = tbl_dosen.usr_id 867 | "); 868 | $display .= ''.$labels[$key] .':'; 869 | if($this->privilege != ADM){ 870 | $display .= ''; 874 | } 875 | while($row = $res->fetch()){ 876 | if($row['dsn_id'] == $value){ 877 | $display .= ''; 878 | } 879 | else{ 880 | $display .= ''; 881 | } 882 | } 883 | $display .= ''; 884 | } 885 | else if($key == 'usr_kelamin'){ 886 | $display .= ''.$labels[$key] .':'; 887 | $display .= ''; 896 | } 897 | else if($key == 'ortu_penghasilan'){ 898 | $display .= ''.$labels[$key] .':'; 899 | $display .= ''; 908 | } 909 | else if($key == 'usr_desc'){ 910 | $display .= ''.$labels[$key] .':'; 911 | $display .= ''; 912 | } 913 | else if($key == 'foto'){ 914 | $display .= ''.$labels[$key] .':'; 915 | $display .= ''; 916 | } 917 | else{ 918 | $display .= ''.$labels[$key] .':'; 919 | $display .= ''; 920 | } 921 | } 922 | } 923 | $display .= ''; 924 | $display .= 'Password:'; 925 | $display .= ''; 926 | $display .= 'Verifikasi:'; 927 | $display .= ''; 928 | $display .= ''; 929 | $display .= ''; 930 | $display .= ''; 931 | 932 | return $display; 933 | } 934 | function getValueEdit($uid){ 935 | $sql = <<db->query($sql); 967 | $row = $res->fetch(); 968 | return $row; 969 | } 970 | function checkFormEditMhs($fields){ 971 | $display = ''; 972 | $not_req = array('ortu_email'=>'','addr_lokasi_asal'=>'', 973 | 'addr_wilayah_asal'=>'','addr_provinsi_asal'=>'','addr_kodepos_asal'=>''); 974 | if(!$this->isEmail($_POST['usr_email'])){ 975 | $display .= '
  • Email Tidak valid
  • '; 976 | } 977 | foreach ($_POST AS $key => $value){ 978 | if(!$this->isValue($value) && !isset($not_req[$key])){ 979 | $display .= '
  • '.$fields[$key].' Harus diisi!
  • '; 980 | } 981 | } 982 | if($_POST['save'] == 'simpan & ubah password' && !$this->isPassword($_POST['usr_password'],$_POST['usr_password_verify'])){ 983 | $display .= '
  • Password tidak valid atau tidak sama
  • '; 984 | } 985 | return $display; 986 | } 987 | function storeEditMhs(){ 988 | $this->storeEditUser(); 989 | if($_POST['save'] != 'simpan'){ 990 | $this->storeEditPassword(); 991 | } 992 | $this->storeEditAlamat(); 993 | $this->storeEditDataMhs(); 994 | } 995 | function storeEditDataMhs(){ 996 | $input = array_map('htmlentities',$_POST); 997 | $input = array_map('mysql_real_escape_string',$input); 998 | if($this->privilege == ADM){ 999 | $id = $_GET['uid']; 1000 | } 1001 | else{ 1002 | $id = $this->usr_id; 1003 | } 1004 | $this->db->query("UPDATE tbl_mahasiswa SET 1005 | ortu_ayah='".$input['ortu_ayah']."', 1006 | ortu_ibu='".$input['ortu_ibu']."', 1007 | ortu_job_ayah='".$input['ortu_job_ayah']."', 1008 | ortu_job_ibu='".$input['ortu_job_ibu']."', 1009 | ortu_penghasilan='".$input['ortu_penghasilan']."', 1010 | ortu_kontak='".$input['ortu_kontak']."', 1011 | ortu_email='".$input['ortu_email']."' 1012 | WHERE usr_id = $id 1013 | "); 1014 | if($this->privilege == ADM){ 1015 | $this->db->query("UPDATE tbl_mahasiswa SET dsn_id = ".$input['dsn_id']." WHERE usr_id=$id"); 1016 | } 1017 | } 1018 | } 1019 | --------------------------------------------------------------------------------