protected static $_docs = [];
- protected $_operations = [CreateOperation::class, PreviewOperation::class, LinksOperation::class, CompositionOperation::class, StatsOperation::class, DownloadOperation::class, CloneOperation::class, DeletefbOperation::class, EditOperation::class,ChangeownerOperation::class];
+ protected $_operations = [CreateOperation::class, PreviewOperation::class, LinksOperation::class, CompositionOperation::class, StatsOperation::class, DownloadOperation::class, CloneOperation::class, DeletefbOperation::class, EditOperation::class, ChangeownerOperation::class];
protected $casts = ['composition' => 'array'];
*/
public function getTheme()
{
- return FluidbookTheme::find($this->theme);
+ return FluidbookTheme::withoutGlobalScopes()->find($this->theme);
}
/**
protected static function _getDocument($documentID)
{
if (!isset(self::$_docs[$documentID])) {
- self::$_docs[$documentID] = FluidbookDocument::find($documentID);
+ self::$_docs[$documentID] = FluidbookDocument::withoutGlobalScopes()->find($documentID);
}
return self::$_docs[$documentID];
}
public function addWidgets()
{
- Widget::add([
- 'type' => 'alert',
- 'class' => 'alert alert-danger mb-2',
- 'heading' => __('En cours de développement'),
- 'content' => __('Les données et interfaces présentées dans cette section ne sont pas synchronisées avec les données en production. Toutes les modifications effectuées ici peuvent dont disparaître à tout moment.') . ' <p><a class="btn btn-warning" href="https://workshop.fluidbook.com/publications">' . __('Retour en production') . '</a></p>',
- 'close_button' => false, // show close button or not
- ]);
+// Widget::add([
+// 'type' => 'alert',
+// 'class' => 'alert alert-danger mb-2',
+// 'heading' => __('En cours de développement'),
+// 'content' => __('Les données et interfaces présentées dans cette section ne sont pas synchronisées avec les données en production. Toutes les modifications effectuées ici peuvent dont disparaître à tout moment.') . ' <p><a class="btn btn-warning" href="https://workshop.fluidbook.com/publications">' . __('Retour en production') . '</a></p>',
+// 'close_button' => false, // show close button or not
+// ]);
}
return true;
}
+ public function allowsUpdate()
+ {
+ if (!can('fluidbook-publication:write')) {
+ return false;
+ }
+ if ($this->id < WorkshopMigration::WS3_BOOK_ID) {
+ return false;
+ }
+ return true;
+ }
+
+ public function allowsEdit()
+ {
+ return $this->allowsUpdate();
+ }
+
+
+ public function allowsClone()
+ {
+ return $this->allowsCreate();
+ }
+
+ public function allowsPreview()
+ {
+ if (can('fluidbook-publication:write')) {
+ return true;
+ }
+ if (!can('fluidbook-publication:read')) {
+ return false;
+ }
+ if ($this->status == 0) {
+ return false;
+ }
+ return true;
+ }
+
+ public function allowsDownload()
+ {
+ if ($this->id < WorkshopMigration::WS3_BOOK_ID) {
+ return false;
+ }
+ if (can('fluidbook-publication:write')) {
+ return true;
+ }
+ if (!can('fluidbook-publication:read')) {
+ return false;
+ }
+ if ($this->status == 0) {
+ return false;
+ }
+ return true;
+ }
+
+ public function allowsCreate()
+ {
+ if (!can('fluidbook-publication:write')) {
+ return false;
+ }
+ return true;
+ }
+
protected function _baseReplicate(array $except = null)
{
$current = $this;
];
@endphp
-
-<a class="btn btn-sm btn-link" href="#"
- data-toggle="tooltip"
- title="{{__('Cloner la publication')}}"
- data-context-actions="{{json_encode($actions)}}"
- data-context-route="{{$crud->route}}/$id/clone/$action"
- data-context-id="{{$entry->getKey()}}"
-><i class="la la-copy"></i> {{__('Cloner')}}</a>
+@if($entry->allowsClone())
+ <a class="btn btn-sm btn-link" href="#"
+ data-toggle="tooltip"
+ title="{{__('Cloner la publication')}}"
+ data-context-actions="{{json_encode($actions)}}"
+ data-context-route="{{$crud->route}}/$id/clone/$action"
+ data-context-id="{{$entry->getKey()}}"
+ ><i class="la la-copy"></i> {{__('Cloner')}}</a>
+@endif
$servers=\App\Models\FluidbookExternalInstallServer::getAllServers();
$base=$crud->route.'/'.$entry->id;
$basePackage=$base.'/package';
- $actions=[
- 'delivery'=>
- [
- 'label'=>__('Page de téléchargement'),
- 'url'=>$base.'/delivery',
- ],
- ];
- $actions['sep_download']='---------';
+
+ $actions=[];
+
+
+
+// $actions['delivery']=[
+// 'label'=>__('Page de téléchargement'),
+// 'url'=>$base.'/delivery',
+// ];
+//
+// $actions['sep_download']='---------';
foreach (\App\Models\FluidbookPublication::getDownloadVersions() as $k=>$v) {
if($k==='scorm'){
continue;
@endphp
-<a class="btn btn-sm btn-link" href="#"
- data-toggle="tooltip"
- title="{{__('Télécharger la publication')}}"
- data-context-actions="{{json_encode($actions)}}"
- data-context-route="{{$crud->route}}/$id/download/$action"
- data-context-id="{{$entry->getKey()}}"
-><i class="la la-arrow-circle-down"></i> {{__('Télécharger')}}</a>
+@if($entry->allowsDownload())
+ <a class="btn btn-sm btn-link" href="#"
+ data-toggle="tooltip"
+ title="{{__('Télécharger la publication')}}"
+ data-context-actions="{{json_encode($actions)}}"
+ data-context-route="{{$crud->route}}/$id/download/$action"
+ data-context-id="{{$entry->getKey()}}"
+ ><i class="la la-arrow-circle-down"></i> {{__('Télécharger')}}</a>
+@endif