initial commit
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Description of Communicatie
|
||||
*
|
||||
* @author Theo Weijmer
|
||||
* @date juli 22, 2013
|
||||
*
|
||||
* @purpose
|
||||
*
|
||||
*/
|
||||
class Communicatie extends MY_Controller {
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( 'ijkpartituur/Mails_model',
|
||||
'ijkpartituur/Mailadresses_model');
|
||||
$this->load->model($models);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function index(){
|
||||
$this->get_addresses();
|
||||
}
|
||||
|
||||
function save_email(){
|
||||
if (!$this->userid) return;
|
||||
$mailid = $this->uri->segment(4);
|
||||
$adressid = $this->uri->segment(5);
|
||||
$adress = $this->clean_input('adress');
|
||||
|
||||
$data = array( 'mailadress_adress' => $adress ,
|
||||
'mailadress_organisatie_id' => $this->globorgid ,
|
||||
'mailadress_mail_id' => $mailid );
|
||||
|
||||
$this->Mailadresses_model->save_record($data, $adressid);
|
||||
|
||||
$this->get_addresses();
|
||||
}
|
||||
|
||||
public function delete_adress(){
|
||||
if (!$this->userid) return;
|
||||
$adressid = $this->uri->segment(4);
|
||||
$this->Mailadresses_model->delete_record($adressid);
|
||||
$this->get_addresses();
|
||||
}
|
||||
|
||||
private function get_addresses(){
|
||||
if (!$this->userid) return;
|
||||
$mails = $this->Mails_model->get_details(array("(SELECT {$this->userrole} & mail_level) !=" => 0));
|
||||
|
||||
$data = array('mails'=>$mails);
|
||||
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user