Inheritance: extends yii\base\Module
 /**
  * Updated mediafile by id
  * @param $id
  * @return array
  */
 public function actionUpdate($id)
 {
     $model = Mediafile::findOne($id);
     $message = Module::t('main', 'Changes not saved.');
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $message = Module::t('main', 'Changes saved!');
     }
     Yii::$app->session->setFlash('mediafileUpdateResult', $message);
     return $this->renderPartial('info', ['model' => $model, 'strictThumb' => null]);
 }
Example #2
0
/* @var $this yii\web\View */
/* @var $searchModel pendalf89\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($this->context->module->routes['baseUrl'] . $model->path, ['width' => 50, 'height' => 50]) . '<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']);
?>
</p>
        <div id="fileinfo">

        </div>
    </div>
</div>
Example #3
0
    <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>

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

            <div class="text-center">
                <h2>
                    <?php 
echo Html::a(Module::t('main', 'Settings'), ['default/settings']);
?>
                </h2>
                <?php 
echo Html::a(Html::img($assetPath . '/images/settings.png', ['alt' => 'Tools']), ['default/settings']);
?>
            </div>
        </div>
    </div>
</div>
<?php

use dosamigos\fileupload\FileUploadUI;
use pendalf89\filemanager\Module;
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $searchModel pendalf89\filemanager\models\Mediafile */
?>

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

<div id="uploadmanager">
    <p><?php 
echo Html::a('← ' . Module::t('main', 'Back to file manager'), ['file/filemanager']);
?>
</p>
    <?php 
echo FileUploadUI::widget(['model' => $model, 'attribute' => 'file', 'clientOptions' => ['autoUpload' => Yii::$app->getModule('filemanager')->autoUpload], 'clientEvents' => ['fileuploadsubmit' => "function (e, data) { data.formData = [{name: 'tagIds', value: \$('#filemanager-tagIds').val()}]; }"], 'url' => ['upload'], 'gallery' => false, 'formView' => '/file/_upload_form']);
?>
</div>
Example #5
0
<?php

use pendalf89\filemanager\Module;
use pendalf89\filemanager\assets\ModalAsset;
use yii\helpers\Url;
/* @var $this yii\web\View */
$this->title = Module::t('main', 'Files');
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'File manager'), 'url' => ['default/index']];
$this->params['breadcrumbs'][] = $this->title;
ModalAsset::register($this);
?>

<iframe src="<?php 
echo Url::to(['file/filemanager']);
?>
" id="post-original_thumbnail-frame" frameborder="0" role="filemanager-frame"></iframe>
Example #6
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => 'ID', 'name' => Module::t('main', 'Tag')];
 }
 /**
  * @param Module $module
  * @return array images list
  */
 public function getImagesList(Module $module)
 {
     $thumbs = $this->getThumbs();
     $list = [];
     $originalImageSize = $this->getOriginalImageSize($module->routes);
     $list[$this->url] = Module::t('main', 'Original') . ' ' . $originalImageSize;
     foreach ($thumbs as $alias => $url) {
         $preset = $module->thumbs[$alias];
         $list[$url] = $preset['name'] . ' ' . $preset['size'][0] . ' × ' . $preset['size'][1];
     }
     return $list;
 }
Example #8
0
} else {
    ?>
        <?php 
    echo Html::hiddenInput('url', $model->url);
    ?>
    <?php 
}
?>

    <?php 
echo Html::hiddenInput('id', $model->id);
?>

    <?php 
echo Html::button(Module::t('main', 'Insert'), ['id' => 'insert-btn', 'class' => 'btn btn-primary btn-sm']);
?>

    <?php 
echo Html::submitButton(Module::t('main', 'Save'), ['class' => 'btn btn-success btn-sm']);
?>

    <?php 
if ($message = Yii::$app->session->getFlash('mediafileUpdateResult')) {
    ?>
        <div class="text-success"><?php 
    echo $message;
    ?>
</div>
    <?php 
}
ActiveForm::end();
Example #9
0
<div class="form-group row">
    <div class="col-sm-6">
    <?php 
$form = ActiveForm::begin(['options' => ['id' => 'control-form']]);
?>

    <?php 
echo Html::hiddenInput('path', $model->path);
?>
    <?php 
echo Html::hiddenInput('url', $this->context->module->routes['baseUrl'] . $model->path, ['data-ee' => 'duanbiaowu']);
?>

    <?php 
echo Html::button(Module::t('main', 'select_file'), ['id' => 'insert-btn', 'class' => 'btn btn-success btn-sm col-sm-12']);
?>

    <?php 
ActiveForm::end();
?>
    </div>

    <div class="col-sm-6">
        <?php 
echo Html::a(Module::t('main', 'Delete'), ['file/delete/', 'id' => $model->id], ['class' => 'btn btn-danger btn-sm col-sm-12', 'data-confirm' => Yii::t('System', 'common_delete_confirm'), 'data-id' => $model->id, 'role' => 'delete']);
?>
    </div>
</div>

Example #10
0
}
?>
            <p><?php 
echo Module::t('main', 'Now using next thumbnails presets');
?>
:</p>
            <ul>
                <?php 
foreach ($this->context->module->thumbs as $preset) {
    ?>
                    <li><strong><?php 
    echo $preset['name'];
    ?>
:</strong> <?php 
    echo $preset['size'][0] . ' x ' . $preset['size'][1];
    ?>
</li>
                <?php 
}
?>
            </ul>
            <p><?php 
echo Module::t('main', 'If you change the thumbnails sizes, it is strongly recommended to make resize all thumbnails.');
?>
</p>
            <?php 
echo Html::a(Module::t('main', 'Do resize thumbnails'), ['file/resize'], ['class' => 'btn btn-danger']);
?>
        </div>
    </div>
</div>
<?php

use pendalf89\filemanager\Module;
use pendalf89\filemanager\models\Tag;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
/* @var $this yii\web\View */
$form = ActiveForm::begin(['action' => '?', 'method' => 'get']);
?>
	<?php 
echo $form->field($model, 'tagIds')->widget(\kartik\select2\Select2::className(), ['maintainOrder' => true, 'data' => ArrayHelper::map(Tag::find()->all(), 'id', 'name'), 'options' => ['multiple' => true], 'addon' => ['append' => ['content' => Html::submitButton(Module::t('main', 'Search'), ['class' => 'btn btn-primary']), 'asButton' => true]]])->label(false);
ActiveForm::end();