Ejemplo n.º 1
0
 public function has_access_to_subdef(RecordInterface $record, $subdef_name)
 {
     if ($subdef_name == 'thumbnail') {
         return true;
     }
     if ($record->isStory()) {
         return true;
     }
     $databox = $this->app->findDataboxById($record->getDataboxId());
     try {
         $subdef_class = $databox->get_subdef_structure()->get_subdef($record->getType(), $subdef_name)->get_class();
     } catch (\Exception $e) {
         return false;
     }
     $granted = false;
     if ($subdef_class == databox_subdef::CLASS_THUMBNAIL) {
         $granted = true;
     } elseif ($subdef_class == databox_subdef::CLASS_PREVIEW && $this->has_right_on_base($record->getBaseId(), 'candwnldpreview')) {
         $granted = true;
     } elseif ($subdef_class == databox_subdef::CLASS_PREVIEW && $this->has_preview_grant($record)) {
         $granted = true;
     } elseif ($subdef_class == databox_subdef::CLASS_DOCUMENT && $this->has_right_on_base($record->getBaseId(), 'candwnldhd')) {
         $granted = true;
     } elseif ($subdef_class == databox_subdef::CLASS_DOCUMENT && $this->has_hd_grant($record)) {
         $granted = true;
     }
     if (false === $granted && $this->app['repo.feed-items']->isRecordInPublicFeed($record->getDataboxId(), $record->getRecordId())) {
         $granted = true;
     }
     return $granted;
 }
Ejemplo n.º 2
0
 public function getDoctypeIcon(RecordInterface $record)
 {
     $src = $title = '';
     if ($record->isStory()) {
         $src = '/assets/common/images/icons/icon_story.gif';
         $title = $this->app['translator']->trans('reportage');
         return sprintf('<img src="%s" title="%s" />', $src, $title);
     }
     switch ($record->getType()) {
         case 'image':
             $src = '/assets/common/images/icons/icon_image.png';
             $title = $this->app['translator']->trans('image');
             break;
         case 'document':
             $src = '/assets/common/images/icons/icon_document.png';
             $title = $this->app['translator']->trans('document');
             break;
         case 'video':
             $src = '/assets/common/images/icons/icon_video.png';
             $title = $this->app['translator']->trans('reportage');
             break;
         case 'audio':
             $src = '/assets/common/images/icons/icon_audio.png';
             $title = $this->app['translator']->trans('audio');
             break;
         case 'flash':
             $src = '/assets/common/images/icons/icon_flash.png';
             $title = $this->app['translator']->trans('flash');
             break;
     }
     return sprintf('<img src="%s" title="%s" />', $src, $title);
 }