コード例 #1
0
 public function actionDelete()
 {
     if (Yii::app()->user->isGuest) {
         echo "No access";
     } else {
         $property_id = Yii::app()->user->getState('property_id');
         $fielid = YII::app()->request->getPost('id', false);
         $filer = new propertyFile($property_id);
         $result = $filer->removeFileById($fielid);
         echo json_encode(array('result' => $result));
         die;
     }
 }
コード例 #2
0
 public function actionDelete()
 {
     $property_id = (int) Yii::app()->user->getState('property_id', 0);
     $id = (int) YII::app()->request->getPost('id', 0);
     $this->model = new Guestbook('search');
     $Guestbook2userModel = new Guestbook2user();
     $link = $Guestbook2userModel->findByAttributes(array('user_id' => Yii::app()->user->getState('id'), 'guestbook_id' => $id));
     if ($link == null && $this->access > UserAccessTable::FULL_ACCESS) {
         $result = false;
     } else {
         $Guestbook2userModel->deleteAllByAttributes(array('guestbook_id' => $id));
         $result = $this->model->with('file2Guestbooks')->findByPk($id, "property_id = {$property_id}");
         $filer = new propertyFile($property_id);
         if ($result) {
             foreach ($result->file2Guestbooks as $link) {
                 $id = $link->file->getAttribute('id');
                 $link->delete();
                 $filer->removeFileById($id);
             }
             $result = $result->delete();
         }
     }
     $this->renderPartial('delete', array('result' => $result));
 }
コード例 #3
0
 public function actionDeleteimage()
 {
     if ($this->access > UserAccessTable::FULL_ACCESS) {
         return 0;
     }
     $property_id = (int) Yii::app()->user->getState('property_id', 0);
     $id = (int) YII::app()->request->getPost('id', 0);
     $this->model = new Gallery('search');
     $result = $this->model->with('file')->findByPk($id, "property_id = {$property_id}");
     $filer = new propertyFile($property_id);
     $id = $result->file->getAttribute('id');
     $result = $result->delete();
     $filer->removeFileById($id);
     echo json_encode(array('result' => $result));
     die;
 }