Also the data of the message sender are not taken anymore via
the Person_model, but via the MessageToken_model, to avoid that
the login will be prompted
This commit is contained in:
Paolo
2017-03-30 16:43:35 +02:00
3 changed files with 69 additions and 19 deletions
+34 -5
View File
@@ -12,17 +12,17 @@ class MessageToken_model extends CI_Model
public function __construct()
{
parent::__construct();
// Loads config file message
$this->config->load('message');
// Load return message helper
$this->load->helper('message');
// Loads the database object
$this->load->database();
}
/**
* Get a received message identified by token
*/
@@ -45,7 +45,7 @@ class MessageToken_model extends CI_Model
) s ON (r.message_id = s.message_id AND r.person_id = s.person_id)
WHERE r.token = ?
LIMIT 1';
$result = $this->db->query($sql, array(MSG_STATUS_DELETED, $token));
// If no errors occurred
@@ -139,5 +139,34 @@ class MessageToken_model extends CI_Model
{
return error($this->db->error());
}
return success($result->result());
}
/**
* Get data of the message sender
*/
public function getSenderData($person_id)
{
$sql = 'SELECT p.vorname,
p.nachname,
p.anrede,
p.titelpost,
p.titelpre,
p.vornamen
FROM public.tbl_person p
WHERE p.person_id = ?';
$result = $this->db->query($sql, array($person_id));
// If no errors occurred
if ($result)
{
return success($result->result());
}
else
{
return error($this->db->error());
}
}
}