| Total Complexity | 7 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class OrderHistoryController extends \PageController |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var array |
||
| 12 | */ |
||
| 13 | private static $allowed_actions = [ |
||
|
|
|||
| 14 | 'index', |
||
| 15 | ]; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var PaginatedList |
||
| 19 | */ |
||
| 20 | private $order_paginated_list; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @return bool|\SilverStripe\Control\HTTPResponse |
||
| 24 | */ |
||
| 25 | public function checkMember() |
||
| 26 | { |
||
| 27 | if (Security::getCurrentUser()) { |
||
| 28 | return true; |
||
| 29 | } else { |
||
| 30 | return Security::permissionFailure($this, _t( |
||
| 31 | 'AccountPage.CANNOTCONFIRMLOGGEDIN', |
||
| 32 | 'Please login to view this page.' |
||
| 33 | )); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return array |
||
| 39 | */ |
||
| 40 | public function index() |
||
| 41 | { |
||
| 42 | $this->checkMember(); |
||
| 43 | |||
| 44 | return []; |
||
| 45 | } |
||
| 46 | |||
| 47 | protected function setOrderPaginatedList() |
||
| 48 | { |
||
| 49 | $request = $this->getRequest(); |
||
| 50 | $orders = $this->data()->getOrderList(); |
||
| 51 | $start = ($request->getVar('start')) ? (int)$request->getVar('start') : 0; |
||
| 52 | $records = PaginatedList::create($orders, $request); |
||
| 53 | $records->setPageStart($start); |
||
| 54 | $records->setPageLength($this->data()->PerPage); |
||
| 55 | |||
| 56 | $this->extend('updateOrderPaginatedList', $records); |
||
| 57 | |||
| 58 | $this->order_paginated_list = $records; |
||
| 59 | |||
| 60 | return $this; |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @return PaginatedList |
||
| 65 | */ |
||
| 66 | public function OrderPaginatedList() |
||
| 73 | } |
||
| 74 | } |
||
| 75 |