public function markasAction() { if ($data = Zend_Json::decode($this->getRequest()->getRawBody())) { try { if (empty($data["notif_id"])) { throw new Exception($this->_('An error occurred while saving. Please try again later.')); } $notification = new Backoffice_Model_Notification(); $notification->find($data["notif_id"]); if (!$notification->getId()) { throw new Exception($this->_('An error occurred while saving. Please try again later.')); } $is_read = (int) (!empty($data["is_read"])); $notification->setIsRead($is_read)->save(); $html = array('success' => 1, 'is_read' => $is_read); } catch (Exception $e) { $html = array('error' => 1, 'message' => $e->getMessage()); } $this->getLayout()->setHtml(Zend_Json::encode($html)); } }