diff --git a/institusi.sql b/institusi.sql deleted file mode 100644 index ee709e30a25e74b4a3151af01e7d73a836f67e67..0000000000000000000000000000000000000000 --- a/institusi.sql +++ /dev/null @@ -1,103 +0,0 @@ --- phpMyAdmin SQL Dump --- version 4.2.11 --- http://www.phpmyadmin.net --- --- Host: 127.0.0.1 --- Generation Time: Apr 04, 2016 at 08:39 PM --- Server version: 5.6.21 --- PHP Version: 5.5.19 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; - --- --- Database: `pendidikan` --- - --- -------------------------------------------------------- - --- --- Table structure for table `institusi` --- - -CREATE TABLE IF NOT EXISTS `institusi` ( -`institusi_id` int(11) NOT NULL, - `nama_institusi` varchar(255) NOT NULL, - `alamat_institusi` varchar(255) NOT NULL, - `email_institusi` varchar(255) NOT NULL, - `notelp_institusi` varchar(255) NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; - --- --- Dumping data for table `institusi` --- - -INSERT INTO `institusi` (`institusi_id`, `nama_institusi`, `alamat_institusi`, `email_institusi`, `notelp_institusi`) VALUES -(1, 'Universitas Indonesia', 'Kampus Baru UI Depok, Depok', 'humas-ui@ui.ac.id', '+62217867222'), -(4, 'Institut Teknologi Bandung', 'Jl. Ganesha No.10, Jawa Barat, Indonesia', 'itb@itb.ac.id', '+62222500935'), -(5, 'Institut Teknologi Bandung', 'Jl. Ganesha No.10, Jawa Barat, Indonesia', 'itb@itb.ac.id', '+62222500935'); - --- -------------------------------------------------------- - --- --- Table structure for table `pendidikan_formal` --- - -CREATE TABLE IF NOT EXISTS `pendidikan_formal` ( -`id` int(11) NOT NULL, - `nip` int(11) NOT NULL, - `nama_institusi` varchar(140) NOT NULL, - `tingkatan` varchar(20) NOT NULL, - `gelar` varchar(10) NOT NULL, - `jurusan` varchar(140) NOT NULL, - `no_ijazah` varchar(30) NOT NULL, - `tahun` year(4) NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; - --- --- Dumping data for table `pendidikan_formal` --- - -INSERT INTO `pendidikan_formal` (`id`, `nip`, `nama_institusi`, `tingkatan`, `gelar`, `jurusan`, `no_ijazah`, `tahun`) VALUES -(1, 12345678, 'ITB', 'S1', 'ST', 'Teknik Informatika', 'ab12345', 2001), -(2, 12345678, 'ITB', 'S2', 'M.T.', 'Teknik Elektro', 'bc23455', 2007); - --- --- Indexes for dumped tables --- - --- --- Indexes for table `institusi` --- -ALTER TABLE `institusi` - ADD PRIMARY KEY (`institusi_id`); - --- --- Indexes for table `pendidikan_formal` --- -ALTER TABLE `pendidikan_formal` - ADD PRIMARY KEY (`id`); - --- --- AUTO_INCREMENT for dumped tables --- - --- --- AUTO_INCREMENT for table `institusi` --- -ALTER TABLE `institusi` -MODIFY `institusi_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=6; --- --- AUTO_INCREMENT for table `pendidikan_formal` --- -ALTER TABLE `pendidikan_formal` -MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/kependudukan.sql b/kependudukan.sql deleted file mode 100644 index fb4e9852cf1d69532a406d45f3c1614d4b8165ae..0000000000000000000000000000000000000000 --- a/kependudukan.sql +++ /dev/null @@ -1,249 +0,0 @@ --- phpMyAdmin SQL Dump --- version 4.4.14 --- http://www.phpmyadmin.net --- --- Host: 127.0.0.1 --- Generation Time: Mar 24, 2016 at 12:50 AM --- Server version: 5.6.26 --- PHP Version: 5.6.12 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8mb4 */; - --- --- Database: `kependudukan` --- - --- -------------------------------------------------------- - --- --- Table structure for table `kecamatan` --- - -CREATE TABLE IF NOT EXISTS `kecamatan` ( - `id` int(11) NOT NULL, - `nama` varchar(50) NOT NULL, - `alamatKantor` varchar(255) NOT NULL, - `pengurusNIK` varchar(16) NOT NULL, - `kotaId` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- -------------------------------------------------------- - --- --- Table structure for table `keluarga` --- - -CREATE TABLE IF NOT EXISTS `keluarga` ( - `id` varchar(20) NOT NULL, - `alamat` varchar(255) NOT NULL, - `rtId` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- -------------------------------------------------------- - --- --- Table structure for table `kelurahan` --- - -CREATE TABLE IF NOT EXISTS `kelurahan` ( - `id` int(11) NOT NULL, - `nama` varchar(50) NOT NULL, - `alamatKantor` varchar(255) NOT NULL, - `pengurusNIK` varchar(16) NOT NULL, - `kecamatanId` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- -------------------------------------------------------- - --- --- Table structure for table `kota` --- - -CREATE TABLE IF NOT EXISTS `kota` ( - `id` int(11) NOT NULL, - `nama` varchar(50) NOT NULL, - `alamatKantor` varchar(255) NOT NULL, - `pengurusNIK` varchar(16) NOT NULL, - `provinsiId` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- -------------------------------------------------------- - --- --- Table structure for table `penduduk` --- - -CREATE TABLE IF NOT EXISTS `penduduk` ( - `id` varchar(20) NOT NULL, - `nama` varchar(255) NOT NULL, - `tanggalLahir` date NOT NULL, - `kotaLahir` int(11) NOT NULL, - `golonganDarah` varchar(2) NOT NULL, - `keluargaId` varchar(16) NOT NULL, - `jenisKelamin` char(10) NOT NULL, - `agama` varchar(50) DEFAULT NULL, - `wni` tinyint(1) NOT NULL, - `statusPerkawinan` varchar(50) NOT NULL, - `pekerjaan` varchar(50) NOT NULL, - `hubunganKeluarga` varchar(50) NOT NULL, - `ayahId` varchar(20) NOT NULL, - `ibuId` varchar(20) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- -------------------------------------------------------- - --- --- Table structure for table `provinsi` --- - -CREATE TABLE IF NOT EXISTS `provinsi` ( - `id` int(11) NOT NULL, - `nama` varchar(50) NOT NULL, - `alamatKantor` varchar(255) NOT NULL, - `pengurusNIK` varchar(16) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- -------------------------------------------------------- - --- --- Table structure for table `rt` --- - -CREATE TABLE IF NOT EXISTS `rt` ( - `id` int(11) NOT NULL, - `nama` varchar(50) NOT NULL, - `alamatKantor` varchar(255) NOT NULL, - `pengurusNIK` varchar(16) NOT NULL, - `rwId` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- -------------------------------------------------------- - --- --- Table structure for table `rw` --- - -CREATE TABLE IF NOT EXISTS `rw` ( - `id` int(11) NOT NULL, - `nama` varchar(50) NOT NULL, - `alamatKantor` varchar(255) NOT NULL, - `pengurusNIK` varchar(16) NOT NULL, - `kelurahanId` int(11) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- --- Indexes for dumped tables --- - --- --- Indexes for table `kecamatan` --- -ALTER TABLE `kecamatan` - ADD PRIMARY KEY (`id`), - ADD KEY `kotaId` (`kotaId`); - --- --- Indexes for table `keluarga` --- -ALTER TABLE `keluarga` - ADD PRIMARY KEY (`id`), - ADD KEY `rtId` (`rtId`); - --- --- Indexes for table `kelurahan` --- -ALTER TABLE `kelurahan` - ADD PRIMARY KEY (`id`), - ADD KEY `kecamatanId` (`kecamatanId`); - --- --- Indexes for table `kota` --- -ALTER TABLE `kota` - ADD PRIMARY KEY (`id`), - ADD KEY `provinsiId` (`provinsiId`), - ADD KEY `provinsiId_2` (`provinsiId`); - --- --- Indexes for table `penduduk` --- -ALTER TABLE `penduduk` - ADD PRIMARY KEY (`id`), - ADD KEY `keluargaId` (`keluargaId`), - ADD KEY `ayahId` (`ayahId`), - ADD KEY `ibuId` (`ibuId`), - ADD KEY `kotaLahir` (`kotaLahir`); - --- --- Indexes for table `provinsi` --- -ALTER TABLE `provinsi` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `rt` --- -ALTER TABLE `rt` - ADD PRIMARY KEY (`id`), - ADD KEY `rwId` (`rwId`); - --- --- Indexes for table `rw` --- -ALTER TABLE `rw` - ADD PRIMARY KEY (`id`), - ADD KEY `kelurahanId` (`kelurahanId`); - --- --- Constraints for dumped tables --- - --- --- Constraints for table `kecamatan` --- -ALTER TABLE `kecamatan` - ADD CONSTRAINT `kecamatan_ibfk_1` FOREIGN KEY (`id`) REFERENCES `kelurahan` (`kecamatanId`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `keluarga` --- -ALTER TABLE `keluarga` - ADD CONSTRAINT `keluarga_ibfk_1` FOREIGN KEY (`rtId`) REFERENCES `rt` (`id`) ON UPDATE CASCADE; - --- --- Constraints for table `kelurahan` --- -ALTER TABLE `kelurahan` - ADD CONSTRAINT `kelurahan_ibfk_1` FOREIGN KEY (`id`) REFERENCES `rw` (`kelurahanId`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `kota` --- -ALTER TABLE `kota` - ADD CONSTRAINT `kota_ibfk_1` FOREIGN KEY (`provinsiId`) REFERENCES `provinsi` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - ADD CONSTRAINT `kota_ibfk_2` FOREIGN KEY (`id`) REFERENCES `kecamatan` (`kotaId`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `penduduk` --- -ALTER TABLE `penduduk` - ADD CONSTRAINT `fk_Ayah` FOREIGN KEY (`ayahId`) REFERENCES `penduduk` (`id`), - ADD CONSTRAINT `penduduk_ibfk_1` FOREIGN KEY (`kotaLahir`) REFERENCES `kota` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - ADD CONSTRAINT `penduduk_ibfk_2` FOREIGN KEY (`keluargaId`) REFERENCES `keluarga` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rw` --- -ALTER TABLE `rw` - ADD CONSTRAINT `rw_ibfk_1` FOREIGN KEY (`id`) REFERENCES `rt` (`rwId`) ON DELETE CASCADE ON UPDATE CASCADE; - -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/pendidikan.sql b/pendidikan.sql deleted file mode 100644 index d77bc3f45c73974990eb9df16b93ac159abf6c6e..0000000000000000000000000000000000000000 --- a/pendidikan.sql +++ /dev/null @@ -1,74 +0,0 @@ --- phpMyAdmin SQL Dump --- version 4.2.11 --- http://www.phpmyadmin.net --- --- Host: 127.0.0.1 --- Generation Time: Apr 04, 2016 at 08:37 PM --- Server version: 5.6.21 --- PHP Version: 5.6.3 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; - --- --- Database: `pendidikan` --- - --- -------------------------------------------------------- - --- --- Table structure for table `pendidikan_formal` --- - -CREATE TABLE IF NOT EXISTS `pendidikan_formal` ( -`id` int(11) NOT NULL, - `nip` varchar(20) NOT NULL, - `nama_institusi` varchar(140) NOT NULL, - `tingkatan` varchar(20) NOT NULL, - `gelar` varchar(10) NOT NULL, - `jurusan` varchar(140) NOT NULL, - `no_ijazah` varchar(30) NOT NULL, - `tahun` year(4) NOT NULL -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; - --- --- Dumping data for table `pendidikan_formal` --- - -INSERT INTO `pendidikan_formal` (`id`, `nip`, `nama_institusi`, `tingkatan`, `gelar`, `jurusan`, `no_ijazah`, `tahun`) VALUES -(1, '22345', 'ITB', 'Strata 1', 'ST', 'Teknik Informatika', 'ab12345', 2001), -(2, '12345678', 'ITB', 'S2', 'M.T.', 'Teknik Elektro', 'bc23455', 2007), -(3, '1234567', 'ITB', 'Strata 3', 'Dr', 'Tasdhjk', '1652761', 2012), -(4, '213443', 'Haha', 'SMA/Sederajat', '-', 'IPA', '139128hh', 2014), -(5, '21212', 'Haha', 'SD/Sederajat', 'assdfsd', '-', '3128973hsa', 2012), -(6, '1234567', 'Hhaha', 'Strata 3', 'Doktor', 'Hmmm', 'ahj122222344', 2013), -(7, '1234567', 'hjkhkjh', 'Strata 3', 'h', 'jhjk', '56g', 2013); - --- --- Indexes for dumped tables --- - --- --- Indexes for table `pendidikan_formal` --- -ALTER TABLE `pendidikan_formal` - ADD PRIMARY KEY (`id`); - --- --- AUTO_INCREMENT for dumped tables --- - --- --- AUTO_INCREMENT for table `pendidikan_formal` --- -ALTER TABLE `pendidikan_formal` -MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=8; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/iterasi1.sql b/ppl2.sql similarity index 70% rename from iterasi1.sql rename to ppl2.sql index 820d3e0d9818c72bc58184af6420a9bc0b54384d..f6d41feeacf226ff8d19af558a1927ac1344db2d 100644 --- a/iterasi1.sql +++ b/ppl2.sql @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 --- Generation Time: Apr 04, 2016 at 09:05 PM +-- Generation Time: May 12, 2016 at 01:22 PM -- Server version: 10.1.10-MariaDB -- PHP Version: 7.0.4 @@ -17,7 +17,7 @@ SET time_zone = "+00:00"; /*!40101 SET NAMES utf8mb4 */; -- --- Database: `pendidikan` +-- Database: `ppl2` -- -- -------------------------------------------------------- @@ -96,11 +96,43 @@ INSERT INTO `migrations` (`migration`, `batch`) VALUES CREATE TABLE `password_resets` ( `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `token` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- +-- +-- Table structure for table `pelatihan` +-- + +CREATE TABLE `pelatihan` ( + `id_jadwal` int(11) NOT NULL, + `id_institusi` int(11) NOT NULL, + `keahlian` varchar(140) NOT NULL, + `durasi_ijazah` int(11) NOT NULL, + `tanggal` date NOT NULL, + `jam` time NOT NULL, + `tempat` varchar(50) NOT NULL, + `kapasitas` int(5) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `pendaftaran_pelatihan` +-- + +CREATE TABLE `pendaftaran_pelatihan` ( + `id_pendaftaran` int(11) NOT NULL, + `id_jadwal` int(11) NOT NULL, + `nip` varchar(20) NOT NULL, + `email` varchar(50) NOT NULL, + `no_ijazah` varchar(30) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- -------------------------------------------------------- + -- -- Table structure for table `pendidikan_formal` -- @@ -113,16 +145,20 @@ CREATE TABLE `pendidikan_formal` ( `gelar` varchar(10) NOT NULL, `jurusan` varchar(140) NOT NULL, `no_ijazah` varchar(30) NOT NULL, - `tahun` year(4) NOT NULL + `tahun` year(4) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `ip` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `pendidikan_formal` -- -INSERT INTO `pendidikan_formal` (`id`, `nip`, `nama_institusi`, `tingkatan`, `gelar`, `jurusan`, `no_ijazah`, `tahun`) VALUES -(1, '12345678', 'ITB', 'S1', 'ST', 'Teknik Informatika', 'ab12345', 2001), -(2, '12345678', 'ITB', 'S2', 'M.T.', 'Teknik Elektro', 'bc23455', 2007); +INSERT INTO `pendidikan_formal` (`id`, `nip`, `nama_institusi`, `tingkatan`, `gelar`, `jurusan`, `no_ijazah`, `tahun`, `created_at`, `updated_at`, `ip`) VALUES +(0, '21322', 'Ini Tio Beban', 'Strata 3', 'S.Tio', 'Komputer', 'dfvf23r4tdx', 2015, '2016-05-12 04:08:08', '2016-05-12 04:08:08', '::1'), +(1, '12345678', 'ITB', 'S1', 'ST', 'Teknik Informatika', 'ab12345', 2001, '2016-05-12 10:59:31', '0000-00-00 00:00:00', ''), +(2, '12345678', 'ITB', 'S2', 'M.T.', 'Teknik Elektro', 'bc23455', 2007, '2016-05-12 10:59:31', '0000-00-00 00:00:00', ''); -- -------------------------------------------------------- @@ -144,13 +180,44 @@ CREATE TABLE `users` ( -- Indexes for dumped tables -- +-- +-- Indexes for table `informals` +-- +ALTER TABLE `informals` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `institusi` +-- +ALTER TABLE `institusi` + ADD PRIMARY KEY (`institusi_id`); + -- -- Indexes for table `password_resets` -- ALTER TABLE `password_resets` + ADD PRIMARY KEY (`email`,`token`), ADD KEY `password_resets_email_index` (`email`), ADD KEY `password_resets_token_index` (`token`); +-- +-- Indexes for table `pelatihan` +-- +ALTER TABLE `pelatihan` + ADD PRIMARY KEY (`id_jadwal`); + +-- +-- Indexes for table `pendaftaran_pelatihan` +-- +ALTER TABLE `pendaftaran_pelatihan` + ADD PRIMARY KEY (`id_pendaftaran`); + +-- +-- Indexes for table `pendidikan_formal` +-- +ALTER TABLE `pendidikan_formal` + ADD PRIMARY KEY (`id`); + -- -- Indexes for table `users` -- diff --git a/ppl2/app/Http/Controllers/AutentikasiController.php b/ppl2/app/Http/Controllers/AutentikasiController.php new file mode 100644 index 0000000000000000000000000000000000000000..8f20b56fedb09b4776b56a80c24e5c0d38efa739 --- /dev/null +++ b/ppl2/app/Http/Controllers/AutentikasiController.php @@ -0,0 +1,73 @@ +<?php + +namespace App\Http\Controllers; + +use Illuminate\Http\Request; + +use App\Http\Requests; + +use View; + +use Validator; + +use Input; + +use Redirect; + +use Auth; + + +class AutentikasiController extends Controller +{ + // + + public function showLogin() + { + // show the form + Auth::logout(); + return View::make('pages.loginPage'); + } + + public function doLogin() + { + // process the form + // validate the info, create rules for the inputs + $rules = array( + 'email' => 'required|email', // make sure the email is an actual email + 'password' => 'required|alphaNum|min:3' // password can only be alphanumeric and has to be greater than 3 characters + ); + + // run the validation rules on the inputs from the form + $validator = Validator::make(Input::all(), $rules); + + // if the validator fails, redirect back to the form + if ($validator->fails()) { + return Redirect::to('login') + ->withErrors($validator) // send back all errors to the login form + ->withInput(Input::except('password')); // send back the input (not the password) so that we can repopulate the form + } else { + + // create our user data for the authentication + $userdata = array( + 'email' => Input::get('email'), + 'password' => Input::get('password') + ); + + // attempt to do the login + if (Auth::attempt($userdata)) { + // validation successful! + // redirect them to the secure section or whatever + // return Redirect::to('secure'); + // for now we'll just echo success (even though echoing in a controller is bad) + echo 'SUCCESS!'; + return Redirect::to('daftarinstitusi'); + + } else { + // validation not successful, send back to form + return Redirect::to('/'); + + } + + } + } +} diff --git a/ppl2/app/Http/Controllers/PendFormalController.php b/ppl2/app/Http/Controllers/PendFormalController.php index b25ea01af485594d261f0c2c1e571f0681d4d2e5..177bfbb2be875a813343fcb52c07a985c59c0eb8 100644 --- a/ppl2/app/Http/Controllers/PendFormalController.php +++ b/ppl2/app/Http/Controllers/PendFormalController.php @@ -10,6 +10,8 @@ use App\PendidikanFormal; use Session; +use DB; + class PendFormalController extends Controller { // @@ -21,9 +23,12 @@ class PendFormalController extends Controller public function getPendidikan($nip) { $pend = PendidikanFormal::where('nip',$nip)->get(); - return view('pages.pendidikanPegawai',compact('pend','nip'));; + return view('pages.pendidikanPegawai',compact('pend','nip')); } + + + public function edit($id) { $pend = PendidikanFormal::find($id); return view('pages.editFormal', compact('pend')); @@ -39,6 +44,7 @@ class PendFormalController extends Controller $formal->jurusan = $request->input('jurusan'); $formal->no_ijazah = $request->input('no_ijazah'); $formal->tahun = $request->input('tahun'); + $formal->ip = $request->ip(); $formal->save(); Session::flash('message', 'Pendidikan formal berhasil ditambahkan'); return \Redirect::to('pendidikan-formal'); @@ -72,4 +78,46 @@ class PendFormalController extends Controller $res = $request->input('query'); return \Redirect::to('pendidikan-formal/all/'.$res); } + + public function getStatistikStrata() { + $pend = DB::table('pendidikan_formal') + ->select(DB::raw('count(*) as jumlah, tingkatan')) + ->groupBy('tingkatan') + ->get(); + $nip = null; + return $pend; + } + + public function getStatistikInstitusi() { + $first = DB::table('pendidikan_formal') + ->select(DB::raw('count(*) as jumlah, nama_institusi')) + ->groupBy('nama_institusi') + ->get(); + $second = DB::table('informals') + ->select(DB::raw('count(*) as jumlah, nama_institusi')) + ->groupBy('nama_institusi') + ->get(); + $result = array_merge($first, $second); + return $second; + } + + public function getStatistikKeahlian() { + $pend = DB::table('informals') + ->select(DB::raw('count(*) as jumlah, keahlian')) + ->groupBy('keahlian') + ->get(); + $nip = null; + return $pend; + } + + public function getAllStatistik() { + $stratastat= PendFormalController::getStatistikStrata(); + $institusistat= PendFormalController::getStatistikInstitusi(); + $keahlianstat= PendFormalController::getStatistikKeahlian(); + $nip = null; + return view('pages.statistik',compact('stratastat','nip','institusistat','keahlianstat')); + } + + + } diff --git a/ppl2/app/Http/routes.php b/ppl2/app/Http/routes.php index 3a5722cbec730bd6274c29400c795f0be7f3078e..f9f33c8ccf4dc6921efd3fe04bef573fddc25639 100644 --- a/ppl2/app/Http/routes.php +++ b/ppl2/app/Http/routes.php @@ -11,9 +11,16 @@ | */ -Route::get('/', function () { - return view('pages.loginPage'); -}); + + +// route to show the login form +Route::get('/', array('uses' => 'AutentikasiController@showLogin')); + +Route::get('logout', array('uses' => 'AutentikasiController@showLogin')); + +// route to process the form +Route::post('login', array('uses' => 'AutentikasiController@doLogin')); + Route::get('pendidikan-formal/new', function() { return view('pages.formPendidikan'); @@ -96,3 +103,4 @@ Route::get('/penjadwalan', function () { return view('penjadwalan'); }); +Route::get('/statistik','PendFormalController@getAllStatistik'); diff --git a/ppl2/app/Institusi.php b/ppl2/app/Institusi.php index 7e2b44ccd50582d120947155c017e568316c93e4..dcdec344b1b0326167e8bbeba6e2611b507ec1d2 100644 --- a/ppl2/app/Institusi.php +++ b/ppl2/app/Institusi.php @@ -9,6 +9,6 @@ class Institusi extends Model // protected $table = 'institusi'; protected $primaryKey = 'id'; - public $timestamps = false; //tidak ada create_at dan update_at + public $timestamps = true; //tidak ada create_at dan update_at protected $connection = 'mysql'; } diff --git a/ppl2/app/Pegawai.php b/ppl2/app/Pegawai.php index acfad9575a10ecb16719b0a2bcd27f53646d6627..5b8b73e7a334761624fbc65b0f9a785878986aa2 100644 --- a/ppl2/app/Pegawai.php +++ b/ppl2/app/Pegawai.php @@ -9,6 +9,6 @@ class Pegawai extends Model // protected $table = 'pegawai'; protected $primaryKey = 'nip'; - //public $timestamps = false; //tidak ada create_at dan update_at + public $timestamps = true; //tidak ada create_at dan update_at protected $connection = 'mysql2'; } diff --git a/ppl2/app/PendidikanFormal.php b/ppl2/app/PendidikanFormal.php index 654f6fa963dde3c28abebdad17cc78adb65ee1b7..ec89e8f3ee65cb54b32e06acd5695a9710532f7e 100644 --- a/ppl2/app/PendidikanFormal.php +++ b/ppl2/app/PendidikanFormal.php @@ -9,7 +9,7 @@ class PendidikanFormal extends Model // protected $table = 'pendidikan_formal'; protected $primaryKey = 'id'; - public $timestamps = false; //tidak ada create_at dan update_at + public $timestamps = true; //tidak ada create_at dan update_at protected $connection = 'mysql'; } diff --git a/ppl2/app/informal.php b/ppl2/app/informal.php index d64108ab3c1ad5c658b2555f70185e57bb55e907..05f2a06bacf1c9005967a1dba96ff2cb6f4b5075 100644 --- a/ppl2/app/informal.php +++ b/ppl2/app/informal.php @@ -6,8 +6,8 @@ use Illuminate\Database\Eloquent\Model; class informal extends Model { - protected $table = 'booking'; - protected $primaryKey = 'id_booking'; - public $timestamps = false; //tidak ada create_at dan update_at + protected $table = 'informals'; + protected $primaryKey = 'id'; + public $timestamps = true; //tidak ada create_at dan update_at protected $connection = 'mysql'; } diff --git a/ppl2/app/non_formal.php b/ppl2/app/non_formal.php deleted file mode 100644 index 306d5bb21bf03b95b9446478470a141f90431b2f..0000000000000000000000000000000000000000 --- a/ppl2/app/non_formal.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php - -namespace App; - -use Illuminate\Database\Eloquent\Model; - -class non_formal extends Model -{ - // -} diff --git a/ppl2/config/app.php b/ppl2/config/app.php index cee856adea5729d5d39f50d30994bc307265ba7e..fce72eac5d7d5131632b7d8469bc6421a916a908 100644 --- a/ppl2/config/app.php +++ b/ppl2/config/app.php @@ -201,6 +201,7 @@ return [ 'URL' => Illuminate\Support\Facades\URL::class, 'Validator' => Illuminate\Support\Facades\Validator::class, 'View' => Illuminate\Support\Facades\View::class, + 'Input' => Illuminate\Support\Facades\Input::class ], diff --git a/ppl2/database/seeds/DatabaseSeeder.php b/ppl2/database/seeds/DatabaseSeeder.php index e119db624aa8f894d74ef57283c4947e734015b0..5b6a5d3afb157dffe450ccd28acffecfbb44ee25 100644 --- a/ppl2/database/seeds/DatabaseSeeder.php +++ b/ppl2/database/seeds/DatabaseSeeder.php @@ -12,5 +12,8 @@ class DatabaseSeeder extends Seeder public function run() { // $this->call(UsersTableSeeder::class); + Eloquent::unguard(); + + $this->call(UserTableSeeder::class); } } diff --git a/ppl2/database/seeds/UserTableSeeder.php b/ppl2/database/seeds/UserTableSeeder.php new file mode 100644 index 0000000000000000000000000000000000000000..bac413f1012cb1e6c7eb6f54d2c72ea04d6efab9 --- /dev/null +++ b/ppl2/database/seeds/UserTableSeeder.php @@ -0,0 +1,20 @@ +<?php + +use Illuminate\Database\Seeder; +use Illuminate\Database\Eloquent\Model; + +use App\User; +class UserTableSeeder extends Seeder +{ + +public function run() +{ + DB::table('users')->delete(); + User::create(array( + 'name' => 'Yoga Adrian', + 'email' => 'admin@a.a', + 'password' => Hash::make('admin'), + )); +} + +} \ No newline at end of file diff --git a/ppl2/resources/views/app_template.blade.php b/ppl2/resources/views/app_template.blade.php index d87f6a18ff2519e34d4027599bd2c32a1909bd20..295d344fb53d00640dfb84f1831fa3fd02c156e1 100644 --- a/ppl2/resources/views/app_template.blade.php +++ b/ppl2/resources/views/app_template.blade.php @@ -60,22 +60,59 @@ <ul class="dropdown-menu" role="menu"> <li> + + @if (Auth::check()) <a href="{{URL::to('pendidikan-formal')}}"> + @else + + <a href="{{URL::to('/')}}"> + @endif <span>Pendidikan Formal</span> </a> </li> <li> + @if (Auth::check()) <a href="{{URL::to('pendidikan-informal')}}"> + @else + + <a href="{{URL::to('/')}}"> + @endif + <span>Pendidikan Informal</span> </a> </li> <li> - - <a href="{{URL::to('daftarinstitusi')}}"> + @if (Auth::check()) + <a href="{{URL::to('daftarinstitusi')}}"> + @else + + <a href="{{URL::to('/')}}"> + @endif + <span>Institusi</span> </a> </li> + <li> + @if (Auth::check()) + <a href="{{URL::to('penjadwalan')}}"> + @else + + <a href="{{URL::to('/')}}"> + @endif + <span>Penjadwalan</span> + </a> + </li> + <li> + @if (Auth::check()) + <a href="{{URL::to('statistik')}}"> + @else + + <a href="{{URL::to('/')}}"> + @endif + <span>Statistik</span> + </a> + </li> </ul> </li> <li> @@ -138,7 +175,7 @@ </li> <li class="divider"></li> <li> - <a>Logout</a> + <a href='logout'>Logout</a> </li> </ul> <!-- / dropdown --> @@ -164,7 +201,7 @@ <a href="#" data-toggle="dropdown" class="dropdown-toggle hidden-folded"> <span class="clear"> <span class="block m-t-sm"> - <strong class="font-bold text-lt">John.Smith</strong> + <strong class="font-bold text-lt">Cliff.TheDragon.John</strong> <b class="caret"></b> </span> <span class="text-muted text-xs block">Art Director</span> @@ -223,23 +260,61 @@ <span>Components</span> </li> <li> - <a href="{{URL::to('pendidikan-formal')}}"> + @if (Auth::check()) + <a href="{{URL::to('pendidikan-formal')}}"> + @else + + <a href="{{URL::to('/')}}"> + @endif + <i class="icon-bdg_table"></i> <span class="font-bold">Formal</span> </a> </li> <li> - <a href="{{URL::to('pendidikan-informal')}}"> + @if (Auth::check()) + <a href="{{URL::to('pendidikan-informal')}}"> + @else + + <a href="{{URL::to('/')}}"> + @endif <i class="icon-bdg_table"></i> <span class="font-bold">Informal</span> </a> </li> <li> - <a href="{{URL::to('daftarinstitusi')}}"> + @if (Auth::check()) + <a href="{{URL::to('daftarinstitusi')}}"> + @else + + <a href="{{URL::to('/')}}"> + @endif <i class="icon-bdg_table"></i> <span class="font-bold">Institusi</span> </a> </li> + <li> + @if (Auth::check()) + <a href="{{URL::to('penjadwalan')}}"> + @else + + <a href="{{URL::to('/')}}"> + @endif + <i class="icon-bdg_table"></i> + <span class="font-bold">Penjadwalan</span> + </a> + </li> + <li> + @if (Auth::check()) + <a href="{{URL::to('statistik')}}"> + @else + + <a href="{{URL::to('/')}}"> + @endif + <i class="icon-bdg_table"></i> + <span class="font-bold">Statistik</span> + </a> + </li> </ul> </nav> <!-- nav --> diff --git a/ppl2/resources/views/pages/loginPage.blade.php b/ppl2/resources/views/pages/loginPage.blade.php index 4bd9bacd26adc10ab371faf5b27367f4c5f8b74a..d31dec2dbfd9585af332b8ebbfd77c4037735df8 100644 --- a/ppl2/resources/views/pages/loginPage.blade.php +++ b/ppl2/resources/views/pages/loginPage.blade.php @@ -20,7 +20,7 @@ <div class="panel panel-default"> <div class="panel-heading font-bold">Login</div> <div class="panel-body"> - <form class="bs-example form-horizontal" method = "POST" action = "{{URL::to('')}}"> + <form class="bs-example form-horizontal" method = "POST" action = "{{URL::to('login')}}"> <div class="form-group"> <label class="col-lg-2 control-label">e-mail</label> <div class="col-lg-8"> diff --git a/ppl2/resources/views/pages/statistik.blade.php b/ppl2/resources/views/pages/statistik.blade.php new file mode 100644 index 0000000000000000000000000000000000000000..5e0cacbb9b4724223b617b052ac76511105f2197 --- /dev/null +++ b/ppl2/resources/views/pages/statistik.blade.php @@ -0,0 +1,103 @@ +@extends('app_template') + +@section('title') + Statistik +@stop + +@section('page_title') + <h2>Statistik Aplikasi Pendidikan Pegawai</h2> +@stop + +@section('head_content') + @if (Session::has('message')) + <div class="alert alert-info fade in">{{ Session::get('message') }} + <a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a> + </div> + @endif +@stop + +@section('content') + + + +<div class="panel-heading font-semibold">Statistik Tingkatan</div> + <div class="panel-body no-padder"> + <div class="wrapper"> + <div ui-jq="plot" ui-options=" + [ + @foreach($stratastat as $strata) + {label : '{{$strata->tingkatan}}',data:[{{$strata->jumlah}}]}, + @endforeach + ], + { + series: { pie: { show: true, innerRadius: 0.5, stroke: { width: 0 }, label: { show: true, threshold: 0.05 } } }, + colors: ['#00b0ff','#ff7e00','#8560a8','#8dc80e','#b8bcce'], + grid: { hoverable: true, clickable: true, borderWidth: 0, color: '#ccc' }, + tooltip: true, + tooltipOpts: { content: '%s: %p.0%' }, + legend: {show: false} + } + " style="height:240px"></div> + + </div> + </div> +</div> + + +<!-- Pie Chart--> + <div class="col-md-6"> + <div class="panel panel-default"> + <div class="panel-heading font-semibold">Statistik Almamater</div> + <div class="panel-body no-padder"> + <div class="wrapper"> + <div ui-jq="plot" ui-options=" + [ + @foreach($institusistat as $strata) + {label : '{{$strata->nama_institusi}}',data:[{{$strata->jumlah}}]}, + @endforeach + ], + { + series: { pie: { show: true, stroke: { width: 0 }, label: { show: true, threshold: 0.05 } } }, + colors: ['#00b0ff','#ff7e00','#8560a8','#8dc80e','#b8bcce'], + grid: { hoverable: true, clickable: true, borderWidth: 0, color: '#ccc' }, + tooltip: true, + tooltipOpts: { content: '%s: %p.0%' }, + legend: {show: false} + } + " style="height:240px"></div> + + </div> + </div> + </div> + </div> +<!-- Bar table--> + <div class="col-md-6"> + <div class="panel panel-default"> + <div class="panel-heading font-semibold">Statistik Keahlian</div> + <div class="panel-body no-padder"> + <div class="wrapper"> + <div ui-jq="plot" ui-options=" + [ + <?php $i = 10; ?> + @foreach($keahlianstat as $keahlian) + {label : '{{$keahlian->keahlian}}',data: [ [ {{$i}},{{$keahlian->jumlah}} ] ]}, + <?php $i=$i+10;?> + @endforeach + ], + { + bars: { show: true, fill: true, lineWidth: 0, order: 1, fillColor: { colors: [{ opacity: 0.5 }, { opacity: 0.9}] } }, + colors: ['#00e5ff', '#00b0ff', '#2979ff' ,'#3d5afe' ], + series: { shadowSize: 1 }, + xaxis:{ font: { color: '#ccc' } }, + yaxis:{ font: { color: '#ccc' } }, + grid: { hoverable: true, clickable: true, borderWidth: 0, color: '#ccc' }, + tooltip: true, + legend: {show: false} + } + " style="height:240px"></div> + </div> + </div> + </div> + </div> + </div> +@stop \ No newline at end of file diff --git a/ppl2/resources/views/pages/statistikStrata.blade.php b/ppl2/resources/views/pages/statistikStrata.blade.php new file mode 100644 index 0000000000000000000000000000000000000000..5025a696ed6d77225e300f68a33f505a60158ab3 --- /dev/null +++ b/ppl2/resources/views/pages/statistikStrata.blade.php @@ -0,0 +1,68 @@ +@extends('app_template') + +@section('title') + Pendidikan Formal Pegawai +@stop + +@section('page_title') + <h2>Pendidikan Formal Pegawai</h2> +@stop + +@section('head_content') + @if (Session::has('message')) + <div class="alert alert-info fade in">{{ Session::get('message') }} + <a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a> + </div> + @endif + <div class="row"> + <div class="col-md-3"> + <button class="btn m-b-sm m-r-sm btn-success" onclick="location.href = '{{URL::to('/')}}/pendidikan-formal/new';"><i class="m-r-xs fa fa-plus"></i>Tambahkan Pendidikan</button> + </div> + <div class="col-md-6"> + <form action = "{{URL::to('/')}}/pendidikan-formal/search" method="GET"> + <div class="input-group"> + <input type="text" class="form-control" placeholder="Cari berdasarkan NIP" name="query" required> + <span class="input-group-btn"> + <button class="btn btn-default" type="submit">Go!</button> + </span> + </div> + </form> + </div> + </div> +@stop + +@section('content') +<div class="panel panel-default"> + <div class="panel-heading font-semibold"> + <!-- Tampilkan Pesan --> + Tabel Pendidikan + @if($nip == null) + Semua Pegawai + @else + Pegawai NIP : {{$nip}} + @endif + </div> + <div> + <table class="table" ui-jq="footable" ui-options='{ + "paging": { + "enabled": true + }}'> + <thead> + <tr> + <th data-breakpoints="xs">tingkatan</th> + <th>strata</th> + </tr> + </thead> + <tbody> + <?php $i = 1; ?> + @foreach($pend as $pendidikan) + <tr data-expanded="true"> + <td>{{$pendidikan -> jumlah}}</td> + <td>{{$pendidikan -> tingkatan}}</td> + </tr> + <?php $i++ ;?> + @endforeach + </tbody> + </table> + </div> +@stop \ No newline at end of file diff --git a/ppl2/resources/views/penjadwalan.blade.php b/ppl2/resources/views/penjadwalan.blade.php index 8bdb8361293765f4c86eced5dd33219bee4f84e5..39ceb249556c3b15ad36ee90aecd04278789f684 100644 --- a/ppl2/resources/views/penjadwalan.blade.php +++ b/ppl2/resources/views/penjadwalan.blade.php @@ -207,7 +207,7 @@ <h4 class="modal-title">Input Jadwal</h4> </div> <div class="modal-body"> - <form class="form-group" method = "POST" action = "{{URL::to('')}}"> + <form class="form-group" method = "POST" action = "{{URL::to('daftarinstitusi')}}" > <label for="judul">Judul kegiatan</label> <input type="text" class="form-control" id="judul"> <label for="nama">Nama penyelenggara</label> @@ -217,12 +217,15 @@ <option>Ruangan 1</option> <option>Ruangan 2</option> </select> - </form> + + </div> <div class="modal-footer"> - <input type="submit" class="btn btn-primary" data-dismiss="modal" value="Submit"> + <button type="submit" class="btn btn-primary">Submit</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> + </div> + </form> </div> </div>