1 | <?php |
||
20 | class Typo3 |
||
21 | extends \Aimeos\MShop\Customer\Manager\Group\Standard |
||
22 | implements \Aimeos\MShop\Customer\Manager\Group\Iface |
||
23 | { |
||
24 | private $searchConfig = array( |
||
25 | 'customer.group.id' => array( |
||
26 | 'code' => 'customer.group.id', |
||
27 | 'internalcode' => 't3feg."uid"', |
||
28 | 'label' => 'Customer group ID', |
||
29 | 'type' => 'integer', |
||
30 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_INT, |
||
31 | ), |
||
32 | 'customer.group.code' => array( |
||
33 | 'code' => 'customer.group.code', |
||
34 | 'internalcode' => 't3feg."uid"', |
||
35 | 'label' => 'Customer group code', |
||
36 | 'type' => 'string', |
||
37 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
38 | ), |
||
39 | 'customer.group.label' => array( |
||
40 | 'code' => 'customer.group.label', |
||
41 | 'internalcode' => 't3feg."title"', |
||
42 | 'label' => 'Customer group label', |
||
43 | 'type' => 'string', |
||
44 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
45 | ), |
||
46 | 'customer.group.ctime'=> array( |
||
47 | 'code' => 'customer.group.ctime', |
||
48 | 'internalcode' => 't3feg."crdate"', |
||
49 | 'label' => 'Customer group creation time', |
||
50 | 'type' => 'datetime', |
||
51 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
52 | ), |
||
53 | 'customer.group.mtime'=> array( |
||
54 | 'code' => 'customer.group.mtime', |
||
55 | 'internalcode' => 't3feg."tstamp"', |
||
56 | 'label' => 'Customer group modification time', |
||
57 | 'type' => 'datetime', |
||
58 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
59 | ), |
||
60 | 'customer.group.editor'=> array( |
||
61 | 'code' => 'customer.group.editor', |
||
62 | 'internalcode' => '1', |
||
63 | 'label' => 'Customer group editor', |
||
64 | 'type' => 'string', |
||
65 | 'internaltype' => \Aimeos\MW\DB\Statement\Base::PARAM_STR, |
||
66 | ), |
||
67 | ); |
||
68 | |||
69 | private $plugins = array(); |
||
70 | private $reverse = array(); |
||
71 | |||
72 | |||
73 | /** |
||
74 | * Initializes the customer group manager object |
||
75 | * |
||
76 | * @param \Aimeos\MShop\Context\Iface $context Context object with required objects |
||
77 | */ |
||
78 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
||
79 | { |
||
80 | parent::__construct( $context ); |
||
81 | |||
82 | $plugin = new \Aimeos\MW\Criteria\Plugin\T3Datetime(); |
||
83 | $this->plugins['customer.ctime'] = $this->reverse['crdate'] = $plugin; |
||
84 | $this->plugins['customer.mtime'] = $this->reverse['tstamp'] = $plugin; |
||
85 | } |
||
86 | |||
87 | |||
88 | /** |
||
89 | * Removes old entries from the database |
||
90 | * |
||
91 | * @param integer[] $siteids List of IDs for sites whose entries should be deleted |
||
92 | */ |
||
93 | public function cleanup( array $siteids ) |
||
94 | { |
||
95 | $path = 'mshop/customer/manager/group/submanagers'; |
||
96 | |||
97 | foreach( $this->getContext()->getConfig()->get( $path, array() ) as $domain ) { |
||
98 | $this->getSubManager( $domain )->cleanup( $siteids ); |
||
99 | } |
||
100 | } |
||
101 | |||
102 | |||
103 | /** |
||
104 | * Removes multiple items specified by their IDs |
||
105 | * |
||
106 | * @param array $ids List of IDs |
||
107 | */ |
||
108 | public function deleteItems( array $ids ) |
||
112 | |||
113 | |||
114 | /** |
||
115 | * Returns the attributes that can be used for searching |
||
116 | * |
||
117 | * @param boolean $withsub Return attributes of sub-managers too if true |
||
118 | * @return array List of attribute items implementing \Aimeos\MW\Criteria\Attribute\Iface |
||
119 | */ |
||
120 | public function getSearchAttributes( $withsub = true ) |
||
121 | { |
||
122 | $path = 'mshop/customer/manager/group/submanagers'; |
||
123 | |||
124 | return $this->getSearchAttributesBase( $this->searchConfig, $path, array(), $withsub ); |
||
125 | } |
||
126 | |||
127 | |||
128 | /** |
||
129 | * Returns a new manager for customer group extensions |
||
130 | * |
||
131 | * @param string $manager Name of the sub manager type in lower case |
||
132 | * @param string|null $name Name of the implementation, will be from configuration (or Default) if null |
||
133 | * @return \Aimeos\MShop\Common\Manager\Iface Manager for different extensions |
||
134 | */ |
||
135 | public function getSubManager( $manager, $name = null ) |
||
139 | |||
140 | |||
141 | /** |
||
142 | * Inserts a new or updates an existing customer group item |
||
143 | * |
||
144 | * @param \Aimeos\MShop\Customer\Item\Group\Iface $item Customer group item |
||
145 | * @param boolean $fetch True if the new ID should be returned in the item |
||
146 | */ |
||
147 | public function saveItem( \Aimeos\MShop\Common\Item\Iface $item, $fetch = true ) |
||
151 | |||
152 | |||
153 | /** |
||
154 | * Returns the item objects matched by the given search criteria. |
||
155 | * |
||
156 | * @param \Aimeos\MW\Criteria\Iface $search Search criteria object |
||
157 | * @param array $ref List of domain items that should be fetched too |
||
158 | * @param integer &$total Number of items that are available in total |
||
159 | * @return array List of items implementing \Aimeos\MShop\Customer\Item\Group\Iface |
||
160 | * @throws \Aimeos\MShop\Exception If retrieving items failed |
||
161 | */ |
||
162 | public function searchItems( \Aimeos\MW\Criteria\Iface $search, array $ref = array(), &$total = null ) |
||
284 | |||
285 | |||
286 | /** |
||
287 | * Creates a new customer item. |
||
288 | * |
||
289 | * @param array $values List of attributes for customer item |
||
290 | * @param array $listItems List items associated to the customer item |
||
291 | * @param array $refItems Items referenced by the customer item via the list items |
||
292 | * @return \Aimeos\MShop\Customer\Item\Iface New customer item |
||
293 | */ |
||
294 | protected function createItemBase( array $values = array(), array $listItems = array(), array $refItems = array() ) |
||
308 | } |
||
309 |