Пример #1
0
 /**
  * Provides upload file
  * @return mixed
  */
 public function actionUpload()
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     $model = new Mediafile();
     $routes = $this->module->routes;
     $rename = $this->module->rename;
     $model->saveUploadedFile($routes, $rename);
     $bundle = FilemanagerAsset::register($this->view);
     if ($model->isImage()) {
         $model->createThumbs($routes, $this->module->thumbs);
     }
     $response['files'][] = ['url' => $model->url, 'thumbnailUrl' => $model->getDefaultThumbUrl($bundle->baseUrl), 'name' => $model->filename, 'type' => $model->type, 'size' => $model->file->size, 'deleteUrl' => Url::to(['file/delete', 'id' => $model->mfile_id]), 'deleteType' => 'POST'];
     return $response;
 }
Пример #2
0
<?php

use yii\helpers\Html;
use doavers\filemanager\Module;
use doavers\filemanager\assets\FilemanagerAsset;
/* @var $this yii\web\View */
$this->title = Module::t('main', 'File manager');
$this->params['breadcrumbs'][] = $this->title;
$assetPath = FilemanagerAsset::register($this)->baseUrl;
?>

<div class="filemanager-default-index">
    <h1><?php 
echo Module::t('main', 'File manager module');
?>
</h1>

    <div class="row">
        <div class="col-md-6">

            <div class="text-center">
                <h2>
                    <?php 
echo Html::a(Module::t('main', 'Files'), ['file/index']);
?>
                </h2>
                <?php 
echo Html::a(Html::img($assetPath . '/images/files.png', ['alt' => 'Files']), ['file/index']);
?>
            </div>
        </div>
Пример #3
0
<?php

use doavers\filemanager\assets\FilemanagerAsset;
use doavers\filemanager\Module;
use yii\widgets\ListView;
use yii\helpers\Html;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel doavers\filemanager\models\Mediafile */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->params['moduleBundle'] = FilemanagerAsset::register($this);
?>

<header id="header"><span class="glyphicon glyphicon-picture"></span> <?php 
echo Module::t('main', 'File manager');
?>
</header>

<div id="filemanager" data-url-info="<?php 
echo Url::to(['file/info']);
?>
">
    <?php 
echo ListView::widget(['dataProvider' => $dataProvider, 'layout' => '<div class="items">{items}</div>{pager}', 'itemOptions' => ['class' => 'item'], 'itemView' => function ($model, $key, $index, $widget) {
    return Html::a(Html::img($model->getDefaultThumbUrl($this->params['moduleBundle']->baseUrl)) . '<span class="checked glyphicon glyphicon-check"></span>', '#mediafile', ['data-key' => $key]);
}]);
?>

    <div class="dashboard">
        <p><?php 
echo Html::a('<span class="glyphicon glyphicon-upload"></span> ' . Module::t('main', 'Upload manager'), ['file/uploadmanager'], ['class' => 'btn btn-default']);
Пример #4
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use doavers\filemanager\assets\FilemanagerAsset;
use doavers\filemanager\Module;
/* @var $this yii\web\View */
/* @var $model doavers\filemanager\models\Mediafile */
/* @var $form yii\widgets\ActiveForm */
$bundle = FilemanagerAsset::register($this);
?>

<?php 
echo Html::img($model->getDefaultThumbUrl($bundle->baseUrl));
?>

<ul class="detail">
    <li><?php 
echo $model->type;
?>
</li>
    <li><?php 
echo Yii::$app->formatter->asDatetime($model->getLastChanges());
?>
</li>
    <?php 
if ($model->isImage()) {
    ?>
        <li><?php 
    echo $model->getOriginalImageSize($this->context->module->routes);
    ?>