当前位置: 首页>>代码示例>>PHP>>正文


PHP record_adapter::get_serialize_key方法代码示例

本文整理汇总了PHP中record_adapter::get_serialize_key方法的典型用法代码示例。如果您正苦于以下问题:PHP record_adapter::get_serialize_key方法的具体用法?PHP record_adapter::get_serialize_key怎么用?PHP record_adapter::get_serialize_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在record_adapter的用法示例。


在下文中一共展示了record_adapter::get_serialize_key方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_upload_datas

 /**
  * Returns dats needed for an uploaded record
  *
  * @param Request        $request
  * @param record_adapter $record
  *
  * @return array
  */
 public function get_upload_datas(Request $request, record_adapter $record)
 {
     $key = $record->get_serialize_key();
     $datas = ['title' => $request->get('title_' . $key), 'description' => $request->get('description_' . $key), 'tag' => $request->get('tags_' . $key), 'private' => $request->get('privacy_' . $key) === 'private' ? true : false];
     return $datas;
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:14,代码来源:Dailymotion.php

示例2: fromRequest

 /**
  * Create a new RecordRequest from current request
  *
  * @param  Application    $app
  * @param  Request        $request
  * @param  boolean        $flattenStories
  * @param  array          $rightsColl
  * @param  array          $rightsDatabox
  * @return RecordsRequest|\record_adapter[]
  */
 public static function fromRequest(Application $app, Request $request, $flattenStories = self::FLATTEN_NO, array $rightsColl = [], array $rightsDatabox = [])
 {
     $elements = $received = [];
     $basket = null;
     if ($request->get('ssel')) {
         $basket = $app['converter.basket']->convert($request->get('ssel'));
         $app['acl.basket']->hasAccess($basket, $app->getAuthenticatedUser());
         foreach ($basket->getElements() as $basket_element) {
             $received[$basket_element->getRecord($app)->get_serialize_key()] = $basket_element->getRecord($app);
         }
     } elseif ($request->get('story')) {
         $repository = $app['repo.story-wz'];
         $storyWZ = $repository->findByUserAndId($app, $app->getAuthenticatedUser(), $request->get('story'));
         $received[$storyWZ->getRecord($app)->get_serialize_key()] = $storyWZ->getRecord($app);
     } else {
         foreach (explode(";", $request->get('lst')) as $bas_rec) {
             $basrec = explode('_', $bas_rec);
             if (count($basrec) != 2) {
                 continue;
             }
             try {
                 $record = new \record_adapter($app, (int) $basrec[0], (int) $basrec[1]);
                 $received[$record->get_serialize_key()] = $record;
                 unset($record);
             } catch (NotFoundHttpException $e) {
                 continue;
             }
         }
     }
     $elements = $received;
     $to_remove = [];
     foreach ($elements as $id => $record) {
         if (!$app->getAclForUser($app->getAuthenticatedUser())->has_access_to_record($record)) {
             $to_remove[] = $id;
             continue;
         }
         foreach ($rightsColl as $right) {
             if (!$app->getAclForUser($app->getAuthenticatedUser())->has_right_on_base($record->get_base_id(), $right)) {
                 $to_remove[] = $id;
                 continue;
             }
         }
         foreach ($rightsDatabox as $right) {
             if (!$app->getAclForUser($app->getAuthenticatedUser())->has_right_on_sbas($record->get_sbas_id(), $right)) {
                 $to_remove[] = $id;
                 continue;
             }
         }
     }
     foreach ($to_remove as $id) {
         unset($elements[$id]);
     }
     return new static($elements, new ArrayCollection($received), $basket, $flattenStories);
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:64,代码来源:RecordsRequest.php

示例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;
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:101,代码来源:Tools.php

示例4: check_record_constraints

 /**
  *
  * @param  record_adapter $record
  * @return array
  */
 private function check_record_constraints(record_adapter $record)
 {
     $errors = [];
     $key = $record->get_serialize_key();
     if (!$record->get_hd_file() instanceof SplFileInfo) {
         $errors["file_size_" . $key] = $this->translator->trans("Le record n'a pas de fichier physique");
     }
     //Record must rely on real file
     if ($record->get_duration() > self::AUTH_VIDEO_DURATION) {
         $errors["duration_" . $key] = $this->translator->trans("La taille maximale d'une video est de %duration% minutes.", ['%duration%' => self::AUTH_VIDEO_DURATION / 60]);
     }
     if ($record->get_technical_infos('size') > self::AUTH_VIDEO_SIZE) {
         $errors["size_" . $key] = $this->translator->trans("Le poids maximum d'un fichier est de %size%", ['%size%' => p4string::format_octets(self::AUTH_VIDEO_SIZE)]);
     }
     return $errors;
 }
开发者ID:nlegoff,项目名称:Phraseanet,代码行数:21,代码来源:Youtube.php

示例5: get_cache_key

 /**
  * Part of the cache_cacheableInterface
  *
  * @param  string $option
  * @return string
  */
 public function get_cache_key($option = null)
 {
     return 'caption_field_' . $this->databox_field->get_id() . '_' . $this->record->get_serialize_key() . ($option ? '_' . $option : '');
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:10,代码来源:field.php

示例6: hasChild

 public function hasChild(\record_adapter $record)
 {
     return $this->get_children()->offsetExists($record->get_serialize_key());
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:4,代码来源:adapter.php

示例7: remove_element

 /**
  *
  * @param  record_adapter $record
  * @return set
  */
 public function remove_element(\record_adapter $record)
 {
     $key = $record->get_serialize_key();
     if (isset($this->elements[$key])) {
         unset($this->elements[$key]);
     }
     return $this;
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:13,代码来源:abstract.php


注:本文中的record_adapter::get_serialize_key方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。