예제 #1
0
 public function api_plugin($options = [])
 {
     Fancybox::widget(['selector' => '.easyii-box', 'options' => $options]);
 }
예제 #2
0
파일: photos.php 프로젝트: tqsq2005/Yii2adv
 * @date: 16-5-18 下午10:32
 * @author: LocoRoco<*****@*****.**>
 * @version:v2016
 * @since:Yii2
 * ----------------------------------------------
 * 程序文件简介:
 * ==============================================
 */
use common\populac\helpers\Image;
use common\populac\models\Photo;
use common\populac\widgets\Fancybox;
use yii\helpers\Html;
use yii\helpers\Url;
use common\populac\assets\PhotosAsset;
PhotosAsset::register($this);
Fancybox::widget(['selector' => '.plugin-box']);
$class = get_class($this->context->model);
$item_id = $this->context->model->primaryKey;
$linkParams = ['class' => $class, 'item_id' => $item_id];
$photoTemplate = '<tr data-id="{{photo_id}}">' . (IS_ROOT ? '<td>{{photo_id}}</td>' : '') . '<td><a href="' . Yii::$app->homeUrl . '{{photo_image}}" class="plugin-box" title="{{photo_description}}" rel="easyii-photos">' . '<img class="photo-thumb" id="photo-{{photo_id}}" src="{{photo_thumb}}"></a></td>' . '<td>' . '<textarea class="form-control photo-description">{{photo_description}}</textarea>' . '<a href="' . Url::to(['/populac/photos/description/{{photo_id}}']) . '" class="btn btn-sm btn-primary disabled save-photo-description">' . Yii::t('easyii', 'Save') . '</a>' . '</td>' . '<td class="control vtop">' . '<div class="btn-group btn-group-sm" role="group">' . '<a href="' . Url::to(['/populac/photos/up/{{photo_id}}'] + $linkParams) . '" class="btn btn-default move-up" title="' . Yii::t('easyii', 'Move up') . '"><span class="glyphicon glyphicon-arrow-up"></span></a>' . '<a href="' . Url::to(['/populac/photos/down/{{photo_id}}'] + $linkParams) . '" class="btn btn-default move-down" title="' . Yii::t('easyii', 'Move down') . '"><span class="glyphicon glyphicon-arrow-down"></span></a>' . '<a href="' . Url::to(['/populac/photos/image/{{photo_id}}'] + $linkParams) . '" class="btn btn-default change-image-button" title="' . Yii::t('easyii', 'Change image') . '"><span class="glyphicon glyphicon-floppy-disk"></span></a>' . '<a href="' . Url::to(['/populac/photos/delete/{{photo_id}}']) . '" class="btn btn-default color-red delete-photo" title="' . Yii::t('easyii', 'Delete item') . '"><span class="glyphicon glyphicon-remove"></span></a>' . '<input type="file" name="Photo[image]" class="change-image-input hidden">' . '</div>' . '</td>' . '</tr>';
$this->registerJs("\nvar photoTemplate = '{$photoTemplate}';\n", \yii\web\View::POS_HEAD);
$photoTemplate = str_replace('>\\', '>', $photoTemplate);
?>
<button id="photo-upload" class="btn btn-success text-uppercase"><span class="glyphicon glyphicon-arrow-up"></span> <?php 
echo Yii::t('easyii', 'Upload');
?>
</button>
<small id="uploading-text" class="smooth"><?php 
echo Yii::t('easyii', 'Uploading. Please wait');
?>
<span></span></small>