qa = 1; parent::__construct(); } public function initToolbarTitle() { $this->toolbar_title = $this->l('Questions and Answers', 'AdminEtsRVQuestionsController'); } public function extraJSON($data = array()) { $data = parent::extraJSON($data); if (!isset($data['list']) || !$data['list']) { // Process list filtering if ($this->filter && $this->action != 'reset_filters') { $this->processFilter(); } $data['list'] = $this->renderList(); } $data['qa'] = $this->qa; $data['prop'] = 'Question'; return $data; } public function getCommentsNumberAsField($productCommentId) { if ($productCommentId) { $repo = EtsRVCommentRepository::getInstance(); $repo2 = EtsRVReplyCommentRepository::getInstance(); $idLang = $this->context->language->id; return ($comments = $repo->getCommentsNumber((int)$productCommentId, $idLang, null, 1, $this->context, $this->qa) + $repo2->getRepliesNumber((int)$productCommentId, $idLang, null, 1, $this->context, $this->qa)) ? $comments . (($awaiting = $repo->getCommentsNumber((int)$productCommentId, $idLang, 0, 1, $this->context, $this->qa) + $repo2->getRepliesNumber((int)$productCommentId, $idLang, 0, 1, $this->context, $this->qa)) ? ' (' . $awaiting . ' ' . $this->l('Awaiting', 'AdminEtsRVQuestionsController') . ')' : '') : '--'; } } public function getRepliesNumberAsField($productCommentId) { if ($productCommentId) { $repo = EtsRVCommentRepository::getInstance(); $idLang = $this->context->language->id; return ($answers = $repo->getCommentsNumber((int)$productCommentId, $idLang, null, 1, $this->context, $this->qa, 1)) ? $answers . (($awaiting = $repo->getCommentsNumber((int)$productCommentId, $idLang, 0, 1, $this->context, $this->qa, 1)) ? ' (' . $awaiting . ' ' . $this->l('Awaiting', 'AdminEtsRVQuestionsController') . ')' : '') : '--'; } } }