示例#1
0
 public function save(Default_Model_UploadedFiles $value)
 {
     $data = array('idMessage' => $value->getIdMessage(), 'idUser' => $value->getIdUser(), 'name' => $value->getName(), 'type' => $value->getType(), 'module' => $value->getModule());
     if (null === ($id = $value->getId())) {
         $data['created'] = new Zend_Db_Expr('NOW()');
         $id = $this->getDbTable()->insert($data);
     } else {
         $this->getDbTable()->update($data, array('id = ?' => $id));
     }
     return $id;
 }
 public function downloadAction()
 {
     $id = $this->getRequest()->getParam('id');
     //$loggedInUserId = Zend_Registry::get('user')->getId();
     $model = new Default_Model_UploadedFiles();
     if ($model->find($id)) {
         $name = $model->getName();
         $this->view->result = $name;
     }
 }
示例#3
0
 public function deleteExpenseSavedUploadsAction()
 {
     $return = 0;
     $fileId = $this->getRequest()->getParam('fileId');
     $picModel = new Default_Model_UploadedFiles();
     if ($picModel->find($fileId)) {
         @unlink(APPLICATION_PUBLIC_PATH . '/media/files/' . $picModel->getName());
         if ($picModel->delete()) {
             $return = 1;
         }
     }
     echo Zend_Json_Encoder::encode($return);
 }