*/ Yii::import('application.modules.message.models.*'); ?> <table class="detail-view"> <tbody> <tr> <th><?php echo Yii::t('app', 'webserver'); ?> </th> <td><?php echo $_SERVER['SERVER_SOFTWARE']; ?> </td> </tr> <tr> <th><?php echo Yii::t('app', 'new messages'); ?> </th> <td><?php echo Mailbox::newMsgs(Yii::app()->user->id); ?> </td> </tr> </tbody> </table>
public function getNewMsgs($userid = 0) { if (!$userid) { $userid = $this->getUserId(); } return Mailbox::newMsgs($userid); // Update message count only once every 30 seconds if (!$this->_new) { $this->_new = Mailbox::newMsgs(Yii::app()->user->id); } return $this->_new; // Update message count only once every 30 seconds if (!$_SESSION['Mailbox']['new'] || $_SESSION['Mailbox']['timestamp'] < time() + 30) { $_SESSION['Mailbox']['new'] = Mailbox::newMsgs($userid); $_SESSION['Mailbox']['timestamp'] = time(); } return $_SESSION['Mailbox']['new']; }
public function actionUpdatemsg() { echo Mailbox::newMsgs(Yii::app()->user->id); }