/** * @brief get reviews */ function getReviews(&$item_info) { if (!$this->getReviewCount()) { return; } //if(!$this->isGranted() && $this->isSecret()) return; // cpage is a number of comment pages $cpage = Context::get('cpage'); // Get a list of comments $oReviewModel =& getModel('store_review'); $output = $oReviewModel->getReviewList($item_info->module_srl, $item_info->item_srl, $cpage, $is_admin); if (!$output->toBool() || !count($output->data)) { return; } // Create commentItem object from a comment list // If admin priviledge is granted on parent posts, you can read its child posts. $accessible = array(); foreach ($output->data as $key => $val) { $oStoreReviewItem = new store_reviewItem(); $oStoreReviewItem->setAttribute($val); // If permission is granted to the post, you can access it temporarily if ($oStoreReviewItem->isGranted()) { $accessible[$val->item_srl] = true; } // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oStoreReviewItem->isAccessible() && $accessible[$val->parent_srl] === true) { $oStoreReviewItem->setAccessible(); } $review_list[$val->review_srl] = $oStoreReviewItem; } // Variable setting to be displayed on the skin Context::set('cpage', $output->page_navigation->cur_page); if ($output->total_page > 1) { $this->review_page_navigation = $output->page_navigation; } return $review_list; }
/** * @brief Contructor **/ function dispNstore_digitalAdminDashboard() { $args = new stdClass(); $output = executeQueryArray('nstore_digital.getOrderStat', $args); if (!$output->toBool()) { return $output; } $list = $output->data; if (!is_array($list)) { $list = array(); } $stat_arr = array(); $keys = array_keys($this->order_status); foreach ($keys as $key) { $stat_arr[$key] = 0; } foreach ($list as $key => $val) { $stat_arr[$val->order_status] = $val->count; } Context::set('order_status', $this->getOrderStatus()); Context::set('orderstat', $stat_arr); // get module srls $module_srls = array(); $args = new stdClass(); $output = executeQueryArray('nproduct.getModInstList', $args); if (!$output->toBool()) { return $output; } $modinst_list = $output->data; if (!is_array($modinst_list)) { $modinst_list = array(); } foreach ($modinst_list as $modinst) { $module_srls[] = $modinst->module_srl; } // newest comment $oCommentModel = getModel('comment'); $columnList = array('comment_srl', 'module_srl', 'document_srl', 'content', 'nick_name', 'member_srl'); $args = new stdClass(); $args->module_srl = $module_srls; $args->list_count = 20; $comment_list = $oCommentModel->getNewestCommentList($args, $columnList); if (!is_array($comment_list)) { $comment_list = array(); } foreach ($comment_list as $key => $value) { $value->content = strip_tags($value->content); } Context::set('comment_list', $comment_list); unset($args, $comment_list, $columnList); // newest review $review_list = array(); require_once _XE_PATH_ . 'modules/store_review/store_review.item.php'; $args = new stdClass(); $args->module_srl = $module_srls; $output = executeQueryArray('nstore_digital.getNewestReviewList', $args); if (!is_array($output->data)) { $output->data = array(); } foreach ($output->data as $key => $val) { if (!$val->review_srl) { continue; } $oReview = new store_reviewItem(); $oReview->setAttribute($val); $oReview->storeItem = new nproductItem($oReview->get('item_srl')); $review_list[$key] = $oReview; } Context::set('review_list', $review_list); $this->getNewsFromAgency(); $this->setTemplateFile('dashboard'); }