177 lines
3.0 KiB
PHP
177 lines
3.0 KiB
PHP
<?php
|
|
class Class_model extends CI_model
|
|
|
|
{
|
|
|
|
//CLASS
|
|
|
|
//get all classes
|
|
|
|
function all_class()
|
|
{
|
|
$this->db->from('tbl_classname');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
//end get all classes
|
|
|
|
//create classes
|
|
|
|
function create_class($class_name)
|
|
{
|
|
$this->db->insert('tbl_classname',$class_name);
|
|
return true;
|
|
}
|
|
|
|
//end create classes
|
|
|
|
//update classes
|
|
|
|
function update_class($class_name,$class_id)
|
|
{
|
|
$this->db->where('class_id',$class_id);
|
|
$this->db->update('tbl_classname',$class_name);
|
|
return true;
|
|
}
|
|
|
|
//end update classes
|
|
|
|
//return classes
|
|
|
|
function return_class($class_id)
|
|
{
|
|
$this->db->from('tbl_classname');
|
|
$this->db->where('class_id',$class_id);
|
|
return $this->db->get()->row();
|
|
}
|
|
|
|
//end return classes
|
|
|
|
//delete classes
|
|
|
|
function delete_class($class_id)
|
|
{
|
|
$this->db->where('class_id',$class_id);
|
|
$this->db->delete('tbl_classname');
|
|
return true;
|
|
}
|
|
|
|
//end delete classes
|
|
|
|
|
|
|
|
//LOCATIONS
|
|
|
|
//get all locations
|
|
|
|
function all_locations()
|
|
{
|
|
$this->db->from('tbl_classlocations');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
//end get all locations
|
|
|
|
//create location
|
|
|
|
function create_location($location_name)
|
|
{
|
|
$this->db->insert('tbl_classlocations',$location_name);
|
|
return true;
|
|
}
|
|
|
|
//end create location
|
|
|
|
//update location
|
|
|
|
function update_location($location_name,$locat_id)
|
|
{
|
|
$this->db->where('locat_id',$locat_id);
|
|
$this->db->update('tbl_classlocations',$location_name);
|
|
return true;
|
|
}
|
|
|
|
//end update location
|
|
|
|
//return location
|
|
|
|
function return_location($locat_id)
|
|
{
|
|
$this->db->from('tbl_classlocations');
|
|
$this->db->where('locat_id',$locat_id);
|
|
return $this->db->get()->row();
|
|
}
|
|
|
|
//end return location
|
|
|
|
//delete location
|
|
|
|
function delete_location($locat_id)
|
|
{
|
|
$this->db->where('locat_id',$locat_id);
|
|
$this->db->delete('tbl_classlocations');
|
|
return true;
|
|
}
|
|
|
|
//end delete location
|
|
|
|
//INSTRUCTORS
|
|
|
|
//get all Instructors
|
|
|
|
function all_instructors()
|
|
{
|
|
$this->db->from('tbl_instructors');
|
|
return $this->db->get()->result_array();
|
|
}
|
|
|
|
//end get all Instructors
|
|
|
|
//create Instructors
|
|
|
|
function create_instructors($instructor_name)
|
|
{
|
|
$this->db->insert('tbl_instructors',$instructor_name);
|
|
return true;
|
|
}
|
|
|
|
//end create Instructors
|
|
|
|
//update Instructors
|
|
|
|
function update_instructors($instructor_name,$instr_id)
|
|
{
|
|
$this->db->where('instr_id',$instr_id);
|
|
$this->db->update('tbl_instructors',$instructor_name);
|
|
return true;
|
|
}
|
|
|
|
//end update Instructors
|
|
|
|
//return instructors
|
|
|
|
function return_instructors($instr_id)
|
|
{
|
|
$this->db->from('tbl_instructors');
|
|
$this->db->where('instr_id',$instr_id);
|
|
return $this->db->get()->row();
|
|
}
|
|
|
|
//end return instructors
|
|
|
|
//delete instructors
|
|
|
|
function delete_instructors($instr_id)
|
|
{
|
|
$this->db->where('instr_id',$instr_id);
|
|
$this->db->delete('tbl_instructors');
|
|
return true;
|
|
}
|
|
|
|
//end delete instructors
|
|
|
|
}
|
|
|
|
|
|
?>
|