add more flash msg methods

This commit is contained in:
Uwe Steinmann 2013-05-18 22:52:43 +02:00
parent 0f0cad93cd
commit b5caa801b6

View File

@ -82,7 +82,10 @@ class SeedDMS_Session {
$this->data['clipboard'] = json_decode($resArr[0]['clipboard'], true); $this->data['clipboard'] = json_decode($resArr[0]['clipboard'], true);
else else
$this->data['clipboard'] = array('docs'=>array(), 'folders'=>array()); $this->data['clipboard'] = array('docs'=>array(), 'folders'=>array());
$this->data['flashmsg'] = array(); if($resArr[0]['flashmsg'])
$this->data['flashmsg'] = json_decode($resArr[0]['flashmsg'], true);
else
$this->data['flashmsg'] = array();
return $resArr[0]; return $resArr[0];
} /* }}} */ } /* }}} */
@ -241,7 +244,7 @@ class SeedDMS_Session {
function setClipboard($clipboard) { /* {{{ */ function setClipboard($clipboard) { /* {{{ */
/* id is only set if load() was called before */ /* id is only set if load() was called before */
if($this->id) { if($this->id) {
$queryStr = "UPDATE tblSessions SET clipboard = " . json_encode($this->db->qstr($clipboard)) . " WHERE id = " . $this->db->qstr($this->id); $queryStr = "UPDATE tblSessions SET clipboard = " . $this->db->qstr(json_encode($clipboard)) . " WHERE id = " . $this->db->qstr($this->id);
if (!$this->db->getResult($queryStr)) if (!$this->db->getResult($queryStr))
return false; return false;
$this->data['clipboard'] = $clipboard; $this->data['clipboard'] = $clipboard;
@ -312,7 +315,7 @@ class SeedDMS_Session {
function setFlashMsg($msg) { /* {{{ */ function setFlashMsg($msg) { /* {{{ */
/* id is only set if load() was called before */ /* id is only set if load() was called before */
if($this->id) { if($this->id) {
$queryStr = "UPDATE tblSessions SET flashmsg = " . json_encode($this->db->qstr($msg)) . " WHERE id = " . $this->db->qstr($this->id); $queryStr = "UPDATE tblSessions SET flashmsg = " . $this->db->qstr(json_encode($msg)) . " WHERE id = " . $this->db->qstr($this->id);
if (!$this->db->getResult($queryStr)) if (!$this->db->getResult($queryStr))
return false; return false;
$this->data['flashmsg'] = $msg; $this->data['flashmsg'] = $msg;
@ -320,6 +323,22 @@ class SeedDMS_Session {
return true; return true;
} /* }}} */ } /* }}} */
/**
* Set flash message of session
*
* @param array $msg contains 'typ' and 'msg'
*/
function clearFlashMsg() { /* {{{ */
/* id is only set if load() was called before */
if($this->id) {
$queryStr = "UPDATE tblSessions SET flashmsg = '' WHERE id = " . $this->db->qstr($this->id);
if (!$this->db->getResult($queryStr))
return false;
$this->data['flashmsg'] = '';
}
return true;
} /* }}} */
/** /**
* Get flash message of session * Get flash message of session
* *