当前位置: 首页>>代码示例>>PHP>>正文


PHP FWValidator::isEmpty方法代码示例

本文整理汇总了PHP中FWValidator::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP FWValidator::isEmpty方法的具体用法?PHP FWValidator::isEmpty怎么用?PHP FWValidator::isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FWValidator的用法示例。


在下文中一共展示了FWValidator::isEmpty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getViewGeneratorOptions

 /**
  * This function returns the ViewGeneration options for a given entityClass
  *
  * @access protected
  * @global $_ARRAYLANG
  * @param $entityClassName contains the FQCN from entity
  * @return array with options
  */
 protected function getViewGeneratorOptions($entityClassName)
 {
     global $_ARRAYLANG;
     $classNameParts = explode('\\', $entityClassName);
     $classIdentifier = end($classNameParts);
     $langVarName = 'TXT_' . strtoupper($this->getType() . '_' . $this->getName() . '_ACT_' . $classIdentifier);
     $header = '';
     if (isset($_ARRAYLANG[$langVarName])) {
         $header = $_ARRAYLANG[$langVarName];
     }
     switch ($entityClassName) {
         case 'Cx\\Modules\\Order\\Model\\Entity\\Order':
             return 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();
                     if (!$productEntity) {
                         continue;
                     }
                     $productEntityName = $subscription->getProduct()->getName();
                     $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);
             }))));
             break;
         case 'Cx\\Modules\\Order\\Model\\Entity\\Subscription':
             return 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) {
                 $subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription');
                 $subscription = $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;
                 }
                 $subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription');
                 $subscription = $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;
                 }
                 $subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription');
                 $subscription = $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) {
                 $subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription');
                 $subscription = $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)));
             break;
         default:
             return array('header' => $header, 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false));
     }
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:99,代码来源:BackendController.class.php

示例2: createOrder

 /**
  * Create a new Order 
  * 
  * @param integer $productId            productId
  * @param object  $objUser              \User object
  * @param string  $transactionReference transactionReference
  * @param array   $subscriptionOptions  subscriptionOptions
  * 
  * @return boolean
  * @throws OrderRepositoryException
  */
 public function createOrder($productId, \Cx\Modules\Crm\Model\Entity\Currency $currency, \User $objUser, $transactionReference, $subscriptionOptions = array())
 {
     if (\FWValidator::isEmpty($productId) || \FWValidator::isEmpty($subscriptionOptions) || \FWValidator::isEmpty($transactionReference) || \FWValidator::isEmpty($currency)) {
         return;
     }
     $contactId = $objUser->getCrmUserId();
     if (\FWValidator::isEmpty($contactId)) {
         return;
     }
     try {
         $order = new \Cx\Modules\Order\Model\Entity\Order();
         $order->setContactId($contactId);
         $order->setCurrency($currency);
         $productRepository = \Env::get('em')->getRepository('Cx\\Modules\\Pim\\Model\\Entity\\Product');
         $product = $productRepository->findOneBy(array('id' => $productId));
         //create subscription
         $subscription = $order->createSubscription($product, $subscriptionOptions);
         // set discount price for first payment period of subscription
         if (!empty($subscriptionOptions['oneTimeSalePrice'])) {
             $subscription->setPaymentAmount($subscriptionOptions['oneTimeSalePrice']);
         }
         $order->billSubscriptions();
         $invoices = $order->getInvoices();
         if (!empty($invoices)) {
             \DBG::msg(__METHOD__ . ": order has invoices");
             $paymentRepo = \Env::get('em')->getRepository('\\Cx\\Modules\\Order\\Model\\Entity\\Payment');
             foreach ($invoices as $invoice) {
                 if (!$invoice->getPaid()) {
                     \DBG::msg(__METHOD__ . ": lookup payment with transaction-reference {$transactionReference} and amount " . $invoice->getAmount());
                     $payment = $paymentRepo->findOneByCriteria(array('amount' => $invoice->getAmount(), 'transactionReference' => $transactionReference, 'invoice' => null));
                     if ($payment) {
                         \DBG::msg(__METHOD__ . ": payment found");
                         //set subscription-id to Subscription::$externalSubscriptionId
                         if ($subscription) {
                             \DBG::msg(__METHOD__ . ": trying to link to new subscription to the external subscription ID");
                             $referenceArry = explode('|', $payment->getTransactionReference());
                             if (isset($referenceArry[4]) && !empty($referenceArry[4])) {
                                 $subscription->setExternalSubscriptionId($referenceArry[4]);
                             }
                         }
                         $transactionData = $payment->getTransactionData();
                         if (!\FWValidator::isEmpty($transactionData) && isset($transactionData['contact']) && isset($transactionData['contact']['id'])) {
                             \DBG::msg(__METHOD__ . ": set externalPaymentCustomerIdProfileAttributeId of user to " . $transactionData['contact']['id']);
                             $objUser->setProfile(array(\Cx\Core\Setting\Controller\Setting::getValue('externalPaymentCustomerIdProfileAttributeId', 'MultiSite') => array(0 => $transactionData['contact']['id'])), true);
                             if (!$objUser->store()) {
                                 \DBG::msg('Order::createOrder() Updating user failed: ' . $objUser->getErrorMsg());
                             }
                         }
                         $invoice->addPayment($payment);
                         $payment->setInvoice($invoice);
                         \Env::get('em')->persist($invoice);
                         \Env::get('em')->persist($payment);
                         break;
                     }
                 }
             }
         }
         \Env::get('em')->persist($order);
         \Env::get('em')->flush();
         return $order;
     } catch (\Exception $e) {
         throw new OrderRepositoryException($e->getMessage());
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:75,代码来源:OrderRepository.class.php

示例3: getCurrencyIdByCrmId

 /**
  * Get currencyId by crm id
  *
  * @param integer $crmId crm id
  *
  * @return mixed null or currencyId
  */
 public static function getCurrencyIdByCrmId($crmId)
 {
     if (\FWValidator::isEmpty($crmId)) {
         return null;
     }
     $db = \Env::get('cx')->getDb()->getAdoDb();
     $currencyId = $db->GetOne("SELECT `customer_currency` FROM `" . DBPREFIX . "module_crm_contacts` WHERE `id` = " . intval($crmId));
     return $currencyId;
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:16,代码来源:CrmLibrary.class.php

示例4: terminateExpiredSubscriptions

 /**
  * Terminate expired Subscriptions
  *
  * This method does call the method Subscription::terminate() on all Subscriptions
  * that are expired (Subscription::$expirationDate < now), but are still
  * active (Subscription::$state = active) or have been cancelled (Subscription::$state = cancelled).
  * Expired Subscriptions that are inactive (Subscription::$state = inactive) are not
  * terminated as long as they are inactive. This allows a Subscription to be re-activated
  * and resetting a new expiration date without having the Subscription automatically
  * being terminated.
  */
 public function terminateExpiredSubscriptions()
 {
     $subscriptionRepo = \Env::get('em')->getRepository('Cx\\Modules\\Order\\Model\\Entity\\Subscription');
     $subscriptions = $subscriptionRepo->getExpiredSubscriptions(array(\Cx\Modules\Order\Model\Entity\Subscription::STATE_ACTIVE, \Cx\Modules\Order\Model\Entity\Subscription::STATE_CANCELLED));
     if (\FWValidator::isEmpty($subscriptions)) {
         return;
     }
     foreach ($subscriptions as $subscription) {
         $subscription->terminate();
     }
     \Env::get('em')->flush();
 }
开发者ID:hbdsklf,项目名称:LimeCMS,代码行数:23,代码来源:ComponentController.class.php

示例5: showRegistrationForm

 /**
  * performs the registratio page
  * 
  * @return null
  */
 function showRegistrationForm()
 {
     global $_ARRAYLANG, $_CORELANG;
     $this->_objTpl->setTemplate($this->pageContent, true, true);
     $objFWUser = \FWUser::getFWUserObject();
     $objUser = $objFWUser->objUser;
     $userId = intval($objUser->getId());
     $userLogin = $objUser->login();
     $captchaCheck = true;
     if (!$userLogin && isset($_POST['submitRegistration'])) {
         $captchaCheck = \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->check();
         if (!$captchaCheck) {
             $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_ERROR' => '<span class="text-danger">' . $_ARRAYLANG['TXT_CALENDAR_INVALID_CAPTCHA_CODE'] . '</span>'));
         }
     }
     $objEvent = $this->objEventManager->eventList[0];
     if (empty($objEvent)) {
         \Cx\Core\Csrf\Controller\Csrf::redirect(\Cx\Core\Routing\Url::fromModuleAndCmd($this->moduleName, ''));
         return;
     }
     if (!$objEvent->status) {
         \Cx\Core\Csrf\Controller\Csrf::redirect(\Cx\Core\Routing\Url::fromModuleAndCmd($this->moduleName, ''));
         return;
     }
     if ($objEvent->access == 1 && !\FWUser::getFWUserObject()->objUser->login()) {
         $link = base64_encode(CONTREXX_SCRIPT_PATH . '?' . $_SERVER['QUERY_STRING']);
         \Cx\Core\Csrf\Controller\Csrf::redirect(CONTREXX_SCRIPT_PATH . "?section=Login&redirect=" . $link);
         return;
     }
     $dateForPageTitle = $objEvent->startDate;
     $this->pageTitle = $this->format2userDate($dateForPageTitle) . ": " . html_entity_decode($objEvent->title, ENT_QUOTES, CONTREXX_CHARSET);
     // Only show registration form if event lies in the future
     if (time() <= $objEvent->startDate->getTimestamp()) {
         // Only show registration form if event accepts registrations.
         // Event accepts registrations, if registration is set up and
         //     - no attendee limit is set
         //     - or if there are still free places available
         if ($objEvent->registration == CalendarEvent::EVENT_REGISTRATION_INTERNAL && (empty($objEvent->numSubscriber) || !\FWValidator::isEmpty($objEvent->getFreePlaces()))) {
             $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_ID' => intval($_REQUEST['id']), $this->moduleLangVar . '_FORM_ID' => intval($objEvent->registrationForm), $this->moduleLangVar . '_EVENT_DATE' => intval($_REQUEST['date']), $this->moduleLangVar . '_USER_ID' => $userId, 'TXT_' . $this->moduleLangVar . '_REGISTRATION_SUBMIT' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUBMIT']));
             $objFormManager = new \Cx\Modules\Calendar\Controller\CalendarFormManager();
             $objFormManager->setEvent($objEvent);
             $objFormManager->getFormList();
             //$objFormManager->showForm($this->_objTpl,intval($objEvent->registrationForm), 2, $objEvent->ticketSales);
             // Made the ticket sales always true, because ticket functionality currently not implemented
             $objFormManager->showForm($this->_objTpl, intval($objEvent->registrationForm), 2, true);
             /* if ($this->arrSettings['paymentStatus'] == '1' && $objEvent->ticketSales && ($this->arrSettings['paymentBillStatus'] == '1' || $this->arrSettings['paymentYellowpayStatus'] == '1')) {
                                 $paymentMethods  = '<select class="calendarSelect" name="paymentMethod">';
                                 $paymentMethods .= $this->arrSettings['paymentBillStatus'] == '1' || $objEvent->price == 0 ? '<option value="1">'.$_ARRAYLANG['TXT_CALENDAR_PAYMENT_BILL'].'</option>'  : '';
                                 $paymentMethods .= $this->arrSettings['paymentYellowpayStatus'] == '1' && $objEvent->price > 0 ? '<option value="2">'.$_ARRAYLANG['TXT_CALENDAR_PAYMENT_YELLOWPAY'].'</option>' : '';
                                 $paymentMethods .= '</select>';
             
                                 $this->_objTpl->setVariable(array(
                                     'TXT_'.$this->moduleLangVar.'_PAYMENT_METHOD' => $_ARRAYLANG['TXT_CALENDAR_PAYMENT_METHOD'],
                                     $this->moduleLangVar.'_PAYMENT_METHODS'       => $paymentMethods,
                                 ));
                                 $this->_objTpl->parse('calendarRegistrationPayment');
                             } else {
                                 $this->_objTpl->hideBlock('calendarRegistrationPayment');
                             } */
             if (!$userLogin) {
                 $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA'], $this->moduleLangVar . '_CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode()));
                 $this->_objTpl->parse('calendarRegistrationCaptcha');
             } else {
                 $this->_objTpl->hideBlock('calendarRegistrationCaptcha');
             }
             if (isset($_POST['submitRegistration']) && $captchaCheck) {
                 $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration(intval($_POST['form']));
                 if ($objRegistration->save($_POST)) {
                     if ($objRegistration->saveIn == 2) {
                         $status = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUCCESSFULLY_ADDED_WAITLIST'];
                     } else {
                         if ($objRegistration->saveIn == 0) {
                             $status = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUCCESSFULLY_ADDED_SIGNOFF'];
                         } else {
                             $status = $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_SUCCESSFULLY_ADDED'];
                             /* if($_POST["paymentMethod"] == 2) {
                                    $objRegistration->get($objRegistration->id);
                                    $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent($objRegistration->eventId);                                
                                    $this->getSettings();
                                    $amount  = (int) $objEvent->price * 100;
                                    $status .= \Cx\Modules\Calendar\Controller\CalendarPayment::_yellowpay(array("orderID" => $objRegistration->id, "amount" => $amount, "currency" => $this->arrSettings["paymentCurrency"], "language" => "DE"));
                                } */
                         }
                     }
                     $this->_objTpl->setVariable(array($this->moduleLangVar . '_LINK_BACK' => '<a href="' . CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '">' . $_ARRAYLANG['TXT_CALENDAR_BACK'] . '</a>', $this->moduleLangVar . '_REGISTRATION_STATUS' => $status));
                     $this->_objTpl->touchBlock('calendarRegistrationStatus');
                     $this->_objTpl->hideBlock('calendarRegistrationForm');
                 } else {
                     $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_ERROR' => '<span class="text-danger">' . $_ARRAYLANG['TXT_CALENDAR_CHECK_REQUIRED'] . '</span>'));
                     $this->_objTpl->parse('calendarRegistrationForm');
                     $this->_objTpl->hideBlock('calendarRegistrationStatus');
                 }
             } else {
                 $this->_objTpl->parse('calendarRegistrationForm');
                 $this->_objTpl->hideBlock('calendarRegistrationStatus');
//.........这里部分代码省略.........
开发者ID:Niggu,项目名称:cloudrexx,代码行数:101,代码来源:Calendar.class.php

示例6: showEventList

 /**
  * Sets the placeholders used for the event list view
  *
  * @param object  $objTpl Template object
  * @param integer $type   Event type
  *
  * @return null
  */
 function showEventList($objTpl, $type = '')
 {
     global $objInit, $_ARRAYLANG, $_LANGID;
     $this->getFrontendLanguages();
     //if($objInit->mode == 'backend') {
     $i = 0;
     foreach ($this->eventList as $key => $objEvent) {
         $objCategory = new \Cx\Modules\Calendar\Controller\CalendarCategory(intval($objEvent->catId));
         $showIn = explode(",", $objEvent->showIn);
         $languages = '';
         if (count(\FWLanguage::getActiveFrontendLanguages()) > 1) {
             $langState = array();
             foreach ($this->arrFrontendLanguages as $langKey => $arrLang) {
                 if (in_array($arrLang['id'], $showIn)) {
                     $langState[$langKey] = 'active';
                 }
             }
             $languages = \Html::getLanguageIcons($langState, 'index.php?cmd=Calendar&amp;act=modify_event&amp;id=' . $objEvent->id . '&amp;langId=%1$d' . ($type == 'confirm' ? "&amp;confirm=1" : ""));
             if ($type == 'confirm' && $objTpl->blockExists('txt_languages_block_confirm_list')) {
                 $objTpl->touchBlock('txt_languages_block_confirm_list');
             } elseif ($objTpl->blockExists('txt_languages_block')) {
                 $objTpl->touchBlock('txt_languages_block');
             }
         } else {
             if ($type == 'confirm' && $objTpl->blockExists('txt_languages_block_confirm_list')) {
                 $objTpl->hideBlock('txt_languages_block_confirm_list');
             } elseif ($objTpl->blockExists('txt_languages_block')) {
                 $objTpl->hideBlock('txt_languages_block');
             }
         }
         list($priority, $priorityImg) = $this->getPriorityImage($objEvent);
         $plainDescription = contrexx_html2plaintext($objEvent->description);
         if (strlen($plainDescription) > 100) {
             $points = '...';
         } else {
             $points = '';
         }
         $parts = explode("\n", wordwrap($plainDescription, 100, "\n"));
         $attachNamePos = strrpos($objEvent->attach, '/');
         $attachNamelength = strlen($objEvent->attach);
         $attachName = substr($objEvent->attach, $attachNamePos + 1, $attachNamelength);
         $hostUri = '';
         $hostTarget = '';
         if ($objEvent->external) {
             $objHost = new \Cx\Modules\Calendar\Controller\CalendarHost($objEvent->hostId);
             if (substr($objHost->uri, -1) != '/') {
                 $hostUri = $objHost->uri . '/';
             } else {
                 $hostUri = $objHost->uri;
             }
             if (substr($hostUri, 0, 7) != 'http://') {
                 $hostUri = "http://" . $hostUri;
             }
             $hostTarget = 'target="_blank"';
         }
         $copyLink = '';
         if ($objInit->mode == 'backend') {
             $editLink = 'index.php?cmd=' . $this->moduleName . '&amp;act=modify_event&id=' . $objEvent->id . ($type == 'confirm' ? "&amp;confirm=1" : "");
             $copyLink = $editLink . "&amp;copy=1";
         } else {
             $editLink = CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '&amp;cmd=edit&id=' . $objEvent->id;
         }
         $picThumb = file_exists(\Env::get('cx')->getWebsitePath() . "{$objEvent->pic}.thumb") ? "{$objEvent->pic}.thumb" : ($objEvent->pic != '' ? $objEvent->pic : '');
         $placeWebsite = $objEvent->place_website != '' ? "<a href='" . $objEvent->place_website . "' target='_blank' >" . $objEvent->place_website . "</a>" : "";
         $placeWebsiteSource = $objEvent->place_website;
         $placeLink = $objEvent->place_link != '' ? "<a href='" . $objEvent->place_link . "' target='_blank' >" . $objEvent->place_link . "</a>" : "";
         $placeLinkSource = $objEvent->place_link;
         if ($this->arrSettings['placeData'] > 1 && $objEvent->locationType == 2) {
             $objEvent->loadPlaceFromMediadir($objEvent->place_mediadir_id, 'place');
             list($placeLink, $placeLinkSource) = $objEvent->loadPlaceLinkFromMediadir($objEvent->place_mediadir_id, 'place');
         }
         $hostWebsite = $objEvent->org_website != '' ? "<a href='" . $objEvent->org_website . "' target='_blank' >" . $objEvent->org_website . "</a>" : "";
         $hostWebsiteSource = $objEvent->org_website;
         $hostLink = $objEvent->org_link != '' ? "<a href='" . $objEvent->org_link . "' target='_blank' >" . $objEvent->org_link . "</a>" : "";
         $hostLinkSource = $objEvent->org_link;
         if ($this->arrSettings['placeDataHost'] > 1 && $objEvent->hostType == 2) {
             $objEvent->loadPlaceFromMediadir($objEvent->host_mediadir_id, 'host');
             list($hostLink, $hostLinkSource) = $objEvent->loadPlaceLinkFromMediadir($objEvent->host_mediadir_id, 'host');
         }
         $startDate = $objEvent->startDate;
         $endDate = $objEvent->endDate;
         if ($objEvent->numSubscriber) {
             $freeSeats = \FWValidator::isEmpty($objEvent->getFreePlaces()) ? '0 (' . $_ARRAYLANG['TXT_CALENDAR_SAVE_IN_WAITLIST'] . ')' : $objEvent->getFreePlaces();
         } else {
             $freeSeats = $_ARRAYLANG['TXT_CALENDAR_YES'];
         }
         if (in_array($objEvent->registration, array(CalendarEvent::EVENT_REGISTRATION_NONE, CalendarEvent::EVENT_REGISTRATION_EXTERNAL))) {
             $freeSeats = $_ARRAYLANG['TXT_CALENDAR_NOT_SPECIFIED'];
         }
         $objTpl->setVariable(array($this->moduleLangVar . '_EVENT_ROW' => $i % 2 == 0 ? 'row1' : 'row2', $this->moduleLangVar . '_EVENT_LED' => $objEvent->status == 0 ? 'red' : 'green', $this->moduleLangVar . '_EVENT_STATUS' => $objEvent->status == 0 ? $_ARRAYLANG['TXT_CALENDAR_INACTIVE'] : $_ARRAYLANG['TXT_CALENDAR_ACTIVE'], $this->moduleLangVar . '_EVENT_ID' => $objEvent->id, $this->moduleLangVar . '_EVENT_TITLE' => $objEvent->title, $this->moduleLangVar . '_EVENT_TEASER' => $objEvent->teaser, $this->moduleLangVar . '_EVENT_PICTURE' => $objEvent->pic != '' ? '<img src="' . $objEvent->pic . '" alt="' . $objEvent->title . '" title="' . $objEvent->title . '" />' : '', $this->moduleLangVar . '_EVENT_PICTURE_SOURCE' => $objEvent->pic, $this->moduleLangVar . '_EVENT_THUMBNAIL' => $objEvent->pic != '' ? '<img src="' . $picThumb . '" alt="' . $objEvent->title . '" title="' . $objEvent->title . '" />' : '', $this->moduleLangVar . '_EVENT_PRIORITY' => $priority, $this->moduleLangVar . '_EVENT_PRIORITY_IMG' => $priorityImg, $this->moduleLangVar . '_EVENT_PLACE' => $objEvent->place, $this->moduleLangVar . '_EVENT_DESCRIPTION' => $objEvent->description, $this->moduleLangVar . '_EVENT_SHORT_DESCRIPTION' => $parts[0] . $points, $this->moduleLangVar . '_EVENT_LINK' => $objEvent->link ? "<a href='" . $objEvent->link . "' target='_blank' >" . $objEvent->link . "</a>" : "", $this->moduleLangVar . '_EVENT_LINK_SOURCE' => $objEvent->link, $this->moduleLangVar . '_EVENT_ATTACHMENT' => $objEvent->attach != '' ? '<a href="' . $hostUri . $objEvent->attach . '" target="_blank" >' . $attachName . '</a>' : '', $this->moduleLangVar . '_EVENT_ATTACHMENT_SOURCE' => $objEvent->attach, $this->moduleLangVar . '_EVENT_START' => $this->format2userDateTime($startDate), $this->moduleLangVar . '_EVENT_START_DATE' => $this->format2userDate($startDate), $this->moduleLangVar . '_EVENT_START_TIME' => $this->format2userTime($startDate), $this->moduleLangVar . '_EVENT_DATE' => $this->format2userDate($startDate), $this->moduleLangVar . '_EVENT_END' => $this->format2userDateTime($endDate), $this->moduleLangVar . '_EVENT_END_DATE' => $this->format2userDate($endDate), $this->moduleLangVar . '_EVENT_END_TIME' => $this->format2userTime($endDate), $this->moduleLangVar . '_EVENT_LANGUAGES' => $languages, $this->moduleLangVar . '_EVENT_CATEGORY' => $objCategory->name, $this->moduleLangVar . '_EVENT_EXPORT_LINK' => $hostUri . 'index.php?section=' . $this->moduleName . '&amp;export=' . $objEvent->id, $this->moduleLangVar . '_EVENT_EXPORT_ICON' => '<a href="' . $hostUri . 'index.php?section=' . $this->moduleName . '&amp;export=' . $objEvent->id . '"><img src="modules/Calendar/View/Media/ical_export.gif" border="0" title="' . $_ARRAYLANG['TXT_CALENDAR_EXPORT_ICAL_EVENT'] . '" alt="' . $_ARRAYLANG['TXT_CALENDAR_EXPORT_ICAL_EVENT'] . '" /></a>', $this->moduleLangVar . '_EVENT_EDIT_LINK' => $editLink, $this->moduleLangVar . '_EVENT_COPY_LINK' => $copyLink, $this->moduleLangVar . '_EVENT_SERIES' => $objEvent->seriesStatus == 1 ? '<img src="' . ASCMS_MODULE_WEB_PATH . '/' . $this->moduleName . '/View/Media/Repeat.png" border="0"/>' : '<i>' . $_ARRAYLANG['TXT_CALENDAR_NO_SERIES'] . '</i>', $this->moduleLangVar . '_EVENT_FREE_PLACES' => $freeSeats, $this->moduleLangVar . '_EVENT_ACCESS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ACCESS_' . $objEvent->access]));
         if ($objEvent->showDetailView) {
             $objTpl->setVariable(array($this->moduleLangVar . '_EVENT_DETAIL_LINK' => $objEvent->type == 0 ? self::_getDetailLink($objEvent) : $objEvent->arrData['redirect'][$_LANGID], $this->moduleLangVar . '_EVENT_DETAIL_TARGET' => $objEvent->type == 0 ? '_self' : '_blank'));
//.........这里部分代码省略.........
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:101,代码来源:CalendarEventManager.class.php

示例7: getParsedUserLink

 /**
  * Get the user details link
  *
  * @param mixed $user \User or
  *                    \Cx\Core\User\Model\Entity\User or
  *                    $userId (Id of a user)
  *
  * @return string Returns the parsed user detail link(crm and access)
  */
 public static function getParsedUserLink($user)
 {
     global $_CORELANG;
     if ($user instanceof \Cx\Core\User\Model\Entity\User) {
         $user = self::getFWUserObject()->objUser->getUser($user->getId());
     }
     if (!is_object($user)) {
         $user = self::getFWUserObject()->objUser->getUser($user);
     }
     if (!$user instanceof \User) {
         return '';
     }
     $crmDetailImg = '';
     if (!\FWValidator::isEmpty($user->getCrmUserId())) {
         $crmDetailImg = "<a href='index.php?cmd=Crm&amp;act=customers&amp;tpl=showcustdetail&amp;id={$user->getCrmUserId()}'\n                                title='{$_CORELANG['TXT_CORE_EDIT_USER_CRM_ACCOUNT']}'>\n                                <img\n                                    src='../core/Core/View/Media/navigation_level_1_189.png'\n                                    width='16' height='16'\n                                    alt='{$_CORELANG['TXT_CORE_EDIT_USER_CRM_ACCOUNT']}'\n                                />\n                            </a>";
     }
     return "<a href='index.php?cmd=Access&amp;act=user&amp;tpl=modify&amp;id={$user->getId()}'\n                    title='{$_CORELANG['TXT_EDIT_USER_ACCOUNT']}'>" . self::getParsedUserTitle($user) . "</a>" . $crmDetailImg;
 }
开发者ID:hbdsklf,项目名称:LimeCMS,代码行数:27,代码来源:FWUser.class.php

示例8: save


//.........这里部分代码省略.........
     } else {
         \Cx\Core\Setting\Controller\Setting::set('dashboardMessages', base64_encode(serialize($this->getDashboardMessages())));
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('isUpgradable')) {
         \Cx\Core\Setting\Controller\Setting::add('isUpgradable', $this->isUpgradable() ? 'on' : 'off', 1, \Cx\Core\Setting\Controller\Setting::TYPE_RADIO, 'on:Activated,off:Deactivated', 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('isUpgradable', $this->isUpgradable() ? 'on' : 'off');
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseGrayzoneMessages')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseGrayzoneMessages', base64_encode(serialize($this->getGrayzoneMessages())), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseGrayzoneMessages', base64_encode(serialize($this->getGrayzoneMessages())));
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseGrayzoneTime')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseGrayzoneTime', $this->getGrayzoneTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseGrayzoneTime', $this->getGrayzoneTime());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseLockTime')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseLockTime', $this->getFrontendLockTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseLockTime', $this->getFrontendLockTime());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseUpdateInterval')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseUpdateInterval', $this->getRequestInterval(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseUpdateInterval', $this->getRequestInterval());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseFailedUpdate')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseFailedUpdate', $this->getFirstFailedUpdateTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseFailedUpdate', $this->getFirstFailedUpdateTime());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('licenseSuccessfulUpdate')) {
         \Cx\Core\Setting\Controller\Setting::add('licenseSuccessfulUpdate', $this->getLastSuccessfulUpdateTime(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'license');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('licenseSuccessfulUpdate', $this->getLastSuccessfulUpdateTime());
     }
     // release
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsEdition')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsEdition', $this->getEditionName(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsEdition', $this->getEditionName());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsVersion')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsVersion', $this->getVersion()->getNumber(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsVersion', $this->getVersion()->getNumber());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsCodeName')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsCodeName', $this->getVersion()->getCodeName(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsCodeName', $this->getVersion()->getCodeName());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsStatus')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsStatus', $this->getVersion()->getState(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsStatus', $this->getVersion()->getState());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsReleaseDate')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsReleaseDate', $this->getVersion()->getReleaseDate(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_DATE, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsReleaseDate', $this->getVersion()->getReleaseDate());
     }
     if (!\Cx\Core\Setting\Controller\Setting::isDefined('coreCmsName')) {
         \Cx\Core\Setting\Controller\Setting::add('coreCmsName', $this->getVersion()->getName(), 1, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'release');
     } else {
         \Cx\Core\Setting\Controller\Setting::set('coreCmsName', $this->getVersion()->getName());
     }
     \Cx\Core\Setting\Controller\Setting::updateAll();
     $query = '
         UPDATE
             ' . DBPREFIX . 'modules
         SET
             `is_licensed` = \'0\' , 
             `additional_data` = NULL
         WHERE
             `distributor` = \'Cloudrexx AG\'
     ';
     $objDb->Execute($query);
     $query = '
         UPDATE
             ' . DBPREFIX . 'modules
         SET
             `is_licensed` = \'1\'
         WHERE
             `name` IN(\'' . implode('\', \'', $this->getLegalComponentsList()) . '\')
     ';
     $objDb->Execute($query);
     //Save legal components additional data values.
     if (!\FWValidator::isEmpty($this->getLegalComponentsAdditionalData())) {
         foreach ($this->getLegalComponentsAdditionalData() as $componentName => $additionalData) {
             if (empty($componentName)) {
                 continue;
             }
             $query = "\n                    UPDATE \n                        " . DBPREFIX . "modules\n                    SET \n                        `additional_data` = '" . contrexx_raw2db(json_encode($additionalData)) . "'\n                    WHERE \n                        `name` = '" . contrexx_raw2db($componentName) . "'\n                    ";
             $objDb->Execute($query);
         }
     }
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:101,代码来源:License.class.php

示例9: updateCodeBase

 /**
  * Update CodeBase
  * 
  * @param string $newCodeBaseVersion   latest codeBase version
  * @param string $installationRootPath installationRoot path
  * @param string $oldCodeBaseVersion   old codeBase version
  */
 public function updateCodeBase($newCodeBaseVersion, $installationRootPath, $oldCodeBaseVersion = '')
 {
     //change installation root
     $objConfigData = new \Cx\Lib\FileSystem\File(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteConfigPath() . '/configuration.php');
     $configData = $objConfigData->getData();
     if (!\FWValidator::isEmpty($oldCodeBaseVersion)) {
         $matches = array();
         preg_match('/\\$_PATHCONFIG\\[\'ascms_installation_root\'\\] = \'(.*?)\';/', $configData, $matches);
         $installationRootPath = str_replace($newCodeBaseVersion, $oldCodeBaseVersion, $matches[1]);
         $newCodeBaseVersion = $oldCodeBaseVersion;
     }
     $newConfigData = preg_replace('/\\$_PATHCONFIG\\[\'ascms_installation_root\'\\] = \'.*?\';/', '$_PATHCONFIG[\'ascms_installation_root\'] = \'' . $installationRootPath . '\';', $configData);
     $objConfigData->write($newConfigData);
     //change code base
     \Cx\Core\Setting\Controller\Setting::init('Config', '', 'Yaml');
     \Cx\Core\Setting\Controller\Setting::set('coreCmsVersion', $newCodeBaseVersion);
     \Cx\Core\Setting\Controller\Setting::update('coreCmsVersion');
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:25,代码来源:UpdateController.class.php

示例10: store

 /**
  * Store user account
  *
  * This stores the metadata of the user, which includes the username,
  * password, email, language ID, activ status and the administration status,
  * to the database.
  * If it is a new user, it also sets the registration time to the current time.
  * @global ADONewConnection
  * @global array
  * @return boolean
  */
 public function store()
 {
     global $objDatabase, $_CORELANG, $_LANGID;
     //for calling postPersist and postUpdate based on $callPostUpdateEvent
     $callPostUpdateEvent = $this->id;
     $generatedPassword = '';
     // Track if a user account change is being flushed to the database.
     // If so, we'll trigger the postUpdate event, but only in that case.
     // Explanation: A flush would indicate that the user object has actually been altered.
     // This is a pseudo emulation of doctrine's own event system behavior which triggers
     // the postUpdate event on an entity only in case the entity has actually been altered.
     $userChangeStatus = null;
     if (!$this->validateUsername()) {
         return false;
     }
     if (!$this->validateEmail()) {
         return false;
     }
     if ($this->networks) {
         $this->networks->save();
     }
     if ($this->id) {
         // update existing account
         \Env::get('cx')->getEvents()->triggerEvent('model/preUpdate', array(new \Doctrine\ORM\Event\LifecycleEventArgs($this, \Env::get('em'))));
         $this->updateUser($userChangeStatus);
     } else {
         // add new account
         if (\FWValidator::isEmpty($this->getHashedPassword())) {
             $generatedPassword = $this->make_password();
             $this->setPassword($generatedPassword);
         }
         \Env::get('cx')->getEvents()->triggerEvent('model/prePersist', array(new \Doctrine\ORM\Event\LifecycleEventArgs($this, \Env::get('em'))));
         $this->createUser();
         if (!\FWValidator::isEmpty($generatedPassword)) {
             $this->sendUserAccountInvitationMail($generatedPassword);
         }
     }
     if (!$this->storeGroupAssociations($userChangeStatus)) {
         $this->error_msg[] = $_CORELANG['TXT_ARRAY_COULD_NOT_SET_GROUP_ASSOCIATIONS'];
         return false;
     }
     if (!$this->storeNewsletterSubscriptions($userChangeStatus)) {
         $this->error_msg[] = $_CORELANG['TXT_ARRAY_COULD_NOT_SET_NEWSLETTER_ASSOCIATIONS'];
         return false;
     }
     if (!$this->storeProfile($userChangeStatus)) {
         $this->error_msg[] = $_CORELANG['TXT_ACCESS_FAILED_STORE_PROFILE'];
         return false;
     }
     if (!empty($callPostUpdateEvent)) {
         // only trigger postUpdate event in case an actual change on the user object has been flushed to the database
         if ($userChangeStatus) {
             \Env::get('cx')->getEvents()->triggerEvent('model/postUpdate', array(new \Doctrine\ORM\Event\LifecycleEventArgs($this, \Env::get('em'))));
         }
     } else {
         \Env::get('cx')->getEvents()->triggerEvent('model/postPersist', array(new \Doctrine\ORM\Event\LifecycleEventArgs($this, \Env::get('em'))));
     }
     return true;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:70,代码来源:User.class.php

示例11: import

 /**
  * This function is used to convert the entity object into array.
  * 
  * @param  mixed Single or array of entity objects     
  * 
  * @return array  return as array
  */
 public function import($data)
 {
     // convert data into a array if its not an array
     if (!is_array($data)) {
         $data = array($data);
     }
     //create array from objects
     $resultArr = array();
     foreach ($data as $object) {
         if (!is_object($object) && !$object instanceof \Cx\Model\Base\EntityBase) {
             return;
         }
         $em = \Env::get('em');
         $associationEntityColumns = array();
         $entityClassMetaData = $em->getClassMetadata(get_class($object));
         $associationMappings = $entityClassMetaData->getAssociationMappings();
         if (!empty($associationMappings)) {
             foreach ($associationMappings as $field => $associationMapping) {
                 if ($entityClassMetaData->isSingleValuedAssociation($field) && in_array('get' . ucfirst($field), get_class_methods($object))) {
                     $associationObject = $object->{'get' . ucfirst($field)}();
                     if ($associationObject) {
                         //get association columns
                         $associationEntityColumn = $this->getColumnNamesByEntity($associationObject);
                         $associationEntityColumns[$field] = !\FWValidator::isEmpty($associationEntityColumn) ? $associationEntityColumn : '';
                     }
                 }
             }
         }
         //get entity columns
         $entityColumns = $this->getColumnNamesByEntity($object);
         $resultData = array_merge($entityColumns, $associationEntityColumns);
         $resultData['virtual'] = $object->isVirtual();
         $resultArr[] = $resultData;
     }
     return $resultArr;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:43,代码来源:EntityInterface.class.php

示例12: showSubscriptions

 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());
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:66,代码来源:SubscriptionController.class.php


注:本文中的FWValidator::isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。