public function getRootItems() { $this->checkUserRootFolder(Yii::$app->getUser()->id, Yii::$app->getUser()->identity->username, ['files' => Module::t('medialib', 'Files'), 'images' => Module::t('medialib', 'Images')]); $items = [new Entity(['id' => 0, 'name' => 'default', 'path' => '/default/', 'parentid' => 0, 'isfolder' => 1, 'type' => 'folder', 'mimetype' => 'entity', 'ownerid' => 0]), new Entity(['id' => 0, 'name' => Yii::$app->user->identity->username, 'path' => '/' . Yii::$app->user->identity->username . '/', 'parentid' => 0, 'isfolder' => 1, 'type' => 'folder', 'mimetype' => 'entity', 'ownerid' => Yii::$app->user->id])]; if (!\Yii::$app->getUser()->can('medialib.admin')) { return $items; } $dirs = Entity::find()->where(['parentid' => 0])->andWhere(['<>', 'ownerid', \Yii::$app->user->id])->all(); return ArrayHelper::merge($items, $dirs); }
public function getStatusText() { switch ($this->status) { case self::STATUS_PREPARE: return Module::t('medialib', 'Prepare'); case self::STATUS_PREPARE: return Module::t('medialib', 'Process'); case self::STATUS_PREPARE: return Module::t('medialib', 'Ready'); } return Module::t('medialib', 'Unknown status'); }
<?php use yii\helpers\Html; use simplator\medialib\Module; /* @var $this yii\web\View */ /* @var $model simplator\medialib\models\Entity */ $this->title = Module::t('medialib', 'Update {modelClass}: ', ['modelClass' => 'Entity']) . ' ' . $model->name; $this->params['breadcrumbs'][] = ['label' => Module::t('medialib', 'Entities'), 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; $this->params['breadcrumbs'][] = Module::t('medialib', 'Update'); ?> <div class="entity-update"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_form', ['model' => $model]); ?> </div>
<?php use yii\helpers\Html; use yii\helpers\Json; use simplator\medialib\Module; use simplator\medialib\FilemanagerAsset; /* @var $this yii\web\View */ /* @var $model simplator\medialib\models\Picture */ $fm = FilemanagerAsset::register($this); $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'Medialib'), 'url' => ['index']]; $fma = $fm->baseUrl; $config['options']['managerPath'] = $fma; ?> <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>File Manager</title> <link rel="stylesheet" type="text/css" href="<?php echo $fma; ?> /styles/reset.css" /> <link rel="stylesheet" type="text/css" href="<?php echo $fma; ?> /scripts/jquery.filetree/jqueryFileTree.css" /> <link rel="stylesheet" type="text/css" href="<?php echo $fma; ?> /scripts/jquery.contextmenu/jquery.contextMenu-1.01.css" /> <link rel="stylesheet" type="text/css" href="<?php
<?php use yii\helpers\Html; use simplator\medialib\Module; /* @var $this yii\web\View */ /* @var $model simplator\medialib\models\Entity */ $this->title = Module::t('medialib', 'Create Entity'); $this->params['breadcrumbs'][] = ['label' => Module::t('medialib', 'Entities'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="entity-create"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_form', ['model' => $model]); ?> </div>
echo $form->field($model, 'size')->textInput(); ?> <?php echo $form->field($model, 'sizefull')->textInput(); ?> <?php echo $form->field($model, 'type')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'icon')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'comment')->textInput(['maxlength' => true]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Module::t('medialib', 'Create') : Module::t('medialib', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
<?php use yii\helpers\Html; use yii\widgets\DetailView; use simplator\medialib\Module; use simplator\medialib\models\Entity; /* @var $this yii\web\View */ /* @var $model simplator\medialib\models\Entity */ ?> <div class="entity-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Module::t('medialib', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Module::t('medialib', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Module::t('medialib', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo Html::a("[{$model->id}] {$model->name}, {$model->type}. " . $model->entity->className(), ['view', 'id' => $model->id]); ?> </div>
/** @inheritdoc */ public function adminMenu($route, $module) { return [['label' => Module::t('medialib', 'Medialib'), 'url' => ['/' . $route], 'items' => [['label' => Module::t('medialib', 'Files'), 'url' => ['/' . $route . '/files']], ['label' => Module::t('medialib', 'File manager'), 'url' => ['/' . $route . '/fm']]]]]; }
<?php use yii\helpers\Html; use simplator\medialib\Module; /* @var $this yii\web\View */ /* @var $model simplator\medialib\models\Picture */ $this->params['breadcrumbs'][] = ['label' => Module::t('app', 'Medialib'), 'url' => ['index']]; echo Html::a(Module::t('app', 'Pictures'), ['/medialib/picture'], ['class' => 'btn btn-primary']); ?> <div class="medialib-default-index"> <h1><?php echo $this->context->action->uniqueId; ?> </h1> <p> This is the view content for action "<?php echo $this->context->action->id; ?> ". The action belongs to the controller "<?php echo get_class($this->context); ?> " in the "<?php echo $this->context->module->id; ?> " module. </p> <p> You may customize this page by editing the following file:<br>
/** * @inheritdoc */ public function attributeLabels() { return ['id' => Module::t('medialib', 'ID'), 'name' => Module::t('medialib', 'Name'), 'path' => Module::t('medialib', 'Path'), 'parentid' => Module::t('medialib', 'Parentid'), 'size' => Module::t('medialib', 'Size'), 'sizefull' => Module::t('medialib', 'Sizefull'), 'type' => Module::t('medialib', 'Type'), 'mimetype' => Module::t('medialib', 'Mimetype'), 'comment' => Module::t('medialib', 'Comment')]; }
/** * @inheritdoc */ public function attributeLabels() { return ['id' => Module::t('medialib', 'ID'), 'mimetype' => Module::t('medialib', 'Mimetype'), 'storage' => Module::t('medialib', 'Storage'), 'status' => Module::t('medialib', 'Status'), 'hash' => Module::t('medialib', 'Hash'), 'ext' => Module::t('medialib', 'Ext'), 'size' => Module::t('medialib', 'Size'), 'sizefull' => Module::t('medialib', 'Sizefull'), 'width' => Module::t('medialib', 'Width'), 'height' => Module::t('medialib', 'Height'), 'created_at' => Module::t('medialib', 'Created At'), 'updated_at' => Module::t('medialib', 'Updated At')]; }
<?php use yii\helpers\Html; use yii\widgets\ListView; use simplator\medialib\Module; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Module::t('medialib', 'Files'); $this->params['breadcrumbs'][] = ['label' => Module::t('medialib', 'Medialib'), 'url' => ['..']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="entity-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php echo Html::a(Module::t('medialib', 'Create Entity'), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo ListView::widget(['dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'item'], 'itemView' => '_view']); ?> </div>