本文整理汇总了PHP中Topxia\Common\ArrayToolkit::format方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayToolkit::format方法的具体用法?PHP ArrayToolkit::format怎么用?PHP ArrayToolkit::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Topxia\Common\ArrayToolkit
的用法示例。
在下文中一共展示了ArrayToolkit::format方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction(Request $request)
{
$user = $this->getCurrentUser();
if ($request->getMethod() == 'POST') {
$conditions = $request->request->all();
$paginator = new Paginator($this->get('request'), $this->getUserService()->searchUserCount($conditions), $request->request->get('rows'));
$users = $this->getUserService()->searchUsers($conditions, array('createdTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
$users = ArrayToolkit::format($users, array('createdTime'));
$usersJson['total'] = $this->getUserService()->searchUserCount($conditions);
$usersJson['rows'] = $users;
return $this->createJsonResponse($usersJson);
}
return $this->render('TopxiaAdminBundle:User:user-index.html.twig');
}
示例2: cartAction
public function cartAction(Request $request)
{
if ($request->getMethod() == 'POST') {
$conditions = $request->request->all();
$paginator = new Paginator($request, $this->getCartService()->searchCartsCount($conditions), $request->request->get('rows'));
$carts = $this->getCartService()->searchCarts($conditions, 'latest', $paginator->getOffsetCount(), $paginator->getPerPageCount());
$users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($carts, 'userId'));
$carts = ArrayToolkit::format($carts, array('createdTime'), $users);
$cartsJson['total'] = $this->getCartService()->searchCartsCount($conditions);
$cartsJson['rows'] = $carts;
return $this->createJsonResponse($cartsJson);
}
return $this->render('TopxiaAdminBundle:Order:cart-index.html.twig');
}
示例3: indexAction
public function indexAction(Request $request)
{
if ($request->getMethod() == 'POST') {
$conditions = array_filter($request->query->all());
$paginator = new Paginator($request, $this->getContentService()->searchContentCount($conditions), $request->request->get('rows'));
$contents = $this->getContentService()->searchContents($conditions, array('createdTime', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
$contents = ArrayToolkit::format($contents, array('publishedTime'));
$userIds = ArrayToolkit::column($contents, 'userId');
$users = $this->getUserService()->findUsersByIds($userIds);
$categoryIds = ArrayToolkit::column($contents, 'categoryId');
$categories = $this->getCategoryService()->findCategoriesByIds($categoryIds);
$contentsJson['total'] = $this->getContentService()->searchContentCount($conditions);
$contentsJson['rows'] = $contents;
return $this->createJsonResponse($contentsJson);
}
return $this->render('TopxiaAdminBundle:Content:content-index.html.twig');
}
示例4: listAction
public function listAction(Request $request)
{
$conditions = $request->request->all();
$conditions['targetType'] = 'gift';
$paginator = new Paginator($request, $this->getGiftOrdersService()->searchOrdersCount($conditions), $request->request->get('rows'));
$orders = $this->getGiftOrdersService()->searchOrders($conditions, 'latest', $paginator->getOffsetCount(), $paginator->getPerPageCount());
$users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($orders, 'userId'));
$orders = ArrayToolkit::format($orders, array('createdTime', 'paidTime'), $users);
foreach ($orders as $index => $expiredOrderToBeUpdated) {
if ($expiredOrderToBeUpdated["createdTime"] + 48 * 60 * 60 < time() && $expiredOrderToBeUpdated["status"] == 'created') {
$this->getGiftOrdersService()->cancelOrder($expiredOrderToBeUpdated['id']);
$orders[$index]['status'] = 'cancelled';
}
}
$orderJson['total'] = $this->getGiftOrdersService()->searchOrdersCount($conditions);
$orderJson['rows'] = $orders;
return $this->createJsonResponse($orderJson);
}
示例5: listAction
public function listAction(Request $request)
{
$conditions = $request->request->all();
if (!empty($conditions['courseTitle'])) {
$courses = $this->getCourseService()->findCoursesByLikeTitle(trim($conditions['courseTitle']));
$conditions['courseIds'] = ArrayToolkit::column($courses, 'id');
if (count($conditions['courseIds']) == 0) {
return $this->render('TopxiaAdminBundle:Review:index.html.twig', array('reviews' => array(), 'users' => array(), 'courses' => array(), 'paginator' => new Paginator($request, 0, 20)));
}
}
$paginator = new Paginator($request, $this->getReviewService()->searchReviewsCount($conditions), $request->request->get('rows'));
$reviews = $this->getReviewService()->searchReviews($conditions, 'latest', $paginator->getOffsetCount(), $paginator->getPerPageCount());
$users = $this->getUserService()->findUsersByIds(ArrayToolkit::column($reviews, 'userId'));
$reviews = ArrayToolkit::format($reviews, array('createdTime'), $users);
$courses = $this->getCourseService()->findCoursesByIds(ArrayToolkit::column($reviews, 'courseId'));
$reviewsJson['total'] = $this->getReviewService()->searchReviewsCount($conditions);
$reviewsJson['rows'] = $reviews;
return $this->createJsonResponse($reviewsJson);
}
示例6: cashbillListAction
public function cashbillListAction(Request $request)
{
$fields = $request->request->all();
if (!empty($fields)) {
$conditions = $this->_prepareSearchConditions($fields);
}
$conditions['cashType'] = 'RMB';
$paginator = new Paginator($request, $this->getCashService()->searchFlowsCount($conditions), 20);
$cashes = $this->getCashService()->searchFlows($conditions, array('ID', 'DESC'), $paginator->getOffsetCount(), $paginator->getPerPageCount());
$userIds = ArrayToolkit::column($cashes, "userId");
$users = $this->getUserService()->findUsersByIds($userIds);
$cashes = ArrayToolkit::format($cashes, array('createdTime'), $users);
$jsonData['total'] = $this->getCashService()->searchFlowsCount($conditions);
$conditions['type'] = 'inflow';
$amountInflow = $this->getCashService()->analysisAmount($conditions);
$conditions['type'] = 'outflow';
$amountOutflow = $this->getCashService()->analysisAmount($conditions);
$jsonData['rows'] = $cashes;
$jsonData['footer'] = array(array('amount' => 0, 'type' => '充值:<span class="inflow">' . $amountInflow . '</span>消费:<span class="outflow">' . $amountOutflow . '</span>'));
return $this->createJsonResponse($jsonData);
}