public function search(Request $request) { $surah_start = $request->input('surah_start'); $ayat_start = $request->input('ayat_start'); $ayat_end = $request->input('ayat_end'); $fill_ayat_end = $request->input('fill_ayat_end'); $QuranModel = new Quran(); $surah_detail = $QuranModel->getSurah($surah_start); // ayat checking if (isset($ayat_start) || isset($ayat_end)) { if ($surah_detail[0]->ayat < $ayat_start) { return redirect('memoz')->with('messageError', 'Surah ' . $surah_detail[0]->surah_name . ' ada ' . $surah_detail[0]->ayat . ' ayat, ayat ' . $ayat_start . ' tidak ada!'); } elseif ($surah_detail[0]->ayat < $ayat_end) { return redirect('memoz')->with('messageError', 'Surah ' . $surah_detail[0]->surah_name . ' ada ' . $surah_detail[0]->ayat . ' ayat, ayat ' . $ayat_end . ' tidak ada!'); } } if ($surah_start && !empty($ayat_start) && !empty($ayat_end)) { setcookie('coo_last_memoz', url('memoz/surah/' . $surah_start . '/' . $ayat_start . '-' . $ayat_end)); return redirect('memoz/surah/' . $surah_start . '/' . $ayat_start . '-' . $ayat_end); } elseif ($surah_start && !empty($ayat_start)) { setcookie('coo_last_memoz', url('memoz/surah/' . $surah_start . '/' . $ayat_start . '-' . $ayat_end)); return redirect('memoz/surah/' . $surah_start . '/' . $ayat_start); } else { return redirect('memoz'); } }
public function create() { // get surah $QuranModel = new Quran(); $surahs = $QuranModel->getSurah(); $NotesModel = new Notes(); // send to view $data['surahs'] = $surahs; $data['notesDetail'] = $NotesModel->get(); $data[''] = ''; $dataHTML['modal_title'] = 'Simpan Note'; $dataHTML['modal_body'] = view('notes_form', $data)->render(); $dataHTML['modal_footer'] = ''; return response()->json($dataHTML); }
/** * select juz * */ public function juzPage($juz) { $QuranModel = new Quran(); $pages = $QuranModel->getJuzPage($juz); $page = $pages[0]->page; // get pages mushaf quran $pages = $QuranModel->getPage(); // get mushaf per page $ayats = $QuranModel->getAyat($page); if (empty($ayats)) { return redirect('mushaf'); } // get surah $surahs = $QuranModel->getSurah(); // showing paging if ($page <= 4) { $pages = array_slice($pages, 0, 4); } elseif ($page > 4 && $page <= 592) { $pages = array_slice($pages, $page - 3, 5); } else { $pages = array_slice($pages, $page - 3, 5); } // send to view $data['surahs'] = $surahs; $data['ayats'] = $ayats; $data['pages'] = $pages; $data['curr_page'] = $page; // data header $data['header_title'] = 'Mushaf Hal ' . $page . ', Juz ' . $ayats[0]->juz . ', Surah ' . $ayats[0]->surah_name; $data['body_class'] = 'body-mushaf'; $data['ayat_start'] = ''; $data['ayat_end'] = ''; $data['cookies'] = getCookie(); $data['bookmarked'] = @$_COOKIE['coo_mushaf_bookmark_url'] == $_SERVER['REQUEST_URI'] ? 'fa-bookmark' : 'fa-bookmark-o'; // show view template return view('mushaf', $data); }