yii2-netdisk/views/share/view.php

50 lines
1.6 KiB
PHP
Raw Normal View History

2024-02-16 15:13:29 +08:00
<?php
use yii\helpers\Html;
2024-02-17 16:43:39 +08:00
use yii\web\JqueryAsset;
use yii\web\View;
use yii\web\YiiAsset;
2024-02-16 15:13:29 +08:00
use yii\widgets\DetailView;
/** @var yii\web\View $this */
/** @var app\models\Share $model */
2024-02-17 16:43:39 +08:00
$this->title = '分享ID '.$model->share_id;
2024-02-25 10:28:14 +08:00
$this->params['breadcrumbs'][] = ['label' => '分享', 'url' => ['index']];
2024-02-16 15:13:29 +08:00
$this->params['breadcrumbs'][] = $this->title;
2024-02-17 16:43:39 +08:00
YiiAsset::register($this);
JqueryAsset::register($this);
2024-02-16 15:13:29 +08:00
?>
<div class="share-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
2024-02-17 16:43:39 +08:00
<?= Html::a('复制分享链接', null, ['class' => 'btn btn-primary', 'id' => 'copy-link-button']) ?>
2024-02-25 10:28:14 +08:00
<?= Html::a('访问分享链接', ['share/access', 'share_id' => $model->share_id,'access_code'=>$model->access_code], ['class' => 'btn btn-primary', 'target' => '_blank']) ?>
2024-02-17 16:43:39 +08:00
<?= Html::a('修改分享', ['update', 'share_id' => $model->share_id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('取消分享', ['delete', 'share_id' => $model->share_id], [
2024-02-16 15:13:29 +08:00
'class' => 'btn btn-danger',
'data' => [
2024-02-25 10:28:14 +08:00
'confirm' => '你确定要取消这个分享?其他人将无法通过该链接访问文件',
2024-02-16 15:13:29 +08:00
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'share_id',
// 'sharer_id',
'file_relative_path',
'access_code',
'creation_date',
],
]) ?>
</div>
2024-02-17 16:43:39 +08:00
<?php
$this->registerJsFile('@web/js/share_view.js', ['depends' => [JqueryAsset::class], 'position' => View::POS_END]);
?>