Пример #1
0
 private function listEmbeddableMedia(Request $request, \record_adapter $record, \media_subdef $media)
 {
     if (!$media->is_physically_present()) {
         return null;
     }
     if ($this->getAuthenticator()->isAuthenticated()) {
         $acl = $this->getAclForUser();
         if ($media->get_name() !== 'document' && false === $acl->has_access_to_subdef($record, $media->get_name())) {
             return null;
         }
         if ($media->get_name() === 'document' && !$acl->has_right_on_base($record->getBaseId(), 'candwnldhd') && !$acl->has_hd_grant($record)) {
             return null;
         }
     }
     if ($media->get_permalink() instanceof \media_Permalink_Adapter) {
         $permalink = $this->listPermalink($media->get_permalink());
     } else {
         $permalink = null;
     }
     $urlTTL = (int) $request->get('subdef_url_ttl', $this->getConf()->get(['registry', 'general', 'default-subdef-url-ttl']));
     if ($urlTTL < 0) {
         $urlTTL = -1;
     }
     $issuer = $this->getAuthenticatedUser();
     return ['name' => $media->get_name(), 'permalink' => $permalink, 'height' => $media->get_height(), 'width' => $media->get_width(), 'filesize' => $media->get_size(), 'devices' => $media->getDevices(), 'player_type' => $media->get_type(), 'mime_type' => $media->get_mime(), 'substituted' => $media->is_substituted(), 'created_on' => $media->get_creation_date()->format(DATE_ATOM), 'updated_on' => $media->get_modification_date()->format(DATE_ATOM), 'url' => $this->generateSubDefinitionUrl($issuer, $media, $urlTTL), 'url_ttl' => $urlTTL];
 }
Пример #2
0
 /**
  * @retrieve detailled informations about one suddef
  *
  * @param  media_subdef $media
  *
  * @return array
  */
 private function list_embedable_media(Application $app, \record_adapter $record, \media_subdef $media)
 {
     if (!$media->is_physically_present()) {
         return null;
     }
     if ($app['authentication']->isAuthenticated()) {
         if ($media->get_name() !== 'document' && false === $app['acl']->get($app['authentication']->getUser())->has_access_to_subdef($record, $media->get_name())) {
             return null;
         }
         if ($media->get_name() === 'document' && !$app['acl']->get($app['authentication']->getUser())->has_right_on_base($record->get_base_id(), 'candwnldhd') && !$app['acl']->get($app['authentication']->getUser())->has_hd_grant($record)) {
             return null;
         }
     }
     if ($media->get_permalink() instanceof \media_Permalink_Adapter) {
         $permalink = $this->list_permalink($media->get_permalink());
     } else {
         $permalink = null;
     }
     return ['name' => $media->get_name(), 'permalink' => $permalink, 'height' => $media->get_height(), 'width' => $media->get_width(), 'filesize' => $media->get_size(), 'devices' => $media->getDevices(), 'player_type' => $media->get_type(), 'mime_type' => $media->get_mime()];
 }
Пример #3
0
 /**
  * @retrieve detailled informations about one suddef
  *
  * @param  media_subdef $media
  * @return array
  */
 protected function list_embedable_media(media_subdef $media)
 {
     if (!$media->is_physically_present()) {
         return null;
     }
     if ($media->get_permalink() instanceof media_Permalink_Adapter) {
         $permalink = $this->list_permalink($media->get_permalink());
     } else {
         $permalink = null;
     }
     return ['name' => $media->get_name(), 'permalink' => $permalink, 'height' => $media->get_height(), 'width' => $media->get_width(), 'filesize' => $media->get_size(), 'devices' => $media->getDevices(), 'player_type' => $media->get_type(), 'mime_type' => $media->get_mime()];
 }