This repository has been archived by the owner on Jun 21, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
IDataProvider.php
156 lines (136 loc) · 3.59 KB
/
IDataProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
/**
* For the full copyright and license information, please view
* the file license.txt that was distributed with this source code.
*
* @author Martin Štekl <[email protected]>
* @since 2012.01.30
* @license MIT
* @copyright Copyright (c) 2011, 2012 Martin Štekl <[email protected]>
*/
namespace stekycz\gallery;
/**
* Define how to communicate with database.
*/
interface IDataProvider {
/**
* Returs associative array of namespaces.
*
* @return string[]
*/
public function getNamespaces();
/**
* Creates new group of items. Returns ID for new created group.
*
* @param array $group_data Array of group data
* @return int|string GroupID
*/
public function createGroup(array $group_data);
/**
* Updates given group by new data or insert new files.
*
* @param int|string $group_id GroupID
* @param array $update_data
*/
public function updateGroup($group_id, array $update_data = array());
/**
* Change activity for given group.
*
* @param int|string $group_id GroupID
*/
public function toggleActiveGroup($group_id);
/**
* Delete given group.
*
* @param int|string $group_id GroupID
*/
public function deleteGroup($group_id);
/**
* Returns count of groups in given namespace.
*
* @param int $namespace_id
* @param bool $admin
* @return int
*/
public function countGroups($namespace_id, $admin = false);
/**
* Returns data for all groups in given namespace. This helps with paging.
*
* @param int $namespace_id
* @param bool $admin
* @param int $page
* @param int $itemPerPage
* @return array
*/
public function getAllGroups($namespace_id, $admin = false, $page = 1, $itemPerPage = 25);
/**
* Returns data for given group.
*
* @param int|string $group_id GroupID
* @return array
*/
public function getGroupById($group_id);
/**
* Creates new item. Returns ID for new created item.
*
* @param array $item_data Array of item data
* @param int|string $group_id Identify in which group item is
* @return int|string ItemID
*/
public function createItem(array $item_data, $group_id);
/**
* Updates given item by new data.
*
* @param int|string $item_id ItemID
* @param array $update_data
*/
public function updateItem($item_id, array $update_data = array());
/**
* Change activity for given item.
*
* @param int|string $item_id ItemID
*/
public function toggleActiveItem($item_id);
/**
* Delete given item.
*
* @param int|string $item_id ItemID
*/
public function deleteItem($item_id);
/**
* Returns data for all items in given group.
*
* @param int|string $group_id GroupID
* @param bool $admin
* @return array
*/
public function getItemsByGroup($group_id, $admin = false);
/**
* Returns data for given item.
*
* @param int|string $item_id ItemID
* @return array
*/
public function getItemById($item_id);
/**
* Returns ItemID for item which is previous given item.
*
* @param int|string $item_id ItemID
* @return int|string ItemID for item on the left side
*/
public function getLeftItemBy($item_id);
/**
* Returns ItemID for item which is next to given item.
*
* @param int|string $item_id ItemID
* @return int|string ItemID for item on the right side
*/
public function getRightItemBy($item_id);
/**
* Change ordering for given items -> switch them.
*
* @param int|string $item_id_1
* @param int|string $item_id_2
*/
public function swapItems($item_id_1, $item_id_2);
}