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


PHP Helper::truncateNotBreakingHtmlTags方法代码示例

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


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

示例1: pullAction

 public function pullAction()
 {
     try {
         if (!$this->getRequest()->isXmlHttpRequest()) {
             return $this->redirect()->toRoute('home');
         }
         /**
          * @var \DDD\Service\Notifications $notificationsService
          */
         $notificationsService = $this->getServiceLocator()->get('service_notifications');
         $auth = $this->getServiceLocator()->get('library_backoffice_auth');
         $userId = $auth->getIdentity()->id;
         $notifications = $notificationsService->getUserNotifications($userId, false, false);
         $notifications = $notifications['result'];
         $notificationData = [];
         foreach ($notifications as $notification) {
             array_push($notificationData, ['message' => Helper::truncateNotBreakingHtmlTags($notification->getMessage()), 'url' => !is_null($notification->getUrl()) ? $notification->getUrl() : '', 'type' => $notification->getType(), 'sender' => $notification->getSender(), 'id' => $notification->getId()]);
         }
         return new JsonModel(['status' => 'success', 'data' => $notificationData]);
     } catch (\Exception $e) {
         return new JsonModel(['status' => 'success', 'msg' => TextConstants::ERROR]);
     }
 }
开发者ID:arbi,项目名称:MyCode,代码行数:23,代码来源:NotificationController.php

示例2: ajaxGetOfficeCostsAction

 public function ajaxGetOfficeCostsAction()
 {
     try {
         $request = $this->getRequest();
         if (!$request->isXmlHttpRequest()) {
             throw new \Exception(TextConstants::AJAX_NO_POST_ERROR);
         }
         /**
          * @var BackofficeAuthenticationService $auth
          * @var \DDD\Dao\Finance\Expense\ExpenseCost $expenseCostDao
          */
         $auth = $this->getServiceLocator()->get('library_backoffice_auth');
         $expenseCostDao = $this->getServiceLocator()->get('dao_finance_expense_expense_cost');
         $officeId = $this->params()->fromRoute('id');
         $datatableParams = ['iDisplayStart' => $this->params()->fromQuery('iDisplayStart'), 'iDisplayLength' => $this->params()->fromQuery('iDisplayLength'), 'iSortCol_0' => $this->params()->fromQuery('iSortCol_0'), 'sSortDir_0' => $this->params()->fromQuery('sSortDir_0'), 'sSearch' => $this->params()->fromQuery('sSearch')];
         $officeCosts = $expenseCostDao->getOfficeCosts($officeId, $datatableParams, true);
         $officeCostsFiltered = $expenseCostDao->getOfficeCosts($officeId, $datatableParams);
         $totalCount = $officeCosts->count();
         $data = [];
         foreach ($officeCostsFiltered as $cost) {
             $viewUrl = $this->url()->fromRoute('finance/purchase-order/edit', ['id' => $cost['expense_id']]);
             $view = '<a class="btn btn-xs btn-primary" href="' . $viewUrl . '" target="_blank">View</a>';
             $rows = [$cost['id'], $cost['category'], date(Constants::GLOBAL_DATE_FORMAT, strtotime($cost['date'])), $cost['currency_code'], $cost['amount'], Helper::truncateNotBreakingHtmlTags($cost['purpose'])];
             if ($auth->hasRole(Roles::ROLE_EXPENSE_MANAGEMENT)) {
                 array_push($rows, $view);
             }
             array_push($data, $rows);
         }
         $result = ['iTotalRecords' => $totalCount, 'iTotalDisplayRecords' => $totalCount, 'iDisplayStart' => 0, 'iDisplayLength' => 25, 'aaData' => $data];
     } catch (\Exception $e) {
         $this->gr2logException($e, 'Cannot get Office Costs');
         $result['status'] = 'error';
         $result['msg'] = TextConstants::SERVER_ERROR . ' <b>' . $e->getMessage();
     }
     return new JsonModel($result);
 }
开发者ID:arbi,项目名称:MyCode,代码行数:36,代码来源:OfficeController.php

示例3: prepareVenueCharges

 private function prepareVenueCharges($venueId = 0)
 {
     /**
      * @var \Library\Authentication\BackofficeAuthenticationService $auth
      * @var \DDD\Dao\Venue\Charges $venueChargesService
      */
     $auth = $this->getServiceLocator()->get('library_backoffice_auth');
     $venueChargesService = $this->getServiceLocator()->get('dao_venue_charges');
     $venueCharges = $venueChargesService->getChargesByVenueId($venueId, false);
     $isVenueManager = $auth->hasRole(Roles::ROLE_VENUE_MANAGER);
     $isChargeManager = $auth->hasRole(Roles::ROLE_VENUE_CHARGE_MANAGER);
     $chargesData = [];
     foreach ($venueCharges as $charge) {
         /**
          * @var \DDD\Domain\Venue\Charges $charge
          * @var \DDD\Dao\User\UserManager $userDao
          */
         $userDao = $this->getServiceLocator()->get('dao_user_user_manager');
         $creatorData = $userDao->getUserById($charge->getCreatorId(), true, ['firstname', 'lastname']);
         $chargedUserData = $userDao->getUserById($charge->getChargedUserId(), true, ['firstname', 'lastname']);
         switch ($charge->getStatus()) {
             case VenueCharges::CHARGE_STATUS_NEW:
                 $status = '<span class="label label-success">' . VenueCharges::getChargeStatuses()[$charge->getStatus()] . '</span>';
                 break;
             case VenueCharges::CHARGE_STATUS_TRANSFERRED:
                 $status = '<span class="label label-primary">' . VenueCharges::getChargeStatuses()[$charge->getStatus()] . '</span>';
                 break;
             default:
                 $status = '<span class="label label-default">' . VenueCharges::getChargeStatuses()[$charge->getStatus()] . '</span>';
         }
         switch ($charge->getOrderStatus()) {
             case VenueCharges::ORDER_STATUS_NEW:
                 $orderStatus = '<span class="label label-success">' . VenueCharges::getChargeOrderStatuses()[$charge->getOrderStatus()] . '</span>';
                 break;
             case VenueCharges::ORDER_STATUS_PROCESSING:
                 $orderStatus = '<span class="label label-dark-green">' . VenueCharges::getChargeOrderStatuses()[$charge->getOrderStatus()] . '</span>';
                 break;
             case VenueCharges::ORDER_STATUS_DONE:
                 $orderStatus = '<span class="label label-info">' . VenueCharges::getChargeOrderStatuses()[$charge->getOrderStatus()] . '</span>';
                 break;
             case VenueCharges::ORDER_STATUS_VERIFIED:
                 $orderStatus = '<span class="label label-primary">' . VenueCharges::getChargeOrderStatuses()[$charge->getOrderStatus()] . '</span>';
                 break;
             default:
                 $orderStatus = '<span class="label label-default">' . VenueCharges::getChargeOrderStatuses()[$charge->getOrderStatus()] . '</span>';
         }
         $editButton = $isVenueManager || $isChargeManager ? '<a href="' . $this->url()->fromRoute('venue-charges', ['action' => 'edit', 'id' => $charge->getId()]) . '" class="btn btn-xs btn-primary" target="_blank">Edit</a>' : '';
         array_push($chargesData, [$status, $orderStatus, $creatorData->getFirstName() . ' ' . $creatorData->getLastName(), $chargedUserData->getFirstName() . ' ' . $chargedUserData->getLastName(), Helper::truncateNotBreakingHtmlTags($charge->getDescription(), 200), $charge->getAmount(), $editButton]);
     }
     return $chargesData;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:51,代码来源:General.php


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