public function showProducts()
 {
     global $_ARRAYLANG;
     $products = $this->productRepository->findAll();
     if (empty($products)) {
         $products = new \Cx\Modules\Pim\Model\Entity\Product();
     }
     $view = new \Cx\Core\Html\Controller\ViewGenerator($products, array('header' => $_ARRAYLANG['TXT_MODULE_PIM_ACT_DEFAULT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false)));
     $this->template->setVariable('PRODUCTS_CONTENT', $view->render());
 }
 public function showPayments()
 {
     global $_ARRAYLANG;
     $payments = $this->paymentRepo->findAll();
     if (empty($payments)) {
         $payments = new \Cx\Modules\Order\Model\Entity\Payment();
     }
     $view = new \Cx\Core\Html\Controller\ViewGenerator($payments, array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_PAYMENT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false)));
     $this->template->setVariable('PAYMENT_CONTENT', $view->render());
 }
 public function showInvoices()
 {
     global $_ARRAYLANG;
     $invoices = $this->invoiceRepo->findAll();
     if (empty($invoices)) {
         $invoices = new \Cx\Modules\Order\Model\Entity\Invoice();
     }
     $view = new \Cx\Core\Html\Controller\ViewGenerator($invoices, array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_INVOICE'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false)));
     $this->template->setVariable('INVOICE_CONTENT', $view->render());
 }
 protected function parseEntityClassPage($template, $entityClassName, $classIdentifier, $filter = array(), &$isSingle = false)
 {
     if (!$template->blockExists('entity_view')) {
         return;
     }
     // this should be moved to view generator
     if (count($filter)) {
         $em = $this->cx->getDb()->getEntityManager();
         $repo = $em->getRepository($entityClassName);
         $entityClassName = $repo->findBy($filter);
     }
     $view = new \Cx\Core\Html\Controller\ViewGenerator($entityClassName, $this->getViewGeneratorOptions($entityClassName, $classIdentifier));
     $renderedContent = $view->render($isSingle);
     $template->setVariable('ENTITY_VIEW', $renderedContent);
 }
Ejemplo n.º 5
0
 public function showPrices()
 {
     global $_ARRAYLANG;
     $prices = $this->priceRepository->findAll();
     if (empty($prices)) {
         $prices = new \Cx\Modules\Pim\Model\Entity\Price();
     }
     $view = new \Cx\Core\Html\Controller\ViewGenerator($prices, array('header' => $_ARRAYLANG['TXT_MODULE_PIM_ACT_PRICE'], 'validate' => function ($formGenerator) {
         // this validation checks whether already a price for the currency and product exists
         $data = $formGenerator->getData()->toArray();
         $currency = $data['currency'];
         $product = $data['product'];
         $priceRepository = \Env::get('cx')->getDb()->getEntityManager()->getRepository('Cx\\Modules\\Pim\\Model\\Entity\\Price');
         $prices = $priceRepository->createQueryBuilder('p')->where('p.currency = ?1')->setParameter(1, $currency)->andWhere('p.product = ?2')->setParameter(2, $product);
         $prices = $prices->getQuery()->getResult();
         if (!empty($data['editid']) && count($prices) > 1) {
             return false;
         }
         if (empty($data['editid']) && count($prices) > 0) {
             return false;
         }
         return true;
     }, 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false)));
     $this->template->setVariable('PRICES_CONTENT', $view->render());
 }
 /**
  * Show all the Domain Alias
  *
  * @global array $_ARRAYLANG
  */
 public function showDomains()
 {
     global $_ARRAYLANG, $objInit;
     $langData = $objInit->loadLanguageData('Config');
     $_ARRAYLANG = array_merge($_ARRAYLANG, $langData);
     $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
     $domains = $domainRepository->findAll();
     $options = $this->getController('Backend')->getAllViewGeneratorOptions();
     $view = new \Cx\Core\Html\Controller\ViewGenerator($domains, $options);
     $this->template->setVariable('DOMAINS_CONTENT', $view->render());
 }
 /**
  * Displaying entities of job using ViewGenerator.
  *
  * @global type $_ARRAYLANG
  */
 public function showCronJobs()
 {
     global $_ARRAYLANG;
     $cronJob = $this->jobRepository->findAll();
     if (empty($cronJob)) {
         $cronJob = new \Cx\Core_Modules\Cron\Model\Entity\Job();
     }
     $options = $this->getController('Backend')->getAllViewGeneratorOptions();
     $view = new \Cx\Core\Html\Controller\ViewGenerator($cronJob, $options);
     $this->template->setVariable('CRON_CONTENT', $view->render());
 }
 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());
 }
 /**
  * Always returns the add view of an entity
  * This is mostly used for oneToMany associations to load the associated entity (in a model)
  *
  * @access public
  * @param array $params data from ajax request
  * @return json rendered form
  */
 public function getViewOverJson($params)
 {
     $entityClass = $params['get']['entityClass'];
     $entityClassObject = new $entityClass();
     $mappedBy = $params['get']['mappedBy'];
     $options = $_SESSION['vgOptions'][$params['get']['sessionKey']];
     // if the option 'add' is not true, there is no possibility to open the modal, because we are not allowed to add
     // an entry. That's why we set add to true here
     $options->recursiveOffsetSet(true, $entityClass . '/functions/add');
     // formButtons should not be set over ViewGenerator, because they are set over modal (js) and we do not want to
     // load them twice. Furthermore there should be no save button, because the entry should be saved if the main
     // for gets stored and not in the modal.
     $options->recursiveOffsetSet(false, $entityClass . '/functions/formButtons');
     // We never show the mapped-attribute, because it should not be possible to change this.
     // The value of this field must always be the id of the main form entry.
     // This will automatically be done by ViewGenerator while saving the main entry
     $options->recursiveOffsetSet(false, $entityClass . '/fields/' . $mappedBy . '/showDetail');
     $entityClassObjectView = new \Cx\Core\Html\Controller\ViewGenerator($entityClassObject, $options->toArray());
     return $entityClassObjectView->render();
 }
Ejemplo n.º 10
0
 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();
     }
     $view = new \Cx\Core\Html\Controller\ViewGenerator($orders, array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_DEFAULT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false), 'fields' => array('contactId' => array('header' => 'contactId', 'table' => array('parse' => function ($value) {
         global $_ARRAYLANG;
         $userId = \Cx\Modules\Crm\Controller\CrmLibrary::getUserIdByCrmUserId($value);
         $userName = \FWUser::getParsedUserTitle($userId);
         $crmDetailLink = "<a href='index.php?cmd=Crm&amp;act=customers&amp;tpl=showcustdetail&amp;id={$value}' \n                                                    title='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'>\n                                                    <img \n                                                        src='" . \Env::get('cx')->getCodeBaseCoreWebPath() . "/Core/View/Media/navigation_level_1_189.png' \n                                                        width='16' height='16' \n                                                        alt='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'\n                                                    />\n                                                </a>";
         $url = "<a href='index.php?cmd=Access&amp;act=user&amp;tpl=modify&amp;id={$userId}'\n                                       title='{$_ARRAYLANG['TXT_MODULE_ORDER_MODIY_USER_ACCOUNT']}'>" . $userName . "</a>" . $crmDetailLink;
         return $url;
     })), 'subscriptions' => array('header' => 'subscriptions', 'table' => array('parse' => function ($subscriptions) {
         $result = array();
         foreach ($subscriptions as $subscription) {
             $productEntity = $subscription->getProductEntity();
             $productEntityName = $subscription->getProduct()->getName();
             if (!$productEntity) {
                 continue;
             }
             $productEditLink = $productEntity;
             if (method_exists($productEntity, 'getEditLink')) {
                 $productEditLink = $productEntity->getEditLink();
             }
             $subscriptionEditUrl = '<a href=​index.php?cmd=Order&act=subscription&editid=' . $subscription->getId() . '>' . $productEntityName . '</a>';
             $result[] = $subscriptionEditUrl . ' (' . $productEditLink . ')';
         }
         return implode(', ', $result);
     })))));
     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());
 }
Ejemplo n.º 11
0
 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());
 }
Ejemplo n.º 12
0
 public function showProducts()
 {
     // Create view for product. This must be done in component, because ViewGenerator don't support views in first
     // tab. This can be delete as soon as the ViewGenerator can handle the first tab.
     $view = new \Cx\Core\Html\Controller\ViewGenerator('\\Cx\\Modules\\Pim\\Model\\Entity\\Product', $this->getController('Backend')->getAllViewGeneratorOptions());
     $this->template->setVariable('PRODUCTS_CONTENT', $view->render());
 }
 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'));
     }
     $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');
     $view = new \Cx\Core\Html\Controller\ViewGenerator($subscriptions, array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_SUBSCRIPTION'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false), 'fields' => array('id' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_ID']), 'subscriptionDate' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_DATE']), 'expirationDate' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_EXPIRATION_DATE']), 'productEntityId' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_PRODUCT_ENTITY'], 'table' => array('parse' => function ($value, $rowData) {
         $subscription = $this->subscriptionRepo->findOneBy(array('id' => $rowData['id']));
         $productEntity = $subscription->getProductEntity();
         if (!$productEntity) {
             return;
         }
         $productEditLink = $productEntity;
         if (method_exists($productEntity, 'getEditLink')) {
             $productEditLink = $productEntity->getEditLink();
         }
         return $productEditLink;
     })), 'paymentAmount' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_PAYMENT_AMOUNT'], 'table' => array('parse' => function ($value, $rowData) {
         if (\FWValidator::isEmpty(floatval($value))) {
             return null;
         }
         $subscription = $this->subscriptionRepo->findOneBy(array('id' => $rowData['id']));
         $currency = '';
         $order = $subscription->getOrder();
         if ($order) {
             $currency = !\FWValidator::isEmpty($order->getCurrency()) ? $order->getCurrency() : '';
         }
         $paymentInterval = $subscription->getRenewalUnit();
         return $value . ' ' . $currency . ' / ' . $paymentInterval;
     })), 'renewalUnit' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_RENEWAL_UNIT'], 'table' => array('parse' => function ($value, $rowData) {
         if (empty($value)) {
             return null;
         }
         $subscription = $this->subscriptionRepo->findOneBy(array('id' => $rowData['id']));
         $renewalDate = '';
         if ($subscription->getRenewalDate()) {
             $renewalDate = $subscription->getRenewalDate();
             $quantifier = $subscription->getRenewalQuantifier();
             $renewalDate->modify("-{$quantifier} {$value}");
             return $renewalDate->format('d.M.Y H:i:s');
         }
         return $renewalDate;
     })), 'renewalQuantifier' => array('showOverview' => false), 'renewalDate' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_RENEWAL_DATE']), 'description' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_DESCRIPTION']), 'state' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_STATE']), 'terminationDate' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_TERMI_DATE']), 'note' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_NOTE']), 'product' => array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_SUBSCRIPTION_PRODUCT'], 'table' => array('parse' => function ($value, $rowData) {
         $subscription = $this->subscriptionRepo->findOneBy(array('id' => $rowData['id']));
         $product = $subscription->getProduct();
         if (!$product) {
             return;
         }
         return $product->getName();
     })), 'paymentState' => array('showOverview' => false), 'externalSubscriptionId' => array('showOverview' => false), 'order' => array('showOverview' => false))));
     $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());
 }
Ejemplo n.º 14
0
 /**
  * Show all the Domain Alias
  * 
  * @global array $_ARRAYLANG
  */
 public function showDomains()
 {
     global $_ARRAYLANG, $objInit;
     $langData = $objInit->loadLanguageData('Config');
     $_ARRAYLANG = array_merge($_ARRAYLANG, $langData);
     $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
     $domains = $domainRepository->findAll();
     $view = new \Cx\Core\Html\Controller\ViewGenerator($domains, array('header' => $_ARRAYLANG['TXT_CORE_NETMANAGER'], 'entityName' => $_ARRAYLANG['TXT_CORE_NETMANAGER_ENTITY'], 'fields' => array('name' => array('header' => $_ARRAYLANG['TXT_NAME'], 'table' => array('parse' => function ($value) {
         global $_ARRAYLANG;
         static $mainDomainName;
         if (empty($mainDomainName)) {
             $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
             $mainDomainName = $domainRepository->getMainDomain()->getName();
         }
         $domainName = contrexx_raw2xhtml(\Cx\Core\Net\Controller\ComponentController::convertIdnToUtf8Format($value));
         if ($domainName != contrexx_raw2xhtml($value)) {
             $domainName .= ' (' . contrexx_raw2xhtml($value) . ')';
         }
         $mainDomainIcon = '';
         if ($value == $mainDomainName) {
             $mainDomainIcon = ' <img src="' . \Env::get('cx')->getCodeBaseCoreWebPath() . '/Core/View/Media/icons/Home.png" title="' . $_ARRAYLANG['TXT_CORE_CONFIG_MAINDOMAINID'] . '" />';
         }
         return $domainName . $mainDomainIcon;
     }), 'formfield' => function ($fieldname, $fieldtype, $fieldlength, $fieldvalue, $fieldoptions) {
         return \Cx\Core\Net\Controller\ComponentController::convertIdnToUtf8Format($fieldvalue);
     }), 'id' => array('showOverview' => false)), 'functions' => array('add' => true, 'edit' => false, 'allowEdit' => true, 'delete' => false, 'allowDelete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false, 'actions' => function ($rowData, $rowId) {
         global $_CORELANG;
         static $mainDomainName;
         if (empty($mainDomainName)) {
             $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
             $mainDomainName = $domainRepository->getMainDomain()->getName();
         }
         preg_match_all('/\\d+/', $rowId, $ids, null, 0);
         $actionIcons = '';
         $csrfParams = \Cx\Core\Csrf\Controller\Csrf::param();
         if ($mainDomainName !== $rowData['name']) {
             $actionIcons = '<a href="' . \Env::get('cx')->getWebsiteBackendPath() . '/?cmd=NetManager&amp;editid=' . $rowId . '" class="edit" title="Edit entry"></a>';
             $actionIcons .= '<a onclick=" if(confirm(\'' . $_CORELANG['TXT_CORE_RECORD_DELETE_CONFIRM'] . '\'))window.location.replace(\'' . \Env::get('cx')->getWebsiteBackendPath() . '/?cmd=NetManager&amp;deleteid=' . (empty($ids[0][1]) ? 0 : $ids[0][1]) . '&amp;vg_increment_number=' . (empty($ids[0][0]) ? 0 : $ids[0][0]) . '&amp;' . $csrfParams . '\');" href="javascript:void(0);" class="delete" title="Delete entry"></a>';
         }
         return $actionIcons;
     })));
     $this->template->setVariable('DOMAINS_CONTENT', $view->render());
 }
Ejemplo n.º 15
0
 /**
  * Displaying entities of job using ViewGenerator.
  * 
  * @global type $_ARRAYLANG
  */
 public function showCronJobs()
 {
     global $_ARRAYLANG;
     $cronJob = $this->jobRepository->findAll();
     if (empty($cronJob)) {
         $cronJob = new \Cx\Core_Modules\Cron\Model\Entity\Job();
     }
     $view = new \Cx\Core\Html\Controller\ViewGenerator($cronJob, array('header' => $_ARRAYLANG['TXT_CORE_MODULE_CRON_ACT_DEFAULT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false), 'fields' => array('id' => array('showOverview' => false), 'active' => array('header' => $_ARRAYLANG['TXT_CORE_MODULE_CRON_ACTIVE']), 'expression' => array('header' => $_ARRAYLANG['TXT_CORE_MODULE_CRON_EXPRESSION']), 'command' => array('header' => $_ARRAYLANG['TXT_CORE_MODULE_CRON_COMMAND'], 'storecallback' => function ($value) {
         return $value['command'] . ' ' . $value['arguments'];
     }, 'formfield' => function ($name, $type, $length, $value, $options) {
         $field = new \Cx\Core\Html\Model\Entity\HtmlElement('span');
         $commandSelectOptions = array_keys($this->cx->getCommands());
         $value = explode(' ', $value, 2);
         $commandSelect = new \Cx\Core\Html\Model\Entity\DataElement($name . '[command]', \Html::getOptions(array_combine(array_values($commandSelectOptions), array_values($commandSelectOptions)), isset($value[0]) ? $value[0] : ''), \Cx\Core\Html\Model\Entity\DataElement::TYPE_SELECT);
         $commandArguments = new \Cx\Core\Html\Model\Entity\DataElement($name . '[arguments]', isset($value[1]) ? $value[1] : '');
         $field->addChild($commandSelect);
         $field->addChild($commandArguments);
         return $field;
     }), 'lastRan' => array('header' => $_ARRAYLANG['TXT_CORE_MODULE_CRON_LAST_RUN']))));
     $this->template->setVariable('CRON_CONTENT', $view->render());
 }