KeyValueFactory.php
3 years ago
KeyValuePair.php
3 years ago
ListColumnOrder.php
3 years ago
ListScreenOrder.php
3 years ago
NetworkOptionFactory.php
3 years ago
Option.php
3 years ago
OptionFactory.php
3 years ago
SiteOption.php
3 years ago
Timestamp.php
3 years ago
Transaction.php
3 years ago
UserColumnOrder.php
3 years ago
UserMeta.php
3 years ago
UserColumnOrder.php
60 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AC\Storage; |
| 4 | |
| 5 | use AC\Preferences\Site; |
| 6 | use AC\Type\ListScreenId; |
| 7 | |
| 8 | class UserColumnOrder { |
| 9 | |
| 10 | /** |
| 11 | * @var Site |
| 12 | */ |
| 13 | private $user_preference; |
| 14 | |
| 15 | public function __construct() { |
| 16 | $this->user_preference = new Site( 'column_order' ); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * @param array $column_names |
| 21 | */ |
| 22 | public function save( ListScreenId $id, array $column_names ) { |
| 23 | $this->user_preference->set( |
| 24 | $id->get_id(), |
| 25 | $column_names |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * @param ListScreenId $id |
| 31 | * |
| 32 | * @return bool |
| 33 | */ |
| 34 | public function exists( ListScreenId $id ) { |
| 35 | return null !== $this->get( $id ); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * @param ListScreenId $id |
| 40 | * |
| 41 | * @return array |
| 42 | */ |
| 43 | public function get( ListScreenId $id ) { |
| 44 | return $this->user_preference->get( |
| 45 | $id->get_id() |
| 46 | ); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * @param ListScreenId $id |
| 51 | * |
| 52 | * @return void |
| 53 | */ |
| 54 | public function delete( ListScreenId $id ) { |
| 55 | $this->user_preference->delete( |
| 56 | $id->get_id() |
| 57 | ); |
| 58 | } |
| 59 | |
| 60 | } |