Exemplo n.º 1
0
 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');
     }
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 /**
  * search surah depend the keyword
  *
  */
 public function searchKeyword()
 {
     $keyword = isset($_GET['keyword']) ? $_GET['keyword'] : '';
     $surah = isset($_GET['surah']) ? $_GET['surah'] : '';
     $page = isset($_GET['page']) ? $_GET['page'] : 1;
     $header_description_add = $pages = '';
     if (!empty($keyword)) {
         $QuranModel = new Quran();
         $search_result = $QuranModel->searchKeyword($keyword, $surah, $page);
         $data['search_result'] = $search_result;
         $count_search = $QuranModel->countSearchKeyword($keyword, $surah);
         $data['count_search'] = $count_search;
         // devide the search page
         if (is_int($count_search)) {
             $pages = round($count_search / 10);
             $data['pages'] = $pages;
             $data['page'] = $page;
         }
         // list surah
         $surahs = $QuranModel->surahSearchKeyword($keyword, $surah);
         $data['surahs'] = $surahs;
         $data['selected_surah'] = $surah;
         $header_description_add = '\'' . $keyword . '\' ditemukan dalam ' . $count_search . ' ayat. ';
     }
     if (empty($surahs)) {
         if (empty($keyword)) {
             return redirect('mushaf')->with('messageError', 'Masukan kata yang ingin dicari!');
         }
         return redirect('mushaf')->with('messageError', 'Data tidak ditemukan!');
     }
     $data['keyword'] = $keyword;
     $data['pages'] = $pages;
     $data['header_title'] = 'Cari Kata \'' . $keyword . '\'';
     $data['header_description'] = $header_description_add . 'Cari kata dalam Al-Quran dan Tafsir Al-Quran';
     return view('mushaf_search', $data);
 }