コード例 #1
0
ファイル: Articles.php プロジェクト: s4urp8n/kohana-admin
    public function getOutputFunctions()
    {
        return ['Изображение' => function ($row) {
            $model = new self();
            $uploadsKeys = $this->getUploadsParams();
            $uploadsKeys = array_keys($uploadsKeys);
            $uploads = [];
            foreach ($uploadsKeys as $key) {
                $uploads = array_merge($uploads, $model->getSharedModelUploads($model, $row['id'], $key));
            }
            //only images
            foreach ($uploads as $key => $upload) {
                if (Admin::isImageFile($upload)) {
                    ?>
                        <img src="<?php 
                    echo ImagePreview::getPreview($upload, 100, 100);
                    ?>
"/>
                        <?php 
                }
                break;
            }
        }];
    }
コード例 #2
0
ファイル: Crop.php プロジェクト: s4urp8n/kohana-admin
<?php

$request = Request::initial();
$original = $request->query('file');
$originalFull = mb_substr(DOCROOT, 0, -1) . $original;
$previews = ImagePreview::findPreviews($originalFull);
$previewsShared = $previews;
foreach ($previewsShared as $key => $shared) {
    $previewsShared[$key]['previewFile'] = mb_substr($shared['previewFile'], mb_strlen(DOCROOT) - 1);
}
?>

<div class='well'>
    
    <form action='' method='POST'>
        <div>
            <a href="<?php 
echo $request->query('ref');
?>
" class="btn btn-default">
                <i class="fa fa-mail-reply"></i>
                Вернуться к списку
            </a>
            
            <button id='cropSave' type="submit" class="fieldsSave btn btn-warning">
                <i class="fa fa-floppy-o"></i>
                Сохранить изменения
            </button>
        </div>
        <br/>
        <div class='alert alert-info'>
コード例 #3
0
ファイル: Template.php プロジェクト: s4urp8n/kohana-admin
        <?php 
$id = '';
foreach ($data as $entity) {
    $id = md5(uniqid('', true));
    ?>
            <label for="<?php 
    echo $id;
    ?>
" class='pickerItem'>
                <?php 
    if (method_exists($entity, 'getImage')) {
        $image = $entity->getImage();
        if (!empty($image)) {
            ?>
                        <img src='<?php 
            echo ImagePreview::getPreview($image, 200, 150);
            ?>
'>
                        <?php 
        }
    }
    ?>
                <input id='<?php 
    echo $id;
    ?>
'
                       type="checkbox"
                       name='<?php 
    echo implode(Model_Admin_Picker::$separator, [$entity->id, get_class($entity)]);
    ?>
'
コード例 #4
0
ファイル: Admin.php プロジェクト: s4urp8n/kohana-admin
 public function action_ajaxUploadDelete()
 {
     if ($this->check(['isAllowed', 'isModifyingAllowed', 'isDeletionAllowed'], ['getEditData'], ['primary'], ['directoryIndex', 'file']) === true) {
         $data = $this->model->getEditData($this->params['primary']);
         if (!empty($data) && !empty($data['uploadsDirs']) && !empty($data['uploadsDirs'][$this->query['directoryIndex']]) && !in_array(mb_eregi_replace('\\s', '', $this->query['file']), Admin::getProtectedUploadFilenames())) {
             $data = $data['uploadsDirs'][$this->query['directoryIndex']];
             $file = Admin::getFullUploadsPath() . $data['directory'] . $this->query['file'];
             if (file_exists($file)) {
                 ImagePreview::removePreviews($file);
                 unlink($file);
             }
         }
     }
     die;
 }