Beispiel #1
0
 public function detailsAction()
 {
     $userId = null;
     $auth = Zend_Auth::getInstance();
     $authAccount = $auth->getStorage()->read();
     if (null != $authAccount) {
         if (null != $authAccount->getId()) {
             $userId = $authAccount->getId();
         }
     }
     $id = $this->getRequest()->getParam('id');
     if ($id) {
         $model = new Default_Model_NotificationMessages();
         /*if($model->find($id)){
         			$vizualizare = $model->setVizualizare();
         		}*/
         $select = $model->getMapper()->getDbTable()->select()->where('NOT deleted')->where('id=?', $id);
         $result = $model->fetchRow($select);
         if ($result) {
             $modelto = new Default_Model_NotificationTo();
             $select = $modelto->getMapper()->getDbTable()->select()->where('NOT deleted')->where('idNotification=?', $id)->where('idUserTo=?', $userId);
             $result2 = $modelto->fetchRow($select);
             if ($modelto->find($result2->id)) {
             }
             if ($modelto->getStatus() == 1) {
                 $this->view->notificationBg = "necitit";
             }
             $modelto->setStatus('0');
             $modelto->save();
             $this->view->result = $result;
         }
     }
 }
Beispiel #2
0
 public function save(Default_Model_NotificationTo $value)
 {
     $data = array('idNotification' => $value->getIdNotification(), 'idUserTo' => $value->getIdUserTo(), 'status' => $value->getStatus(), 'deleted' => '0');
     if (null === ($id = $value->getId())) {
         $data['created'] = new Zend_Db_Expr('NOW()');
         $id = $this->getDbTable()->insert($data);
     } else {
         $data['modified'] = new Zend_Db_Expr('NOW()');
         $this->getDbTable()->update($data, array('id = ?' => $id));
     }
     return $id;
 }