/** * Read storage * * @param \XLite\Model\Base\Storage $storage Storage * * @return void */ protected function readStorage(\XLite\Model\Base\Storage $storage) { if ($this->storageKey) { $this->storageKey->incrementAttempt(); \XLite\Core\Database::getEM()->flush(); } parent::readStorage($storage); }
/** * Get download URL for customer front-end by key * * @return string */ public function getDownloadURL(\XLite\Module\CDev\Egoods\Model\OrderItem\PrivateAttachment $attachment) { $params = $this->getGetterParams(); $params['key'] = $attachment->getDownloadKey(); return \XLite\Core\Converter::buildFullURL('storage', 'download', $params, \XLite::getCustomerScript()); }
/** * Get status class * * @param \XLite\Module\CDev\Egoods\Model\OrderItem\PrivateAttachment $attachment Attachment * * @return string */ protected function getStatusClass(\XLite\Module\CDev\Egoods\Model\OrderItem\PrivateAttachment $attachment) { if ($attachment->isExpired() || $attachment->isAttemptsEnded()) { $class = 'expired'; } elseif ($attachment->getBlocked() || !$attachment->isAvailable()) { $class = 'blocked'; } else { $class = 'avail'; } return $class; }