本文整理汇总了PHP中record_adapter::log_view方法的典型用法代码示例。如果您正苦于以下问题:PHP record_adapter::log_view方法的具体用法?PHP record_adapter::log_view怎么用?PHP record_adapter::log_view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类record_adapter
的用法示例。
在下文中一共展示了record_adapter::log_view方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logView
private function logView(\record_adapter $record, Request $request)
{
try {
$logger = $this->getDataboxLogger($record->get_databox());
$log_id = $logger->get_id();
$record->log_view($log_id, $request->headers->get('referer', 'NO REFERRER'), $this->app['phraseanet.configuration']['main']['key']);
} catch (\Exception $e) {
// Ignore exception
}
}
示例2: deliverContent
public function deliverContent(Request $request, \record_adapter $record, $subdef, $watermark, $stamp, Application $app)
{
$file = $record->get_subdef($subdef);
$pathOut = $file->get_pathfile();
if ($watermark === true && $file->get_type() === \media_subdef::TYPE_IMAGE) {
$pathOut = \recordutils_image::watermark($app, $file);
} elseif ($stamp === true && $file->get_type() === \media_subdef::TYPE_IMAGE) {
$pathOut = \recordutils_image::stamp($app, $file);
}
$log_id = null;
try {
$logger = $app['phraseanet.logger']($record->get_databox());
$log_id = $logger->get_id();
$referrer = 'NO REFERRER';
if (isset($_SERVER['HTTP_REFERER'])) {
$referrer = $_SERVER['HTTP_REFERER'];
}
$record->log_view($log_id, $referrer, $app['conf']->get(['main', 'key']));
} catch (\Exception $e) {
}
$disposition = $request->query->get('download') ? DeliverDataInterface::DISPOSITION_ATTACHMENT : DeliverDataInterface::DISPOSITION_INLINE;
$response = $app['phraseanet.file-serve']->deliverFile($pathOut, $file->get_file(), $disposition, $file->get_mime());
$response->setPrivate();
/* @var $response \Symfony\Component\HttpFoundation\Response */
if ($file->getEtag()) {
$response->setEtag($file->getEtag());
$response->setLastModified($file->get_modification_date());
}
if (false === $record->is_grouping() && $subdef !== 'document') {
try {
if ($file->getDataboxSubdef()->get_class() == \databox_subdef::CLASS_THUMBNAIL) {
// default expiration is 5 days
$expiration = 60 * 60 * 24 * 5;
$response->setExpires(new \DateTime(sprintf('+%d seconds', $expiration)));
$response->setMaxAge($expiration);
$response->setSharedMaxAge($expiration);
$response->setPublic();
}
} catch (\Exception $e) {
}
}
$response->isNotModified($request);
return $response;
}