本文整理汇总了PHP中record_adapter::get_sbas_id方法的典型用法代码示例。如果您正苦于以下问题:PHP record_adapter::get_sbas_id方法的具体用法?PHP record_adapter::get_sbas_id怎么用?PHP record_adapter::get_sbas_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类record_adapter
的用法示例。
在下文中一共展示了record_adapter::get_sbas_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* {@inheritdoc}
*/
public function execute(InputInterface $input, OutputInterface $output)
{
foreach ($this->app->getDataboxes() as $databox) {
foreach ($databox->get_meta_structure()->get_elements() as $databox_field) {
if ($databox_field->is_on_error()) {
throw new \Exception(sprintf("Databox description field %s is on error, please fix it before continue</error>", $databox_field->get_name()));
}
}
$this->ensureMigrateColumn($databox);
do {
$rs = $this->getEmptyOriginalNameRecords($databox);
$databox->get_connection()->beginTransaction();
foreach ($rs as $record) {
$this->setOriginalName($databox, $record);
}
$databox->get_connection()->commit();
} while (count($rs) > 0);
do {
$rs = $this->getRecordsToMigrate($databox);
$databox->get_connection()->beginTransaction();
$sql = 'UPDATE record SET migrate35=1 WHERE record_id = :record_id';
$stmt = $databox->get_connection()->prepare($sql);
foreach ($rs as $row) {
$stmt->execute([':record_id' => $row['record_id']]);
try {
$record = new \record_adapter($this->app, $databox->get_sbas_id(), $row['record_id']);
} catch (\Exception $e) {
$this->app['monolog']->addError(sprintf("Unable to load record %d on databox %d : %s", $record->get_record_id(), $record->get_sbas_id(), $record->get_sbas_id(), $e->getMessage()));
continue;
}
try {
$this->updateMetadatas($record, $row['xml']);
} catch (\Exception $e) {
$this->app['monolog']->addError(sprintf("Error while upgrading metadatas for record %d on databox %d : %s", $record->get_record_id(), $record->get_sbas_id(), $e->getMessage()));
}
try {
$record->set_binary_status($row['status']);
} catch (\Exception $e) {
$this->app['monolog']->addError(sprintf("Error while upgrading status for record %d on databox %d : %s", $record->get_record_id(), $record->get_sbas_id(), $e->getMessage()));
}
unset($record);
}
$stmt->closeCursor();
$databox->get_connection()->commit();
} while (count($rs) > 0);
}
foreach ($this->app->getDataboxes() as $databox) {
$this->ensureDropMigrateColumn($databox);
}
}
示例2: __construct
/**
*
* @param Application $app
* @param record_adapter $record
* @param databox $databox
*
* @return caption_record
*/
public function __construct(Application $app, \record_adapter $record, databox $databox)
{
$this->app = $app;
$this->sbas_id = $record->get_sbas_id();
$this->record = $record;
$this->databox = $databox;
}
示例3: generate_url
/**
*
* @param boolean $random
* @return string
*/
protected function generate_url()
{
if (!$this->is_physically_present()) {
return;
}
if (in_array($this->mime, ['video/mp4'])) {
$token = p4file::apache_tokenize($this->app['conf'], $this->get_pathfile());
if ($token) {
$this->url = $token;
return;
}
}
$this->url = "/datafiles/" . $this->record->get_sbas_id() . "/" . $this->record->get_record_id() . "/" . $this->get_name() . "/";
return;
}
示例4: generate_url
/**
*
* @param boolean $random
* @return string
*/
protected function generate_url()
{
if (!$this->is_physically_present()) {
return;
}
if ($this->get_name() === 'thumbnail') {
if ($this->app['phraseanet.static-file-factory']->isStaticFileModeEnabled() && null !== ($url = $this->app['phraseanet.static-file']->getUrl($this->get_pathfile()))) {
$this->url = $url;
return;
}
}
if ($this->app['phraseanet.h264-factory']->isH264Enabled() && in_array($this->mime, ['video/mp4'])) {
if (null !== ($url = $this->app['phraseanet.h264']->getUrl($this->get_pathfile()))) {
$this->url = $url;
return;
}
}
$this->url = Url::factory("/datafiles/" . $this->record->get_sbas_id() . "/" . $this->record->get_record_id() . "/" . $this->get_name() . "/");
return;
}
示例5: serialize
public function serialize(\record_adapter $record)
{
$technicalInformation = $caption = $business = $status = [];
foreach ($record->get_technical_infos() as $name => $value) {
$technicalInformation[$name] = $value;
}
foreach ($record->get_caption()->get_fields(null, true) as $field) {
$isDate = $field->get_databox_field()->get_type() === \databox_field::TYPE_DATE;
$isBusiness = $field->get_databox_field()->isBusiness();
$vi = $field->get_values();
if ($field->is_multi()) {
$values = [];
foreach ($vi as $value) {
$values[] = $this->sanitizeSerializedValue($value->getValue());
}
$value = implode(' ' . $field->get_databox_field()->get_separator(false) . ' ', $values);
} else {
$value = $this->sanitizeSerializedValue(array_pop($vi)->getValue());
}
if ($isDate) {
try {
$date = new \DateTime($value);
$value = $date->format(DATE_ATOM);
} catch (\Exception $e) {
continue;
}
}
if ($isBusiness) {
$business[$field->get_databox_field()->get_name()] = $value;
}
$caption[$field->get_databox_field()->get_name()] = $value;
}
$i = 0;
foreach (preg_split('//', strrev($record->get_status()), -1, PREG_SPLIT_NO_EMPTY) as $val) {
$status['status-' . $i] = (int) $val;
$i++;
}
return ['databox_id' => $record->get_sbas_id(), 'record_id' => $record->get_record_id(), 'collection_id' => $record->get_collection()->get_coll_id(), 'base_id' => $record->get_base_id(), 'mime_type' => $record->get_mime(), 'title' => $record->get_title(), 'original_name' => $record->get_original_name(), 'updated_on' => $record->get_modification_date()->format(DATE_ATOM), 'created_on' => $record->get_creation_date()->format(DATE_ATOM), 'sha256' => $record->get_sha256(), 'technical_informations' => $technicalInformation, 'phrasea_type' => $record->get_type(), 'type' => $record->is_grouping() ? 'story' : 'record', 'uuid' => $record->get_uuid(), 'caption' => $caption, 'status' => $status, 'caption-business' => $business];
}
示例6: create
public static function create(Application $app, Bridge_Account $account, record_adapter $record, $title, $status, $type, array $datas = [])
{
$sql = 'INSERT INTO bridge_elements
(id, account_id, sbas_id, record_id, dist_id, title, `type`
, serialized_datas, status, created_on, updated_on)
VALUES
(null, :account_id, :sbas_id, :record_id, null, :title, :type
,:datas , :status, NOW(), NOW())';
$params = [':account_id' => $account->get_id(), ':sbas_id' => $record->get_sbas_id(), ':record_id' => $record->get_record_id(), ':status' => $status, ':title' => $title, ':type' => $type, ':datas' => serialize($datas)];
$stmt = $app->getApplicationBox()->get_connection()->prepare($sql);
$stmt->execute($params);
$stmt->closeCursor();
$element_id = $app->getApplicationBox()->get_connection()->lastInsertId();
return new self($app, $account, $element_id);
}
示例7: mockElasticsearchResult
/**
* @param \record_adapter $record
* @return \Alchemy\Phrasea\Application
*/
protected function mockElasticsearchResult(\record_adapter $record)
{
$app = $this->getApplication();
$elasticsearchRecord = new ElasticsearchRecord();
$elasticsearchRecord->setDataboxId($record->get_sbas_id());
$elasticsearchRecord->setRecordId($record->get_record_id());
$result = new SearchEngineResult(new ArrayCollection([$elasticsearchRecord]), '', 0, 0, 1, 1, 0, 0, new ArrayCollection(), null, null);
$searchEngine = $this->prophesize(SearchEngineInterface::class);
$searchEngine->query('', 0, Argument::any(), Argument::any())->willReturn($result);
$searchEngine->excerpt(Argument::any(), Argument::any(), Argument::any(), Argument::any())->willReturn([]);
$app['search_engine'] = $searchEngine->reveal();
return $app;
}
示例8: createQueryParams
private function createQueryParams($query, SearchEngineOptions $options, \record_adapter $record = null)
{
$params = ['index' => $this->indexName, 'type' => 'record', 'body' => ['fields' => ['databox_id', 'record_id'], 'sort' => $this->createSortQueryParams($options)]];
$ESquery = $this->createESQuery($query, $options);
$filters = $this->createFilters($options);
if ($record) {
$filters[] = ['term' => ['_id' => sprintf('%s-%s', $record->get_sbas_id(), $record->get_record_id())]];
$fields = [];
foreach ($record->get_databox()->get_meta_structure() as $dbField) {
$fields['caption.' . $dbField->get_name()] = new \stdClass();
}
$params['body']['highlight'] = ["pre_tags" => ["[[em]]"], "post_tags" => ["[[/em]]"], "fields" => $fields];
}
if (count($filters) > 0) {
$ESquery = ['filtered' => ['query' => $ESquery, 'filter' => ['and' => $filters]]];
}
$params['body']['query'] = $ESquery;
return $params;
}
示例9: apply
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
try {
$sql = 'ALTER TABLE `ssel` ADD `migrated` INT NOT NULL DEFAULT "0"';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
} catch (\Exception $e) {
}
$sql = 'SELECT ssel_id, usr_id, name, descript, pub_date, updater, pub_restrict, homelink
FROM ssel
WHERE (public = "1" OR homelink="1")
AND migrated = 0';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$date_ref = new DateTime();
$n = 0;
$app['orm.em']->getEventManager()->removeEventSubscriber(new TimestampableListener());
foreach ($rs as $row) {
if (null === ($user = $this->loadUser($app['orm.em'], $row['usr_id']))) {
continue;
}
$feed = $this->get_feed($app, $appbox, $user, $row['pub_restrict'], $row['homelink']);
if (!$feed instanceof Feed) {
continue;
}
$publishers = $feed->getPublishers();
$entry = new FeedEntry();
$entry->setAuthorEmail((string) $user->getEmail());
$entry->setAuthorName((string) $user->getDisplayName());
$entry->setFeed($feed);
$entry->setPublisher($publishers->first());
$entry->setTitle($row['name']);
$entry->setSubtitle($row['descript']);
$feed->addEntry($entry);
$date_create = new DateTime($row['pub_date']);
if ($date_create < $date_ref) {
$date_ref = $date_create;
}
$entry->setCreatedOn($date_create);
if ($row['updater'] != '0000-00-00 00:00:00') {
$date_update = new DateTime($row['updater']);
$entry->setUpdatedOn($date_update);
}
$sql = 'SELECT sselcont_id, ssel_id, base_id, record_id
FROM sselcont
WHERE ssel_id = :ssel_id
ORDER BY ord ASC';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute([':ssel_id' => $row['ssel_id']]);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row) {
try {
$record = new record_adapter($app, phrasea::sbasFromBas($app, $row['base_id']), $row['record_id']);
$item = new FeedItem();
$item->setEntry($entry);
$entry->addItem($item);
$item->setRecordId($record->get_record_id());
$item->setSbasId($record->get_sbas_id());
$app['orm.em']->persist($item);
} catch (NotFoundHttpException $e) {
}
}
$app['orm.em']->persist($entry);
$sql = 'UPDATE ssel SET deleted = "1", migrated="1"
WHERE ssel_id = :ssel_id';
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute([':ssel_id' => $row['ssel_id']]);
$stmt->closeCursor();
$app['orm.em']->persist($feed);
$n++;
if ($n % 1000 == 0) {
$app['orm.em']->flush();
$app['orm.em']->clear();
}
}
$this->set_feed_dates($date_ref);
$app['orm.em']->flush();
$app['orm.em']->clear();
$app['orm.em']->getEventManager()->removeEventSubscriber(new TimestampableListener());
return true;
}
示例10: findByRecord
/**
* @param Application $app
* @param \record_adapter $Story
* @return StoryWZ[]
*/
public function findByRecord(Application $app, \record_adapter $Story)
{
$dql = 'SELECT s FROM Phraseanet:StoryWZ s
WHERE s.sbas_id = :sbas_id
AND s.record_id = :record_id';
$query = $this->_em->createQuery($dql);
$query->setParameters(['sbas_id' => $Story->get_sbas_id(), 'record_id' => $Story->get_record_id()]);
/** @var StoryWZ[] $stories */
$stories = $query->getResult();
foreach ($stories as $key => $story) {
try {
$story->getRecord($app);
} catch (NotFoundHttpException $e) {
$this->getEntityManager()->remove($story);
$this->getEntityManager()->flush();
unset($stories[$key]);
}
}
return $stories;
}
示例11: grant_preview_on
public function grant_preview_on(record_adapter $record, User $pusher, $action)
{
$sql = 'REPLACE INTO records_rights
(id, usr_id, sbas_id, record_id, preview, `case`, pusher_usr_id)
VALUES
(null, :usr_id, :sbas_id, :record_id, 1, :case, :pusher)';
$params = [':usr_id' => $this->user->getId(), ':sbas_id' => $record->get_sbas_id(), ':record_id' => $record->get_record_id(), ':case' => $action, ':pusher' => $pusher->getId()];
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
$stmt->closeCursor();
$this->delete_data_from_cache(self::CACHE_RIGHTS_RECORDS);
return $this;
}
示例12: setRecord
public function setRecord(\record_adapter $record)
{
$this->setRecordId($record->get_record_id());
$this->setSbasId($record->get_sbas_id());
}
示例13: __construct
/**
*
* @param Application $app
* @param string $lst
* @param integer $sstid
* @param integer $storyWZid
* @return set_export
*/
public function __construct(Application $app, $lst, $sstid, $storyWZid = null)
{
$this->app = $app;
$download_list = [];
$remain_hd = [];
if ($storyWZid) {
$repository = $app['EM']->getRepository('\\Entities\\StoryWZ');
$storyWZ = $repository->findByUserAndId($this->app, $app['authentication']->getUser(), $storyWZid);
$lst = $storyWZ->getRecord($this->app)->get_serialize_key();
}
if ($sstid != "") {
$repository = $app['EM']->getRepository('Phraseanet:Basket');
/* @var $repository Alchemy\Phrasea\Model\Repositories\BasketRepository */
$Basket = $repository->findUserBasket($sstid, $app['authentication']->getUser(), false);
$this->exportName = str_replace([' ', '\\', '/'], '_', $Basket->getName()) . "_" . date("Y-n-d");
foreach ($Basket->getElements() as $basket_element) {
$base_id = $basket_element->getRecord($this->app)->get_base_id();
$record_id = $basket_element->getRecord($this->app)->get_record_id();
if (!isset($remain_hd[$base_id])) {
if ($app['acl']->get($app['authentication']->getUser())->is_restricted_download($base_id)) {
$remain_hd[$base_id] = $app['acl']->get($app['authentication']->getUser())->remaining_download($base_id);
} else {
$remain_hd[$base_id] = false;
}
}
$current_element = $download_list[] = new record_exportElement($app, $basket_element->getRecord($this->app)->get_sbas_id(), $record_id, $Basket->getName(), $remain_hd[$base_id]);
$remain_hd[$base_id] = $current_element->get_remain_hd();
}
} else {
$this->exportName = "Export_" . date("Y-n-d") . '_' . mt_rand(100, 999);
$tmp_lst = explode(';', $lst);
$n = 1;
foreach ($tmp_lst as $basrec) {
$basrec = explode('_', $basrec);
if (count($basrec) != 2) {
continue;
}
try {
$record = new record_adapter($this->app, $basrec[0], $basrec[1]);
} catch (\Exception_Record_AdapterNotFound $e) {
continue;
}
if ($record->is_grouping()) {
foreach ($record->get_children() as $child_basrec) {
$base_id = $child_basrec->get_base_id();
$record_id = $child_basrec->get_record_id();
if (!isset($remain_hd[$base_id])) {
if ($app['acl']->get($app['authentication']->getUser())->is_restricted_download($base_id)) {
$remain_hd[$base_id] = $app['acl']->get($app['authentication']->getUser())->remaining_download($base_id);
} else {
$remain_hd[$base_id] = false;
}
}
$current_element = $download_list[] = new record_exportElement($app, $child_basrec->get_sbas_id(), $record_id, $record->get_title(null, null, true) . '_' . $n, $remain_hd[$base_id]);
$remain_hd[$base_id] = $current_element->get_remain_hd();
}
} else {
$base_id = $record->get_base_id();
$record_id = $record->get_record_id();
if (!isset($remain_hd[$base_id])) {
if ($app['acl']->get($app['authentication']->getUser())->is_restricted_download($base_id)) {
$remain_hd[$base_id] = $app['acl']->get($app['authentication']->getUser())->remaining_download($base_id);
} else {
$remain_hd[$base_id] = false;
}
}
$current_element = $download_list[$basrec[0] . '_' . $basrec[1]] = new record_exportElement($app, $record->get_sbas_id(), $record_id, '', $remain_hd[$base_id]);
$remain_hd[$base_id] = $current_element->get_remain_hd();
}
$n++;
}
}
$this->elements = $download_list;
$display_download = [];
$display_orderable = [];
$this->total_download = 0;
$this->total_order = 0;
$this->total_ftp = 0;
$this->businessFieldsAccess = false;
foreach ($this->elements as $download_element) {
if ($app['acl']->get($app['authentication']->getUser())->has_right_on_base($download_element->get_base_id(), 'canmodifrecord')) {
$this->businessFieldsAccess = true;
}
foreach ($download_element->get_downloadable() as $name => $properties) {
if (!isset($display_download[$name])) {
$display_download[$name] = ['size' => 0, 'total' => 0, 'available' => 0, 'refused' => []];
}
$display_download[$name]['total']++;
if ($properties !== false) {
$display_download[$name]['available']++;
$display_download[$name]['label'] = $properties['label'];
$display_download[$name]['class'] = $properties['class'];
//.........这里部分代码省略.........
示例14: list_story
/**
* Retrieve detailled informations about one story
*
* @param \record_adapter $story
*
* @return array
*/
public function list_story(Application $app, Request $request, \record_adapter $story)
{
if (!$story->is_grouping()) {
return Result::createError($request, 404, 'Story not found')->createResponse();
}
$that = $this;
$records = array_map(function (\record_adapter $record) use($that, $app) {
return $that->list_record($app, $record);
}, array_values($story->get_children()->get_elements()));
$caption = $story->get_caption();
$format = function (\caption_record $caption, $dcField) {
$field = $caption->get_dc_field($dcField);
if (!$field) {
return null;
}
return $field->get_serialized_values();
};
return ['@entity@' => self::OBJECT_TYPE_STORY, 'databox_id' => $story->get_sbas_id(), 'story_id' => $story->get_record_id(), 'updated_on' => $story->get_modification_date()->format(DATE_ATOM), 'created_on' => $story->get_creation_date()->format(DATE_ATOM), 'collection_id' => \phrasea::collFromBas($app, $story->get_base_id()), 'thumbnail' => $this->list_embedable_media($app, $story, $story->get_thumbnail()), 'uuid' => $story->get_uuid(), 'metadatas' => ['@entity@' => self::OBJECT_TYPE_STORY_METADATA_BAG, 'dc:contributor' => $format($caption, \databox_Field_DCESAbstract::Contributor), 'dc:coverage' => $format($caption, \databox_Field_DCESAbstract::Coverage), 'dc:creator' => $format($caption, \databox_Field_DCESAbstract::Creator), 'dc:date' => $format($caption, \databox_Field_DCESAbstract::Date), 'dc:description' => $format($caption, \databox_Field_DCESAbstract::Description), 'dc:format' => $format($caption, \databox_Field_DCESAbstract::Format), 'dc:identifier' => $format($caption, \databox_Field_DCESAbstract::Identifier), 'dc:language' => $format($caption, \databox_Field_DCESAbstract::Language), 'dc:publisher' => $format($caption, \databox_Field_DCESAbstract::Publisher), 'dc:relation' => $format($caption, \databox_Field_DCESAbstract::Relation), 'dc:rights' => $format($caption, \databox_Field_DCESAbstract::Rights), 'dc:source' => $format($caption, \databox_Field_DCESAbstract::Source), 'dc:subject' => $format($caption, \databox_Field_DCESAbstract::Subject), 'dc:title' => $format($caption, \databox_Field_DCESAbstract::Title), 'dc:type' => $format($caption, \databox_Field_DCESAbstract::Type)], 'records' => $records];
}
示例15: findReceivedValidationElementsByRecord
public function findReceivedValidationElementsByRecord(\record_adapter $record, User $user)
{
$dql = 'SELECT e
FROM Phraseanet:BasketElement e
JOIN e.basket b
JOIN b.validation v
JOIN v.participants p
WHERE p.user = :usr_id
AND e.record_id = :record_id
AND e.sbas_id = :sbas_id';
$params = ['sbas_id' => $record->get_sbas_id(), 'record_id' => $record->get_record_id(), 'usr_id' => $user->getId()];
$query = $this->_em->createQuery($dql);
$query->setParameters($params);
return $query->getResult();
}