Example #1
0
 /**
  * Конструктор проверяет чтобы имя файла было не пусто
  */
 public function __construct($path = null, $absPath = false)
 {
     if (is_null($path) || $path == '') {
         throw new FileSystemException('No path or file name given for File constructor');
     }
     parent::__construct($path, $absPath);
 }
Example #2
0
 function FileUpadter()
 {
     FileSystemObject::setRoot(dirname(__FILE__));
     $d = new Dir('files');
     $fu = new FileUpdater($d->getDir('source/includes'), $d->getDir('target/includes'), $d->getDir('backup/includes'));
     $command = ArgsHolder::get()->shiftCommand();
     if ($command == 'cdo') {
         $fu->copyDo();
     } elseif ($command == 'cundo') {
         $fu->copyUndo();
     } elseif ($command == 'undo') {
         $fu->undo();
     } elseif ($command == 'do') {
         $fu->run();
     } else {
         io::out('command not found');
     }
 }
 /**
  * List files and directories in the directory.
  *
  * @param int $sortOrder [optional] The order of the entries being returned. Using alphabetical order by default.
  * Order types:
  * - SCANDIR_SORT_ASCENDING
  * - SCANDIR_SORT_DESCENDING
  * - SCANDIR_SORT_NONE
  * @param resource $context [optional] The directory context. See PHPs scandir() function for more information.
  * @param bool $ignorePeriodDirs [optional] True to ignore period dirs such as /. and /.., false otherwise.
  *
  * @return Array|null A list of filesystem objects as an array or null on failure.
  *
  * @see scandir();
  */
 public function scan($sortOrder = SCANDIR_SORT_ASCENDING, $context, $ignorePeriodDirs = false)
 {
     // Make sure the directory handle was opened
     if (!$this->isOpened()) {
         return null;
     }
     // Scan the directory
     if ($context !== null) {
         $scan = scandir($this->handle, $sortOrder, $context);
     } else {
         $scan = scandir($this->handle, $sortOrder);
     }
     // Make sure the result was valid
     if ($scan === false) {
         return null;
     }
     // Create an array of filesystem objects
     $entries = array();
     foreach ($scan as $entry) {
         // Check whether period directories should be ignored
         if ($ignorePeriodDirs && StringUtils::equals($entry, array('.', '..'), false, true)) {
             continue;
         }
         $entries[] = FileSystemObject::from($this->dir, $entry);
     }
     // Return the result
     return $entries;
 }
Example #4
0
 /**
  *
  */
 public static function setRoot($root)
 {
     self::$root = $root;
 }
Example #5
0
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
$menuOptions = array('index', 'create', 'createEmail', 'createQuote', 'import', 'export');
$this->insertMenu($menuOptions);
Yii::app()->clientScript->registerCssFile(Yii::app()->controller->module->assetsUrl . '/css/index.css');
Yii::app()->clientScript->registerScriptFile(Yii::app()->controller->module->assetsUrl . '/js/FolderManager.js');
Yii::app()->clientScript->registerScript('docsIndexJS', "\nx2.folderManager = new x2.FolderManager (" . CJSON::encode(array('translations' => array('createFolder' => Yii::t('docs', 'Create Folder'), 'deleteFolderConf' => Yii::t('docs', 'Are you sure you want to delete this folder and all of its contents?'), 'deleteDocConf' => Yii::t('docs', 'Are you sure you want to delete this Doc?'), 'folderDeleted' => Yii::t('docs', 'Folder deleted.'), 'docDeleted' => Yii::t('docs', 'Doc deleted.'), 'permissionsMissing' => Yii::t('docs', 'You do not have permission to delete that Doc or folder.')), 'urls' => array('moveFolder' => Yii::app()->controller->createUrl('/docs/moveFolder'), 'index' => Yii::app()->controller->createUrl('/docs/index'), 'deleteFileFolder' => Yii::app()->controller->createUrl('/docs/deleteFileFolder')))) . ");\n", CClientScript::POS_END);
?>
<div>
<?php 
$folderViewHeader = FileSystemObject::getListViewHeader();
$columns = array(array('name' => 'gvCheckbox', 'width' => '30px', 'header' => '', 'disabled' => '!$data->objId || $data->objId === -1', 'value' => '$data->objId ? $data->objId : -2'), array('name' => 'name', 'header' => Yii::t('docs', 'Name'), 'type' => 'raw', 'value' => '$data->renderName ()', 'width' => '30%', 'htmlOptions' => array('id' => 'php:$data->id . "-file-system-object"', 'data-type' => 'php:$data->type', 'data-id' => 'php:$data->objId', 'class' => 'php:"view file-system-object".' . "(\$data->type=='folder'?' file-system-object-folder':' file-system-object-doc')")), array('name' => 'owner', 'header' => Yii::t('docs', 'Owner'), 'type' => 'raw', 'value' => '$data->getOwner ();', 'width' => '30%', 'htmlOptions' => array('class' => 'file-system-object-owner')), array('name' => 'lastUpdated', 'header' => Yii::t('docs', 'Last Updated'), 'type' => 'raw', 'value' => '$data->getLastUpdateInfo ();', 'width' => '25%', 'htmlOptions' => array('class' => 'file-system-object-last-updated')), array('name' => 'visibility', 'header' => Yii::t('docs', 'Visibility'), 'type' => 'raw', 'value' => '$data->getVisibility ();', 'width' => '10%', 'htmlOptions' => array('class' => 'file-system-object-visibility')));
$listView = $this->widget('X2GridViewGeneric', array('dataProvider' => $folderDataProvider, 'id' => 'folder-contents', 'baseScriptUrl' => Yii::app()->request->baseUrl . '/themes/' . Yii::app()->theme->name . '/css/listview', 'columns' => $columns, 'template' => '<div class="page-title rounded-top icon docs"><h2>' . Yii::t('docs', 'Docs') . ' </h2>{massActionButtons}{summary}' . X2Html::tag('span', array('id' => 'create-folder-button', 'class' => 'x2-button fa-stack', 'style' => 'float:right;margin-top:5px;'), X2Html::fa('folder fa-stack-2x', array('style' => 'margin-top:1px;')) . X2Html::fa('plus-circle fa-stack-1x fa-inverse', array('style' => 'margin-top:3px;margin-left:5px;'))) . '</div>{items}{pager}', 'afterGridViewUpdateJSString' => 'x2.folderManager.setUpDragAndDrop ();', 'massActions' => array('MassMoveFileSysObjToFolder', 'MassRenameFileSysObj'), 'dataColumnClass' => 'X2DataColumnGeneric', 'rowHtmlOptionsExpression' => 'array (
        "class" => ($data->validDraggable() ? " draggable-file-system-object" : "").
                   ($data->validDroppable() ? " droppable-file-system-object" : ""),
    )', 'enableColDragging' => false, 'enableGridResizing' => false, 'rememberColumnSort' => false));
?>
</div>
<div id="file-delete" style="text-align:center;display:none;"> 
    <?php 
echo X2Html::fa('trash fa-3x fa-border', array('id' => 'delete-drop', 'style' => 'color:red;margin:auto;margin-top:20px;'));
?>
</div>
<br />
<div class='flush-grid-view'>
<?php