Source of file OrdersUserAccountControllerExtension.php
Size: 2,726 Bytes - Last Modified: 2021-12-24T05:16:53+00:00
/var/www/docs.ssmods.com/process/src/code/extensions/OrdersUserAccountControllerExtension.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 | <?php class OrdersUserAccountControllerExtension extends Extension { private static $allowed_actions = array( "history", "outstanding", "order" ); /** * Display all historic orders for the current user * */ public function history() { $member = Member::currentUser(); $orders = new PaginatedList( $member->getHistoricOrders(), $this->owner->request ); $this->owner->customise(array( "ClassName" => "AccountPage", "Title" => _t('Orders.OrderHistory', 'Order History'), "Orders" => $orders )); return $this->owner->renderWith(array( "UserAccount_history", "UserAccount", "Page" )); } /** * Display all outstanding orders for the current user * */ public function outstanding() { $member = Member::currentUser(); $orders = new PaginatedList( $member->getOutstandingOrders(), $this->owner->request ); $this->owner->customise(array( "ClassName" => "AccountPage", "Title" => _t('Orders.OutstandingOrders', 'Outstanding Orders'), "Orders" => $orders )); return $this->owner->renderWith(array( "UserAccount_outstanding", "UserAccount", "Page" )); } /** * Display the currently selected order from the URL * */ public function order() { $orderID = $this->owner->request->param("ID"); $order = Order::get()->byID($orderID); $this->owner->customise(array( "ClassName" => "AccountPage", "Order" => $order )); return $this->owner->renderWith(array( "UserAccount_order", "UserAccount", "Page" )); } /** * Add commerce specific links to account menu * */ public function updateAccountMenu($menu) { $curr_action = $this->owner->request->param("Action"); $menu->add(new ArrayData(array( "ID" => 1, "Title" => _t('Orders.OutstandingOrders', 'Outstanding Orders'), "Link" => $this->owner->Link("outstanding"), "LinkingMode" => ($curr_action == "outstanding") ? "current" : "link" ))); $menu->add(new ArrayData(array( "ID" => 2, "Title" => _t('Orders.OrderHistory', "Order history"), "Link" => $this->owner->Link("history"), "LinkingMode" => ($curr_action == "history") ? "current" : "link" ))); } } |