public function detailsAction() { $id = $this->getRequest()->getParam('id'); $type = $this->getRequest()->getParam('type'); $this->view->type = $type; $loggedInUserId = Zend_Registry::get('user')->getId(); $modelMesaj = new Default_Model_Messages(); if ($modelMesaj->find($id) && ($modelMesaj->getIdUserFrom() == $loggedInUserId || $modelMesaj->getIdUserTo() == $loggedInUserId)) { //BEGIN:mark as read if ($modelMesaj->getRead() == 0) { $model = new Default_Model_Messages(); $model->find($id); $model->makeRead(); } //END:mark as read $this->view->result = $modelMesaj; } }