Example #1
0
    private function _displayFormReported()
    {
        $this->_html .= '<fieldset class="width2">
				<legend><img src="' . $this->_path . 'img/comments_delete.png" alt="" title="" />' . $this->l('Reported Comments') . '</legend>';
        require_once dirname(__FILE__) . '/ProductComment.php';
        $comments = ProductComment::getReportedComments();
        if (count($comments)) {
            $this->_html .= '
					<form action="' . Tools::safeOutput($this->_baseUrl) . '" method="post" name="comment_form">
					<input type="hidden" name="id_product_comment[]" id="id_product_comment" />
					<input type="hidden" name="action" id="action" />
					<br /><table class="table" border="0" cellspacing="0" cellpadding="0">
					<thead>
					<tr>
						<th><input class="noborder" type="checkbox" name="id_product_comment[]" onclick="checkDelBoxes(this.form, \'id_product_comment[]\', this.checked)" /></th>
						<th style="width:150px;">' . $this->l('Author') . '</th>
						<th style="width:550px;">' . $this->l('Comment') . '</th>
						<th style="width:150px;">' . $this->l('Product name') . '</th>
						<th style="width:30px;">' . $this->l('Actions') . '</th>
					</tr>
					</thead>
					<tbody>';
            foreach ($comments as $comment) {
                $this->_html .= '<tr>
						<td><input class="noborder" type="checkbox" value="' . $comment['id_product_comment'] . '" name="id_product_comment[]" /></td>
						<td>' . htmlspecialchars($comment['customer_name'], ENT_COMPAT, 'UTF-8') . '.</td>
						<td>' . htmlspecialchars($comment['content'], ENT_COMPAT, 'UTF-8') . '</td>
						<td>' . $comment['id_product'] . ' - ' . htmlspecialchars($comment['name'], ENT_COMPAT, 'UTF-8') . '</td>
						<td><a href="javascript:;" onclick="acceptComment(\'' . (int) $comment['id_product_comment'] . '\');"><img src="' . $this->_path . 'img/accept.png" alt="' . $this->l('Accept') . '" title="' . $this->l('Accept') . '" /></a>
							<a href="javascript:;" onclick="deleteComment(\'' . (int) $comment['id_product_comment'] . '\');"><img src="' . $this->_path . 'img/delete.png" alt="' . $this->l('Delete') . '" title="' . $this->l('Delete') . '" /></a></td>
						</tr>';
            }
            $this->_html .= '
						<tr>
							<td colspan="4" style="font-weight:bold;text-align:right">' . $this->l('Selection:') . '</td>
							<td><a href="javascript:;" onclick="acceptComment(0);"><img src="' . $this->_path . 'img/accept.png" alt="' . $this->l('Accept') . '" title="' . $this->l('Accept') . '" /></a>
							<a href="javascript:;" onclick="deleteComment(0);"><img src="' . $this->_path . 'img/delete.png" alt="' . $this->l('Delete') . '" title="' . $this->l('Delete') . '" /></a></td>
						</tr>
						</tbody>
					</table>
					</form>';
        } else {
            $this->_html .= $this->l('No reported comments at this time.');
        }
        $this->_html .= '</fieldset><br />';
    }
 public function renderModerateLists()
 {
     require_once dirname(__FILE__) . '/ProductComment.php';
     $return = null;
     if (Configuration::get('PRODUCT_COMMENTS_MODERATE')) {
         $comments = ProductComment::getByValidate(0, false);
         $fields_list = $this->getStandardFieldList();
         if (version_compare(_PS_VERSION_, '1.6', '<')) {
             $return .= "<h1>" . $this->l('Reviews waiting for approval') . "</h1>";
             $actions = array('enable', 'delete');
         } else {
             $actions = array('approve', 'delete');
         }
         $helper = new HelperList();
         $helper->shopLinkType = '';
         $helper->simple_header = true;
         $helper->actions = $actions;
         $helper->show_toolbar = false;
         $helper->module = $this;
         $helper->listTotal = count($comments);
         $helper->identifier = 'id_product_comment';
         $helper->title = $this->l('Reviews waiting for approval');
         $helper->table = $this->name;
         $helper->token = Tools::getAdminTokenLite('AdminModules');
         $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
         //$helper->tpl_vars = array('priority' => array($this->l('High'), $this->l('Medium'), $this->l('Low')));
         $return .= $helper->generateList($comments, $fields_list);
     }
     $comments = ProductComment::getReportedComments();
     $fields_list = $this->getStandardFieldList();
     if (version_compare(_PS_VERSION_, '1.6', '<')) {
         $return .= "<h1>" . $this->l('Reported Reviews') . "</h1>";
         $actions = array('enable', 'delete');
     } else {
         $actions = array('delete', 'noabuse');
     }
     $helper = new HelperList();
     $helper->shopLinkType = '';
     $helper->simple_header = true;
     $helper->actions = $actions;
     $helper->show_toolbar = false;
     $helper->module = $this;
     $helper->listTotal = count($comments);
     $helper->identifier = 'id_product_comment';
     $helper->title = $this->l('Reported Reviews');
     $helper->table = $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     //$helper->tpl_vars = array('priority' => array($this->l('High'), $this->l('Medium'), $this->l('Low')));
     $return .= $helper->generateList($comments, $fields_list);
     return $return;
 }