This commit is contained in:
Paminger
2016-05-04 07:05:23 +02:00
parent a932cfd0ad
commit 6836c3608d
216 changed files with 2934 additions and 147 deletions
@@ -1,83 +1,44 @@
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Studiengang_model extends DB_Model
{
public $table = 'public.tbl_studiengang';
public $id = 'studiengang_kz';
public $order = 'DESC';
function __construct()
{
parent::__construct();
}
// get all
function get_all()
{
$this->db->order_by($this->id, $this->order);
return $this->db->get($this->table)->result();
}
// get data by id
function get_by_id($id)
{
$this->db->where($this->id, $id);
return $this->db->get($this->table)->row();
}
// get total rows
function total_rows() {
$this->db->from($this->table);
return $this->db->count_all_results();
}
// get data with limit
function index_limit($limit, $start = 0) {
$this->db->order_by($this->id, $this->order);
$this->db->limit($limit, $start);
return $this->db->get($this->table)->result();
}
// get search total rows
function search_total_rows($keyword = NULL) {
$this->db->like('', $keyword);
$this->db->from($this->table);
return $this->db->count_all_results();
}
// get search data with limit
function search_index_limit($limit, $start = 0, $keyword = NULL) {
$this->db->order_by($this->id, $this->order);
$this->db->like('', $keyword);
$this->db->limit($limit, $start);
return $this->db->get($this->table)->result();
}
// insert data
function insert($data)
{
$this->db->insert($this->table, $data);
}
// update data
function update($id, $data)
{
$this->db->where($this->id, $id);
$this->db->update($this->table, $data);
}
// delete data
function delete($id)
{
$this->db->where($this->id, $id);
$this->db->delete($this->table);
}
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->dbTable = 'public.tbl_studiengang';
$this->pk = 'studiengang_kz';
}
/**
*
*/
public function getAllForBewerbung()
{
$result = NULL;
$allForBewerbungQuery = "SELECT DISTINCT studiengang_kz,
typ,
organisationseinheittyp_kurzbz,
studiengangbezeichnung,
standort,
studiengangbezeichnung_englisch,
lgartcode,
tbl_lgartcode.bezeichnung
FROM lehre.vw_studienplan LEFT JOIN bis.tbl_lgartcode USING (lgartcode)
WHERE onlinebewerbung IS TRUE
AND aktiv IS TRUE
ORDER BY typ, studiengangbezeichnung, tbl_lgartcode.bezeichnung ASC";
// Checks if the operation is permitted by the API caller
// All the code should be put inside this if statement
if(isAllowed($this->getAddonID(), 'course'))
{
$result = $this->db->query($allForBewerbungQuery);
}
return $result;
}
}
/* End of file Studiengang_model.php */
/* Location: ./application/models/Studiengang_model.php */