Exemplo n.º 1
0
 public function save(Default_Model_Comments $value)
 {
     $auth = Zend_Auth::getInstance();
     $authAccount = $auth->getStorage()->read();
     if (null != $authAccount) {
         if (null != $authAccount->getId()) {
             $user = new Default_Model_Users();
             $user->find($authAccount->getId());
             $data = array('id' => $value->getId(), 'idProject' => $value->getIdProject(), 'idParent' => $value->getIdParent(), 'idShop' => '3', 'idUserFrom' => $user->id, 'idUserTo' => $value->getIdUserTo(), 'description' => $value->getDescription(), 'deleted' => '0');
             $action_done = '';
             if (null === ($id = $value->getId())) {
                 $data['created'] = new Zend_Db_Expr('NOW()');
                 $id = $this->getDbTable()->insert($data);
                 //logs	action done
                 $user_name = $user->name . ' ' . $user->surname;
                 $project_name = $value->getProjectName()->getName();
                 $action_done = ' ' . $user_name . ' a adaugat un comentariu la proiectul ' . $project_name . ' ';
                 //end logs action done
             }
             Needs_Logs::DbLogTracking($user->id, $value->getIdProject(), 'comments', 'adaugare', $action_done);
             return $id;
         }
     }
 }