mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
initial functions for flash messages
This commit is contained in:
parent
2fe12295ea
commit
917e018bb4
|
@ -77,11 +77,12 @@ class SeedDMS_Session {
|
|||
if (!$this->db->getResult($queryStr))
|
||||
return false;
|
||||
$this->id = $id;
|
||||
$this->data = array('userid'=>$resArr[0]['userID'], 'theme'=>$resArr[0]['theme'], 'lang'=>$resArr[0]['language'], 'id'=>$resArr[0]['id'], 'lastaccess'=>$resArr[0]['lastAccess'], 'flashmsg'=>'', 'su'=>$resArr[0]['su']);
|
||||
$this->data = array('userid'=>$resArr[0]['userID'], 'theme'=>$resArr[0]['theme'], 'lang'=>$resArr[0]['language'], 'id'=>$resArr[0]['id'], 'lastaccess'=>$resArr[0]['lastAccess'], 'su'=>$resArr[0]['su']);
|
||||
if($resArr[0]['clipboard'])
|
||||
$this->data['clipboard'] = json_decode($resArr[0]['clipboard'], true);
|
||||
else
|
||||
$this->data['clipboard'] = array('docs'=>array(), 'folders'=>array());
|
||||
$this->data['flashmsg'] = array();
|
||||
return $resArr[0];
|
||||
} /* }}} */
|
||||
|
||||
|
@ -107,6 +108,8 @@ class SeedDMS_Session {
|
|||
$this->data['lastaccess'] = $lastaccess;
|
||||
$this->data['su'] = 0;
|
||||
$this->data['clipboard'] = array('docs'=>array(), 'folders'=>array());
|
||||
$this->data['clipboard'] = array('type'=>'', 'msg'=>'');
|
||||
$this->data['flashmsg'] = array();
|
||||
return $id;
|
||||
} /* }}} */
|
||||
|
||||
|
@ -301,5 +304,30 @@ class SeedDMS_Session {
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Set flash message of session
|
||||
*
|
||||
* @param array $msg contains 'typ' and 'msg'
|
||||
*/
|
||||
function setFlashMsg($msg) { /* {{{ */
|
||||
/* id is only set if load() was called before */
|
||||
if($this->id) {
|
||||
$queryStr = "UPDATE tblSessions SET flashmsg = " . json_encode($this->db->qstr($msg)) . " WHERE id = " . $this->db->qstr($this->id);
|
||||
if (!$this->db->getResult($queryStr))
|
||||
return false;
|
||||
$this->data['flashmsg'] = $msg;
|
||||
}
|
||||
return true;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Get flash message of session
|
||||
*
|
||||
* @return array last flash message
|
||||
*/
|
||||
function getFlashMsg() { /* {{{ */
|
||||
return (array) $this->data['flashmsg'];
|
||||
} /* }}} */
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -46,11 +46,29 @@ class SeedDMS_Bootstrap_Style extends SeedDMS_View_Common {
|
|||
echo $this->extraheader;
|
||||
echo '<script type="text/javascript" src="../styles/bootstrap/jquery/jquery.min.js"></script>'."\n";
|
||||
echo '<script type="text/javascript" src="../js/jquery.passwordstrength.js"></script>'."\n";
|
||||
echo '<script type="text/javascript" src="../styles/bootstrap/noty/js/noty/jquery.noty.js"></script>'."\n";
|
||||
echo '<script type="text/javascript" src="../styles/bootstrap/noty/js/noty/layouts/topRight.js"></script>'."\n";
|
||||
echo '<script type="text/javascript" src="../styles/bootstrap/noty/js/noty/themes/default.js"></script>'."\n";
|
||||
|
||||
echo '<link rel="shortcut icon" href="../styles/'.$this->theme.'/favicon.ico" type="image/x-icon"/>'."\n";
|
||||
echo "<title>".(strlen($this->params['sitename'])>0 ? $this->params['sitename'] : "SeedDMS").(strlen($title)>0 ? ": " : "").htmlspecialchars($title)."</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<body".(strlen($bodyClass)>0 ? " class=\"".$bodyClass."\"" : "").">\n";
|
||||
if($flashmsg = $this->params['session']->getFlashMsg()) {
|
||||
?>
|
||||
<script>
|
||||
noty({
|
||||
text: '<?= $flashmsg['msg'] ?>',
|
||||
type: '<?= $flashmsg['type'] ?>',
|
||||
dismissQueue: true,
|
||||
layout: 'topRight',
|
||||
theme: 'defaultTheme',
|
||||
timeout: 1500,
|
||||
_template: '<div class="noty_message alert alert-block alert-error"><span class="noty_text"></span><div class="noty_close"></div></div>'
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
function htmlAddHeader($head) { /* {{{ */
|
||||
|
|
Loading…
Reference in New Issue
Block a user