Hello,
i am writing a class for the usage of Simogeo filemanager.
class FW_Class_Filemanager {
private $uid = '';
private $absPath = null;
private $relPath = null;
function __construct($path = null, $document_root = null)
{
$this->uid = uniqid();
if ($document_root == null) {
$document_root = $_SERVER['DOCUMENT_ROOT'];
}
if ($path == null) {
$path = $document_root;
}
if (!mb_left($path, '/')) {
$path = '/'.$path;
}
$this->absPath = $path;
$this->relPath = $path;
if (!mb_left($document_root, $this->absPath)){
$this->absPath = $document_root.$this->absPath;
}
file_put_contents('/www/tmp/fm_'.$this->uid, $this->relPath.';'.$this->absPath);
error_log(file_get_contents('/www/tmp/fm_'.$this->uid));
}
function build($width='98%', $height='400px')
{
$attributes = array(
'src' => '/inc/lib/filemanager/index.php?uid='.$this->uid,
'width' => $width,
'height' => $height,
'frameborder' => '0',
'name' => 'filemanager_'.$this->uid,
);
$output = createSingleHtmlTag('iframe', $attributes, false);
$output .= createSingleHtmlTag('iframe', null, true);
return $output;
}
then in my form i can:
$filemanager = new FW_Class_Filemanager('/data/files/' , null);
echo $filemanager->build();
when i call the class i give a path where i upload the files.
I store the files in a filestructure.
i know there is a way to set the root folder in php side:
$fm = new Filemanager();
);
$fm->setFileRoot('/data/files/');
but this is bade in the connectors/php/filemanager.php
im looking for a way to pass varriables to the filemanager.php so u can set the root dinamicaly.