BaseHandler.php
11 years ago
EmptyTrashHandler.php
11 years ago
GetTaxonomiesHandler.php
11 years ago
ListingSortHandler.php
11 years ago
NestToggleHandler.php
11 years ago
NewChildHandler.php
11 years ago
NewLinkHandler.php
11 years ago
QuickEditHandler.php
11 years ago
QuickEditLinkHandler.php
11 years ago
SearchHandler.php
11 years ago
SortHandler.php
11 years ago
SyncMenuHandler.php
11 years ago
SortHandler.php
36 lines
| 1 | <?php namespace NestedPages\Form\Handlers; |
| 2 | |
| 3 | /** |
| 4 | * Handles processing sortable pages |
| 5 | * updates menu order & page parents |
| 6 | * @return json response |
| 7 | */ |
| 8 | class SortHandler extends BaseHandler { |
| 9 | |
| 10 | |
| 11 | public function __construct() |
| 12 | { |
| 13 | parent::__construct(); |
| 14 | $this->updateOrder(); |
| 15 | $this->syncMenu(); |
| 16 | $this->sendResponse(); |
| 17 | } |
| 18 | |
| 19 | |
| 20 | /** |
| 21 | * Update Post Order |
| 22 | */ |
| 23 | private function updateOrder() |
| 24 | { |
| 25 | $posts = $this->data['list']; |
| 26 | $order = $this->post_update_repo->updateOrder($posts); |
| 27 | if ( $order ){ |
| 28 | $this->response = array('status' => 'success', 'message' => __('Page order successfully updated.','nestedpages') ); |
| 29 | } else { |
| 30 | $this->response = array('status'=>'error', 'message'=> __('There was an error updating the page order.','nestedpages') ); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | |
| 35 | } |
| 36 |