Files
monpas/application/models/monpas/Schooldetails_model.php
T

51 lines
1.6 KiB
PHP

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/** Schooldetails_model mei 2015 */
class Schooldetails_model extends MY_Model{
protected $tablename = 'tb_schooldetails';
function __construct(){
parent::__construct();
$models = array('');
$this->load->model($models);
}
function get_details($schoolid){
$this->sql="SELECT id, organisatie_id, straat, plaats, telefoon, email1, web, directie, ib, email2, logo
FROM tb_schooldetails
WHERE organisatie_id={$schoolid} ";
return $this->get_query_row();
}
function get_details2($schoolid){
$this->sql="SELECT id, organisatie_id, COALESCE(straat, '') AS straat, COALESCE(plaats, '') AS plaats,
COALESCE(telefoon, '') AS telefoon, COALESCE(email1, '') AS email1, COALESCE(web, '') AS web,
COALESCE(directie, '') AS directie, COALESCE(ib, '') AS ib, COALESCE(email2, '') AS email2
FROM tb_schooldetails
WHERE organisatie_id={$schoolid}";
return $this->get_query_row();
}
function getLogo($orgid){
$this->sql = "SELECT logo
FROM tb_schooldetails
WHERE organisatie_id={$orgid}";
return $this->get_query_row('logo');
}
function getschool($orgid){
$this->sql = "SELECT O.id, O.brin, O.naam, O.naamkort, S.plaats, O.soort,
concat('../images/logos/', logo) as logo,
S.telefoon, S.straat, S.email1, S.web
FROM tb_organisaties O
JOIN tb_schooldetails S ON O.id = S.organisatie_id
WHERE O.id = {$orgid}";
return $this->get_query_row();
}
}