Files
monpas/application/models/monpas/Schooldetails_model.php
T
2022-09-09 16:44:27 +02:00

57 lines
1.9 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,
if (straat AND straat is not null, straat, '' ) as straat,
if (plaats AND plaats is not null, plaats, '') as plaats,
if (telefoon AND telefoon is not null, telefoon,'') as telefoon,
if (email1 AND email1 is not null, email1, '') as email1,
if (web AND web is not null, web , '') as web,
if (directie AND directie is not null, directie ,'') as directie,
if (ib AND ib is not null, ib, '') as ib,
if (email2 AND email2 is not null, 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();
}
}