public function getData($id, $title, $kode)
 {
     $dateNow = Carbon::now();
     $kelasDosen = Perkuliahan::select('kodekelas')->where('nip', '=', $id)->get()->toArray();
     $data = array('dosen' => DB::table('dosen')->where('nip', $id)->first(), 'dosenProfile' => Dosen::where('nip', '=', Request::segment(3))->first(), 'kelas' => Mhskelas::with(array('mhs', 'perkuliahan', 'mk'))->where('nim', '=', $id)->get(), 'kelasDosen' => Perkuliahan::with(array('mk', 'dosen'))->where('nip', '=', $id)->get(), 'title' => $title, 'listPerkuliahan' => ['' => '-- Pilih kelas --'] + Mhskelas::select('matakuliah.namamk', 'mhskelas.kodekelas')->join('matakuliah', 'mhskelas.kodemk', '=', 'matakuliah.kodemk')->join('mahasiswa', 'mhskelas.nim', '=', 'mahasiswa.nim')->where('mahasiswa.nim', '=', $id)->lists('matakuliah.namamk', 'mhskelas.kodekelas'), 'perkuliahanDosen' => ['' => '-- Pilih kelas --'] + Perkuliahan::select('perkuliahan.kodekelas', 'matakuliah.namamk')->join('matakuliah', 'matakuliah.kodemk', '=', 'perkuliahan.kodemk')->where('perkuliahan.nip', '=', $id)->lists('matakuliah.namamk', 'perkuliahan.kodekelas'), 'grup' => AnggotaGrup::select('grup.nama', 'grup.kodekelas')->join('grup', 'grup.id', '=', 'anggota_grup.id_grup')->where('anggota_grup.nim', '=', $id)->get(), 'post' => Post::with(array('komentar', 'mhs', 'perkuliahan'))->where('creator', '=', $id)->get(), 'postKelas' => Post::with(array('komentar', 'mhs', 'perkuliahan'))->where('id_scope', '=', $kode)->get(), 'kelasMember' => Mhskelas::with('mhs')->where('kodekelas', '=', $kode)->get(), 'infokelas' => Perkuliahan::with('mk', 'dosen')->where('kodekelas', '=', $kode)->first(), 'tugasDosen' => Tugas::where('pengumpulan', '>=', $dateNow)->whereIn('kelas', $kelasDosen)->get(), 'pengumumanDosen' => Pengumuman::where('waktuaktif', '>=', $dateNow)->whereIn('kodekelas', $kelasDosen)->get());
     return $data;
 }
Ejemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('mahasiswa')->delete();
     DB::table('wali')->delete();
     DB::table('dosen')->delete();
     DB::table('hobi')->delete();
     DB::table('mahasiswa_hobi')->delete();
     $dosen = Dosen::create(array('nama' => 'Fazma Arif', 'nipd' => '1234567890'));
     $this->command->info('Data dosen telah diisi!');
     $puji = Mahasiswa::create(array('nama' => 'Puji Muharani', 'nim' => '1103120133', 'id_dosen' => $dosen->id));
     $aul = Mahasiswa::create(array('nama' => 'Aulia Marchita', 'nim' => '1103120264', 'id_dosen' => $dosen->id));
     $ganin = Mahasiswa::create(array('nama' => 'Ganine Vinanda', 'nim' => '1103124321', 'id_dosen' => $dosen->id));
     $this->command->info('Mahasiswa telah diisi!');
     Wali::create(array('nama' => 'Bedy Purnama', 'id_mahasiswa' => $puji->id));
     Wali::create(array('nama' => 'Tjokorda', 'id_mahasiswa' => $aul->id));
     Wali::create(array('nama' => 'Fatimah Arum', 'id_mahasiswa' => $ganin->id));
     $this->command->info('Data mahasiswa dan wali telah diisi!');
     $menggambar = Hobi::create(array('hobi' => 'Menggambar'));
     $ngoding = Hobi::create(array('hobi' => 'Ngoding'));
     $puji->hobi()->attach($menggambar->id);
     $aul->hobi()->attach($ngoding->id);
     $ganin->hobi()->attach($menggambar->id);
     $ganin->hobi()->attach($ngoding->id);
     $this->command->info('Mahasiswa beserta Hobi telah diisi!');
 }
 public function getData($id, $title, $kodeKelas, $kodeGrup)
 {
     $dateNow = Carbon::now();
     $kelasDosen = Perkuliahan::select('kodekelas')->where('nip', '=', $id)->get()->toArray();
     $kelasMhs = Mhskelas::select('kodekelas')->where('nim', '=', $id)->get()->toArray();
     $data = array('mahasiswaProfile' => Mahasiswa::with('dosenWali')->where('nim', '=', Request::segment(3))->first(), 'mahasiswa' => Mahasiswa::where('nim', '=', $id)->first(), 'dosenwali' => ['' => '-- Pilih dosen --'] + Dosen::lists('nama', 'nip'), 'kelas' => Mhskelas::with(array('mhs', 'perkuliahan', 'mk'))->where('nim', '=', $id)->get(), 'title' => $title, 'listPerkuliahan' => ['' => '-- Pilih kelas --'] + Mhskelas::select('matakuliah.namamk', 'mhskelas.kodekelas')->join('matakuliah', 'mhskelas.kodemk', '=', 'matakuliah.kodemk')->join('mahasiswa', 'mhskelas.nim', '=', 'mahasiswa.nim')->where('mahasiswa.nim', '=', $id)->lists('matakuliah.namamk', 'mhskelas.kodekelas'), 'grup' => AnggotaGrup::select('grup.nama', 'grup.kodekelas', 'grup.id')->join('grup', 'grup.id', '=', 'anggota_grup.id_grup')->where('anggota_grup.nim', '=', $id)->get(), 'kelasMember' => Mhskelas::with('mhs')->where('kodekelas', '=', $kodeKelas)->get(), 'infokelas' => Perkuliahan::with('mk', 'dosen')->where('kodekelas', '=', $kodeKelas)->first(), 'infoGrup' => Grup::with('mk', 'mhs')->where('id', '=', $kodeGrup)->first(), 'grupMember' => AnggotaGrup::with('mhs')->where('id_grup', '=', $kodeGrup)->get(), 'inviteNotifCount' => Notifikasi::with('mhs')->where('recepient', '=', $id)->get(), 'tugasDosen' => Tugas::where('pengumpulan', '>=', $dateNow)->whereIn('kelas', $kelasDosen)->get(), 'tugasMhs' => Tugas::where('pengumpulan', '>=', $dateNow)->whereIn('kelas', $kelasMhs)->get(), 'pengumumanDosen' => Pengumuman::where('waktuaktif', '>=', $dateNow)->whereIn('kodekelas', $kelasDosen)->get(), 'pengumumanMhs' => Pengumuman::where('waktuaktif', '>=', $dateNow)->whereIn('kodekelas', $kelasMhs)->get());
     return $data;
 }
Ejemplo n.º 4
0
 public function edit($id)
 {
     $mhs = Mahasiswa::find($id);
     $dosens = Dosen::lists('nama', 'id');
     $status_mahasiswa = [0 => 'Aktif', 1 => 'Lulus', 2 => 'BSS', 3 => 'Keluar'];
     $agama = [1 => 'Islam', 2 => 'Kristen Protestan', 3 => 'Kristen Katolik', 4 => 'Hindu', 5 => 'Budha'];
     $jalur_masuk = [1 => 'SBMPTN', 2 => 'SNMPTN'];
     $sumber_dana = [1 => 'Sumber Dana Sendiri', 2 => 'Beasiswa', 3 => 'Sumber Dana Lainnya'];
     $jenis_kelamin = [0 => 'Pria', 1 => 'Wanita'];
     return view('mahasiswa.edit', compact('mhs', 'dosens', 'status_mahasiswa', 'agama', 'jalur_masuk', 'sumber_dana', 'jenis_kelamin'));
 }
Ejemplo n.º 5
0
 /**
  * Run the database seeds.
  */
 public function run()
 {
     Model::unguard();
     $if = ProgramStudi::create(['nama' => 'S1 Teknik Informatika', 'deskripsi' => 'Informatika adalah.....']);
     $ik = ProgramStudi::create(['nama' => 'S1 Ilmu Komputasi', 'deskripsi' => 'IK adalah.....']);
     $admin = Admin::create();
     $user = User::create(['nama' => 'feber', 'username' => 'feber', 'password' => bcrypt('feber'), 'userable_id' => $admin->id, 'userable_type' => User::TYPE_ADMIN]);
     $dosen = Dosen::create(['nip' => '053', 'prodi_id' => $if->id]);
     $user = User::create(['nama' => 'mahar', 'username' => 'mahar', 'password' => bcrypt('mahar'), 'userable_id' => $dosen->id, 'userable_type' => User::TYPE_DOSEN]);
     $dosen = Dosen::create(['nip' => '054', 'prodi_id' => $ik->id]);
     $user = User::create(['nama' => 'sendy', 'username' => 'sendy', 'password' => bcrypt('sendy'), 'userable_id' => $dosen->id, 'userable_type' => User::TYPE_DOSEN]);
     $mahasiswa = Mahasiswa::create(['nim' => '1103', 'prodi_id' => $if->id]);
     $user = User::create(['nama' => 'dimas', 'username' => 'dimas', 'password' => bcrypt('dimas'), 'userable_id' => $mahasiswa->id, 'userable_type' => User::TYPE_MAHASISWA]);
     $mahasiswa = Mahasiswa::create(['nim' => '1107', 'prodi_id' => $ik->id]);
     $user = User::create(['nama' => 'ali', 'username' => 'ali', 'password' => bcrypt('ali'), 'userable_id' => $mahasiswa->id, 'userable_type' => User::TYPE_MAHASISWA]);
     MataKuliah::create(['nama' => 'Desain Analisis Algoritma', 'kode' => 'CSG1xx', 'deskripsi' => 'Main algoritma...', 'prodi_id' => $if->id]);
     MataKuliah::create(['nama' => 'Algoritma Struktur Data', 'kode' => 'CSG2xx', 'deskripsi' => 'ASD...', 'prodi_id' => $if->id]);
     MataKuliah::create(['nama' => 'Data Mining', 'kode' => 'CSH1xx', 'deskripsi' => 'Main data...', 'prodi_id' => $ik->id]);
     Model::reguard();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     DB::transaction(function () use($request) {
         $account = null;
         if ($request->role === User::TYPE_MAHASISWA) {
             $account = Mahasiswa::create(['nim' => $request->nim]);
             $account->prodi_id = $request->prodi_id;
         } elseif ($request->role === User::TYPE_DOSEN) {
             $account = Dosen::create(['nip' => $request->nip]);
             $account->prodi_id = $request->prodi_id;
         } else {
             $account = Admin::create();
         }
         $user = new User();
         $user->nama = $request->nama;
         $user->username = $request->username;
         $user->password = bcrypt($request->password);
         $user->userable_id = $account->id;
         $user->userable_type = get_class($account);
         $user->save();
     });
     return redirect('user');
 }
Ejemplo n.º 7
0
 public function getPost($kode, $kodeGrup)
 {
     if ($kodeGrup == 0) {
         $segmentKelas = "true";
         $segmentGrup = "false";
     } elseif ($kodeGrup > 0) {
         $segmentKelas = "false";
         $segmentGrup = "true";
     } else {
         $segmentKelas = "false";
         $segmentGrup = "false";
     }
     $id = Session::get('user');
     if (Auth::user()->role == "mahasiswa") {
         $foto = Mahasiswa::where('nim', '=', $id)->first();
         //Mendapatkan Array Kelas
         $kelasTmp = Mhskelas::select('kodekelas')->where('nim', '=', $id)->get();
         for ($i = 0; $i < count($kelasTmp); $i++) {
             $kelas[$i] = $kelasTmp[$i]['kodekelas'];
         }
         //Mendapatkan Array Grup
         $grupTmp = AnggotaGrup::select('id_grup')->where('nim', '=', $id)->get();
         for ($i = 0; $i < count($grupTmp); $i++) {
             $grup[$i] = $grupTmp[$i]['id_grup'];
         }
         $scope = array_merge($kelas, $grup);
     } else {
         $foto = Dosen::where('nip', '=', $id)->first();
         $kelasTmp = Perkuliahan::select('kodekelas')->where('nip', '=', $id)->get();
         for ($i = 0; $i < count($kelasTmp); $i++) {
             $scope[$i] = $kelasTmp[$i]['kodekelas'];
         }
     }
     $data = array('post' => Post::with(array('komentar', 'mhs', 'dosen', 'perkuliahan'))->whereIn('id_scope', $scope)->orderBy('id', 'desc')->take(10)->get(), 'postKelas' => Post::with(array('komentar', 'mhs', 'dosen', 'perkuliahan', 'grup'))->where('id_scope', '=', $kode)->where('scope', '=', 'kelas')->orderBy('id', 'desc')->get(), 'postGrup' => Post::with(array('komentar', 'mhs', 'grup', 'perkuliahan'))->where('id_scope', '=', $kodeGrup)->where('scope', '=', 'grup')->orderBy('id', 'desc')->get(), 'foto' => $foto, 'segmentKelas' => $segmentKelas, 'segmentGrup' => $segmentGrup);
     return view('frontend.includes.posts')->with($data);
 }
Ejemplo n.º 8
0
|
*/
Route::get('/', function () {
    return view('welcome');
});
//RELASI ELOQUENT
Route::get('relasi-1', function () {
    $mahasiswa = Mahasiswa::where('nim', '=', '1103120133')->first();
    return $mahasiswa->wali->nama;
});
Route::get('relasi-2', function () {
    $mahasiswa = Mahasiswa::where('nim', '=', '1103124321')->first();
    return $mahasiswa->dosen->nama;
});
Route::get('relasi-3', function () {
    $dosen = Dosen::where('nama', '=', 'Fazma Arif')->first();
    foreach ($dosen->mahasiswa as $temp) {
        echo '<li> Nama : ' . $temp->nama . ' <strong> (' . $temp->nim . ') </strong></li>';
    }
});
Route::get('relasi-4', function () {
    $ganin = Mahasiswa::where('nama', '=', 'Ganine Vinanda')->first();
    foreach ($ganin->hobi as $temp) {
        echo '<li>' . $temp->hobi . '</li>';
    }
});
Route::get('relasi-5', function () {
    $ngoding = Hobi::where('hobi', '=', 'Ngoding')->first();
    foreach ($ngoding->mahasiswa as $temp) {
        echo '<li> Nama : ' . $temp->nama . ' <strong>' . $temp->nim . '</strong></li>';
    }
Ejemplo n.º 9
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $dosen = App\Dosen::find($id);
     $dosen->delete();
     return redirect('/dosen');
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     $data = array('title' => 'Edit Perkuliahan', 'perkuliahan' => Perkuliahan::find($id), 'dosen' => ['' => '-- Pilih dosen --'] + Dosen::lists('nama', 'nip'), 'matakuliah' => ['' => '-- Pilih matakuliah --'] + Matakuliah::whereIn('status', array(1))->get()->lists('namamk', 'kodemk'));
     return view('backend.pages.backend-edit-perkuliahan')->with($data);
 }
 public function deletedosen($id_dosen)
 {
     $dosen = Dosen::find($id_dosen);
     $dosen->delete();
     return redirect('/adminprodi/dosen');
 }
Ejemplo n.º 12
0
 public function createdsn($id)
 {
     $mhs = \App\Dosen::findOrFail($id);
     $mhs->type = '1';
     return view('user.create', compact('mhs'));
 }
Ejemplo n.º 13
0
 public function getUser($folder, $kelas, $grup, $tugasId)
 {
     $client = $this->getClient();
     $getToken = User::find(Session::get('user_id'));
     //Token Expired dan Session masih aktif
     if ($client->isAccessTokenExpired() && $getToken->access_token != "") {
         $tempToken = json_decode($getToken->access_token);
         $client->refreshToken($tempToken->refresh_token);
         Session::put('access_token', $client->getAccessToken());
         $getToken->refresh_token = $client->getAccessToken();
         $getToken->save();
         $service = new \Google_Service_Drive($client);
         $googlePlus = new \Google_Service_Plus($client);
         $file = new \Google_Service_Drive_DriveFile();
         $userProfile = $googlePlus->people->get('me');
         $emails = $userProfile->getEmails();
         $photo = $userProfile->getImage();
         $userId = $userProfile->getId();
         /*$value = array("*****@*****.**","*****@*****.**");
           for ($i=0; $i < 2; $i++) { 
                   $this->sharing($service,$this->getParent($service)[0]->id,"user","reader",$value[$i]);
               }    */
         if (count($this->getParent($service)) == 0) {
             $this->makeFolder($file, $service, "Collaborative Learning", null);
             $this->makeFolder($file, $service, "Materi", $this->getParent($service)[0]->id);
             $this->makeFolder($file, $service, "Tugas", $this->getParent($service)[0]->id);
         }
         $result = $this->getFolderItem($service, $this->getFolder($service, $folder), $kelas, $grup, $tugasId);
         $data = array('email' => $emails[0]->value, 'photo' => $photo->url, 'userId' => $userId, 'result' => $result, 'title' => 'test');
         //User belum melakukan autentikasi
     } else {
         if (!Session::has('access_token') && $getToken->access_token == "") {
             $id = Session::get('user');
             if (Auth::user()->role == "mahasiswa") {
                 $pengguna = Mahasiswa::where('nim', '=', $id)->first();
             } else {
                 $pengguna = Dosen::where('nip', '=', $id)->first();
             }
             $data = array('title' => 'test', 'user' => $pengguna->email);
             //Session tidak aktif tapi user telah melakukan autentikasi
         } else {
             if (!Session::has('access_token') && $client->getAccessToken()) {
                 Session::put('access_token', $client->getAccessToken());
                 $data = array('title' => 'test');
             } else {
                 $client->setAccessToken(Session::get('access_token'));
                 $data = array('title' => 'test');
             }
         }
     }
     return view('frontend.includes.storage-content')->with($data);
 }
Ejemplo n.º 14
0
 public function changeStatus($id)
 {
     $dosen = Dosen::find($id);
     $dosen->status = 0;
     $dosen->save();
     // redirect
     Session::flash('message', 'Data dosen berhasil di hapus');
     return Redirect::to('dashboard/dosen');
 }
 public function index()
 {
     $data = array('title' => "dashboard", 'dosen' => count(Dosen::where('status', '=', 1)->get()), 'mahasiswa' => count(Mahasiswa::where('status', '=', 1)->get()), 'matakuliah' => count(Matakuliah::where('status', '=', 1)->get()), 'perkuliahan' => count(Perkuliahan::where('status', '=', 1)->get()), 'userMhs' => User::with('mhs')->where('role', '=', 'mahasiswa')->get(), 'userDosen' => User::with('dosen')->where('role', '=', 'dosen')->get());
     return view('backend.pages.backend-home')->with($data);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     $data = array('title' => 'Edit Mahasiswa', 'mahasiswa' => Mahasiswa::find($id), 'dosen' => ['' => '-- Pilih dosen --'] + Dosen::lists('nama', 'nip'));
     return view('backend.pages.backend-edit-mahasiswa')->with($data);
 }