/** * Displays "Right Now" meta box. */ public function rightNow() { $counts = $this->wp->wpCountPosts(Types::PRODUCT); $productCount = $counts->publish; $categoryCount = $this->wp->wpCountTerms(Types::PRODUCT_CATEGORY); $tagCount = $this->wp->wpCountTerms(Types::PRODUCT_TAG); $attributesCount = $this->productService->countAttributes(); $counts = $this->wp->wpCountPosts(Types::ORDER); $pendingCount = $counts->{Order\Status::PENDING}; $onHoldCount = $counts->{Order\Status::ON_HOLD}; $processingCount = $counts->{Order\Status::PROCESSING}; $completedCount = $counts->{Order\Status::COMPLETED}; $cancelledCount = $counts->{Order\Status::CANCELLED}; $refundedCount = $counts->{Order\Status::REFUNDED}; Render::output('admin/dashboard/rightNow', array('productCount' => $productCount, 'categoryCount' => $categoryCount, 'tagCount' => $tagCount, 'attributesCount' => $attributesCount, 'pendingCount' => $pendingCount, 'onHoldCount' => $onHoldCount, 'processingCount' => $processingCount, 'completedCount' => $completedCount, 'cancelledCount' => $cancelledCount, 'refundedCount' => $refundedCount)); }
public function statusFilters($views) { $current = isset($_GET['post_status']) && Entity\Status::exists($_GET['post_status']) ? $_GET['post_status'] : ''; $statuses = Entity\Status::getStatuses(); $counts = $this->wp->wpCountPosts(Types::ORDER, 'readable'); $dates = isset($_GET['m']) ? '&m=' . $_GET['m'] : ''; foreach ($statuses as $status => $label) { $count = isset($counts->{$status}) ? $counts->{$status} : 0; $views[$status] = '<a class="' . $status . ($current == $status ? ' current' : '') . '" href="?post_type=' . Types::ORDER . '&post_status=' . $status . $dates . '">' . $label . ' <span class="count">(' . $count . ')</a>'; } if (!empty($current)) { $views['all'] = str_replace('current', '', $views['all']); } unset($views['publish']); if (isset($views['trash'])) { $trash = $views['trash']; unset($views['draft']); unset($views['trash']); $views['trash'] = $trash; } return $views; }