load->model('Project_model'); $this->load->model('Commonsql_model'); } /** * Index Page for this controller. * * Maps to the following URL * http://example.com/index.php/welcome * - or - * http://example.com/index.php/welcome/index * - or - * Since this controller is set as the default controller in * config/routes.php, it's displayed at http://example.com/ * * So any other public methods not prefixed with an underscore will * map to /index.php/welcome/ * @see https://codeigniter.com/user_guide/general/urls.html */ public function project_list() { $data['pro']=$this->Project_model->list_pro(); $this->load->view('project/project_list',$data); } function add_project() { $data['dep']=$this->Project_model->get_dep(); $data['stu']=$this->Project_model->get_stu(); $data['fac']=$this->Project_model->get_fac(); $this->load->view('project/add_project',$data); if($this->input->post('submit')) { $name=$this->input->post('projectName'); $date=$this->input->post('date'); $student=$this->input->post('student'); $semester=$this->input->post('semester'); $gender=$this->input->post('gender'); $department=$this->input->post('department'); $designation=$this->input->post('designation'); $faculty=$this->input->post('faculty'); $drivelink=$this->input->post('drive'); $vedio=$this->input->post('vedio'); $image=$this->input->post('image'); $table="project"; $values=array('projectName'=>$name, 'date'=>$date, 'student'=>$student, 'semester'=>$semester, 'department'=>$department, 'gender'=>$gender, 'designation'=>$designation, 'faculty'=>$faculty, 'drivelink'=>$drivelink, 'vedio'=>$vedio, 'image'=>$image, 'createdOn'=>date('Y-m-d'), 'createdBy'=>1, 'status'=>1); $result=$this->Commonsql_model->insert_table($table,$values); if($result) { $this->session->set_userdata('suc','successfully added'); redirect('project'); } else { $this->session->set_userdata('err','Please try again'); redirect('project'); } } } function edit_project($id) { $data['pro']=$this->Project_model->get_pro($id); $this->load->view('project/edit_project',$data); if($this->input->post('submit')) { $name=$this->input->post('projectName'); $date=$this->input->post('date'); $student=$this->input->post('student'); $semester=$this->input->post('semester'); $gender=$this->input->post('gender'); $department=$this->input->post('department'); $designation=$this->input->post('designation'); $faculty=$this->input->post('faculty'); $drivelink=$this->input->post('drive'); $vedio=$this->input->post('vedio'); $image=$this->input->post('image'); $table="project"; $where=array("id"=>$id); $values=array('projectName'=>$name, 'date'=>$date, 'student'=>$student, 'semester'=>$semester, 'department'=>$department, 'gender'=>$gender, 'designation'=>$designation, 'faculty'=>$faculty, 'drivelink'=>$drivelink, 'vedio'=>$vedio, 'image'=>$image, 'updatedOn'=>date('Y-m-d'), 'updatedBy'=>1, 'status'=>1); $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) { $this->session->set_userdata('suc','successfully Updated'); redirect('project'); } else { $this->session->set_userdata('err','Please try again'); redirect('project'); } } } function deleted_project() { if($this->input->post('submit')) { $id=$this->input->post('hiddenpass'); $table="project"; $where=array("id"=>$id); $values=array( 'status'=>0); $result=$this->Commonsql_model->updateTable($table,$where,$values); if($result) { $this->session->set_userdata('suc','successfully deleted'); redirect('project'); } else { $this->session->set_userdata('err','Please try again'); redirect('project'); } } } }