function statusModificationList($user = false) { if ($user === false) { $user = eZUser::currentUser(); } else { if (is_numeric($user)) { $user = eZUser::fetch($user); } } if (!is_object($user)) { eZDebug::writeError("Cannot calculate status access list without a user", __METHOD__); return false; } $accessResult = $user->hasAccessTo('shop', 'setstatus'); $accessWord = $accessResult['accessWord']; $access = false; $currentStatusID = $this->attribute("status_id"); $statusList = array(); if ($accessWord == 'yes') { // We have full access so we return all of them $statusList = eZOrderStatus::fetchOrderedList(true, false); return $statusList; } if ($accessWord == 'limited') { $limitationList = $accessResult['policies']; $access = true; // All 'to' statues will be appended to this array $accessList = array(); foreach ($limitationList as $pid => $limit) { $access = true; foreach ($limit as $name => $value) { if ($name == 'FromStatus') { if (!in_array($currentStatusID, $value)) { $access = false; } } if (!$access) { break; } } if ($access) { if (isset($limit['ToStatus'])) { $accessList = array_merge($accessList, $limit['ToStatus']); } else { // We have full access for the current status so we return all of them $statusList = eZOrderStatus::fetchOrderedList(true, false); return $statusList; } } } if (count($accessList) > 0) { $accessList = array_unique(array_merge($accessList, array($currentStatusID))); $statuses = eZOrderStatus::fetchOrderedList(true, false); foreach ($statuses as $status) { if (in_array($status->attribute('status_id'), $accessList)) { $statusList[] = $status; } } } } return $statusList; }