Ejemplo n.º 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;
     $tagIds = Yii::$app->request->post('tagIds');
     if ($tagIds !== 'undefined') {
         $model->setTagIds(explode(',', $tagIds));
     }
     $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->id]), 'deleteType' => 'POST'];
     return $response;
 }
Ejemplo n.º 2
0
<?php

use ut8ia\filemanager\assets\FilemanagerAsset;
use yii\helpers\Html;
/* @var $this yii\web\View */
FilemanagerAsset::register($this);
$this->beginPage();
?>
    <!DOCTYPE html>
    <html lang="<?php 
echo Yii::$app->language;
?>
">
    <head>
        <meta charset="<?php 
echo Yii::$app->charset;
?>
"/>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <?php 
echo Html::csrfMetaTags();
?>
        <title><?php 
echo Html::encode($this->title);
?>
</title>
        <?php 
$this->head();
?>
    </head>
    <body>
Ejemplo n.º 3
0
<?php

use yii\helpers\Html;
use ut8ia\filemanager\Module;
use ut8ia\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>
Ejemplo n.º 4
0
<?php

use ut8ia\filemanager\assets\FilemanagerAsset;
use ut8ia\filemanager\Module;
use ut8ia\filemanager\models\Tag;
use yii\helpers\ArrayHelper;
use yii\widgets\ListView;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\bootstrap\ActiveForm;
/* @var $this yii\web\View */
/* @var $searchModel ut8ia\filemanager\models\MediafileSearch */
/* @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 
$searchForm = $this->render('_search_form', ['model' => $model]);
?>
    <?php 
echo ListView::widget(['dataProvider' => $dataProvider, 'layout' => $searchForm . '<div class="items">{items}</div>{pager}', 'itemOptions' => ['class' => 'item'], 'itemView' => function ($model, $key, $index, $widget) {