Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5575 | Rev 5728 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 5575 Rev 5576
Línea 293... Línea 293...
293
 
293
 
294
 
294
 
295
 
295
 
296
    public function commentsDeleteAction()
296
    public function commentsDeleteAction()
297
    {
297
    {
298
        // $request = $this->getRequest();
298
        $request = $this->getRequest();
299
        // if ($request->isPost()) {
299
        if ($request->isPost()) {
300
        //     $currentUserPlugin = $this->plugin('currentUserPlugin');
300
            $currentUserPlugin = $this->plugin('currentUserPlugin');
301
        //     $currentUser = $currentUserPlugin->getUser();
301
            $currentUser = $currentUserPlugin->getUser();
302
 
302
 
303
        //     $post_id = $this->params()->fromRoute('id');
303
            $post_id = $this->params()->fromRoute('id');
304
        //     $comment = $this->params()->fromRoute('comment');
304
            $comment = $this->params()->fromRoute('comment');
305
 
305
 
306
        //     $postMapper = PostMapper::getInstance($this->adapter);
306
            $postMapper = PostMapper::getInstance($this->adapter);
307
        //     $post = $postMapper->fetchOneByUuidAndNetworkId($post_id, $currentUser->network_id);
307
            $post = $postMapper->fetchOneByUuidAndNetworkId($post_id, $currentUser->network_id);
308
 
308
 
309
        //     if ($post) {
309
            if ($post) {
310
 
310
 
311
        //         $commentMapper = CommentMapper::getInstance($this->adapter);
311
                $commentMapper = CommentMapper::getInstance($this->adapter);
312
        //         $comment = $commentMapper->fetchOneByUuid($comment);
312
                $comment = $commentMapper->fetchOneByUuid($comment);
313
 
313
 
314
        //         if ($comment && $comment->post_id == $post->id && $comment->user_id == $currentUser->id) {
314
                if ($comment && $comment->post_id == $post->id && $comment->user_id == $currentUser->id) {
315
 
315
 
316
        //             $comment->status = Comment::STATUS_DELETED;
316
                    $comment->status = Comment::STATUS_DELETED;
317
 
317
 
318
        //             if ($commentMapper->update($comment)) {
318
                    if ($commentMapper->update($comment)) {
319
 
319
 
320
        //                 $total_comments = $commentMapper->fetchCountCommentByPostId($comment->post_id);
320
                        $total_comments = $commentMapper->fetchCountCommentByPostId($comment->post_id);
321
 
321
 
322
 
322
 
323
        //                 $postMapper = PostMapper::getInstance($this->adapter);
323
                        $postMapper = PostMapper::getInstance($this->adapter);
Línea 324... Línea 324...
324
        //                 $post = $postMapper->fetchOne($comment->post_id);
324
                        $post = $postMapper->fetchOne($comment->post_id);
325
        //                 $post->total_comments = $total_comments;
325
                        $post->total_comments = $total_comments;
326
        //                 $postMapper->update($post);
326
                        $postMapper->update($post);
327
 
327
 
328
 
328
 
329
 
329
 
330
 
330
 
331
 
331
 
332
        //                 $response = [
332
                        $response = [
333
        //                     'success' => true,
333
                            'success' => true,
334
        //                     'data' => 'LABEL_COMMENT_WAS_DELETED',
334
                            'data' => 'LABEL_COMMENT_WAS_DELETED',
335
        //                     'total_comments' => $total_comments
335
                            'total_comments' => $total_comments
336
        //                 ];
336
                        ];
337
        //             } else {
337
                    } else {
338
        //                 $response = [
338
                        $response = [
339
        //                     'success' => false,
339
                            'success' => false,
340
        //                     'data' => $commentMapper->getError()
340
                            'data' => $commentMapper->getError()
341
        //                 ];
341
                        ];
342
        //             }
342
                    }
343
        //         } else {
343
                } else {
344
        //             $response = [
344
                    $response = [
345
        //                 'success' => false,
345
                        'success' => false,
346
        //                 'data' => 'ERROR_COMMENT_NOT_FOUND'
346
                        'data' => 'ERROR_COMMENT_NOT_FOUND'
347
        //             ];
347
                    ];
348
        //         }
348
                }
349
        //     } else {
349
            } else {
350
        //         $response = [
350
                $response = [
351
        //             'success' => false,
351
                    'success' => false,
352
        //             'data' => 'ERROR_COMMENT_NOT_FOUND'
352
                    'data' => 'ERROR_COMMENT_NOT_FOUND'
Línea 353... Línea 353...
353
        //         ];
353
                ];
354
        //     }
354
            }
Línea 355... Línea 355...
355
        // } else {
355
        } else {
356
        //     $response = [
356
            $response = [
357
        //         'success' => false,
357
                'success' => false,