public function login() { $user = $_POST['user']; $pass = $_POST['pass']; $pwd = Hash::create('sha1', $pass, HASH_SALT_KEY); $cuser = new User($this->registry); $res = $cuser->login($user, $pwd); if ((int) $res[0] == 1) { $univ = new Universitas($this->registry); $d_univ = array(); $d_jur = array(); $aruniv = $univ->get_univ(); foreach ($aruniv as $v) { if ($v->get_pic() == $res[2]) { $d_univ[] = $v->get_kode_in(); $jur = new Jurusan($this->registry); $arjur = $jur->get_jur_by_univ($v->get_kode_in()); foreach ($arjur as $w) { $d_jur[] = $w->get_kode_jur(); } } } Session::createSession(); Session::set('loggedin', TRUE); Session::set('user', $user); Session::set('role', $res[1]); Session::set('kd_user', $res[3]); Session::set('univ', $d_univ); Session::set('jur', $d_jur); ClassLog::write_log("login", "login", "user " . $user . " role:" . $res[1]); header('location:' . URL); } else { if ((int) $res[0] == 0) { $this->view->error = "user tidak ditemukan!"; $this->view->load('admin/login'); } else { $this->view->error = "database tidak valid!"; $this->view->load('admin/login'); } } }
public function get_jur_by_univ() { $univ = $_POST['param']; $jur = new Jurusan($this->registry); $data = $jur->get_jur_by_univ($univ); echo "<option value=''>-Pilih Jurusan-</option>"; foreach ($data as $val) { echo "<option value=" . $val->get_kode_jur() . ">" . $val->get_nama() . "</option>"; } }
public function get_jur_by_univ() { if (isset($_POST['univ']) && $_POST['univ'] != "") { $univ = $_POST['univ']; $jurusan = new Jurusan($this->registry); $data = $jurusan->get_jur_by_univ($univ); echo "<option value=\"\">Pilih Jurusan</option>"; foreach ($data as $jur) { if (isset($_POST['jur_def'])) { if ($jur->get_kode_jur() == $_POST['jur_def']) { $select = " selected"; } else { $select = ""; } echo "<option value=" . $jur->get_kode_jur() . "" . $select . ">" . $jur->get_nama() . "</option>\n"; } else { echo "<option value=" . $jur->get_kode_jur() . ">" . $jur->get_nama() . "</option>\n"; } } } else { echo "<option value=''>Pilih Jurusan</option>"; } }
public function viewEditKontrak($id = null) { if (Session::get('role') != 2) { $this->display(); exit; } if ($id != "") { $kontrak = new Kontrak(); $data = $kontrak->get_by_id($id); //var_dump($kontrak); $universitas = new Universitas($this->registry); $current_univ = $universitas->get_univ_by_jur($data->kd_jurusan); $jurusan = new Jurusan($this->registry); $jur = $jurusan->get_jur_by_univ($current_univ->get_kode_in()); //echo $data->kd_jurusan; //var_dump($jur); $this->view->universitas = $universitas; $kd_user = Session::get('kd_user'); //echo $kd_user; $univ = $universitas->get_univ_by_pic($kd_user); $kon = $kontrak->get_by_jur($data->kd_jurusan); $this->view->jur = $jur; $this->view->univ = $univ; $this->view->data = $data; $this->view->kon = $kon; $this->view->load('kontrak/edit_kontrak_dialog'); } }