本文整理汇总了PHP中record_adapter::get_title方法的典型用法代码示例。如果您正苦于以下问题:PHP record_adapter::get_title方法的具体用法?PHP record_adapter::get_title怎么用?PHP record_adapter::get_title使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类record_adapter
的用法示例。
在下文中一共展示了record_adapter::get_title方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: datas
/**
*
* @param Array $datas
* @param boolean $unread
* @return Array
*/
public function datas(array $data, $unread)
{
$reason = $data['reason'];
$account_id = $data['account_id'];
$sbas_id = $data['sbas_id'];
$rid = $data['record_id'];
try {
$account = Bridge_Account::load_account($this->app, $account_id);
$record = new record_adapter($this->app, $sbas_id, $rid);
} catch (\Exception $e) {
return [];
}
$ret = ['text' => $this->app->trans("L'upload concernant le record %title% sur le compte %bridge_name% a echoue pour les raisons suivantes : %reason%", ['%title%' => $record->get_title(), '%bridge_name%' => $account->get_api()->get_connector()->get_name(), '%reason%' => $reason]), 'class' => ''];
return $ret;
}
示例2: 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];
}
示例3: connect
//.........这里部分代码省略.........
$fileName = $file->getClientOriginalName();
try {
$tempoDir = tempnam(sys_get_temp_dir(), 'substit');
unlink($tempoDir);
mkdir($tempoDir);
$tempoFile = $tempoDir . DIRECTORY_SEPARATOR . $fileName;
if (false === rename($file->getPathname(), $tempoFile)) {
throw new RuntimeException('Error while renaming file');
}
$record = new \record_adapter($app, $request->get('sbas_id'), $request->get('record_id'));
$media = $app['mediavorus']->guess($tempoFile);
$app['subdef.substituer']->substitute($record, 'document', $media);
$app['phraseanet.logger']($record->get_databox())->log($record, \Session_Logger::EVENT_SUBSTITUTE, 'HD', '');
if ((int) $request->request->get('ccfilename') === 1) {
$record->set_original_name($fileName);
$app['phraseanet.SE']->updateRecord($record);
}
unlink($tempoFile);
rmdir($tempoDir);
$success = true;
$message = $app->trans('Document has been successfully substitued');
} catch (\Exception $e) {
$message = $app->trans('file is not valid');
}
} else {
$message = $app->trans('file is not valid');
}
} else {
$app->abort(400, 'Missing file parameter');
}
return $app['twig']->render('prod/actions/Tools/iframeUpload.html.twig', ['success' => $success, 'message' => $message]);
})->bind('prod_tools_hd_substitution');
$controllers->post('/chgthumb/', function (Application $app, Request $request) {
$success = false;
$message = $app->trans('An error occured');
if ($file = $request->files->get('newThumb')) {
if ($file->isValid()) {
try {
$fileName = $file->getClientOriginalName();
$tempoDir = tempnam(sys_get_temp_dir(), 'substit');
unlink($tempoDir);
mkdir($tempoDir);
$tempoFile = $tempoDir . DIRECTORY_SEPARATOR . $fileName;
if (false === rename($file->getPathname(), $tempoFile)) {
throw new RuntimeException('Error while renaming file');
}
$record = new \record_adapter($app, $request->get('sbas_id'), $request->get('record_id'));
$media = $app['mediavorus']->guess($tempoFile);
$app['subdef.substituer']->substitute($record, 'thumbnail', $media);
$app['phraseanet.logger']($record->get_databox())->log($record, \Session_Logger::EVENT_SUBSTITUTE, 'thumbnail', '');
unlink($tempoFile);
rmdir($tempoDir);
$success = true;
$message = $app->trans('Thumbnail has been successfully substitued');
} catch (\Exception $e) {
$message = $app->trans('file is not valid');
}
} else {
$message = $app->trans('file is not valid');
}
} else {
$app->abort(400, 'Missing file parameter');
}
return $app['twig']->render('prod/actions/Tools/iframeUpload.html.twig', ['success' => $success, 'message' => $message]);
})->bind('prod_tools_thumbnail_substitution');
$controllers->post('/thumb-extractor/confirm-box/', function (Application $app, Request $request) {
$return = ['error' => false, 'datas' => ''];
$template = 'prod/actions/Tools/confirm.html.twig';
try {
$record = new \record_adapter($app, $request->request->get('sbas_id'), $request->request->get('record_id'));
$var = ['video_title' => $record->get_title(), 'image' => $request->request->get('image', '')];
$return['datas'] = $app['twig']->render($template, $var);
} catch (\Exception $e) {
$return['datas'] = $app->trans('an error occured');
$return['error'] = true;
}
return $app->json($return);
});
$controllers->post('/thumb-extractor/apply/', function (Application $app, Request $request) {
$return = ['success' => false, 'message' => ''];
try {
$record = new \record_adapter($app, $request->request->get('sbas_id'), $request->request->get('record_id'));
$dataUri = DataURI\Parser::parse($request->request->get('image', ''));
$path = $app['root.path'] . '/tmp';
$name = sprintf('extractor_thumb_%s', $record->get_serialize_key());
$fileName = sprintf('%s/%s.png', $path, $name);
file_put_contents($fileName, $dataUri->getData());
$media = $app['mediavorus']->guess($fileName);
$app['subdef.substituer']->substitute($record, 'thumbnail', $media);
$app['phraseanet.logger']($record->get_databox())->log($record, \Session_Logger::EVENT_SUBSTITUTE, 'thumbnail', '');
unset($media);
$app['filesystem']->remove($fileName);
$return['success'] = true;
} catch (\Exception $e) {
$return['message'] = $e->getMessage();
}
return $app->json($return);
});
return $controllers;
}
示例4: upload
/**
*
* @param record_adapter $record
* @param array $options
* @return string The new distant Id
*/
public function upload(record_adapter $record, array $options = [])
{
switch ($record->get_type()) {
case 'video':
$video_entry = new Zend_Gdata_YouTube_VideoEntry();
$filesource = new Zend_Gdata_App_MediaFileSource($record->get_hd_file()->getRealPath());
$filesource->setContentType($record->get_hd_file()->get_mime());
$filesource->setSlug($record->get_title());
$video_entry->setMediaSource($filesource);
$video_entry->setVideoTitle($options['title']);
$video_entry->setVideoDescription($options['description']);
$video_entry->setVideoCategory($options['category']);
$video_entry->SetVideoTags(explode(' ', $options['tags']));
$video_entry->setVideoDeveloperTags(['phraseanet']);
if ($options['privacy'] == "public") {
$video_entry->setVideoPublic();
} else {
$video_entry->setVideoPrivate();
}
$app_entry = $this->_api->insertEntry($video_entry, self::UPLOAD_URL, 'Zend_Gdata_YouTube_VideoEntry');
/*
* set major protocole version to 2 otherwise you get exception when calling getVideoId
* but setting setMajorProtocolVersion to 2 at the new entry introduce a new bug with getVideoState
* @see http://groups.google.com/group/youtube-api-gdata/browse_thread/thread/7d86cac0d3f90e3f/d9291d7314f99be7?pli=1
*/
$app_entry->setMajorProtocolVersion(2);
return $app_entry->getVideoId();
break;
default:
throw new Bridge_Exception_InvalidRecordType('Unknown format');
break;
}
}
示例5: get_title
/**
*
* @return String
*/
public function get_title($highlight = '', SearchEngineInterface $search_engine = null)
{
if ($this->title) {
return $this->title;
}
$this->title = collection::getLogo($this->get_base_id(), $this->app) . ' ';
switch ($this->env) {
case "RESULT":
$this->title .= $this->app->trans('preview:: resultat numero %number%', ['%number%' => '<span id="current_result_n">' . ($this->number + 1) . '</span> : ']);
$this->title .= parent::get_title($highlight, $search_engine);
break;
case "BASK":
$this->title .= $this->name . ' - ' . parent::get_title($highlight, $search_engine) . ' (' . $this->get_number() . '/' . $this->total . ') ';
break;
case "REG":
$title = parent::get_title();
if ($this->get_number() == 0) {
$this->title .= $title;
} else {
$this->title .= sprintf('%s %s', $title, $this->get_number() . '/' . $this->total);
}
break;
default:
$this->title .= parent::get_title($highlight, $search_engine);
break;
}
return $this->title;
}
示例6: buildTabUserWhat
/**
* Return basic information about a record
*
* @param integer $bid base id
* @param integer $rid record id
* @param array $tab config for the html table
*
* @return array
*/
public function buildTabUserWhat($bid, $rid, $tab = false)
{
$this->initialize();
$sbas_id = phrasea::sbasFromBas($this->app, $bid);
try {
$record = new record_adapter($this->app, $sbas_id, $rid);
} catch (\Exception_Record_AdapterNotFound $e) {
return $this->report;
}
$this->setDisplay($tab);
$this->champ = ['photo', 'record_id', 'date', 'type', 'titre', 'taille'];
$document = $record->get_subdef('document');
$this->title = $this->app->trans('report:: Information sur l\'enregistrement numero %number%', ['%number%' => (int) $rid]);
$x = $record->get_thumbnail();
$this->result[] = ['photo' => "<img style='width:" . $x->get_width() . "px;height:" . $x->get_height() . "px;'\n src='" . $x->get_url() . "'>", 'record_id' => $record->get_record_id(), 'date' => $this->app['date-formatter']->getPrettyString($document->get_creation_date()), 'type' => $document->get_mime(), 'titre' => $record->get_title(), 'taille' => $document->get_size()];
$this->setDisplayNav();
$this->setReport();
return $this->report;
}
示例7: submitConfirmBoxAction
public function submitConfirmBoxAction(Request $request)
{
$template = 'prod/actions/Tools/confirm.html.twig';
try {
$record = new \record_adapter($this->app, $request->request->get('sbas_id'), $request->request->get('record_id'));
$var = ['video_title' => $record->get_title(), 'image' => $request->request->get('image', '')];
$return = ['error' => false, 'datas' => $this->render($template, $var)];
} catch (\Exception $e) {
$return = ['error' => true, 'datas' => $this->app->trans('an error occured')];
}
return $this->app->json($return);
}
示例8: __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'];
//.........这里部分代码省略.........
示例9: list_record
/**
* Retrieve detailled informations about one record
*
* @param \record_adapter $record
*
* @return array
*/
public function list_record(Application $app, \record_adapter $record)
{
$technicalInformation = [];
foreach ($record->get_technical_infos() as $name => $value) {
$technicalInformation[] = ['name' => $name, 'value' => $value];
}
return ['databox_id' => $record->get_sbas_id(), 'record_id' => $record->get_record_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), 'collection_id' => \phrasea::collFromBas($app, $record->get_base_id()), 'sha256' => $record->get_sha256(), 'thumbnail' => $this->list_embedable_media($app, $record, $record->get_thumbnail()), 'technical_informations' => $technicalInformation, 'phrasea_type' => $record->get_type(), 'uuid' => $record->get_uuid()];
}
示例10: datas
/**
*
* @param Array $datas
* @param boolean $unread
* @return Array
*/
public function datas($datas, $unread)
{
$sx = simplexml_load_string($datas);
$reason = (string) $sx->reason;
$account_id = (int) $sx->account_id;
$sbas_id = (int) $sx->sbas_id;
$rid = (int) $sx->record_id;
try {
$account = Bridge_Account::load_account($this->app, $account_id);
$record = new record_adapter($this->app, $sbas_id, $rid);
} catch (\Exception $e) {
return [];
}
$ret = ['text' => $this->app->trans("L'upload concernant le record %title% sur le compte %bridge_name% a echoue pour les raisons suivantes : %reason%", ['%title%' => $record->get_title(), '%bridge_name%' => $account->get_api()->get_connector()->get_name(), '%reason%' => $reason]), 'class' => ''];
return $ret;
}
示例11: listRecord
/**
* Retrieve detailed information about one record
*
* @param Request $request
* @param \record_adapter $record
* @return array
*/
public function listRecord(Request $request, \record_adapter $record)
{
$technicalInformation = [];
foreach ($record->get_technical_infos()->getValues() as $name => $value) {
$technicalInformation[] = ['name' => $name, 'value' => $value];
}
$data = ['databox_id' => $record->getDataboxId(), 'record_id' => $record->getRecordId(), 'mime_type' => $record->getMimeType(), 'title' => $record->get_title(), 'original_name' => $record->get_original_name(), 'updated_on' => $record->getUpdated()->format(DATE_ATOM), 'created_on' => $record->getCreated()->format(DATE_ATOM), 'collection_id' => $record->getCollectionId(), 'base_id' => $record->getBaseId(), 'sha256' => $record->getSha256(), 'thumbnail' => $this->listEmbeddableMedia($request, $record, $record->get_thumbnail()), 'technical_informations' => $technicalInformation, 'phrasea_type' => $record->getType(), 'uuid' => $record->getUuid()];
if ($request->attributes->get('_extended', false)) {
$subdefs = $caption = [];
foreach ($record->get_embedable_medias([], []) as $name => $media) {
if (null !== ($subdef = $this->listEmbeddableMedia($request, $record, $media))) {
$subdefs[] = $subdef;
}
}
foreach ($record->get_caption()->get_fields() as $field) {
$caption[] = ['meta_structure_id' => $field->get_meta_struct_id(), 'name' => $field->get_name(), 'value' => $field->get_serialized_values(';')];
}
$extendedData = ['subdefs' => $subdefs, 'metadata' => $this->listRecordCaption($record->get_caption()), 'status' => $this->listRecordStatus($record), 'caption' => $caption];
$data = array_merge($data, $extendedData);
}
return $data;
}