本文整理汇总了PHP中record_adapter::get_record_id方法的典型用法代码示例。如果您正苦于以下问题:PHP record_adapter::get_record_id方法的具体用法?PHP record_adapter::get_record_id怎么用?PHP record_adapter::get_record_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类record_adapter
的用法示例。
在下文中一共展示了record_adapter::get_record_id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_metadatas_ids
protected function get_metadatas_ids()
{
try {
return $this->get_data_from_cache();
} catch (\Exception $e) {
}
$connbas = $this->databox_field->get_connection();
$sql = 'SELECT id FROM metadatas WHERE record_id = :record_id AND meta_struct_id = :meta_struct_id';
$params = [':record_id' => $this->record->get_record_id(), ':meta_struct_id' => $this->databox_field->get_id()];
$stmt = $connbas->prepare($sql);
$stmt->execute($params);
$ids = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$this->set_data_to_cache($ids);
return $ids;
}
示例2: generateSubdefPathname
private function generateSubdefPathname(\record_adapter $record, \databox_subdef $subdef, $oldVersion = null)
{
if ($oldVersion) {
$pathdest = \p4string::addEndSlash(pathinfo($oldVersion, PATHINFO_DIRNAME));
} else {
$pathdest = \databox::dispatch($this->filesystem, $subdef->get_path());
}
return $pathdest . $record->get_record_id() . '_' . $subdef->get_name() . '.' . $this->getExtensionFromSpec($subdef->getSpecs());
}
示例3: substitute
public function substitute(\record_adapter $record, $name, MediaInterface $media)
{
$newfilename = $record->get_record_id() . '_0_' . $name . '.' . $media->getFile()->getExtension();
$subdef_def = false;
if ($name == 'document') {
$baseprefs = $record->get_databox()->get_sxml_structure();
$pathhd = \p4string::addEndSlash((string) $baseprefs->path);
$filehd = $record->get_record_id() . "_document." . strtolower($media->getFile()->getExtension());
$pathhd = \databox::dispatch($this->fs, $pathhd);
$this->fs->copy($media->getFile()->getRealPath(), $pathhd . $filehd, true);
$subdefFile = $pathhd . $filehd;
$meta_writable = true;
} else {
$type = $record->isStory() ? 'image' : $record->get_type();
$subdef_def = $record->get_databox()->get_subdef_structure()->get_subdef($type, $name);
if ($record->has_subdef($name) && $record->get_subdef($name)->is_physically_present()) {
$path_file_dest = $record->get_subdef($name)->get_pathfile();
$record->get_subdef($name)->remove_file();
$record->clearSubdefCache($name);
} else {
$path = \databox::dispatch($this->fs, $subdef_def->get_path());
$this->fs->mkdir($path, 0750);
$path_file_dest = $path . $newfilename;
}
try {
$this->alchemyst->turnInto($media->getFile()->getRealPath(), $path_file_dest, $subdef_def->getSpecs());
} catch (MediaAlchemystException $e) {
return;
}
$subdefFile = $path_file_dest;
$meta_writable = $subdef_def->meta_writeable();
}
$this->fs->chmod($subdefFile, 0760);
$media = $this->mediavorus->guess($subdefFile);
\media_subdef::create($this->app, $record, $name, $media);
$record->delete_data_from_cache(\record_adapter::CACHE_SUBDEFS);
if ($meta_writable) {
$record->write_metas();
}
if ($name == 'document') {
$record->rebuild_subdefs();
}
$this->dispatcher->dispatch(RecordEvents::MEDIA_SUBSTITUTED, new RecordMediaSubstitutedEvent($record));
}
示例4: log
public function log(record_adapter $record, $action, $final, $comment)
{
$sql = 'INSERT INTO log_docs
(id, log_id, date, record_id, action, final, comment)
VALUES (null, :log_id, NOW(), :record_id, :action, :final, :comm)';
$stmt = $this->databox->get_connection()->prepare($sql);
$params = [':log_id' => $this->get_id(), ':record_id' => $record->get_record_id(), ':action' => $action, ':final' => $final, ':comm' => $comment];
$stmt->execute($params);
$stmt->closeCursor();
return $this;
}
示例5: 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);
}
}
示例6: 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;
}
示例7: 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;
}
示例8: 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];
}
示例9: 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);
}
示例10: 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;
}
示例11: 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;
}
示例12: create
public static function create(Application $app, databox_field $databox_field, \record_adapter $record, $value, Vocabulary\ControlProvider\ControlProviderInterface $vocabulary = null, $vocabularyId = null)
{
$connbas = $databox_field->get_connection();
/**
* Check consistency
*/
if (!$databox_field->is_multi()) {
try {
$field = $record->get_caption()->get_field($databox_field->get_name());
$values = $field->get_values();
$caption_field_value = array_pop($values);
/* @var $value \caption_Field_Value */
$caption_field_value->set_value($value);
if (!$vocabulary || !$vocabularyId) {
$caption_field_value->removeVocabulary();
} else {
$caption_field_value->setVocab($vocabulary, $vocabularyId);
}
return $caption_field_value;
} catch (\Exception $e) {
}
}
$sql_ins = 'INSERT INTO metadatas (id, record_id, meta_struct_id, value, VocabularyType, VocabularyId)' . ' VALUES (null, :record_id, :field, :value, :VocabType, :VocabId)';
$params = [':record_id' => $record->get_record_id(), ':field' => $databox_field->get_id(), ':value' => $value, ':VocabType' => $vocabulary ? $vocabulary->getType() : null, ':VocabId' => $vocabulary ? $vocabularyId : null];
$stmt_ins = $connbas->prepare($sql_ins);
$stmt_ins->execute($params);
$stmt_ins->closeCursor();
$meta_id = $connbas->lastInsertId();
$caption_field_value = new self($app, $databox_field, $record, $meta_id);
$caption_field_value->update_cache_value($value);
$record->get_caption()->delete_data_from_cache();
$databox_field->delete_data_from_cache();
$caption_field_value->delete_data_from_cache();
return $caption_field_value;
}
示例13: findContainingRecordForUser
public function findContainingRecordForUser(\record_adapter $record, User $user)
{
$dql = 'SELECT b
FROM Phraseanet:Basket b
JOIN b.elements e
WHERE e.record_id = :record_id AND e.sbas_id = e.sbas_id
AND b.user = :usr_id';
$params = ['record_id' => $record->get_record_id(), 'usr_id' => $user->getId()];
$query = $this->_em->createQuery($dql);
$query->setParameters($params);
return $query->getResult();
}
示例14: doReportInformationDocument
/**
* Display information about a document
*
* @param Request $request
* @return JsonResponse
*/
public function doReportInformationDocument(Request $request)
{
$config = ['photo' => [$this->app->trans('report:: document'), 0, 0, 0, 0], 'record_id' => [$this->app->trans('report:: record id'), 0, 0, 0, 0], 'date' => [$this->app->trans('report:: date'), 0, 0, 0, 0], 'type' => [$this->app->trans('phrseanet:: sous definition'), 0, 0, 0, 0], 'titre' => [$this->app->trans('report:: titre'), 0, 0, 0, 0], 'taille' => [$this->app->trans('report:: poids'), 0, 0, 0, 0]];
$config_dl = ['ddate' => [$this->app->trans('report:: date'), 0, 0, 0, 0], 'user' => [$this->app->trans('report:: utilisateurs'), 0, 0, 0, 0], 'final' => [$this->app->trans('phrseanet:: sous definition'), 0, 0, 0, 0], 'coll_id' => [$this->app->trans('report:: collections'), 0, 0, 0, 0], 'comment' => [$this->app->trans('report:: commentaire'), 0, 0, 0, 0], 'fonction' => [$this->app->trans('report:: fonction'), 0, 0, 0, 0], 'activite' => [$this->app->trans('report:: activite'), 0, 0, 0, 0], 'pays' => [$this->app->trans('report:: pays'), 0, 0, 0, 0], 'societe' => [$this->app->trans('report:: societe'), 0, 0, 0, 0]];
//format conf according user preferences
if ('' !== ($columnsList = $request->request->get('list_column', ''))) {
$new_conf = $config_dl;
$columns = explode(',', $columnsList);
foreach (array_keys($config_dl) as $col) {
if (!in_array($col, $columns)) {
unset($new_conf[$col]);
}
}
$config_dl = $new_conf;
}
try {
$record = new \record_adapter($this->app, $request->request->get('sbasid'), $request->request->get('rid'));
} catch (\Exception $e) {
$this->app->abort(404);
}
$what = new \module_report_nav($this->app, $request->request->get('dmin'), $request->request->get('dmax'), $request->request->get('sbasid'), $request->request->get('collection'));
$what->setPeriode('');
$what->setCsv(false);
$what->setPrint(false);
/** @var \record_adapter $record */
$reportArray = $what->buildTabUserWhat($record->get_base_id(), $record->get_record_id(), $config);
$title = $what->getTitle();
$html = $this->render('report/ajax_data_content.html.twig', ['result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false]);
$from = $request->request->get('from', '');
if ('TOOL' === $from) {
$what->setTitle('');
return $this->app->json(['rs' => $html, 'display_nav' => false, 'title' => $title]);
}
if ('DASH' !== $from && 'PUSHDOC' !== $from) {
$download = new \module_report_download($this->app, $request->request->get('dmin'), $request->request->get('dmax'), $request->request->get('sbasid'), $request->request->get('collection'));
$mapColumnTitleToSqlField = $download->getTransQueryString();
$currentfilter = [];
if ('' !== ($serializedFilter = $request->request->get('liste_filter', ''))) {
$currentfilter = @unserialize(urldecode($serializedFilter));
}
$filter = new \module_report_filter($this->app, $currentfilter, $mapColumnTitleToSqlField);
if ('' !== ($filterColumn = $request->request->get('filter_column', ''))) {
$field = current(explode(' ', $filterColumn));
$value = $request->request->get('filter_value', '');
if ($request->request->get('liste') == 'on') {
return $this->app->json(['diag' => $this->render('report/colFilter.html.twig', ['result' => $download->colFilter($field), 'field' => $field]), 'title' => $this->app->trans('filtrer les resultats sur la colonne %colonne%', ['%colonne%' => $field])]);
}
if ($field === $value) {
$filter->removeFilter($field);
} else {
$filter->addFilter($field, '=', $value);
}
}
$filter->addfilter('record_id', '=', $record->get_record_id());
$download->setFilter($filter->getTabFilter());
$download->setOrder('ddate', 'DESC');
$download->setTitle($this->app->trans('report:: historique des telechargements'));
$download->setConfig(false);
$reportArray = $download->buildReport($config_dl);
if ($request->request->get('printcsv') == 'on') {
$download->setPrettyString(false);
return $this->getCSVResponse($download, 'info_document');
}
$html .= $this->render('report/ajax_data_content.html.twig', ['result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false]);
return $this->app->json(['rs' => $html, 'display_nav' => false, 'title' => $title]);
}
if ($this->getConf()->get(['registry', 'modules', 'anonymous-report']) == false && $from !== 'DOC' && $from !== 'DASH' && $from !== 'GEN' && $from !== 'PUSHDOC') {
$conf = ['identifiant' => [$this->app->trans('report:: identifiant'), 0, 0, 0, 0], 'nom' => [$this->app->trans('report:: nom'), 0, 0, 0, 0], 'mail' => [$this->app->trans('report:: email'), 0, 0, 0, 0], 'adresse' => [$this->app->trans('report:: adresse'), 0, 0, 0, 0], 'tel' => [$this->app->trans('report:: telephone'), 0, 0, 0, 0]];
$info = new \module_report_nav($this->app, $request->request->get('dmin'), $request->request->get('dmax'), $request->request->get('sbasid'), $request->request->get('collection'));
$info->setPeriode('');
$info->setConfig(false);
$info->setTitle($this->app->trans('report:: utilisateur'));
$reportArray = $info->buildTabGrpInfo(false, [], $request->request->get('user'), $conf, false);
if ($request->request->get('printcsv') == 'on' && isset($download)) {
return $this->getCSVResponse($this->app, $info, 'info_user');
}
$html .= $this->render('report/ajax_data_content.html.twig', ['result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false]);
return $this->app->json(['rs' => $html, 'display_nav' => false, 'title' => $title]);
}
return $this->app->json(['rs' => $html, 'display_nav' => false, 'title' => $title]);
}
示例15: 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;
}