/** * Parses a rudimentary system log backend page * @param \Cx\Core\Html\Sigma $template Backend template for this page * @param array $cmd Supplied CMD */ public function parsePage(\Cx\Core\Html\Sigma $template, array $cmd) { $em = $this->cx->getDb()->getEntityManager(); $logRepo = $em->getRepository('Cx\\Core_Modules\\SysLog\\Model\\Entity\\Log'); // @todo: parse message if no entries (template block exists already) $parseObject = $this->getNamespace() . '\\Model\\Entity\\Log'; // set default sorting if (!isset($_GET['order'])) { $_GET['order'] = 'timestamp/DESC'; } $parseObject = new \Cx\Core_Modules\Listing\Model\Entity\DataSet(array()); // setDataType is used to make the ViewGenerator load the proper options if $parseObject is empty $parseObject->setDataType('Cx\\Core_Modules\\SysLog\\Model\\Entity\\Log'); // configure view $viewGenerator = new \Cx\Core\Html\Controller\ViewGenerator($parseObject, $this->getAllViewGeneratorOptions()); $template->setVariable('ENTITY_VIEW', $viewGenerator); }
public function showSubscriptions() { global $_ARRAYLANG; $term = isset($_GET['term']) ? contrexx_input2raw($_GET['term']) : ''; $filterProduct = isset($_GET['filter_product']) ? contrexx_input2raw($_GET['filter_product']) : array(); $filterState = isset($_GET['filter_state']) ? contrexx_input2raw($_GET['filter_state']) : array(); if (!empty($term) || !empty($filterProduct) || !empty($filterState)) { $filter = array('term' => $term, 'filterProduct' => $filterProduct, 'filterState' => $filterState); $subscriptions = $this->subscriptionRepo->findSubscriptionsBySearchTerm($filter); } else { $subscriptions = $this->subscriptionRepo->getSubscriptionsByCriteria(null, array('s.id' => 'DESC')); } $subscriptions = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($subscriptions); // setDataType is used to make the ViewGenerator load the proper options if $subscriptions is empty $subscriptions->setDataType('Cx\\Modules\\Order\\Model\\Entity\\Subscription'); $products = \Env::get('em')->getRepository('Cx\\Modules\\Pim\\Model\\Entity\\Product')->findAll(); $this->getSearchFilterDropDown($products, $filterProduct, 'product'); $subscriptionStates = array(\Cx\Modules\Order\Model\Entity\Subscription::STATE_ACTIVE, \Cx\Modules\Order\Model\Entity\Subscription::STATE_INACTIVE, \Cx\Modules\Order\Model\Entity\Subscription::STATE_TERMINATED, \Cx\Modules\Order\Model\Entity\Subscription::STATE_CANCELLED); $this->getSearchFilterDropDown($subscriptionStates, $filterState, 'state'); $options = $this->getController('Backend')->getAllViewGeneratorOptions(); $view = new \Cx\Core\Html\Controller\ViewGenerator($subscriptions, $options); $this->template->setVariable(array('TXT_ORDER_SUBSCRIPTIONS_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_ORDER_SUBSCRIPTIONS_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_ORDER_SUBSCRIPTIONS_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SUBSCRIPTIONS_SEARCH_VALUE' => contrexx_raw2xhtml($term))); if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) { $this->template->hideBlock("subscription_filter"); } $this->template->setVariable('SUBSCRIPTIONS_CONTENT', $view->render()); }
public function showOrders() { global $_ARRAYLANG; $term = isset($_GET['filter-term']) ? contrexx_input2raw($_GET['filter-term']) : ''; $filterUserId = isset($_GET['filter-user-id']) ? contrexx_input2raw($_GET['filter-user-id']) : 0; $objFilterUser = null; if (!empty($term) || !empty($filterUserId)) { if ($filterUserId) { $objFilterUser = \FWUser::getFWUserObject()->objUser->getUser($filterUserId); } $orders = $this->orderRepository->findOrdersBySearchTerm($term, $objFilterUser); } else { $orders = $this->orderRepository->getAllByDesc(); } $orders = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($orders); // setDataType is used to make the ViewGenerator load the proper options if $orders is empty $orders->setDataType('Cx\\Modules\\Order\\Model\\Entity\\Order'); $options = $this->getController('Backend')->getAllViewGeneratorOptions(); $view = new \Cx\Core\Html\Controller\ViewGenerator($orders, $options); if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) { $this->template->hideBlock("order_filter"); } else { \FWUser::getUserLiveSearch(array('minLength' => 1, 'canCancel' => true, 'canClear' => true)); $this->template->setVariable(array('TXT_MODULE_ORDER_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_MODULE_ORDER_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_MODULE_ORDER_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SEARCH_VALUE' => isset($_GET['filter-term']) ? contrexx_input2xhtml($_GET['filter-term']) : '', 'ORDER_USER_ID' => contrexx_raw2xhtml($filterUserId), 'ORDER_USER_NAME' => $objFilterUser ? contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFilterUser)) : '')); } $this->template->setVariable('ORDERS_CONTENT', $view->render()); }