class DataFileSystem in Forena Reports 8
Hierarchy
- class \Drupal\forena\File\FileSystemBase implements FileInterface
- class \Drupal\forena\File\DataFileSystem
Expanded class hierarchy of DataFileSystem
8 files declare their use of DataFileSystem
- DataManager.php in src/
DataManager.php - DataManager.inc Enter description here ... @author davidmetzler
- DriverBase.php in src/
FrxPlugin/ Driver/ DriverBase.php - Class that defines default methods for access control in an DriverBase
- FrxDrupal.php in src/
FrxPlugin/ Driver/ FrxDrupal.php - Provides data blocks for native drupal connections using the default drupal connections.
- FrxFiles.php in src/
FrxPlugin/ Driver/ FrxFiles.php - File class for loading raw xml files as Sample data This class is used as a reference implementation of a data engine, but is also used to provide sample data files and reports. @author metzlerd
- FrxMSSQL.php in src/
FrxPlugin/ Driver/ FrxMSSQL.php - Oracle specific driver that takes advantage of oracles native XML support
File
- src/
File/ DataFileSystem.php, line 5
Namespace
Drupal\forena\FileView source
class DataFileSystem extends FileSystemBase {
public $source = '';
public $dmSvc;
/**
* @param $source
* Machine name of Data Source
* @param $path
* Path to sql files for reports.
* @param DataManager $dataManager
* Data Manager object used to get data
*/
public function __construct($source, $path, DataManager $dataManager) {
parent::__construct();
$this->cacheKey = $this->cacheKey . ':' . $source;
// Load default directory from configuration.
$this->dmSvc = $dataManager;
$this->source = $source;
$data_path = AppService::instance()
->dataDirectory();
$this->source = $source;
$this->dir = rtrim($data_path, '/');
$this->includes[] = $path;
}
/**
* List all data blocks a sure has access to.
*
* @return array
* Array of data blocks.
*/
public function userBlocks($search = '*') {
$blocks = array();
$this
->validateAllCache();
$sql = $this
->getCache('sql');
$inc = $this
->getCache('inc');
$xml = $this
->getCache('xml');
$data = array_merge($xml, $sql, $inc);
if ($data) {
foreach ($data as $base_name => $obj) {
if ($search == '*' || drupal_match_path($base_name, $search)) {
if ($obj->cache) {
$r = $this->dmSvc
->repository($obj->cache['provider']);
if ($r && $r
->access($obj->cache['access'])) {
$blocks[$base_name] = $obj;
}
}
}
}
}
uksort($blocks, '\\Drupal\\forena\\File\\DataFile::blockCompare');
return $blocks;
}
/**
* Sort compare function for sorting data by category then title.
* @param string $a
* @param string $b
* @return number
*/
public static function blockCompare($a, $b) {
$c = strnatcasecmp($a, $b);
return $c;
}
/**
* @param $object
* @return array
* Extract data from an SQL file.
*/
public function parseSQLFile($object) {
$file = file_get_contents($object->file);
$src = $this->dmSvc
->parseSQL($file);
$metaData = [
'provider' => $this->source,
'name' => $this->source . '/' . $this->base_name,
'access' => @$src['access'],
'options' => @$src['options'],
];
return $metaData;
}
/**
* Should load cache data based on that.
* @see FrxFile::buildCache()
*/
public function extractMetaData(&$object) {
switch ($object->ext) {
case 'sql':
$object->metaData = $this
->parseSQLFile($object);
break;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DataFileSystem:: |
public | property | ||
DataFileSystem:: |
public | property | ||
DataFileSystem:: |
public static | function | Sort compare function for sorting data by category then title. | |
DataFileSystem:: |
public | function |
Should load cache data based on that. Overrides FileInterface:: |
|
DataFileSystem:: |
public | function | ||
DataFileSystem:: |
public | function | List all data blocks a sure has access to. | |
DataFileSystem:: |
public | function |
Overrides FileSystemBase:: |
|
FileSystemBase:: |
public | property | ||
FileSystemBase:: |
public | property | ||
FileSystemBase:: |
public | property | ||
FileSystemBase:: |
public | property | ||
FileSystemBase:: |
public | property | ||
FileSystemBase:: |
public | property | ||
FileSystemBase:: |
public | property | ||
FileSystemBase:: |
public | property | ||
FileSystemBase:: |
public | property | ||
FileSystemBase:: |
public | property | ||
FileSystemBase:: |
protected | function | Get all metadata for files of a specific extension. | |
FileSystemBase:: |
constant | 1 | ||
FileSystemBase:: |
public | function |
Return the contents of a file located in the report directory Overrides FileInterface:: |
|
FileSystemBase:: |
public | function |
Delete a file from the directory. Overrides FileInterface:: |
1 |
FileSystemBase:: |
private | function | ||
FileSystemBase:: |
public | function | Return the directory portion of a report filename. | |
FileSystemBase:: |
public | function |
Return whether the file exists. Overrides FileInterface:: |
|
FileSystemBase:: |
public | function | 1 | |
FileSystemBase:: |
public | function |
Returns the cache entry based on a filename. Overrides FileInterface:: |
|
FileSystemBase:: |
public | function | Determine if the file exists in the include path. | |
FileSystemBase:: |
public | function |
Determine whether the file is a cusomt implmentation. Overrides FileInterface:: |
|
FileSystemBase:: |
public | function |
Test whether file is overriding code provided files. Overrides FileInterface:: |
|
FileSystemBase:: |
public | function |
Return an indicator as to whether the file is savable.
New files can be saved if the directory is writabel. Overrides FileInterface:: |
|
FileSystemBase:: |
public | function | Return the full path to the filename | |
FileSystemBase:: |
public | function | Retrieve path info | |
FileSystemBase:: |
public | function | Revert an individual report | |
FileSystemBase:: |
public | function |
Save a file into the report directory. Overrides FileInterface:: |
1 |
FileSystemBase:: |
public | function | ||
FileSystemBase:: |
private | function | Recursive function which scans the directory and loads the base indexes. | |
FileSystemBase:: |
protected | function | Parse a drectory | |
FileSystemBase:: |
public | function | 1 | |
FileSystemBase:: |
private | function | ||
FileSystemBase:: |
function |