本文整理汇总了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]);
}
}
示例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);
}
示例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;
}