Пример #1
0
 public static function download($name, $path)
 {
     $oripath = $path;
     $basePath = RepoManager::model()->repoPath;
     $path = $basePath . base64_decode($path);
     if (is_dir($path)) {
         $base = basename($path);
         // we deliver a zip file
         header("Content-Type: archive/zip");
         // filename for the browser to save the zip file
         header("Content-Disposition: attachment; filename={$base}" . ".zip");
         // get a tmp name for the .zip
         $tmp_zip = tempnam("tmp", "tempname") . ".zip";
         $zip = "zip";
         $delim = ';';
         if (substr(php_uname(), 0, 7) == "Windows") {
             $zip = Yii::getPathOfAlias('application.commands.shell.zip') . ".exe";
             $delim = '&';
         }
         // zip the stuff (dir and all in there) into the tmp_zip file
         $dir = dirname($path);
         $command = "cd {$dir} {$delim} {$zip} -r '{$tmp_zip}' '{$base}'";
         `{$command}`;
         // deliver the zip file
         $fp = fopen("{$tmp_zip}", "r");
         echo fpassthru($fp);
         // clean up the tmp zip file
         `rm {$tmp_zip} `;
     } else {
         Yii::app()->request->sendFile($name, file_get_contents($path));
     }
 }
Пример #2
0

    <div class="modal-dialog" style="z-index:1100;">
        <div class="modal-content">
            <div class="modal-body">

                <div class="well well-sm" style="margin-bottom:5px;font-size:12px;"><i class="fa fa-folder-open-o"></i> {{ path}}</div>
                <div style="border:1px solid #ddd;">
                    <div oc-lazy-load="{name: 'ngGrid', files: [
                         '<?php 
echo Yii::app()->controller->staticUrl('/js/lib/ng-grid.debug.js');
?>
'
                         , '<?php 
echo Yii::app()->controller->staticUrl('/css/ng-grid.css');
?>
' ]}">
                        <div ng-if="gridReady" ng-grid="gridOptions" style="height:300px;"></div>
                    </div>
                </div>
                <div class="clearfix">
                </div>
            </div>
        </div>
    </div>
    <data name="repodata" class="hide">
        <?php 
echo json_encode(RepoManager::model()->browse(RepoManager::getModuleDir())['item']);
?>
    </data>
</div>
Пример #3
0
 public function actionChangeDir($dir)
 {
     echo json_encode(RepoManager::model()->browse($dir));
 }