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


PHP Item::getItemsByReport方法代码示例

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


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

示例1: index

 public function index()
 {
     $person = new Person();
     $report = new Report();
     $item = new Item();
     $role = session('user.role');
     $data = ['total_users' => 0, 'total_report' => 0, 'total_item' => 0];
     if ($role == 'U') {
         //get data on report and item only
     } else {
         if ($role == 'M') {
             $response = $person->getAssignedPersons(session('user.id'));
             if (!empty($response)) {
                 //get total reports or their assigned users
                 $data['total_users'] = $response['totalRecords'];
                 foreach ($response['data'] as $row) {
                     $reports = $report->getReportsByPerson($row['id']);
                     if (!empty($reports['data'])) {
                         $data['total_report'] += $reports['totalRecords'];
                         //get item of the report
                         foreach ($reports['data'] as $srow) {
                             $items = $item->getItemsByReport($srow['id']);
                             $data['total_item'] += $items['totalRecords'];
                         }
                     }
                 }
                 //get current user's report
                 $response = $report->getReportsByPerson(session('user.id'));
                 if (!empty($response['data'])) {
                     $data['total_report'] += $response['totalRecords'];
                     //get item of the report
                     foreach ($response['data'] as $row) {
                         $items = $item->getItemsByReport($row['id']);
                         $data['total_item'] += $items['totalRecords'];
                     }
                 }
             }
         } else {
             //admin
             $response = $person->all([]);
             if (!empty($response)) {
                 //get total reports or their assigned users
                 $data['total_users'] = $response['totalRecords'];
                 foreach ($response['data'] as $row) {
                     $reports = $report->getReportsByPerson($row['id']);
                     if (isset($reports['data']) && !empty($reports['data'])) {
                         $data['total_report'] += $reports['totalRecords'];
                         //get item of the report
                         foreach ($reports['data'] as $srow) {
                             $items = $item->getItemsByReport($srow['id']);
                             $data['total_item'] += $items['totalRecords'];
                         }
                     }
                 }
             }
         }
     }
     return view('dashboard', $data);
 }
开发者ID:grepollo,项目名称:dkb_5sp,代码行数:59,代码来源:DashboardController.php

示例2: show

 public function show($id, Request $request)
 {
     $id = (int) my_decode($id);
     $data['user'] = $this->person->respondWithItem($this->person->get('person_' . $id), new UserTransformer());
     //get invidvidual reports
     $response = $this->report->individual($id);
     $data['totalIReport'] = 0;
     $data['individual'] = [];
     $item = new Item();
     if (!isset($response['error'])) {
         $data['individual'] = $this->report->respondWithCollection($response['data'], new ReportTransformer());
         foreach ($data['individual'] as $i => $row) {
             $items = $item->getItemsByReport((int) my_decode($row['id']));
             $data['individual'][$i]['items'] = $items['totalRecords'];
         }
         $data['totalIReport'] = $response['totalRecords'];
     }
     $response = $this->report->group($id);
     $data['totalGReport'] = 0;
     $data['group'] = [];
     if (!isset($response['error'])) {
         $data['group'] = $this->report->respondWithCollection($response['data'], new ReportTransformer());
         foreach ($data['group'] as $i => $row) {
             $items = $item->getItemsByReport((int) my_decode($row['id']));
             $data['group'][$i]['items'] = $items['totalRecords'];
         }
         $data['totalGReport'] = $response['totalRecords'];
     }
     return view('users_profile', $data);
 }
开发者ID:grepollo,项目名称:dkb_5sp,代码行数:30,代码来源:UsersController.php


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