academicModel = new Academic_model(); $this->Admin_model = new Admin_model(); } // <<<----moderen_lab---->>> public function m_modrenlabs() { $getmodren_lab = $this->academicModel->getmodren_lab(); $data['getmodren_lab'] = $getmodren_lab; return view('academic/m_modrenlabs',$data); } public function getmodrenlabdata($modr_lab_id) { $modrenlab = $this->academicModel->getmodrenlabdata($modr_lab_id); return $this->response->setJSON($modrenlab); } public function getmodrenlabdata_info($modr_lab_id, $row_id) { $modrenlabData = $this->academicModel->getmodrenlabdata_info($modr_lab_id, $row_id); if ($modrenlabData) { return $this->response->setJSON($modrenlabData); } else { return $this->response->setJSON(['error' => 'No data found']); } } public function updatemodrenlab_section() { helper(['form', 'url']); $request = service('request'); $row_id = $request->getPost('edit_row_id'); $modrenlab_id = $request->getPost('edit_mordenlab_id'); $img1 = $this->request->getFile('section_img1'); $img2 = $this->request->getFile('section_img2'); $img3 = $this->request->getFile('section_img3'); $img4 = $this->request->getFile('section_img4'); $img5 = $this->request->getFile('section_img5'); $img6 = $this->request->getFile('section_img6'); $banimg = $this->request->getFile('banner_img'); $vdo = $this->request->getFile('edit_video'); $modrenlab_data = [ 'section_1' => $request->getPost('section_cont1'), 'section_2' => $request->getPost('section_cont2'), 'status' => $request->getPost('edit_section_status') ]; // upload file if ($img1 && $img1->isValid() && !$img1->hasMoved()) { $img1Name = $img1->getRandomName(); $img1->move(FCPATH . 'uploads', $img1Name); $modrenlab_data['img1'] = $img1Name; } if ($img2 && $img2->isValid() && !$img2->hasMoved()) { $img2Name = $img2->getRandomName(); $img2->move(FCPATH . 'uploads', $img2Name); $modrenlab_data['img2'] = $img2Name; } if ($img3 && $img3->isValid() && !$img3->hasMoved()) { $img3Name = $img3->getRandomName(); $img3->move(FCPATH . 'uploads', $img3Name); $modrenlab_data['img3'] = $img3Name; } if ($img4 && $img4->isValid() && !$img4->hasMoved()) { $img4Name = $img4->getRandomName(); $img4->move(FCPATH . 'uploads', $img4Name); $modrenlab_data['img4'] = $img4Name; } if ($img5 && $img5->isValid() && !$img5->hasMoved()) { $img5Name = $img5->getRandomName(); $img5->move(FCPATH . 'uploads', $img5Name); $modrenlab_data['img5'] = $img5Name; } if ($img6 && $img6->isValid() && !$img6->hasMoved()) { $img6Name = $img6->getRandomName(); $img6->move(FCPATH . 'uploads', $img6Name); $modrenlab_data['img6'] = $img6Name; } if ($banimg && $banimg->isValid() && !$banimg->hasMoved()) { $banimgName = $banimg->getRandomName(); $banimg->move(FCPATH . 'uploads', $banimgName); $modrenlab_data['banner_img'] = $banimgName; } if ($vdo && $vdo->isValid() && !$vdo->hasMoved()) { $vdoName = $vdo->getRandomName(); $vdo->move(FCPATH . 'uploads', $vdoName); $modrenlab_data['video'] = $vdoName; } $this->academicModel->updatemodrenlab_section($row_id, $modrenlab_id, $modrenlab_data); return $this->response->setJSON(['status' => 'success']); } public function addmodrenlab_section() { helper(['form', 'url']); $request = service('request'); $img1 = $this->request->getFile('add_section_img1'); $img2 = $this->request->getFile('add_section_img2'); $img3 = $this->request->getFile('add_section_img3'); $img4 = $this->request->getFile('add_section_img4'); $img5 = $this->request->getFile('add_section_img5'); $img6 = $this->request->getFile('add_section_img6'); $vdo = $this->request->getFile('add_video'); $modrenlab_data = [ 'modren_lab_id' => $request->getPost('add_modrenlab_id'), 'section_1' => $request->getPost('add_section_cont1'), 'section_2' => $request->getPost('add_section_cont2'), 'status' => $request->getPost('add_section_status') ]; // upload file if ($img1 && $img1->isValid() && !$img1->hasMoved()) { $img1Name = $img1->getRandomName(); $img1->move(FCPATH . 'uploads', $img1Name); $modrenlab_data['img1'] = $img1Name; } if ($img2 && $img2->isValid() && !$img2->hasMoved()) { $img2Name = $img2->getRandomName(); $img2->move(FCPATH . 'uploads', $img2Name); $modrenlab_data['img2'] = $img2Name; } if ($img3 && $img3->isValid() && !$img3->hasMoved()) { $img3Name = $img3->getRandomName(); $img3->move(FCPATH . 'uploads', $img3Name); $modrenlab_data['img3'] = $img3Name; } if ($img4 && $img4->isValid() && !$img4->hasMoved()) { $img4Name = $img4->getRandomName(); $img4->move(FCPATH . 'uploads', $img4Name); $modrenlab_data['img4'] = $img4Name; } if ($img5 && $img5->isValid() && !$img5->hasMoved()) { $img5Name = $img5->getRandomName(); $img5->move(FCPATH . 'uploads', $img5Name); $modrenlab_data['img5'] = $img5Name; } if ($img6 && $img6->isValid() && !$img6->hasMoved() ) { $img6Name = $img6->getRandomName(); $img6->move(FCPATH . 'uploads', $img6Name); $modrenlab_data['img6'] = $img6Name; } if ($vdo && $vdo->isValid() && !$vdo->hasMoved() ) { $vdoName = $vdo->getRandomName(); $vdo->move(FCPATH . 'uploads', $vdoName); $modrenlab_data['video'] = $vdoName; } $this->academicModel->insertmodrenlab_section($modrenlab_data); return $this->response->setJSON(['status' => 'success']); } public function deletemodrenlab_section($id) { $result = $this->academicModel->deletemodrenlab_section($id); if ($result) { return $this->response->setJSON(['status' => 'success']); } else { return $this->response->setJSON(['status' => 'error', 'error' => 'Failed to delete section']); } } // <<<----classroom---->>> public function m_classroom() { $getclassroom = $this->academicModel->getclassroom(); $data['getclassroom'] = $getclassroom; return view('academic/m_classroom',$data); } public function updateclassroom() { helper(['form', 'url']); $request = service('request'); $row_id = $request->getPost('edit_classid'); $img1 = $this->request->getFile('edit_img1'); $img2 = $this->request->getFile('edit_img2'); $img3 = $this->request->getFile('edit_img3'); $classroomdata = [ 'description' => $request->getPost('edit_description'), 'status' => $request->getPost('edit_status') ]; // upload file if ($img1 && $img1->isValid() && !$img1->hasMoved()) { $img1Name = $img1->getRandomName(); $img1->move(FCPATH . 'uploads', $img1Name); $classroomdata['img1'] = $img1Name; } if ($img2 && $img2->isValid() && !$img2->hasMoved()) { $img2Name = $img2->getRandomName(); $img2->move(FCPATH . 'uploads', $img2Name); $classroomdata['img2'] = $img2Name; } if ($img3 && $img3->isValid() && !$img3->hasMoved()) { $img3Name = $img3->getRandomName(); $img3->move(FCPATH . 'uploads', $img3Name); $classroomdata['img3'] = $img3Name; } $this->academicModel->updateclassroom_data($row_id, $classroomdata); return $this->response->setJSON(['status' => 'success']); } public function addclassroom() { helper(['form', 'url']); $request = service('request'); $img1 = $this->request->getFile('add_img1'); $img2 = $this->request->getFile('add_img2'); $img3 = $this->request->getFile('add_img3'); $classroomdata = [ 'description' => $request->getPost('add_description'), 'status' => $request->getPost('add_status') ]; // upload file if ($img1 && $img1->isValid() && !$img1->hasMoved()) { $img1Name = $img1->getRandomName(); $img1->move(FCPATH . 'uploads', $img1Name); $classroomdata['img1'] = $img1Name; } if ($img2 && $img2->isValid() && !$img2->hasMoved()) { $img2Name = $img2->getRandomName(); $img2->move(FCPATH . 'uploads', $img2Name); $classroomdata['img2'] = $img2Name; } if ($img3 && $img3->isValid() && !$img3->hasMoved()) { $img3Name = $img3->getRandomName(); $img3->move(FCPATH . 'uploads', $img3Name); $classroomdata['img3'] = $img3Name; } $this->academicModel->insertclassroom_data($classroomdata); return $this->response->setJSON(['status' => 'success']); } public function deleteclassroom($id) { $result = $this->academicModel->deleteclassroom_data($id); if ($result) { return $this->response->setJSON(['status' => 'success']); } else { return $this->response->setJSON(['status' => 'error', 'error' => 'Failed to delete section']); } } // <<<----libraray---->>> public function m_library() { $getlibrary = $this->academicModel->getlibrary(); $data['getlibrary'] = $getlibrary; return view('academic/m_library',$data); } public function updatelibrary() { helper(['form', 'url']); $request = service('request'); $row_id = $request->getPost('edit_librid'); $img1 = $this->request->getFile('edit_img1'); $img2 = $this->request->getFile('edit_img2'); $img3 = $this->request->getFile('edit_img3'); $img4 = $this->request->getFile('edit_img4'); $librarydata = [ 'main_content' => $request->getPost('edit_main_content'), 'description1' => $request->getPost('edit_description1'), 'description2' => $request->getPost('edit_description2'), 'description3' => $request->getPost('edit_description3'), 'description4' => $request->getPost('edit_description4'), 'status' => $request->getPost('edit_status') ]; // upload file if ($img1 && $img1->isValid() && !$img1->hasMoved()) { $img1Name = $img1->getRandomName(); $img1->move(FCPATH . 'uploads', $img1Name); $librarydata['img1'] = $img1Name; } if ($img2 && $img2->isValid() && !$img2->hasMoved()) { $img2Name = $img2->getRandomName(); $img2->move(FCPATH . 'uploads', $img2Name); $librarydata['img2'] = $img2Name; } if ($img3 && $img3->isValid() && !$img3->hasMoved()) { $img3Name = $img3->getRandomName(); $img3->move(FCPATH . 'uploads', $img3Name); $librarydata['img3'] = $img3Name; } if ($img4 && $img4->isValid() && !$img4->hasMoved()) { $img4Name = $img4->getRandomName(); $img4->move(FCPATH . 'uploads', $img4Name); $librarydata['img4'] = $img4Name; } $this->academicModel->updatelibrary_data($row_id, $librarydata); return $this->response->setJSON(['status' => 'success']); } public function addlibrary() { helper(['form', 'url']); $request = service('request'); $img1 = $this->request->getFile('add_img1'); $img2 = $this->request->getFile('add_img2'); $img3 = $this->request->getFile('add_img3'); $img4 = $this->request->getFile('add_img4'); $librarydata = [ 'main_content' => $request->getPost('add_main_content'), 'description1' => $request->getPost('add_description1'), 'description2' => $request->getPost('add_description2'), 'description3' => $request->getPost('add_description3'), 'description4' => $request->getPost('add_description4'), 'status' => $request->getPost('add_status') ]; // upload file if ($img1 && $img1->isValid() && !$img1->hasMoved()) { $img1Name = $img1->getRandomName(); $img1->move(FCPATH . 'uploads', $img1Name); $librarydata['img1'] = $img1Name; } if ($img2 && $img2->isValid() && !$img2->hasMoved()) { $img2Name = $img2->getRandomName(); $img2->move(FCPATH . 'uploads', $img2Name); $librarydata['img2'] = $img2Name; } if ($img3 && $img3->isValid() && !$img3->hasMoved()) { $img3Name = $img3->getRandomName(); $img3->move(FCPATH . 'uploads', $img3Name); $librarydata['img3'] = $img3Name; } if ($img4 && $img4->isValid() && !$img4->hasMoved()) { $img4Name = $img4->getRandomName(); $img4->move(FCPATH . 'uploads', $img4Name); $librarydata['img4'] = $img4Name; } $this->academicModel->insertlibrary_data($librarydata); return $this->response->setJSON(['status' => 'success']); } public function deletelibrary($id) { $result = $this->academicModel->deletelibrary_data($id); if ($result) { return $this->response->setJSON(['status' => 'success']); } else { return $this->response->setJSON(['status' => 'error', 'error' => 'Failed to delete section']); } } // <<<----why gmn---->>> public function m_whygmn() { $getwhygmn = $this->academicModel->getwhygmn(); $data['getwhygmn'] = $getwhygmn; return view('academic/m_whygmn',$data); } public function getwhygmndata($modr_lab_id) { $modrenlab = $this->academicModel->getwhygmndata($modr_lab_id); return $this->response->setJSON($modrenlab); } public function getwhygmndata_info($modr_lab_id, $row_id) { $modrenlabData = $this->academicModel->getwhygmndata_info($modr_lab_id, $row_id); if ($modrenlabData) { return $this->response->setJSON($modrenlabData); } else { return $this->response->setJSON(['error' => 'No data found']); } } public function updatewhygmn_section() { helper(['form', 'url']); $request = service('request'); $row_id = $request->getPost('edit_row_id'); $modrenlab_id = $request->getPost('edit_whygmn_id'); $img1 = $this->request->getFile('section_img1'); $img2 = $this->request->getFile('banner_img'); $modrenlab_data = [ 'description' => $request->getPost('section_cont1'), 'status' => $request->getPost('edit_section_status') ]; if ($img1 && $img1->isValid() && !$img1->hasMoved()) { $img1Name = $img1->getRandomName(); $img1->move(FCPATH . 'uploads', $img1Name); $modrenlab_data['img'] = $img1Name; } if ($img2 && $img2->isValid() && !$img2->hasMoved()) { $img2Name = $img2->getRandomName(); $img2->move(FCPATH . 'uploads', $img2Name); $modrenlab_data['banner_img'] = $img2Name; } $this->academicModel->updatewhygmn_section($row_id, $modrenlab_id, $modrenlab_data); return $this->response->setJSON(['status' => 'success']); } public function addwhygmn_section() { helper(['form', 'url']); $request = service('request'); $img1 = $this->request->getFile('add_section_img1'); $modrenlab_data = [ 'whygmn_id' => $request->getPost('add_whygmn_id'), 'description' => $request->getPost('add_section_cont1'), 'status' => $request->getPost('add_section_status') ]; // upload file if ($img1 && $img1->isValid() && !$img1->hasMoved()) { $img1Name = $img1->getRandomName(); $img1->move(FCPATH . 'uploads', $img1Name); $modrenlab_data['img'] = $img1Name; } // print_r($modrenlab_data);die(); $this->academicModel->insertwhygmn_section($modrenlab_data); return $this->response->setJSON(['status' => 'success']); } public function deletewhygmn_section($id) { $result = $this->academicModel->deletewhygmn_section($id); if ($result) { return $this->response->setJSON(['status' => 'success']); } else { return $this->response->setJSON(['status' => 'error', 'error' => 'Failed to delete section']); } } // <<<----why life at gmn---->>> public function m_lifeatgmn() { $getlifeatgmn = $this->academicModel->getlifeatgmn(); $data['getlifeatgmn'] = $getlifeatgmn; return view('academic/m_lifeatgmn',$data); } public function getlifeatgmndata($lifeatgmn_id) { $lifeatgmn = $this->academicModel->getlifeatgmndata($lifeatgmn_id); return $this->response->setJSON($lifeatgmn); } public function getlifeatgmndata_info($lifeatgmn_id, $row_id) { $lifeatgmnData = $this->academicModel->getlifeatgmndata_info($lifeatgmn_id, $row_id); if ($lifeatgmnData) { return $this->response->setJSON($lifeatgmnData); } else { return $this->response->setJSON(['error' => 'No data found']); } } public function updatelifeatgmn_section() { helper(['form', 'url']); $request = service('request'); $row_id = $request->getPost('edit_row_id'); $lifeatgmn_id = $request->getPost('edit_lifeatgmn_id'); $img1 = $this->request->getFile('section_img1'); $img2 = $this->request->getFile('edit_banner_img'); $lifeatgmn_data = [ 'description' => $request->getPost('section_cont1'), 'status' => $request->getPost('edit_section_status') ]; // upload file if ($img1 && $img1->isValid() && !$img1->hasMoved()) { $img1Name = $img1->getName(); $img1->move(FCPATH . 'uploads', $img1Name); $lifeatgmn_data['img'] = $img1Name; } if ($img2 && $img2->isValid() && !$img2->hasMoved()) { $img2Name = $img2->getName(); $img2->move(FCPATH . 'uploads', $img2Name); $lifeatgmn_data['banner_img'] = $img2Name; } $this->academicModel->updatelifeatgmn_section($row_id, $lifeatgmn_id, $lifeatgmn_data); return $this->response->setJSON(['status' => 'success']); } public function addlifeatgmn_section() { helper(['form', 'url']); $request = service('request'); $img1 = $this->request->getFile('add_section_img1'); $lifeatgmn_data = [ 'lifeatgmn_id' => $request->getPost('add_lifeatgmn_id'), 'description' => $request->getPost('add_section_cont1'), 'status' => $request->getPost('add_section_status') ]; if ($img1 && $img1->isValid() && !$img1->hasMoved()) { $img1Name = $img1->getRandomName(); $img1->move(FCPATH . 'uploads', $img1Name); $lifeatgmn_data['img'] = $img1Name; } $this->academicModel->insertlifeatgmn_section($lifeatgmn_data); return $this->response->setJSON(['status' => 'success']); } public function deletelifeatgmn_section($id) { $result = $this->academicModel->deletelifeatgmn_section($id); if ($result) { return $this->response->setJSON(['status' => 'success']); } else { return $this->response->setJSON(['status' => 'error', 'error' => 'Failed to delete section']); } } // <<<----celebration at gmn---->>> public function m_celebration() { $getgallery = $this->academicModel->getcelebr(); $data['getgallery'] = $getgallery; return view('academic/m_celebration', $data); } public function update_celebration() { $celeb_id = $this->request->getPost('gallery_id'); $celeb_data = [ 'status' => $this->request->getPost('edit_status') ]; $gall_img = $this->request->getFile('edit_image_path'); if ($gall_img && $gall_img->isValid() && !$gall_img->hasMoved()) { $newName = $gall_img->getName(); $gall_img->move(FCPATH . '/uploads', $newName); $celeb_data['image_path'] = $newName; } $this->academicModel->updatecelebr($celeb_id, $celeb_data); return $this->response->setJSON(['status' => 'success']); } public function add_celebration() { $gallery_data = [ 'status' => $this->request->getPost('add_status') ]; $news_img = $this->request->getFile('add_image_path'); if ($news_img && $news_img->isValid() && !$news_img->hasMoved()) { $newName = $news_img->getRandomName(); $news_img->move('./uploads', $newName); $gallery_data['image_path'] = $newName; } $this->academicModel->insertcelebr($gallery_data); return $this->response->setJSON(['status' => 'success']); } public function delete_celebration($celeb_id) { $this->academicModel->deletecelebr($celeb_id); return $this->response->setJSON(['status' => 'success']); } //<---------contact---->>> public function m_contactinfo() { $getcontactinfo = $this->academicModel->getcontactinfo(); $data['getcontactinfo'] = $getcontactinfo; return view('academic/m_contactinfo',$data); } public function update_contactinfo() { helper(['form', 'url']); $request = service('request'); $row_id = $request->getPost('edit_id'); $contactinfodata = [ 'address' => $request->getPost('edit_address'), 'landline' => $request->getPost('edit_landline'), 'principal' => $request->getPost('edit_principal'), 'admission_cell' => $request->getPost('edit_admission_cell'), 'email' => $request->getPost('edit_email'), 'website' => $request->getPost('edit_website'), 'status' => $request->getPost('edit_status') ]; $banner_img = $this->request->getFile('edit_banner_img'); if ($banner_img && $banner_img->isValid() && !$banner_img->hasMoved()) { $newName = $banner_img->getRandomName(); $banner_img->move('./uploads', $newName); $contactinfodata['banner_img'] = $newName; } $this->academicModel->updatecontactinfo($row_id, $contactinfodata); return $this->response->setJSON(['status' => 'success']); } }