McGansWebsite/application/controllers/Welcome.php
dotwingssoftware f2a40c268b 20230207
1. Have to test and deploy in server.  2. add faculty detail into employee table and student detail  into employee table, 3. Change Teaching Assistant into multiple select 4. User Profile
2023-02-07 18:41:26 +05:30

166 lines
4.9 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('WelcomeModel');
}
/**
* 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/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$data['lastId']=$this->WelcomeModel->getLastId();
$data['dep']=$this->WelcomeModel->dep_list();
$data['semester']=$this->WelcomeModel->semesterList();
$this->load->view('index',$data);
}
public function subjectList($id)
{
$data['lastId']=$this->WelcomeModel->getLastId();
$data['dep']=$this->WelcomeModel->dep_list();
$data['semester']=$this->WelcomeModel->semesterList();
//echo $this->db->last_query();exit;
$data['subject_list']=$this->WelcomeModel->subject_list($id);
//echo $this->db->last_query();exit;
$this->load->view('subject_list',$data);
}
public function subjectDetail($id)
{
$data['lastId']=$this->WelcomeModel->getLastId();
$data['dep']=$this->WelcomeModel->dep_list();
$data['semester']=$this->WelcomeModel->semesterList();
//echo $this->db->last_query();exit;
$data['subject_Det']=$this->WelcomeModel->subject_Detail($id);
//echo $this->db->last_query();exit;
$this->load->view('subject',$data);
}
public function projectDetail($id)
{
$data['lastId']=$this->WelcomeModel->getLastId();
$data['dep']=$this->WelcomeModel->dep_list();
$data['semester']=$this->WelcomeModel->semesterList();
//echo $this->db->last_query();exit;
$data['projectdetail']=$this->WelcomeModel->projectDetail($id);
//echo $this->db->last_query();exit;
$this->load->view('project_details',$data);
}
public function about()
{
$data['lastId']=$this->WelcomeModel->getLastId();
$data['dep']=$this->WelcomeModel->dep_list();
$data['semester']=$this->WelcomeModel->semesterList();
$this->load->view('about',$data);
}
public function contact()
{
$data['lastId']=$this->WelcomeModel->getLastId();
$data['dep']=$this->WelcomeModel->dep_list();
$data['semester']=$this->WelcomeModel->semesterList();
$this->load->view('contact',$data);
}
function getDepartment()
{
$defaultId=$_POST['defaultId'];
$data=$_POST['data'];
$hidd=$_POST['hidd'];
$this->session->set_userdata('dateYear',$data);
$this->session->set_userdata('dataId',$hidd);
$getDepartment=$this->WelcomeModel->getDepartment($defaultId);
//echo $this->db->last_query();
if(isset($getDepartment) && $getDepartment->num_rows()>0)
{
foreach($getDepartment->result() as $list)
{
$depId=$list->depId;
$depName=$list->depName;
$depCode=$list->depCode;
$depImage=$list->depImage;
?>
<a href="<?=base_url();?>subject-list/<?=$depId?>">
<div class="box-item" style="margin-bottom:15px;">
<?php if($depImage!=""){
?>
<img src="<?=base_url();?>admin/uploads/department/<?=$depImage;?>" class="respimg" alt="">
<?php
}else{?>
<img src="https://ui-avatars.com/api/?name=<?=$depCode?>?background=random&color=random" class="respimg" alt="">
<?php }?>
<div class="overlay">
<h3 style="color: white;font-size: 20px; position: inherit;top: 50%;left: 50%;-webkit-transform: translate(-50%, -50%);-ms-transform: translate(-50%, -50%);transform: translate(-50%, -50%);text-align: center;">
<?=$depCode;?>
</h3>
</div>
</div>
<h1 style="font-size:20px;padding-top:5px"><?=$depName?></h1>
</div>
</a>
<?php
}
}
}
function getDepartmentClick()
{
$data=$_POST['data'];
$dataId=$_POST['dataId'];
$this->session->set_userdata('dateYear',$data);
$this->session->set_userdata('dataId',$dataId);
$getDepartment=$this->WelcomeModel->getDepartment($dataId);
//echo $this->db->last_query();
if(isset($getDepartment) && $getDepartment->num_rows()>0)
{
foreach($getDepartment->result() as $list)
{
$depId=$list->depId;
$depName=$list->depName;
$depCode=$list->depCode;
$depImage=$list->depImage;
?>
<a href="<?=base_url();?>subject-list/<?=$depId?>">
<div class="box-item" style="margin-bottom:15px;">
<?php if($depImage!=""){
?>
<img src="<?=base_url();?>admin/uploads/department/<?=$depImage;?>" class="respimg" alt="">
<?php
}else{?>
<img src="https://ui-avatars.com/api/?name=<?=$depCode?>?background=random&color=random" class="respimg" alt="">
<?php }?>
<div class="overlay"></div>
</div>
<h1 style="font-size:20px;padding-top:5px"><?=$depName?></h1>
</div>
</a>
<?php
}
}
}
}