Example #1
0
 private function _checkModerateComment()
 {
     $action = Tools::getValue('action');
     if (Tools::isSubmit('submitModerate')) {
         $moderate = Tools::getValue('moderate');
         if (intval($moderate) != 0) {
             $moderate = 1;
         }
         Configuration::updateValue('PRODUCT_COMMENTS_MODERATE', intval($moderate));
         $this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="' . $this->l('Confirmation') . '" />' . $this->l('Settings updated') . '</div>';
     } else {
         if (empty($action) === false && intval(Configuration::get('PRODUCT_COMMENTS_MODERATE'))) {
             $id_product_comment = Tools::getValue('id_product_comment');
             require_once dirname(__FILE__) . '/ProductComment.php';
             switch ($action) {
                 case 'accept':
                     $comment = new ProductComment($id_product_comment);
                     $comment->validate();
                     break;
                 case 'delete':
                     $comment = new ProductComment($id_product_comment);
                     $comment->delete();
                     ProductComment::deleteGrades($id_product_comment);
                     break;
                 default:
             }
         }
     }
 }
Example #2
0
 private function _checkDeleteComment()
 {
     $action = Tools::getValue('delete_action');
     if (empty($action) === false) {
         $product_comments = Tools::getValue('delete_id_product_comment');
         if (count($product_comments)) {
             require_once dirname(__FILE__) . '/ProductComment.php';
             if ($action == 'delete') {
                 foreach ($product_comments as $id_product_comment) {
                     if (!$id_product_comment) {
                         continue;
                     }
                     $comment = new ProductComment((int) $id_product_comment);
                     $comment->delete();
                     ProductComment::deleteGrades((int) $id_product_comment);
                 }
             }
         }
     }
 }
 private function _checkModerateComment()
 {
     $action = Tools::getValue('action');
     if (empty($action) === false && (int) Configuration::get('PRODUCT_COMMENTS_MODERATE')) {
         $product_comments = Tools::getValue('id_product_comment');
         if (sizeof($product_comments)) {
             require_once dirname(__FILE__) . '/ProductComment.php';
             switch ($action) {
                 case 'accept':
                     foreach ($product_comments as $id_product_comment) {
                         if (!$id_product_comment) {
                             continue;
                         }
                         $comment = new ProductComment((int) $id_product_comment);
                         $comment->validate();
                     }
                     break;
                 case 'delete':
                     foreach ($product_comments as $id_product_comment) {
                         if (!$id_product_comment) {
                             continue;
                         }
                         $comment = new ProductComment((int) $id_product_comment);
                         $comment->delete();
                         ProductComment::deleteGrades((int) $id_product_comment);
                     }
                     break;
                 default:
             }
         }
     }
 }
Example #4
0
        $productComment = new ProductComment($app);
        echo $productComment->getUserCommentList($ConsumerId);
    });
    #
    # 查询商品评论—详细信息
    #
    # GET	https://<endpoint>/ProductComment/[CommentId]
    #
    $app->get('/:CommentId', function ($CommentId) use($app) {
        $productComment = new ProductComment($app);
        echo $productComment->getCommentId($CommentId);
    });
    #
    # 删除商品评论
    #
    # DELETE	https://<endpoint>/ProductComment/[CommendId]
    #
    $app->delete('/:CommentId', function ($CommentId) use($app) {
        $productComment = new ProductComment($app);
        echo $productComment->delete($CommentId);
    });
    #
    # 查询用户商品评论—总数
    #
    # GET	https://<endpoint>/ProductComment/[ConsumerId]/Count/
    #
    $app->get('/:ConsumerId/Count/', function ($ConsumerId) use($app) {
        $productComment = new ProductComment($app);
        echo $productComment->getConsumerCommentCount($ConsumerId);
    });
});