public function renderCommentsList() { require_once dirname(__FILE__) . '/ProductComment.php'; $comments = ProductComment::getByValidate(1, false); $fields_list = $this->getStandardFieldList(); $helper = new HelperList(); $helper->shopLinkType = ''; $helper->simple_header = true; $helper->actions = array('delete'); $helper->show_toolbar = false; $helper->module = $this; $helper->listTotal = count($comments); $helper->identifier = 'id_product_comment'; $helper->title = $this->l('Approved 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); }
private function _displayFormModerate() { $this->_html = '<script type="text/javascript" src="' . $this->_path . 'js/moderate.js"></script> <fieldset class="width2"> <legend><img src="../img/admin/cog.gif" alt="" title="" />' . $this->l('Configuration') . '</legend> <form action="' . Tools::safeOutput($this->_baseUrl) . '" method="post" name="comment_configuration"> <label style="padding-top: 0;">' . $this->l('All comments must be validated by an employee') . '</label> <div class="margin-form"> <input type="radio" name="moderate" id="moderate_on" value="1" ' . (Configuration::get('PRODUCT_COMMENTS_MODERATE') ? 'checked="checked" ' : '') . '/> <label class="t" for="moderate_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label> <input type="radio" name="moderate" id="moderate_off" value="0" ' . (!Configuration::get('PRODUCT_COMMENTS_MODERATE') ? 'checked="checked" ' : '') . '/> <label class="t" for="moderate_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label> </div> <div class="clear" style="height: 20px;"></div> <label style="padding-top: 0;">' . $this->l('Allow guest comments') . '</label> <div class="margin-form"> <input type="radio" name="allow_guest" id="allow_guest_on" value="1" ' . (Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS') ? 'checked="checked" ' : '') . '/> <label class="t" for="allow_guest_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label> <input type="radio" name="allow_guest" id="allow_guest_off" value="0" ' . (!Configuration::get('PRODUCT_COMMENTS_ALLOW_GUESTS') ? 'checked="checked" ' : '') . '/> <label class="t" for="allow_guest_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label> </div> <div class="clear" style="height: 20px;"></div> <label style="padding-top: 0;">' . $this->l('Minimum time between 2 comments from the same user') . '</label> <div class="margin-form"> <input name="product_comments_minimal_time" type="text" class="text" value="' . Configuration::get('PRODUCT_COMMENTS_MINIMAL_TIME') . '" style="width: 40px; text-align: right;" /> ' . $this->l('seconds') . ' </div> <div class="clear"></div> <div class="margin-form clear"> <input type="submit" name="submitModerate" value="' . $this->l('Save') . '" class="button" /> </div> </form> </fieldset> <br /> <fieldset class="width2"> <legend><img src="' . $this->_path . 'img/comments_delete.png" alt="" title="" />' . $this->l('Moderate Comments') . '</legend>'; if (Configuration::get('PRODUCT_COMMENTS_MODERATE')) { require_once dirname(__FILE__) . '/ProductComment.php'; $comments = ProductComment::getByValidate(); 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" 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 comments to validate at this time.'); } } $this->_html .= '</fieldset><br />'; }
private function _displayFormModerate() { $this->_html = '<script type="text/javascript" src="' . $this->_path . 'js/moderate.js"></script> <form action="' . $_SERVER['REQUEST_URI'] . '" method="post" name="comment_form"> <fieldset><legend><img src="' . $this->_path . 'img/comments_delete.png" alt="" title="" />' . $this->l('Moderate Comments') . '</legend> <label>' . $this->l('Validation required') . '</label> <div class="margin-form"> <input type="radio" name="moderate" id="moderate_on" value="1" ' . (Configuration::get('PRODUCT_COMMENTS_MODERATE') ? 'checked="checked" ' : '') . '/> <label class="t" for="moderate_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label> <input type="radio" name="moderate" id="moderate_off" value="0" ' . (!Configuration::get('PRODUCT_COMMENTS_MODERATE') ? 'checked="checked" ' : '') . '/> <label class="t" for="moderate_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label> </div> <div class="margin-form clear"><input type="submit" name="submitModerate" value="' . $this->l('Save') . '" class="button" /></div>'; if (Configuration::get('PRODUCT_COMMENTS_MODERATE')) { require_once dirname(__FILE__) . '/ProductComment.php'; $comments = ProductComment::getByValidate(); if (sizeof($comments)) { $this->_html .= '<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 style="width:30px;">' . $this->l('Actions') . '</th> <th style="width:150px;">' . $this->l('Author') . '</th> <th style="width:700px;">' . $this->l('Comment') . '</th> </tr> </thead> <tbody>'; foreach ($comments as $comment) { $this->_html .= '<tr> <td><a href="javascript:;" onclick="acceptComment(\'' . intval($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(\'' . intval($comment['id_product_comment']) . '\');"><img src="' . $this->_path . 'img/delete.png" alt="' . $this->l('Delete') . '" title="' . $this->l('Delete') . '" /></a></td> <td>' . htmlspecialchars($comment['firstname'], ENT_COMPAT, 'UTF-8') . ' ' . htmlspecialchars(substr($comment['lastname'], 0, 1), ENT_COMPAT, 'UTF-8') . '.</td> <td>' . htmlspecialchars($comment['content'], ENT_COMPAT, 'UTF-8') . '</td> </tr>'; } $this->_html .= '</tbody> </table>'; } else { $this->_html .= $this->l('No comments to validate.'); } } $this->_html .= '</fieldset></form><br />'; }